Comments (5)
If you are using the same api key for both rest and websocket, there is a chance this can happen, since api calls can fall out of sync. Try using different keys for the rest interface and the websocket and see if that resolves the issue.
from api-connectors.
{"error":"Nonce is not increasing. This nonce: 1515130196494, last nonce: 1515128183690000"}
The two nonces have different format, one is in milliseconds and the other in microseconds. You should use the same format on both clients.
But as @andersea recommended, use different keys for RT and REST, they seem to have nonce conflicts. I couldn't figure out why, it looks like a server side issue.
from api-connectors.
Now the node-swagger and node-ws clients use the same nonce scheme. With a new API key, this shouldn't happen any more.
from api-connectors.
I have solved this problem by making changes in createSocket.js
Added following code in the createSocket function
wsClient.onreconnect = function() {
wsClient.url = makeEndpoint(options);
debug('Reconnecting to BitMEX at ', wsClient.url);
};
and in ReconnectionSocket.js added the following line in reconnect prototype
this.onreconnect();
this is to be added before this.open(this.url);
Changed API keys but it was not solving issue
from api-connectors.
Nonce is increased with each websocket request so you can send from time to time something with the send(msg, callback) method from the socket member of the _bitmexRealtimeApi2.default class (or even BitmexPlus class cause of inheritance) to fix this issue when the websocket client is not active. This was mentioned on another similar issue with the 'ping' message.
But pinging does not sounds like a good persistent fix, especially when Bitmex servers might already have lots of inactive opened sockets they will want to kick out one day, because if someone wants to use REST requests for prices instead of WS when they have no position opened and don't want to open one (I do), he can't disconnect the socket with the connector member functions, he has to access its member objects and hack around, it kind of breaks regular OOP encapsulation.
Bitfinex node API lets you request a reference to a websocket object from their main connector class, maybe this project needs to do the same and encapsulate the socket in another class so users can manipulate and start ws connections by themselves.
from api-connectors.
Related Issues (20)
- How do I add a Keep-Alive connection to a BitMEX-Python-client? HOT 1
- Over time, the websocket-client starts giving the same values HOT 1
- ws.exit() not closing connection. Still able to retrieve data after it. HOT 2
- typo - auto-generated/python/README.md
- The latest version of npm is still 0.5.0 HOT 1
- Support For Multiplexing
- java 的api能用么?aPIKeyGet 报错
- How to get server time?
- Creation of order via bravado python takes >=10 requests of rate-limit
- Documentation: outdated references to bulk endpoints
- Limit orders require 11.05x the amount I'm trying to sell.
- many-exchanges-many-different-streams with watchOrderBook method for okx and bitmex. Algo starting point
- Getting negative rebalancedPnl when using WebSocket subscription
- latency issue from websocket python HOT 1
- Order Reject via API: Canceled: Order had ordType of Market\nSubmitted via API.
- Teknik
- Whatever I request, I get old data.
- How do I cancel orders in bulk in python?
- Some subscriptions have been moved to another endpoint
- websocket-client dependency for Python websocket API outdated
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 api-connectors.