aboutsummaryrefslogtreecommitdiff
path: root/src/history.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2015-05-23 12:10:05 -0400
committerFranklin Wei <git@fwei.tk>2015-05-23 12:10:05 -0400
commit437c81289e70e16b5058b085c8050cf855f8698e (patch)
tree19a117dcdd44f46beea3bf47775db03d9be6c8ed /src/history.c
parent4c7dd079360cebc8cf483907fb5e7175833109a8 (diff)
downloadmarket-sim-437c81289e70e16b5058b085c8050cf855f8698e.zip
market-sim-437c81289e70e16b5058b085c8050cf855f8698e.tar.gz
market-sim-437c81289e70e16b5058b085c8050cf855f8698e.tar.bz2
market-sim-437c81289e70e16b5058b085c8050cf855f8698e.tar.xz
ncurses stuff
Diffstat (limited to 'src/history.c')
-rw-r--r--src/history.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/history.c b/src/history.c
index c7aa1be..3f4b039 100644
--- a/src/history.c
+++ b/src/history.c
@@ -55,12 +55,18 @@ void print_history(struct stock_t *stock)
switch(hist->action)
{
case BUY:
- output("[BUY] %llu shares for $%llu.%02llu each (+$%llu.%02llu).\n", hist->count, hist->price.cents / 100, hist->price.cents % 100,
- total / 100, total % 100);
+ output("[BUY] %llu shares for $%llu.%02llu each (", hist->count, hist->price.cents / 100, hist->price.cents % 100);
+ use_color(COL_GREEN);
+ output("+$%llu.%02llu", total / 100, total % 100);
+ stop_color(COL_GREEN);
+ output(").\n");
break;
case SELL:
- output("[SELL] %llu shares for $%llu.%02llu each (-$%llu.%02llu).\n", hist->count, hist->price.cents / 100, hist->price.cents % 100,
- total / 100, total % 100);
+ output("[SELL] %llu shares for $%llu.%02llu each (", hist->count, hist->price.cents / 100, hist->price.cents % 100);
+ use_color(COL_RED);
+ output("-$%llu.%02llu", total / 100, total % 100);
+ stop_color(COL_RED);
+ output(").\n");
break;
default:
output("unknown history enum (%d).\n", hist->action);