Comments (4)
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
from btfxwss.
@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.
from btfxwss.
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.
from btfxwss.
@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!
from btfxwss.
Related Issues (20)
- Timeout settings? HOT 1
- Websocket configuration is not restored during reconnect HOT 1
- pip install not newest version HOT 1
- after running for hours the timeout become much HOT 1
- Connection Issue HOT 2
- A proper handling of a Bitfinex-initiated connection closing
- how to reconnect properly HOT 3
- ORDER RELATED API HOT 1
- SUBSCRIPTION TO DATA HOT 1
- authenticated channels HOT 4
- New websocket-client release breaking code HOT 1
- client_tests don't work HOT 8
- problems with reconection HOT 3
- Pypi version 1.2.2 breaks `raise_exception` HOT 3
- websockets reconnecting constantly? HOT 2
- the auth_nonce problem
- fail to run client.py ,help HOT 2
- not responding sometimes
- Upcoming Bitfinex API Update June 2019
- Account channel not updated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btfxwss.