How to use OpenQuoteContext for market data
masterTo access market data (quotes, K-lines, order books, etc.), instantiate an OpenQuoteContext object. You must provide the host and port where your FutuOpenD gateway is running.
Workflow:
- Instantiate
ft.OpenQuoteContext(host="...", port=...). - Call
.start()to begin asynchronous data reception. - Use
.set_handler()with a subclass offt.TickerHandlerBase()to process incoming data asynchronously. - Use low-frequency methods (e.g.,
get_market_snapshot) or high-frequency methods (e.g.,get_rt_ticker) to fetch data. - Call
.stop()to stop receiving data and.close()to release resources.
Note: You must have the FutuOpenD gateway client running before executing your Python script.