Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions goxtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

HEIGHT_STATUS = 2
HEIGHT_CON = 7
WIDTH_ORDERBOOK = 45
WIDTH_ORDERBOOK = 61

COLORS = [["con_text", curses.COLOR_BLUE, curses.COLOR_CYAN]
,["status_text", curses.COLOR_BLUE, curses.COLOR_CYAN]
Expand All @@ -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_totalvol", curses.COLOR_BLACK, curses.COLOR_WHITE]

,["chart_text", curses.COLOR_BLACK, curses.COLOR_WHITE]
,["chart_up", curses.COLOR_BLACK, curses.COLOR_GREEN]
Expand Down Expand Up @@ -255,32 +256,39 @@ def paint(self):
col_ask = COLOR_PAIR["book_ask"]
col_vol = COLOR_PAIR["book_vol"]
col_own = COLOR_PAIR["book_own"]

col_totalvol = COLOR_PAIR["book_totalvol"]

# print the asks
# pylint: disable=C0301
book = self.gox.orderbook
pos = mid - 1
i = 0
cnt = len(book.asks)
totalvol = 0
while pos >= 0 and i < cnt:
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)
totalvol += book.asks[i].volume
self.addstr(pos, 28, goxapi.int2str(totalvol, "BTC"), col_totalvol)
ownvol = book.get_own_volume_at(book.asks[i].price)
if ownvol:
self.addstr(pos, 28, goxapi.int2str(ownvol, "BTC"), col_own)
self.addstr(pos, 44, goxapi.int2str(ownvol, "BTC"), col_own)
pos -= 1
i += 1

# print the bids
pos = mid + 1
i = 0
cnt = len(book.bids)
totalvol = 0
while pos < self.height and i < cnt:
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)
totalvol += book.bids[i].volume
self.addstr(pos, 28, goxapi.int2str(totalvol, "BTC"), col_totalvol)
ownvol = book.get_own_volume_at(book.bids[i].price)
if ownvol:
self.addstr(pos, 28, goxapi.int2str(ownvol, "BTC"), col_own)
self.addstr(pos, 44, goxapi.int2str(ownvol, "BTC"), col_own)
pos += 1
i += 1

Expand Down