Retrieving HeXun Futures Candles in Python
Summary
This document describes a Python helper for retrieving futures candlestick data from HeXun’s third-party service. The function accepts an instrument, bar interval, requested history size, and options for including the latest bar or returning a DataFrame. It maps recognized contract prefixes to exchange identifiers, translates supported minute, daily, and weekly intervals into the provider’s request format, parses the response, and converts price fields using a scale factor included in the payload. The accompanying mapping covers selected contracts from several Chinese futures exchanges.
The author notes that an interface update added hourly and weekly data and required correcting interval handling. The code also shows basic checks for unknown contracts, unsupported intervals, and incomplete JSON responses. This is a historical data-access example, not a trading strategy or evaluation of data quality. It relies on a particular third-party endpoint and contract mapping, and the document provides no current availability, licensing, completeness, timestamp convention, or validation evidence. Users would need to verify those details before relying on the resulting series for research.
Key ideas
- The helper requests futures bars from a third-party data service and can return records or a DataFrame.
- It maps contract prefixes to exchange identifiers and supports minute, daily, and weekly intervals.
- The response includes a price scaling factor used when constructing OHLC values.
- The author describes a past interface change affecting hourly and weekly interval handling.
- The document does not establish current endpoint reliability, data quality, or licensing terms.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.