Comments (14)
I tried the alpha with the url https://socket.bittrex.com/signalr instead of self.url = 'https://socket-stage.bittrex.com/signalr which gave me a connection
from python-bittrex-websocket.
Yes, they work interchangeably, unless Bittrex denies the connection.
Is this problem solved?
from python-bittrex-websocket.
I made yesterday some experiments with the network monitor of firefox. Both websocket and http protocol using a sort of ping. The http api seems to need a request for a file version.txt. I had problems with this api, because the data was always 3 to 4 minutes too old and the call LatestTick is not documented. But I was able to implement the call. I will try to implement the request for the version.txt to get data which is not older than 1minute.
The websocket protocol seems to need a "ping". I saw a ping which is the telegram of the ascii string "ping" to the server. We should investigate further, before we make conclusions. I will work on a fork of the bittrex api, which is used by Bittrex to build the chart, until this api is usable. Because to get all necessary data it needs web socket and the http api.
If this is becoming successful we should merge the projects
from python-bittrex-websocket.
@rako233 with respect to the 'ping', do you mean that the websocket needs to ping the server to stay on? I have tested it for a hours in the past and the order flow was up to date. You are right, we should do further testing, I plan to release the revamped code this week.
With respect to API requests, maybe we should have a joined topic with https://github.com/ericsomdahl/python-bittrex since it handles API requests and also the two libraries are still independent for the time being.
from python-bittrex-websocket.
I have the suspicion these pings are used for detecting of users like us. Your proposal to work together with ericsomdahl is a good one. The goal should providing a package to record historic data with a Blaze or pandas interface.
from python-bittrex-websocket.
So I implemented the request for the version.txt and get_latest_tick for 1min and still no change. The data is always delayed. I shouldn't have done that because even the online charts are delayed.
from python-bittrex-websocket.
Periodically I am getting this error as well (using socket.bittrex.com
url), just wondering if it's related:
File "/lib/python3.6/site-packages/websocket/_socket.py", line 93, in recv
"Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
Wed Dec 6 11:37:09 2017 <Greenlet at 0x104b2c508: wrapped_listener> failed with WebSocketConnectionClosedException
Full stack trace:
File "/lib/python3.6/site-packages/gevent/greenlet.py", line 536, in run
result = self._run(*self.args, **self.kwargs)
File "/lib/python3.6/site-packages/signalr/_connection.py", line 53, in wrapped_listener
listener()
File "/lib/python3.6/site-packages/signalr/transports/_ws_transport.py", line 42, in _receive
for notification in self.ws:
File "/lib/python3.6/site-packages/websocket/_core.py", line 105, in __iter__
yield self.recv()
File "/lib/python3.6/site-packages/websocket/_core.py", line 293, in recv
opcode, data = self.recv_data()
File "/lib/python3.6/site-packages/websocket/_core.py", line 310, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/lib/python3.6/site-packages/websocket/_core.py", line 323, in recv_data_frame
frame = self.recv_frame()
File "/lib/python3.6/site-packages/websocket/_core.py", line 357, in recv_frame
return self.frame_buffer.recv_frame()
File "/lib/python3.6/site-packages/websocket/_abnf.py", line 340, in recv_frame
self.recv_header()
File "/lib/python3.6/site-packages/websocket/_abnf.py", line 288, in recv_header
header = self.recv_strict(2)
File "/lib/python3.6/site-packages/websocket/_abnf.py", line 375, in recv_strict
bytes_ = self.recv(min(16384, shortage))
File "/lib/python3.6/site-packages/websocket/_core.py", line 427, in _recv
return recv(self.sock, bufsize)
File "/lib/python3.6/site-packages/websocket/_socket.py", line 93, in recv
"Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
Wed Dec 6 11:37:09 2017 <Greenlet at 0x104b2c508: wrapped_listener> failed with WebSocketConnectionClosedExceptio
from python-bittrex-websocket.
Are you closing the socket with ws.close()
prematurely?
On average how much time passes before you receive websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
I've left the socket to run for hours before closing it and haven't experienced that error. Are you sure your internet connection is not being disconnected?
Nevertheless, there are plans to integrate reconnection.
from python-bittrex-websocket.
I have ws.close()
at the very end of the .py file (which should only be reached if i press ctrl+c). so if it closed, it would've exited, but it stays running after that error. it happens after about an hour of running. Also, I noticed, this issue does NOT happen on http://socket-stage.bittrex.com for some reason (when that URL works).
from python-bittrex-websocket.
@andreixk v0.0.2 has been pushed, please reinstall and post back. Make sure you check the updated documentation because there have been some major changes to how the socket functions.
In my experience http://socket-stage.bittrex.com has always been more stable. I have added it as the primary connection URL.
from python-bittrex-websocket.
Issue still happens, but after about 5-6 hours of connection.
after the error, although it says connection established, there are no updates coming through
Traceback (most recent call last):
File "/lib/python3.6/site-packages/gevent/greenlet.py", line 536, in run
result = self._run(*self.args, **self.kwargs)
File "/lib/python3.6/site-packages/signalr/_connection.py", line 53, in wrapped_listener
listener()
File "/lib/python3.6/site-packages/signalr/transports/_ws_transport.py", line 42, in _receive
for notification in self.ws:
File "/lib/python3.6/site-packages/websocket/_core.py", line 105, in __iter__
yield self.recv()
File "/lib/python3.6/site-packages/websocket/_core.py", line 293, in recv
opcode, data = self.recv_data()
File "/lib/python3.6/site-packages/websocket/_core.py", line 310, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/lib/python3.6/site-packages/websocket/_core.py", line 323, in recv_data_frame
frame = self.recv_frame()
File "/lib/python3.6/site-packages/websocket/_core.py", line 357, in recv_frame
return self.frame_buffer.recv_frame()
File "/lib/python3.6/site-packages/websocket/_abnf.py", line 340, in recv_frame
self.recv_header()
File "/lib/python3.6/site-packages/websocket/_abnf.py", line 288, in recv_header
header = self.recv_strict(2)
File "/lib/python3.6/site-packages/websocket/_abnf.py", line 375, in recv_strict
bytes_ = self.recv(min(16384, shortage))
File "/lib/python3.6/site-packages/websocket/_core.py", line 427, in _recv
return recv(self.sock, bufsize)
File "/lib/python3.6/site-packages/websocket/_socket.py", line 93, in recv
"Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
Fri Dec 15 07:30:19 2017 <Greenlet at 0x1073d6800: wrapped_listener> failed with WebSocketConnectionClosedException
DEBUG:root:Trying to establish connection to Bittrex through https://socket.bittrex.com/signalr.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): socket.bittrex.com
DEBUG:urllib3.connectionpool:https://socket.bittrex.com:443 "GET /signalr/negotiate?connectionData=%5B%7B%22name%22%3A+%22coreHub%22%7D%5D&clientProtocol=1.5 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://socket.bittrex.com:443 "GET /signalr/start?transport=webSockets&connectionToken=9Nmo1LoMNWiYMm6o4z68S4FWgRdo7oJZol0rFUF%2FhB4zYFz2D1PwdbVo8YKb6uMkWOODLuEiUJr4uIRCmmn%2BNmnAl1a4gKsY0XE9VfV%2B3IH0HmI&connectionData=%5B%7B%22name%22%3A+%22coreHub%22%7D%5D&clientProtocol=1.5 HTTP/1.1" 200 None
DEBUG:root:Connection to Bittrex established successfully through https://socket.bittrex.com/signalr.
from python-bittrex-websocket.
I haven't applied reconnection mechanisms yet, they are in order.
For the time being, apply own logic to check if connection is active and restart the whole socket.
from python-bittrex-websocket.
I made a test yesterday and the reconnect worked. Anyway tje JS code on the webpage makes a HTTPS request for https://bittrex.com/Content/version.txt every minute and a ping via
https://socket.bittrex.com/signalr/ping?_= every 5th minute. My guess is the websocket server has a watchdog which is reset by one of these requests. Sadly my code to try this isn't working longer because the version.txt request demands a cookie from cloudflare and my ping isn't working as well, because of cloudflare.
from python-bittrex-websocket.
Maybe you can get it with cfscrape?
from python-bittrex-websocket.
Related Issues (20)
- QueryExchangeState Market Name is None. HOT 9
- Nonetype object not subscriptable HOT 1
- SubscribeToSummaryDeltas error HOT 2
- SSL Fail HOT 27
- Example not finished properly on Ubuntu HOT 4
- Are updates to Order Book provided in real-time or using a polling interval? HOT 3
- Authentication and trade executions HOT 2
- authenticate callback exception HOT 9
- SSL: CERTIFICATE_VERIFY_FAILED HOT 7
- SubscribeToSummaryDeltas read operation timed out
- ImportError: cannot import name 'six' HOT 1
- on monitoring new listings HOT 2
- Lastest price bug HOT 2
- Error messages not being thrown HOT 4
- Unhandled Exception <[Errno 104] Connection reset by peer> HOT 2
- Unhandled Exception Message = <'PassthroughUuid'> HOT 1
- AttributeError: 'ReconnectEvent' object has no attribute 'invoke' HOT 1
- Issue with IndexError after authenticate() HOT 1
- Auto-reconnection is disabled for unhandled exceptions when calling ws.query_summary_state()
- Websockets code to get tickers doesn't work anymore HOT 1
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 python-bittrex-websocket.