Closed adamlawrencium closed 7 years ago
Technicalities aside, you should consider the benefit vs work of implementing WSS APIs. For most exchanges, 6 API calls per second is already more than you need (of course you're correct when calling it 'expired'), because markets are not that fast just yet.
It can, of course, never hurt to be prepared - but implementation of WSS APIs has been a bit of a nuisance (from own personal experience). Especially Poloniex - the WAMP protocol they use, requires you to use Autobahn (or similar). Then there's the issue with message order - while they usually come in the correct order, it does happen that they arrive out of sync - which defeats the purpose of the WSS, since all data that arrives until then is also possibly out of date.
I'm not against the idea of using WSS APIs - I just wanted to highlight some of the difficulties. If you're keen on it, don''t let me stop you ;)
I rewrote bitcoin-arbitrage in go, it connects to wss:// when available and maintain a local market depth, then refreshes it regularly (every 5 mins) using a REST call. It's fairly easy to implement, but I won't redo it here. I'm planning to publish the go version on GitHub, but there is no ETA (and I'm not actively working on it).
Given the short-lived nature of arbitrage opportunities, has anyone considered using Websockets instead of making lots of API calls after 'market data has expired'? Poloniex for example only allows 6 calls per second -- sockets feed provides even quicker data points.
While this could cause other problems, like data being improperly synchronized, I think the benefits of more frequent market updates (and possibly easing the load on the exchanges' servers) could outweigh those issues. If anyone else is interested I can fork this repo and try to add a Websockets implementation.