Exchange APIs for Accounts, Tickers, Candles, and Order Books
Summary
This tutorial introduces exchange API calls for retrieving account details, ticker data, historical candlesticks, and market depth. It explains that a primary exchange object refers to the first exchange in an array, and illustrates polling ticker data in a loop with a pause between requests. The pause controls polling frequency and can help avoid excessive API requests. It also notes that ticker high and low values depend on the exchange’s chosen interval or simulation behavior.
For candles, the guide lists supported intervals, describes records as time-ordered from oldest to newest, and warns that the latest candle remains provisional until its interval closes. For order books, it describes ask and bid arrays, with the best prices at the front, and demonstrates using the best ask and its displayed amount for a marketable buy. The examples and output are instructional rather than a trading evaluation: simulated depth may use artificial quantities, and live order books change quickly. The tutorial does not address robust error handling, latency, partial fills, or risk controls.
Key ideas
- An exchange API can return account balances, ticker snapshots, candlestick records, and order-book depth.
- Polling loops should include a delay because request frequency can affect API access.
- Candlestick records are ordered chronologically, and the current interval’s final record can still change.
- The best ask and bid are at the start of their respective order-book arrays.
- Displayed depth and simulated market data may differ from fast-changing live conditions.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.