Trading APIs

Everyone is Doin’ It

I researched 2 top crypto exchanges and reviewed the documentation on their websites. So far I found that at least 2 exchanges provide partial or full APIs to access their trading systems and data.

RESTful and WebSocket architectures/styles are the most prevalent technologies used for API services. RESTful is supported by 2 exchanges and 2 support WebSocket. Clients on many exchanges can choose the technology because 2 exchanges support both architectures.

FIX is the distant 3rd trading protocol and is supported by these 2 exchanges:

In total, just 2 exchanges support RESTful, WebSocket and FIX protocols.

RESTful vs. WebSocket vs. FIX

Simplified characteristics of each architecture are that RESTful uses matching sets of request-response messages and is the “least” reactive style of the 3 alternatives. WebSocket systems receive subscriptions from clients and respond with ad hoc data push-back to their clients. A few exchanges have outsourced their market data WebSocket services to Pusher.com and PubNub.com. I would expect these indirect feeds to be a little bit “slower” than the WebSocket served directly from the exchanges. The FIX protocol is best suited for order management while its FastFIX “cousin” is intended for real-time market data.

Partial and Full API

In functional terms, APIs can deliver different features:

  1. market data (see “feed“): last-prices, market depth, indicators, markets traded (coins) etc.
  2. order management (see “user“): positions, new order entry, order modification etc.
  3. account management (see “withdrawals“): transfers in-out of the exchange are useful for arbitrage algos.

In most cases, market data services do not require user accounts / authentication (see “public“). All order management and account management utilizes api-key / secret authentication with encryption (see “auth“). The FIX protocol security relies on dedicated (secure) networks and VPNs instead of encryption.

Performance

Theoretically, the best overall performance should be achieved with a combination of WebSocket for real-time market data push, and FIX-via-VPN for order management, because FIX does not consume encryption/decryption processing. Due to RESTful’s request-response design, its server side implementation consumes greater computing resources and all exchanges have set maximum acceptable request rates.

Test Environments

I am a practitioner of unit and integration testing, and I was very interested in any testing facilities that the exchanges might provide. To my surprise I found that only 2 exchanges provide sandbox/test environments:


API DocsRESTfulWebSockets


Subscribe to monthly email about crypto exchanges, data feeds, APIs for automated bots, algos and trading tools: