Building a Daily Futures System with Order-Simulator Accounting
Summary
This short Python example shows how to assemble a daily futures trading system with an order simulator. It creates a data source, loads configuration, and constructs a system from account, portfolio, position-sizing, forecast-combination, forecast-scaling, rule, and raw-data components. By default, the account uses order-simulator accounting; a function argument switches to a conventional account instead. The code is presented as an example for a simple trend system using daily data and market orders.
The snippet illustrates where order simulation fits into a modular system and how to choose between two accounting paths. It does not include the trading rules’ implementation, configuration contents, order-fill assumptions, or any output from a run. Consequently, it teaches system wiring rather than how to design a simulator or assess its realism. The example alone provides no evidence about performance or whether simulated fills match actual execution, so those properties depend on components and settings not shown.
Key ideas
- The example assembles a daily futures system from data, configuration, account, portfolio, sizing, forecast, rule, and raw-data components.
- Order-simulator accounting is selected by default, with an option to use conventional accounting.
- The example concerns a simple trend system using daily data and market orders.
- The snippet does not show simulator assumptions, full trading rules, or performance results.
Tags
Full text
# daily_with_order_simulation.py
```py
### THIS IS AN EXAMPLE OF HOW TO USE A PROPER ORDER SIMULATOR RATHER THAN VECTORISED
### P&L, FOR A SIMPLE TREND SYSTEM USING DAILY DATA WITH MARKET ORDERS
import matplotlib
matplotlib.use("TkAgg")
from syscore.constants import arg_not_supplied
# from sysdata.sim.csv_futures_sim_data import csvFuturesSimData
from sysdata.sim.db_futures_sim_data import dbFuturesSimData
from sysdata.config.configdata import Config
from systems.forecasting import Rules
from systems.basesystem import System
from systems.rawdata import RawData
from systems.forecast_combine import ForecastCombine
from systems.forecast_scale_cap import ForecastScaleCap
from systems.positionsizing import PositionSizing
from systems.portfolio import Portfolios
from systems.accounts.order_simulator.account_curve_order_simulator import (
AccountWithOrderSimulator,
)
from systems.accounts.accounts_stage import Account
def futures_system(
sim_data=arg_not_supplied,
use_vanilla_accounting: bool = False,
config_filename="systems.provided.example.daily_with_order_simulation.yaml",
):
if sim_data is arg_not_supplied:
sim_data = dbFuturesSimData()
config = Config(config_filename)
if use_vanilla_accounting:
account = Account()
else:
account = AccountWithOrderSimulator()
system = System(
[
account,
Portfolios(),
PositionSizing(),
ForecastCombine(),
ForecastScaleCap(),
Rules(),
RawData(),
],
sim_data,
config,
)
return system
```Shown in full with attribution under the source's licence. Licence: GPL-3.0
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.