Package: tradesimr 0.18.7

tradesimr: Execution and Simulation Engine for Trading Strategies

An R-native trading simulation package with a C++ execution core that turns strategy intentions and explicit orders into simulated trades, positions, cash, profit and loss, risk, and performance outputs under configurable execution, margin, funding, and cost assumptions. The package provides historical replay, incremental exchange stepping, durable event tables, append-only agent command logs, registered assets, per-agent shared-cash cross-margin live accounts, AI agent competitors, scheduled live-feed stepping, strategy-backed AI agents with diagnostics, calibrated and coordinated multi-asset market simulation with static covariance, AR-GARCH, factor, and regime models, durable per-feed simulation state, profile-aware heterogeneous inventory and margin execution with atomic mixed-profile order groups, optional portfolio-margin enforcement through a multi-asset C++ step kernel, local live-service APIs, import/export helpers, separate replay, live-state, and agent dashboard exports, and installed local orchestration scripts. It is designed to consume signals, order intents, or target exposure decisions from compatible strategy packages and market data from compatible adapters.

Authors:Oliver Zhou [aut, cre]

tradesimr_0.18.7.tar.gz
tradesimr_0.18.7.zip(r-4.7-x86_64)tradesimr_0.18.7.zip(r-4.7-arm64)tradesimr_0.18.7.zip(r-4.6-x86_64)tradesimr_0.18.7.zip(r-4.6-arm64)tradesimr_0.18.7.zip(r-4.5-x86_64)
tradesimr_0.18.7.tgz(r-4.6-x86_64)tradesimr_0.18.7.tgz(r-4.6-arm64)tradesimr_0.18.7.tgz(r-4.5-x86_64)tradesimr_0.18.7.tgz(r-4.5-arm64)
tradesimr_0.18.7.tar.gz(r-4.7-arm64)tradesimr_0.18.7.tar.gz(r-4.7-x86_64)tradesimr_0.18.7.tar.gz(r-4.6-arm64)tradesimr_0.18.7.tar.gz(r-4.6-x86_64)
tradesimr_0.18.7.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
tradesimr/json (API)

