def updateConfig(mv0=None): print(strTime(), 'Coinbot initializing...') global agent, feeRate, start, orderBooks, pairs, balances, mv orderBooks = {} agent = Poloniex(apikey, secret) pairs = np.array(agent.returnTicker()) feeRate = agent.returnFeeInfo()['takerFee'] start = now() mv, balances = calcMv() print(strTime(), '{:<10}:'.format('Base coin'), baseCoin) print(strTime(), '{:<10}:'.format('Max length'), maxLen) print(strTime(), '{:<10}:'.format('Slippage'), '{:.2f}bp'.format(slippage * 10000)) print(strTime(), '{:<10}:'.format('Threshold'), '{:.2f}bp'.format(threshold * 10000)) print(strTime(), '{:<10}:'.format('Value'), '${:.4f}'.format(mv)) if mv0: print(strTime(), '{:<10}:'.format('Init Value'), '${:.4f}'.format(mv0)) else: mv0 = mv return mv0
# Get private API keys apiKeyFile = open("POLONIEX_API_KEY", "r") apiKey = apiKeyFile.read() apiKeyFile.close() apiSecretFile = open("POLONIEX_SECRET", "r") apiSecret = apiSecretFile.read() apiSecretFile.close() #print(apiKey) #print(apiSecret) # Create private API link polo = Poloniex(apiKey, apiSecret) # Testing private API link feeInfo = polo.returnFeeInfo() print feeInfo #Testing ticker function ticker = polo.returnTicker()["USDT_BTC"] print ticker # Get BTC and USDT balances btcBalance = polo.returnBalances()["BTC"] usdtBalance = polo.returnBalances()["USDT"] print "BTC Balance is: ", btcBalance print "USDT Balance is: ", usdtBalance