diff --git a/goxtool.py b/goxtool.py index b12b30c..3557850 100755 --- a/goxtool.py +++ b/goxtool.py @@ -54,6 +54,7 @@ ,["book_ask", curses.COLOR_BLACK, curses.COLOR_RED] ,["book_own", curses.COLOR_BLACK, curses.COLOR_YELLOW] ,["book_vol", curses.COLOR_BLACK, curses.COLOR_BLUE] + ,["book_bigvol", curses.COLOR_BLACK, curses.COLOR_MAGENTA] ,["chart_text", curses.COLOR_BLACK, curses.COLOR_WHITE] ,["chart_up", curses.COLOR_BLACK, curses.COLOR_GREEN] @@ -254,8 +255,16 @@ def paint(self): col_bid = COLOR_PAIR["book_bid"] col_ask = COLOR_PAIR["book_ask"] col_vol = COLOR_PAIR["book_vol"] + col_bigvol = COLOR_PAIR["book_bigvol"] col_own = COLOR_PAIR["book_own"] + # get threshold for big transactions from config (if any) + vol_threshold = self.gox.config.get_safe("goxtool", "color_bigvol_threshold") + if len(vol_threshold) > 0: + vol_threshold = float(vol_threshold) + else: + vol_threshold = 0 + # print the asks # pylint: disable=C0301 book = self.gox.orderbook @@ -263,8 +272,13 @@ def paint(self): i = 0 cnt = len(book.asks) while pos >= 0 and i < cnt: + col_thisvol = col_vol + if vol_threshold != 0: + if float(goxapi.int2str(book.asks[i].volume, "BTC")) > vol_threshold: + col_thisvol = col_bigvol + self.addstr(pos, 0, goxapi.int2str(book.asks[i].price, book.gox.currency), col_ask) - self.addstr(pos, 12, goxapi.int2str(book.asks[i].volume, "BTC"), col_vol) + self.addstr(pos, 12, goxapi.int2str(book.asks[i].volume, "BTC"), col_thisvol) ownvol = book.get_own_volume_at(book.asks[i].price) if ownvol: self.addstr(pos, 28, goxapi.int2str(ownvol, "BTC"), col_own) @@ -276,8 +290,13 @@ def paint(self): i = 0 cnt = len(book.bids) while pos < self.height and i < cnt: + col_thisvol = col_vol + if vol_threshold != 0: + if float(goxapi.int2str(book.bids[i].volume, "BTC")) > vol_threshold: + col_thisvol = col_bigvol + self.addstr(pos, 0, goxapi.int2str(book.bids[i].price, book.gox.currency), col_bid) - self.addstr(pos, 12, goxapi.int2str(book.bids[i].volume, "BTC"), col_vol) + self.addstr(pos, 12, goxapi.int2str(book.bids[i].volume, "BTC"), col_thisvol) ownvol = book.get_own_volume_at(book.bids[i].price) if ownvol: self.addstr(pos, 28, goxapi.int2str(ownvol, "BTC"), col_own) @@ -605,7 +624,8 @@ def modal(self): self.down(1) if key_pressed == curses.KEY_UP: self.down(-1) - if key_pressed == curses.KEY_IC: + #if key_pressed == curses.KEY_IC: + if key_pressed == curses.KEY_ENTER: self.toggle_select() self.down(1) @@ -623,8 +643,10 @@ class DlgCancelOrders(DlgListItems): """modal dialog to cancel orders""" def __init__(self, stdscr, gox): self.gox = gox - hlp = [("INS", "select"), ("F8", "cancel selected"), ("F10", "exit")] - keys = [(curses.KEY_F8, self._do_cancel)] + #hlp = [("INS", "select"), ("F8", "cancel selected"), ("F10", "exit")] + hlp = [("ENTER", "select"), ("d", "cancel selected"), ("F10", "exit")] + #keys = [(curses.KEY_F8, self._do_cancel)] + keys = [(ord('d'), self._do_cancel)] DlgListItems.__init__(self, stdscr, 45, "Cancel order(s)", hlp, keys) def init_items(self): @@ -962,11 +984,14 @@ def curses_loop(stdscr): key = conwin.win.getch() if key == ord("q"): break - if key == curses.KEY_F4: + #if key == curses.KEY_F4: + if key == ord("b"): DlgNewOrderBid(stdscr, gox).modal() - if key == curses.KEY_F5: + #if key == curses.KEY_F5: + if key == ord("s"): DlgNewOrderAsk(stdscr, gox).modal() - if key == curses.KEY_F6: + #if key == curses.KEY_F6: + if key == ord("i"): DlgCancelOrders(stdscr, gox).modal() if key == curses.KEY_RESIZE: stdscr.erase()