Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Shows syntaxError trying to run for the first time. #8

Closed
penthoy opened this issue Apr 23, 2017 · 4 comments
Closed

Shows syntaxError trying to run for the first time. #8

penthoy opened this issue Apr 23, 2017 · 4 comments

Comments

@penthoy
Copy link

penthoy commented Apr 23, 2017

from btfxwss.classes import BtfxWss, BtfxWssRaw
  File "/home/username/dev/src/bitfinex_wss/btfxwss/classes.py", line 637
    entry = (*data, ts,)
                    ^
SyntaxError: can use starred expression only as assignment target

Maybe I'm doing something wrong? any idea why it giving this error? thanks.

@GenesisGupta
Copy link

GenesisGupta commented Apr 24, 2017

pls run the following code in python 3.5 and let me know if you get an error

from btfxwss import BtfxWss,BtfxWssRaw
import logging
import sys
import time


logging.basicConfig(level=logging.DEBUG, filename='test.log')
log = logging.getLogger(__name__)

fh = logging.FileHandler('test.log')
fh.setLevel(logging.DEBUG)
sh = logging.StreamHandler(sys.stdout)
sh.setLevel(logging.DEBUG)

log.addHandler(sh)
log.addHandler(fh)

apikey = 'your api key '
apisecret = 'your api secret '

wss = BtfxWss(key=apikey, secret=apisecret)
wss.start()
time.sleep(1)  # give the client some prep time to set itself up.

# wss.authenticate()

# Subscribe to some channels
wss.ticker('BTCUSD')
wss.order_book('BTCUSD')

# Send a ping - if this returns silently, everything's fine.
wss.ping()

# Do something else
t = time.time()
while time.time() - t < 10:
    pass

print(wss.tickers['BTCUSD'])
print(wss.books['BTCUSD'].bids())  # prints all current bids for the BTCUSD order book
print(wss.books['BTCUSD'].asks())  # prints all current asks for the BTCUSD order book

@deepbrook
Copy link
Collaborator

@penthoy, that's typically an indicator that you're using an older python version than this code was tested with. Please note that only Python Version 3.5 or later is supported.

@penthoy
Copy link
Author

penthoy commented Apr 25, 2017

Thanks the all your reply, no more syntax error, GenesisGupta, if I run the exact script, the wss.tickers seemed to print out fine, but the wss.books just print out empty list, which is wrong, and it seemed to be in a constant loop, and never give me back my terminal, I'm not sure if this is the intended behavior, if I take out the wss.tickers print statement, it'll give time out error, which is very weird.

@deepbrook
Copy link
Collaborator

deepbrook commented Apr 25, 2017

@penthoy, please attach a copy of your log file (it should be located in the directory where you run your script) - do this as follows:

  • If you've run the script before, delete any files called test.log inside your script's directory
  • run the following code:
    from btfxwss import BtfxWss
    
    logging.basicConfig(level=logging.DEBUG, filename='test.log')
    log = logging.getLogger(__name__)

    fh = logging.FileHandler('test.log')
    fh.setLevel(logging.DEBUG)
    sh = logging.StreamHandler(sys.stdout)
    sh.setLevel(logging.DEBUG)

    log.addHandler(sh)
    log.addHandler(fh)
    
    wss = BtfxWss(key='my_api_key', secret='my_api_secret')
    wss.start()
    time.sleep(1)  # give the client some prep time to set itself up.
    
    # Subscribe to some channels
    wss.ticker('BTCUSD')
    wss.order_book('BTCUSD')
    
    # Send a ping - if this returns silently, everything's fine.
    wss.ping()
    
    # Do something else
    t = time.time()
    while time.time() - t < 10:
        pass

    print(wss.tickers['BTCUSD'])
    print(wss.books['BTCUSD'].bids())  # prints all current bids for the BTCUSD order book
    print(wss.books['BTCUSD'].asks())  # prints all current asks for the BTCUSD order book
  • Upload the new test.log file (if it's too big for github, use pastebin and post the generated on here.

Once you've done that, I'll look into it some more - thanks for your patience!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants