From 965953fb93c310813966ddc509e8bc453e228fce Mon Sep 17 00:00:00 2001 From: Cryptoval Trading Technologies Date: Thu, 2 Apr 2026 01:57:01 +0000 Subject: [PATCH] 20260402 --- data/apps/simulation/rt_simulator.cfg | 74 ++++++++++++ .../simulation/trading_simulator.example.cfg | 112 ++++++++++++++++++ 2 files changed, 186 insertions(+) create mode 100644 data/apps/simulation/rt_simulator.cfg create mode 100644 data/apps/simulation/trading_simulator.example.cfg diff --git a/data/apps/simulation/rt_simulator.cfg b/data/apps/simulation/rt_simulator.cfg new file mode 100644 index 0000000..700d5ab --- /dev/null +++ b/data/apps/simulation/rt_simulator.cfg @@ -0,0 +1,74 @@ +# =============================================================================== +# REAL TIME SIMULATOR +# (no Market Data) +# =============================================================================== +# Environment setting example +# SIM_ORDER_ENTRY_WS_PORT=28081 +# SIM_ORDER_ENTRY_REST_PORT=28082 +# SIM_ACCOUNTING_REST_PORT=28083 + +# simulation/market_simulator -> "" (root) +{ + "initial_positions": { + "exchange": "COINBASE", + "assets": { + "BTC": 0.1, + "ETH": 5.0, + "USD": 10000.0 + } + }, + "market_data": { + # NOT USED HERE. Use Direct Market data via MDGW + } + "order_entry": { + "api": { + "web_socket": { + "url": "ws://localhost:@env{SIM_ORDER_ENTRY_WS_PORT}/ws" + }, + "REST": { + "port": @env{SIM_ORDER_ENTRY_REST_PORT}, + "base_url": "http://localhost:@env{SIM_ORDER_ENTRY_REST_PORT}", + "endpoints": { + "new_order": ["POST", "/order"], + "cancel_order": ["POST", "/cancel"], + "cancel_all": ["POST", "/cancel_all"], + "open_orders": ["GET", "/open_orders"], + "order_status": ["GET", "/order_status"] + } + } + }, + "execution": { + "fast": { # formerly known as --debug_mode in OEGW; use --fast_exec_mode in CL + "partial_fill_wait_sec": 3600.0, + "full_fill_wait_sec": 3600.0, + "fee_rate": 0.006 + }, + "on_market_data": { ## DEFAULT METHOD + "md_exch_acct": "COINBASE_AT", + "execute_on": [ + "BOOK_TOP", + "TRADES" + ], + "top_only": true, + "pricing_method": "BY_MKT_TRD_PRICE_BY_TRADE", + "min_order_age_sec": 0.1, + "fee_schedule": { + "taker_fee_rate": 0.006, + "maker_fee_rate": 0.004 + } + } + }, + }, + "accounting": { + "api": { + "REST": { + "port": @env{SIM_ACCOUNTING_REST_PORT}, + "base_url": "http://localhost:@env{SIM_ACCOUNTING_REST_PORT}", + "endpoints": { + "positions": ["GET", "/positions"], + "trades": ["GET", "/trades"] + } + } + } + } +} diff --git a/data/apps/simulation/trading_simulator.example.cfg b/data/apps/simulation/trading_simulator.example.cfg new file mode 100644 index 0000000..37e5e9f --- /dev/null +++ b/data/apps/simulation/trading_simulator.example.cfg @@ -0,0 +1,112 @@ + +{ + "simulation": { + "market_simulator": { + "initial_positions": { + "exchange": "COINBASE", + "assets": { + "BTC": 0.1, + "ETH": 5.0, + "USD": 10000.0 + } + }, + "market_data": { + "sources": [ + { + "loader_class": "cvttpy_trading.trading.mkt_data.time_series.loaders.sqlite_loader.SqliteMdLoader", + "file_name": "/path/to/market_data.db", + "table_name": "md_trades", + "columns": [ + "tstamp", + "tstamp_ns as tm", + "tstamp_ns as local_time_ns", + "exchange_id", + "instrument_id", + "px as price", + "qty as quantity", + "trade_id", + "condition as aggressor_side", + "condition as taker_side" + ], + "time_column": "tstamp", + "exchange_id": "COINBASE", + "instruments": [ + "PAIR-BTC-USD" + ], + "md_type": "TRADES" + }, + { + "loader_class": "cvttpy_trading.trading.mkt_data.time_series.loaders.sqlite_loader.SqliteMdLoader", + "file_name": "/path/to/market_data.db", + "table_name": "md_booktops", + "columns": [ + "tstamp", + "tstamp_ns as tm", + "tstamp_ns as local_time_ns", + "exchange_id", + "instrument_id", + "bid_price", + "bid_quantity", + "ask_price", + "ask_quantity" + ], + "time_column": "tstamp", + "exchange_id": "COINBASE", + "instruments": [ + "PAIR-BTC-USD" + ], + "md_type": "BOOK_TOP" + } + ], + "api": { + "web_socket": { + "url": "ws://localhost:28080/ws" + } + } + }, + "order_entry": { + "execution": { + "execute_on": [ + "BOOK_TOP", + "TRADES" + ], + "top_only": true, + "pricing_method": "BY_MKT_TRD_PRICE_BY_TRADE", + "min_order_age_sec": 0.1, + "fee_schedule": { + "taker_fee_rate": 0.006, + "maker_fee_rate": 0.004 + } + }, + "api": { + "web_socket": { + "url": "ws://localhost:28081/ws" + }, + "REST": { + "port": 28082, + "base_url": "http://localhost:28082", + "endpoints": { + "new_order": ["POST", "/order"], + "cancel_order": ["POST", "/cancel"], + "cancel_all": ["POST", "/cancel_all"], + "open_orders": ["GET", "/open_orders"], + "order_status": ["GET", "/order_status"] + } + } + } + }, + "accounting": { + "api": { + "REST": { + "port": 28083, + "base_url": "http://localhost:28083", + "endpoints": { + "positions": ["GET", "/positions"], + "trades": ["GET", "/trades"] + } + } + } + } + } + } +}