poloniex.py is ok
autosell.py
import signal, time, sys
import poloniex
APIKey = 'JH*****0U'
Secret = '9677****************************9e'
timefmt = '%Y-%m-%d %H:%M:%S UTC'
shutdown = False
def signal_handler(signal, frame):
global shutdown
shutdown = True
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
p = poloniex.poloniex(APIKey, Secret)
while True:
balance = float(p.returnBalances()['ZEC'])
if balance >= 0.0001:
lastprice = float(p.returnTicker()['BTC_ZEC']['last'])
print '[%s] detected %s ZEC balance, selling at %s for BTC' % (time.strftime(timefmt, time.gmtime()), balance, lastprice)
print '[%s] %s' % (time.strftime(timefmt, time.gmtime()), p.sell('BTC_ZEC', lastprice, balance))
if shutdown:
print '[%s] exiting' % time.strftime(timefmt, time.gmtime())
sys.exit(1)
time.sleep(1)
error
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
========================== RESTART: C:\autosell.py ==========================
Traceback (most recent call last):
File "C:\autosell.py", line 18, in
balance = float(p.returnBalances()['ZEC'])
KeyError: 'ZEC'
>>>
Can you help me?