Skip to content

Commit

Permalink
added curses app that follows candles
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Pettypiece committed Oct 25, 2016
1 parent 3862e62 commit 64722d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'v20-account-changes = account.changes:main',
'v20-account-configure = account.configure:main',
'v20-instrument-candles = instrument.candles:main',
'v20-instrument-candles-follow = instrument.candles_follow:main',
'v20-instrument-candles-poll = instrument.candles_poll:main',
]
}
)
Expand Down
2 changes: 1 addition & 1 deletion src/instrument/candles.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def main():
parser.add_argument(
"--instrument",
type=common.arg_helper.instrument,
default=None,
required=True,
help="The instrument to get candles for"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def update_candles(self, candles):

# Candles haven't changed
if new.time == last.time and new.volume == last.time:
return
return False

# Update last candle
self.candles[-1] = candles.pop(0)
Expand All @@ -50,6 +50,8 @@ def update_candles(self, candles):
# Get rid of the oldest candles
self.candles = self.candles[-self.max_candle_count():]

return True

def max_candle_count(self):
return self.height - 3

Expand Down Expand Up @@ -223,9 +225,8 @@ def run(stdscr):

candles = response.get("candles", 200)

printer.update_candles(candles)

printer.render()
if printer.update_candles(candles):
printer.render()

if __name__ == "__main__":
main()

0 comments on commit 64722d6

Please sign in to comment.