Using a Script Engine for Multi-Instrument Trading and Market Data
Summary
This guide describes an interactive Python workflow for quantitative analysis and automated trading through a script engine. Unlike a single-strategy workflow tied to one instrument or venue, the engine can connect to multiple interfaces and subscribe to several instruments, making it suitable for tasks such as cross-asset hedging, cross-product arbitrage, and automated stock screening. Its example script subscribes to two contracts, retrieves contract details, then polls for updated ticks in a loop that can be stopped through an engine status flag.
The guide also catalogs methods for retrieving single or multiple ticks, orders, trades, contracts, positions, accounts, and historical bars, with optional conversion to tabular data. It explains order submission and cancellation, supported order types, logging, and email notifications. These are operational examples rather than a trading strategy: no signal logic, backtest, execution study, or profitability evidence is provided. Interface configuration, historical data access, and order types depend on the connected gateway and its capabilities.
Key ideas
- The script engine can connect to multiple trading interfaces and subscribe to multiple instruments.
- A continuously running script can poll for market data and stop when its active flag is cleared.
- Query functions cover market data, contracts, historical bars, orders, trades, accounts, and positions.
- The engine supports order placement and cancellation, while available order types vary by interface.
- The material explains platform operations but does not evaluate a trading signal or strategy.
Tags
From a private course collection; the original is not published.