Skip to content

Commit

Permalink
fix hello-world-bot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuifengbuaa committed May 18, 2017
1 parent 0e4f43b commit 13c12fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions btcebot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ def addTrader(self, trader):

def addDepthHandler(self, handler, pairs):
for p in pairs:
self.api.validate_pair(p)
self.api.apiInfo.validate_pair(p)

self.depthHandlers.append((handler, pairs))

def addTradeHistoryHandler(self, handler, pairs):
for p in pairs:
self.api.validate_pair(p)
self.api.apiInfo.validate_pair(p)

self.tradeHistoryHandlers.append((handler, pairs))

Expand Down
7 changes: 4 additions & 3 deletions samples/hello-world-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,16 @@ def onBotError(msg, tracebackText):
def run(key_file, buy_floor, sell_ceiling, live_trades):
# Load the keys and create an API object from the first one.
handler = btceapi.KeyHandler(key_file)
key = handler.getKeys()[0]
key = handler.keys[0]
print "Trading with key %s" % key
api = btceapi.TradeAPI(key, handler)
api = btceapi.TradeAPI(key, handler,btceapi.BTCEConnection())

# Create a trader that handles LTC/USD trades in the given range.
trader = RangeTrader(api, "ltc_usd", buy_floor, sell_ceiling, live_trades)

# Create a bot and add the trader to it.
bot = btcebot.Bot()

bot = btcebot.Bot(api)
bot.addTrader(trader)

# Add an error handler so we can print info about any failures
Expand Down

0 comments on commit 13c12fa

Please sign in to comment.