In may 2021 Saxo Bank introduced CryptoFX: a new set of instruments that enables clients to gains exposure to the volatility of prices on crypto currencies like Bitcoin and Ethereum. This article covers how to use Saxo's OpenAPI to trade with these new instruments.
Crypto FX for developers
Saxo Banks new CryptoFX instruments are essentially regular FX crosses. This means that they are traded in an identical matter to the regular FX instruments like EURUSD or USDJPY. Crypto FX are implemented as a cross between a primary crypto currency: Bitcoin, Ethereum and Litecoin and a secondary major currency like USD, EUR and JPY.
This means that:
- P/L are always in a major currency like USD.
- Cryptos can not be traded against each other. Pairs like ETHBTC or LTCBTC are not possible to trade.
Because Crypto FX are implemented as other FX instruments, they behave in the same way: eg they are traded through the same endpoints and have the same AssetType parameter, available order types, response parameters etc.
Please refer to the section on our home page: https://www.home.saxo/products/crypto for more information about our Crypto offering.
Trading Crypto FX on OpenAPI
Here are some handpicked details about the first Crypto FX instruments that are being released:
Max Autotrade size
Indicative prices can be retrieved through the /trade/v1/infoprices endpoint. This provides information on prices, market state etc.
Example: Get info price for BTCUSD:
Read more about the endpoints request/response parameters here: https://www.developer.saxo/openapi/referencedocs/trade/v1/infoprices.
Historical prices and charts
It's possible to get historical price data for the Crypto FX Instruments back to 19-04-2021 using the chart/v1/charts endpoint. The endpoint requires a specification of the Uic, AssetType and a Horizon. See the table above for which Uics and AssetType to use and the endpoint reference docs for available horizons.
Example: Get hourly samples for ETHJPY
Read more about the charts service group here: https://www.developer.saxo/openapi/referencedocs/chart/v1/charts.
Streaming Price Updates
Just like for regular FX crosses you may setup subscriptions to get real-time updated price and chart data. The example below illustrates how to subscribe to chart updates.
Example: creating streaming subscription to LTCEUR
Create a subscription for the instruments you want updates for:
This will returns a response containing a confirmation that the subscription has been created and a snapshot of the most recent data:
Using the ReferenceId and Contextid you can now open a websocket connection and listen for updates on CryptoFX instruments. To read more about our streaming options go here: https://www.developer.saxo/openapi/learn/streaming. To see a full implementation of a working streaming connection over websocket, go here: https://github.com/SaxoBank/openapi-samples-js/tree/main/websockets/historical-market-data.
CryptoFX instruments can be traded through OpenAPI by sending a POST request with order details to the /orders endpoint. The following order types are supported:
Example: buying 100.00 LTCUSD
Please note: Quote Currency must be left blank or set to FALSE as CryptoFX does not support placing orders in quote currency.
For more information on placing orders or changing/canceling them read here: https://www.developer.saxo/openapi/referencedocs/trade/v2/orders
Things to beware
Here is a description of the limitations our current CryptoFX implementation holds.
Like other FX crosses, Crypto FX are traded in the weekdays and NOT in the weekends. This means that it is not possible to either open or close positions over the weekend. Please refer to the FAQ section on our home page: https://www.home.saxo/products/crypto for more information about trading times.
Charts and historical data
Saxo Bank can only distribute historical prices via OpenAPI going back to the 19th of April 2021.
This has the following implications:
- Queries to the /chart endpoint for any CryptoFX pair will only fetch data going back to the 19th of April 2021 00:00:00 no matter the horizon. Thus calling a horizon of for example one year will per June 2021 only return one sample starting the 1st of January 2021.
- Comparing charts of historical data between OpenAPI and SaxoTrader GO/PRO yields the same results from the 19th of April 2021 and forward. Before this date the charts on SaxoTrader GO/PRO will show historical prices and OpenAPI will not.