Skip to content
All library documents

Signed Exchange Requests and Limit Order Utilities

Code Quant course library

Summary

This HTTP client code illustrates basic operations for an exchange trading API: request signing, server-time retrieval, order creation and cancellation, open-order and position retrieval, and historical candle loading. Private requests add a timestamp and API key, then calculate an HMAC signature over sorted parameters. Its order helper rounds prices to a specified tick and submits limit orders with a post-only time-in-force setting.

The document supplies implementation examples rather than a trading strategy or performance evidence. It shows how candle responses are converted into a tabular form with timestamp and OHLCV fields. The price increment is fixed in the helper, so it may not fit every instrument. Request signing, response handling, and API paths are also dependent on the exchange interface and require operational validation; no execution-quality or risk analysis is provided.

Key ideas

  • Private API requests include a timestamp and key in parameters covered by an HMAC signature.
  • The order helper rounds the requested price to a fixed increment before submitting a post-only limit order.
  • The client provides functions to cancel orders and retrieve open orders and positions.
  • Historical candle data is selected into timestamp, open, high, low, close, and volume fields.
  • The implementation gives no evidence about trading returns, fees, or execution quality.

Tags

From a private course collection; the original is not published.