Skip to content

Commit

Permalink
Example Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave-Vallance committed Sep 4, 2018
1 parent 0cff78d commit f31da88
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ def __init__(self):

def next(self):

# Get cash and balance
# New broker method that will let you get the cash and balance for
# any wallet. It also means we can disable the getcash() and getvalue()
# rest calls before and after next which slows things down.
cash, value = self.broker.get_wallet_balance('USDT')

for data in self.datas:

print('{} - {} | O: {} H: {} L: {} C: {} V:{} SMA:{}'.format(data.datetime.datetime(),
Expand All @@ -23,16 +29,6 @@ def notify_data(self, data, status, *args, **kwargs):
msg= 'Data Status: {}'.format(data._getstatusname(status))
print(dt,dn,msg)

# This bit will allow you to backfill faster when starting the script
# Use with care as it is a hacky workaround and will stop making rest
# calls to get cash and value until a live notification is received.
if data._getstatusname(status) == 'DELAYED':
self.broker.balance_checks = False

if data._getstatusname(status) == 'LIVE':
self.broker.balance_checks = True



apikey = 'Insert Your API Key'
secret = 'Insert Your Secret'
Expand Down

0 comments on commit f31da88

Please sign in to comment.