Author

Topic: - (Read 2234 times)

member
Activity: 311
Merit: 10
-
April 19, 2017, 02:16:54 PM
#5
It's working, thanks!  Grin
member
Activity: 311
Merit: 10
April 18, 2017, 06:48:13 PM
#4
Thanks for responding.
Have you succesfully used this new script?
This is what I get:

c:\Autosell>python autosell.py zec
Traceback (most recent call last):
  File "autosell.py", line 2, in
    import poloniex
  File "c:\_mining\_Autosell\poloniex.py", line 2, in
    import urllib2
ImportError: No module named 'urllib2'

Changed the start of the poloniex.py file:
import urllib
import urllib2
import json
import time
import hmac,hashlib

to:
import urllib
import urllib3
import json
import time
import hmac,hashlib

Not sure if that's correct? Huh
But error is gone..

c:\Autosell>python autosell.py zec
Traceback (most recent call last):
  File "autosell.py", line 22, in
    p = poloniexapi.poloniex(APIKey, Secret)
NameError: name 'poloniexapi' is not defined

Line 22 in autosell.py:
p = poloniexapi.poloniex(APIKey, Secret)

Old version was:
p = poloniex.poloniex(APIKey, Secret)

But that doesn't work either?  Huh
Don't see a recent api connection at Poloniex either.
member
Activity: 311
Merit: 10
April 18, 2017, 06:58:58 AM
#3
What Python version is used? Looks like version 2?
Guess we need other commands for Python 3.5 to get this working?
newbie
Activity: 30
Merit: 0
December 05, 2016, 10:06:52 AM
#2
poloniex.py is ok
autosell.py
Code:
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
Code:
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?
hero member
Activity: 589
Merit: 507
I don't buy nor sell anything here and never will.
November 14, 2016, 02:57:52 PM
#1
-
Jump to: