progres
This commit is contained in:
parent
69ee78424a
commit
34306b6eae
349
data/apps/simulation/cvtt_simtest_docker.cfg
Normal file
349
data/apps/simulation/cvtt_simtest_docker.cfg
Normal file
@ -0,0 +1,349 @@
|
||||
@var COORDINATOR_HOST=localhost
|
||||
@var COORDINATOR_REST_PORT=28001
|
||||
@var COORDINATOR_WS_PORT=28002
|
||||
|
||||
@var GLOBAL_CHANNEL_PREFIX=CVTT_MU_SIM
|
||||
|
||||
@var SIM_HOST=localhost
|
||||
@var SIM_DATA_DIR=/home/oleg/develop/simulation/data
|
||||
|
||||
@var SIM_MD_WS_PORT=28080
|
||||
@var SIM_OE_WS_PORT=28081
|
||||
@var SIM_OE_REST_PORT=28082
|
||||
@var SIM_AC_REST_PORT=28083
|
||||
|
||||
|
||||
{
|
||||
# ---------------------------------------
|
||||
"__dummy__": null
|
||||
# ---------------------------------------
|
||||
# Overwriting "exchanges" part in "refdata"
|
||||
# "refdata": @inc=http://@env{CONFIG_SERVICE}/refdata/refdata
|
||||
"refdata": {
|
||||
"assets": @inc=http://@env{CONFIG_SERVICE}/refdata/assets ,
|
||||
"instruments": @inc=http://@env{CONFIG_SERVICE}/refdata/instruments ,
|
||||
"exchange_instruments": @inc=http://@env{CONFIG_SERVICE}/refdata/exchange_instruments ,
|
||||
"dynamic_instrument_exchanges": ["ALPACA"],
|
||||
"exchanges": {
|
||||
"SIM_COINBASE": {
|
||||
"exchange_id": "COINBASE",
|
||||
"name": "Coinbase Advanced Trade (Simulation)",
|
||||
"type": "SPOT",
|
||||
|
||||
"mktdata" : {
|
||||
"class": "cvttpy.exchanges.mkt_simulator.md_client.MktSimMdClientFeed"
|
||||
"api": @pathptr=simulation/market_simulator/market_data/api
|
||||
},
|
||||
"order_entry": {
|
||||
"class": "cvttpy.exchanges.mkt_simulator.oe_client.MarketSimulatorOEClient"
|
||||
"api": @ptrpath=simulation/market_simulator/order_entry/api
|
||||
},
|
||||
"accounting": {
|
||||
"class": "cvttpy.exchanges.mkt_simulator.acct_client.MktSimAccounting"
|
||||
"api": @ptrpath=simulation/market_simulator/accounting/api
|
||||
},
|
||||
},
|
||||
"SIM_ALPACA": {
|
||||
"exchange_id": "ALPACA",
|
||||
"name": "Alpaca Trading",
|
||||
"type": "EQUITY",
|
||||
|
||||
"mktdata" : {
|
||||
"class": "cvttpy.exchanges.mkt_simulator.md_client.MktSimMdClientFeed"
|
||||
"config_key": "simulation/market_simulator/market_data/api"
|
||||
},
|
||||
"order_entry": {
|
||||
"class": "cvttpy.exchanges.mkt_simulator.oe_client.MarketSimulatorOEClient"
|
||||
"config_key": "simulation/market_simulator/order_entry/api"
|
||||
},
|
||||
"accounting": {
|
||||
"class": "cvttpy.exchanges.mkt_simulator.acct_client.MktSimAccounting"
|
||||
"config_key": "simulation/market_simulator/accounting/api"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
"comm": @inc=http://@env{CONFIG_SERVICE}/apps/common/comm ,
|
||||
"algos": @inc=http://@env{CONFIG_SERVICE}/apps/common/algos ,
|
||||
"strategies": @inc=http://@env{CONFIG_SERVICE}/apps/common/strategies ,
|
||||
"risk_strategies": @inc=http://@env{CONFIG_SERVICE}/apps/common/risk_strategies ,
|
||||
|
||||
"comm_settings": "@env{CONFIG_COMM_SETTINGS}",
|
||||
"global_channel_prefix": "${GLOBAL_CHANNEL_PREFIX}",
|
||||
|
||||
"simulation": {
|
||||
# "speed_factor": 1.0,
|
||||
"speed_factor": 0.0
|
||||
, "time_events_interval_ms": 0
|
||||
, "simtime_file": "${SIM_DATA_DIR}/simtime.bin"
|
||||
, "expected_consumers": [
|
||||
"md_gateway",
|
||||
"mkt_gateway_tester"
|
||||
"coordinator",
|
||||
# "oe_gateway",
|
||||
# "acct_gateway",
|
||||
# "quant",
|
||||
# "trader",
|
||||
# "bookkeeper",
|
||||
# "risk_manager",
|
||||
# "pricer"
|
||||
]
|
||||
, "consumer_timeout_sec": 30.0
|
||||
|
||||
, "market_simulator" : {
|
||||
"initial_positions": {
|
||||
"exchange": "COINBASE",
|
||||
"assets": {
|
||||
"BTC": 0.5
|
||||
, "ETH": 0.0
|
||||
, "USD": 10_000.0
|
||||
}
|
||||
}
|
||||
, "market_data": {
|
||||
"sources": [
|
||||
{
|
||||
"loader_class": "cvttpy.trading.mkt_data.time_series.loaders.sqlite_loader.SqliteMdLoader"
|
||||
, "file_name": "${SIM_DATA_DIR}/20250422.CNBS.BTC_USD.db"
|
||||
, "table_name": "md_trades"
|
||||
, "columns": [
|
||||
"tstamp"
|
||||
, "tstamp_ns as tm" # must have tm for DataFrame
|
||||
, "tstamp_ns as local_time_ns" # must have for simrunner
|
||||
, "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.mkt_data.time_series.loaders.tsdb_loader.TimescaleTSLoader"
|
||||
# , "credentials_key": "TSDB_MD_CVTTDATA_RO"
|
||||
# , "interval": ${INTERVAL}
|
||||
# , "from_time": ${FROM_TIME} #"2024-10-03 09:00:00"
|
||||
# , "exchange_id": "COINBASE"
|
||||
# , "instruments": ["PAIR-BTC-USD"]
|
||||
# , "md_type": "BOOK_TOP"
|
||||
# , "table_name": "coinbase.md_booktops"
|
||||
# , "columns": [
|
||||
# "time",
|
||||
# "local_time_ns",
|
||||
# "exchange_id",
|
||||
# "instrument_id",
|
||||
# "bid_price",
|
||||
# "bid_quantity",
|
||||
# "ask_price",
|
||||
# "ask_quantity",
|
||||
# "'BT' as type",
|
||||
# ]
|
||||
# , "time_column": "time"
|
||||
# }
|
||||
]
|
||||
, "api": {
|
||||
"web_socket": {
|
||||
"url": "ws://${SIM_HOST}:${SIM_MD_WS_PORT}/ws"
|
||||
}
|
||||
}
|
||||
}
|
||||
, "order_entry": {
|
||||
"execution": {
|
||||
"execute_on": ["BOOK_TOP", "TRADES"]
|
||||
"top_only": true
|
||||
,"min_order_age_sec": 0.1
|
||||
, "pricing_method": "BY_MKT_TRD_PRICE_BY_TRADE"
|
||||
|
||||
, "short_sale_allowed": false
|
||||
, "fee_schedule": {
|
||||
"taker_fee_rate": 0.006
|
||||
"maker_fee_rate": 0.004
|
||||
}
|
||||
# , "presubscribe_md_types": ["BOOK_TOP", "TRADES"]
|
||||
}
|
||||
, "api": {
|
||||
"web_socket": {
|
||||
"url": "ws://${SIM_HOST}:${SIM_OE_WS_PORT}/ws"
|
||||
}
|
||||
, "REST": {
|
||||
"port": ${SIM_OE_REST_PORT},
|
||||
"base_url": "http://${SIM_HOST}:${SIM_OE_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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
, "accounting": {
|
||||
"api": {
|
||||
"REST": {
|
||||
"port": ${SIM_AC_REST_PORT},
|
||||
"base_url": "http://${SIM_HOST}:${SIM_AC_REST_PORT}",
|
||||
"endpoints": {
|
||||
"positions": ["GET", "/positions"]
|
||||
"trades": ["GET", "/trades"]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
, "external_participants": [
|
||||
{
|
||||
"class": "cvttpy.apps.trading_simulator.participants.external_strategy.ExternalStrategySim"
|
||||
"params": {
|
||||
"reader": {
|
||||
"source": "file://${SIM_DATA_DIR}/trading_instructions.json"
|
||||
}
|
||||
"listener": {
|
||||
"book_id": "TESTBK_COINBS_01",
|
||||
"strategy_id": "DUMMY_STRATEGY"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
, "coordinator": {
|
||||
"api": {
|
||||
"REST": {
|
||||
"port": ${COORDINATOR_REST_PORT},
|
||||
"base_url": ["POST", "http://${COORDINATOR_HOST}:${COORDINATOR_REST_PORT}"],
|
||||
}
|
||||
, "WS": {
|
||||
"url": "ws://${COORDINATOR_HOST}:${COORDINATOR_WS_PORT}/ws"
|
||||
}
|
||||
}
|
||||
}
|
||||
, "market_data_gateway": {
|
||||
"exchanges_settings": {
|
||||
"*": {
|
||||
"mkt_data": {
|
||||
"enabled": true
|
||||
, "streaming": true
|
||||
},
|
||||
"order_entry": {
|
||||
"enabled": false
|
||||
, "streaming": false
|
||||
},
|
||||
"accounting": {
|
||||
"enabled": false
|
||||
, "streaming": false
|
||||
},
|
||||
},
|
||||
}
|
||||
, "channel_prefix": "${GLOBAL_CHANNEL_PREFIX}.MD_GW"
|
||||
, "app_status_channel": "${GLOBAL_CHANNEL_PREFIX}.MD_GW_APP_STATUS"
|
||||
, "exchanges": [
|
||||
"SIM_COINBASE"
|
||||
],
|
||||
"presubscribe": [
|
||||
"COINBASE:PAIR-BTC-USD"
|
||||
]
|
||||
}
|
||||
, "order_entry_gateway": {
|
||||
"exchanges_settings": {
|
||||
"ALPACA_SNDBX": {
|
||||
"mkt_data": {
|
||||
"enabled": false
|
||||
, "streaming": false
|
||||
},
|
||||
"order_entry": {
|
||||
"enabled": true
|
||||
, "streaming": true
|
||||
},
|
||||
"accounting": {
|
||||
"enabled": false
|
||||
, "streaming": false
|
||||
}
|
||||
, "credentials_key": {
|
||||
"read_only": "ALPACA_SANDBOX"
|
||||
, "trade": "ALPACA_SANDBOX"
|
||||
}
|
||||
}
|
||||
}
|
||||
, "channel_prefix": "${GLOBAL_CHANNEL_PREFIX}.OE_GW"
|
||||
, "app_status_channel": "${GLOBAL_CHANNEL_PREFIX}.OE_GW_APP_STATUS"
|
||||
, "exchanges": [
|
||||
"SIM_COINBASE"
|
||||
]
|
||||
}
|
||||
, "accounting_gateway": {
|
||||
"exchanges_settings": {
|
||||
"ALPACA_SNDBX": {
|
||||
"mkt_data": {
|
||||
"enabled": false
|
||||
, "streaming": false
|
||||
},
|
||||
"order_entry": {
|
||||
"enabled": false
|
||||
, "streaming": false
|
||||
},
|
||||
"accounting": {
|
||||
"enabled": true
|
||||
, "streaming": false
|
||||
}
|
||||
, "credentials_key": {
|
||||
"read_only": "ALPACA_SANDBOX"
|
||||
, "trade": "ALPACA_SANDBOX"
|
||||
}
|
||||
},
|
||||
"COINBASE_AT": {
|
||||
"mkt_data": {
|
||||
"enabled": false
|
||||
, "streaming": false
|
||||
},
|
||||
"order_entry": {
|
||||
"enabled": false
|
||||
, "streaming": false
|
||||
},
|
||||
"accounting": {
|
||||
"enabled": true
|
||||
, "streaming": false
|
||||
}
|
||||
, "credentials_key": {
|
||||
"read_only": "COINBASE_ADV_RO"
|
||||
}
|
||||
}
|
||||
}
|
||||
, "channel_prefix": "${GLOBAL_CHANNEL_PREFIX}.ACCT_GW"
|
||||
, "app_status_channel": "${GLOBAL_CHANNEL_PREFIX}.ACCT_GW_APP_STATUS"
|
||||
, "exchanges": [
|
||||
"SIM_COINBASE"
|
||||
]
|
||||
}
|
||||
, "quant": {
|
||||
"channel_prefix": "${GLOBAL_CHANNEL_PREFIX}.QUANT"
|
||||
, "app_status_channel": "${GLOBAL_CHANNEL_PREFIX}.QUANT_MUSVC_STATUS"
|
||||
}
|
||||
, "trader": {
|
||||
"channel_prefix": "${GLOBAL_CHANNEL_PREFIX}.TRADER"
|
||||
, "app_status_channel": "${GLOBAL_CHANNEL_PREFIX}.TRADER_MUSVC_STATUS"
|
||||
}
|
||||
, "bookkeeper": {
|
||||
"channel_prefix": "${GLOBAL_CHANNEL_PREFIX}.BKPR"
|
||||
, "app_status_channel": "${GLOBAL_CHANNEL_PREFIX}.BKPR_MUSVC_STATUS"
|
||||
, "db": {
|
||||
"server_type": "timescale",
|
||||
"cred_key": "TSDB_TRADING_CVTT_TESTDB"
|
||||
}
|
||||
}
|
||||
, "risk_manager": {
|
||||
"channel_prefix": "${GLOBAL_CHANNEL_PREFIX}.RMGR"
|
||||
, "app_status_channel": "${GLOBAL_CHANNEL_PREFIX}.RMGR_MUSVC_STATUS"
|
||||
, "revalue_interval_sec": 10.5
|
||||
}
|
||||
, "pricer": {
|
||||
"channel_prefix": "${GLOBAL_CHANNEL_PREFIX}.PXER"
|
||||
, "app_status_channel": "${GLOBAL_CHANNEL_PREFIX}.PXER_MUSVC_STATUS"
|
||||
}
|
||||
}
|
||||
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
||||
services:
|
||||
config_service:
|
||||
image: cloud21.cvtt.vpn:5500/config_service:latest
|
||||
container_name: cvtt_config_service
|
||||
user: 1001:1001
|
||||
restart: always
|
||||
#network_mode: host
|
||||
volumes:
|
||||
- /works/repos/config_service/data:/app/data
|
||||
- /works/logs:/logs
|
||||
ports:
|
||||
- 6789:6789
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user