Developers
Three ways to build on Cloud9Trader. Pick the one that matches what you want to make.
| You want to | Use | Start with |
|---|---|---|
| Pull instruments, price history or currency rates into your own script, spreadsheet or app | The REST API | REST API reference |
| Stream live prices, or run your own trading bot that sees your account and sends orders | The WebSocket API | WebSocket API and the private WebSocket |
| Write a strategy that runs on Cloud9Trader’s servers, with backtesting and trading sessions built in | Algorithms, in the browser | Algorithms, then the Algorithm SDK and Indicator SDK |
Before you start
Section titled “Before you start”- Create an API key in API Access in your account settings. See Authentication and keys.
- Know what a request costs. Every REST request spends API credits from your plan. See Credits and limits.
- Handle errors. See Errors for what each status means and when to retry.
Your first request
Section titled “Your first request”curl -H "x-c9t-key: $C9T_API_KEY" "https://price.cloud9trader.com/v1/instruments"This lists every instrument, and costs 1 credit. Each instrument’s id, such as EUR_USD:OANDA, is what the other endpoints take.
Client libraries
Section titled “Client libraries”- JavaScript, for the WebSocket API: the WebSocket client library,
@cloud9trader/websocket-api-clienton npm, connects, signs in, subscribes and reconnects for you. Its REST helpers do not send your key yet, so call the REST API directly. - Everything else: there are no other official libraries. The REST API is plain HTTPS and JSON, and every endpoint in the reference has samples in curl, TypeScript and Python.