# Install 'tradesimr' in R:
install.packages('tradesimr', repos = c('https://oliverlds.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/oliverlds/tradesimr/issues

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

3.65 score 126 exports 3 dependencies

Last updated from:4ba2981c07. Checks:15 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK201
linux-devel-x86_64OK213
source / vignettesOK182
linux-release-arm64OK213
linux-release-x86_64OK211
macos-release-arm64OK183
macos-release-x86_64OK362
macos-oldrel-arm64OK165
macos-oldrel-x86_64OK420
windows-devel-arm64OK578
windows-devel-x86_64OK441
windows-release-arm64OK637
windows-release-x86_64OK336
windows-oldrel-x86_64OK185
wasm-releaseOK110

Exports:as_market_barsas_target_positionsPaperTraderPaperTradingPlatformsim_accountsim_agent_addsim_agent_command_schemasim_agent_dashboard_exportsim_agent_dashboard_opensim_agent_rankingssim_agent_removesim_agent_set_statussim_agents_stepsim_asset_addsim_asset_removesim_assetssim_backtestsim_bond_schedule_addsim_bond_schedulessim_calendar_expected_barssim_calendar_holidayssim_calendar_is_opensim_calendar_settlement_timestampsim_calendar_specsim_cancel_ordersim_cash_ledgersim_cross_asset_risksim_dashboard_exportsim_dashboard_opensim_eventssim_exchange_accountsim_exchange_account_statesim_exchange_accrue_carrysim_exchange_add_barssim_exchange_calendar_exceptionsim_exchange_calendarize_barssim_exchange_cancel_ordersim_exchange_cash_adjustsim_exchange_cash_balancessim_exchange_convert_cashsim_exchange_corporate_actionsim_exchange_dashboardsim_exchange_export_eventssim_exchange_future_rollsim_exchange_fx_ratesim_exchange_loadsim_exchange_newsim_exchange_new_eventssim_exchange_orderssim_exchange_place_ordersim_exchange_positionssim_exchange_process_commandssim_exchange_runsim_exchange_savesim_exchange_set_carry_ratessim_exchange_settlesim_exchange_stepsim_exchange_validate_cadencesim_exportsim_feed_configsim_feed_configuresim_feed_startsim_feed_statussim_feed_stepsim_feed_stopsim_feed_warmupsim_fillssim_heterogeneous_account_stepsim_heterogeneous_order_batch_schemasim_importsim_instrument_profilesim_instrument_profilessim_live_servicesim_live_service_runsim_live_state_dashboard_opensim_manifestsim_market_eventssim_market_model_calibratesim_market_model_calibrate_exchangesim_market_model_configsim_market_model_configuresim_market_model_statussim_metricssim_orderssim_portfolio_decision_policysim_portfolio_executionsim_portfolio_execution_qualitysim_portfolio_exportsim_portfolio_market_stepsim_portfolio_stepsim_portfolio_target_replaysim_portfolio_target_stepsim_portfolio_target_submitsim_portfolio_target_submit_batchsim_positionssim_read_accountsim_read_eventssim_read_manifestsim_read_tablesim_replaysim_replay_dashboard_exportsim_risksim_run_from_eventssim_schema_migratesim_schema_versionsim_schemassim_spot_stepsim_spot_target_submitsim_statesim_state_dashboard_exportsim_stepsim_strategy_listsim_strategy_registersim_strategy_unregistersim_strategy_validate_configsim_submit_ordersim_trading_calendarsTRADESIMR_ACCOUNT_SCHEMA_VERSIONTRADESIMR_SCHEMA_VERSIONvalidate_intentsvalidate_market_datavec_batch_run_simulationsvec_sim_gen_plotvec_sim_gen_summaryvec_sim_gen_summary_tablevec_sim_run_backtest

Dependencies:data.tableR6Rcpp

Readme and manuals

Help Manual

Help pageTopics
Normalize market bars for tradesimras_market_bars
Normalize target-position intents for tradesimras_target_positions
Paper trader demo clientPaperTrader
Paper trading platform demoPaperTradingPlatform
Extract account snapshots from a simulationsim_account
Add an AI or human agent to a live exchangesim_agent_add
Get live-agent command schemassim_agent_command_schema
Export an agent-facing live dashboardsim_agent_dashboard_export
Open an agent-facing live dashboardsim_agent_dashboard_open
Compute current agent rankingssim_agent_rankings
Remove an agent from a live exchangesim_agent_remove
Set an agent statussim_agent_set_status
Step active AI agents and append their order commandssim_agents_step
Register a tradable asset on an exchangesim_asset_add
Remove an asset from an exchange registrysim_asset_remove
List registered exchange assetssim_assets
Run a stateful trading simulation backtestsim_backtest
Register a calendar-driven bond schedulesim_bond_schedule_add
List durable bond schedulessim_bond_schedules
Generate expected completed bar timestamps from a calendarsim_calendar_expected_bars
List deterministic built-in calendar holidayssim_calendar_holidays
Test whether timestamps fall in a built-in tradable sessionsim_calendar_is_open
Calculate a calendar-aware settlement timestampsim_calendar_settlement_timestamp
Get a trading-calendar specificationsim_calendar_spec
Submit an agent order cancellation commandsim_cancel_order
Extract cash ledger entries from a simulationsim_cash_ledger
Compute cross-asset risk for live exchange agentssim_cross_asset_risk
Export a static simulation dashboardsim_dashboard_export
Open an exported static dashboardsim_dashboard_open
Convert a simulation recorder into an event tablesim_events
Get simulated exchange account statesim_exchange_account
Get the durable heterogeneous account statesim_exchange_account_state
Accrue profile-aware borrow and cash interestsim_exchange_accrue_carry
Append market bars to a simulated exchangesim_exchange_add_bars
Add an exchange-specific calendar exceptionsim_exchange_calendar_exception
Calendarize registered-asset market barssim_exchange_calendarize_bars
Cancel an intent-level order in a simulated exchangesim_exchange_cancel_order
Deposit or withdraw a profile-aware currency balancesim_exchange_cash_adjust
Get profile-aware cash balancessim_exchange_cash_balances
Convert cash between currencies at an authoritative exchange FX marksim_exchange_convert_cash
Register a durable inventory corporate actionsim_exchange_corporate_action
Export and open a simulated exchange dashboardsim_exchange_dashboard
Export exchange simulation eventssim_exchange_export_events
Register a futures expiry or contract rollsim_exchange_future_roll
Set a foreign-exchange conversion ratesim_exchange_fx_rate
Load exchange state from disksim_exchange_load
Create an in-memory simulated exchange statesim_exchange_new
Get new events since the previous exchange runsim_exchange_new_events
Get simulated exchange orderssim_exchange_orders
Place an order into a simulated exchangesim_exchange_place_order
Get simulated exchange positionssim_exchange_positions
Process pending agent commandssim_exchange_process_commands
Run or refresh a simulated exchange replaysim_exchange_run
Export exchange events and statesim_exchange_save
Configure borrow and cash interest ratessim_exchange_set_carry_rates
Settle due profile-aware cash movementssim_exchange_settle
Step a simulated exchange with one or more barssim_exchange_step
Validate registered-asset bar cadencesim_exchange_validate_cadence
Export simulation tables to durable filessim_export
Default live feed configurationsim_feed_config
Configure a live exchange feedsim_feed_configure
Start a configured live feedsim_feed_start
Get live feed statussim_feed_status
Step a live feed through completed barssim_feed_step
Stop a configured live feedsim_feed_stop
Generate historical simulation bars before starting a live feedsim_feed_warmup
Extract fill events from a simulationsim_fills
Step a heterogeneous profile-aware account kernelsim_heterogeneous_account_step
Empty normalized heterogeneous order-batch schemasim_heterogeneous_order_batch_schema
Import exported simulation tablessim_import
Resolve an instrument profilesim_instrument_profile
List supported instrument profilessim_instrument_profiles
Create a local live exchange servicesim_live_service
Run a local live exchange servicesim_live_service_run
Open a live-state dashboardsim_live_state_dashboard_open
Build an export manifestsim_manifest
Extract market bars from a simulationsim_market_events
Calibrate a market model from historical OHLC barssim_market_model_calibrate
Configure an exchange market model from historical barssim_market_model_calibrate_exchange
Configure market-level multi-asset simulationsim_market_model_config
Configure a market-level simulation modelsim_market_model_configure
Get market-level simulation model statussim_market_model_status
Calculate core performance metrics from a simulation resultsim_metrics
Convert a simulation recorder into an order/event tablesim_orders
Define a portfolio decision policysim_portfolio_decision_policy
Build execution assumptions for a target-weight portfolio replaysim_portfolio_execution
Project execution quality for durable portfolio target rebalancessim_portfolio_execution_quality
Export a safe portfolio replay snapshot for an external consumersim_portfolio_export
Advance an Arena exchange at one completed market boundarysim_portfolio_market_step
Step the C++ portfolio-margin kernel oncesim_portfolio_step
Replay a historical multi-asset target-weight panelsim_portfolio_target_replay
Step one agent portfolio from target weightssim_portfolio_target_step
Submit one Arena target-weight decision after a market boundarysim_portfolio_target_submit
Submit multiple Arena target-weight decisions after one market boundarysim_portfolio_target_submit_batch
Extract position snapshots from a simulationsim_positions
Read exported account snapshotssim_read_account
Read exported simulation eventssim_read_events
Read an export manifestsim_read_manifest
Read an exported simulation tablesim_read_table
Replay historical bars through the simulation enginesim_replay
Export a static replay dashboardsim_replay_dashboard_export
Extract risk snapshots from a simulationsim_risk
Reconstruct simulation views from exported eventssim_run_from_events
Migrate durable tables to the current schemasim_schema_migrate
Get the tradesimr schema versionsim_schema_version
Simulation table schemassim_schemas
Step a fully paid spot-inventory statesim_spot_step
Submit spot target weights for next-bar executionsim_spot_target_submit
Create a simulation state objectsim_state
Export a live-state dashboardsim_state_dashboard_export
Step the C++ exchange kernel oncesim_step
List registered strategy idssim_strategy_list
Register a strategy function for strategy-backed AI agentssim_strategy_register
Unregister a strategy functionsim_strategy_unregister
Validate strategy-backed agent configsim_strategy_validate_config
Submit an agent order commandsim_submit_order
List built-in trading calendarssim_trading_calendars
Heterogeneous account schema versionTRADESIMR_ACCOUNT_SCHEMA_VERSION
tradesimr durable schema versionTRADESIMR_SCHEMA_VERSION
Validate target-position intent columnsvalidate_intents
Validate core market-bar columnsvalidate_market_data
Generate vectorized simulation inputs for multiple instrumentsvec_batch_run_simulations
Plot vectorized simulation resultsvec_sim_gen_plot
Summarize vectorized simulation resultsvec_sim_gen_summary
Summarize a batch of vectorized simulationsvec_sim_gen_summary_table
Run a vectorized approximate backtestvec_sim_run_backtest