Algorithm connections are going to be configured on AlgorithmConnectorConfiguration
- MarketDataProvider : receive depth and trades . listen(TypeMessage.depth, TypeMessage.trade, TypeMessage.command)
- TradingEngineConnector: send request and listen to execution reports listen(TypeMessage.execution_report, TypeMessage.info)
Every algorithm in this repo must be created in java implementing the java abstract class Algorithm.java
Depth and trades data read from parquet database LAMBDA_DATA_PATH.
{
"backtest": {
"startDate": "20221027 06:00:00",
"endDate": "20221027 22:00:00",
"instrument": "btcusdt_coinbase",
"delayOrderMs": 0,
"feesCommissionsIncluded": true,
"multithreadConfiguration": "singlethread"
},
"algorithm": {
"algorithmName": "AvellanedaStoikov_test",
"parameters": {
"risk_aversion": 0.8,
"windowTick": 15,
"minutesChangeK": 1.0,
"quantity": 0.0001,
"firstHour": 7.0,
"lastHour": 19.0,
"kDefault": -1,
"spreadMultiplier": 1.0,
"positionMultiplier": 1.0,
"spreadCalculation": "Avellaneda",
"kCalculation": "Alridge"
}
}
}
Algorithm is going to be configured on AbstractBacktest afterConstructor with marketDataProvider from
paperTradingEngine.getMarketDataProviderIn()
MarketDataProviderIn refers to the marketDataProvider we are going to configured on the Algorithm
- ParquetMarketDataConnectorPublisher(AbstractMarketDataConnectorPublisher): read the file , sort it and publish on a ConnectorPublisher
- MarketMakerMarketDataExecutionReportListener(MarketDataListener):read the depth and send to PaperTradingEngine
- PaperTradingEngine(AbstractPaperExecutionReportConnectorPublisher):refreshDepth on the MatchEngine
- PaperTradingEngine(AbstractPaperExecutionReportConnectorPublisher):notify depth to MarketDataProviderIn
- Algorithm: onDepth / onTrade
Algorithm is going to be configured on AbstractBacktest afterConstructor with tradingEngine from paperTradingEngine.getPaperTradingEngineConnector()
- Algorithm: tradingEngine.orderRequest
- PaperTradingEngine(TradingEngineConnector): OrderbookManager.orderRequest
- OrderMatchEngine: updates with the orderbook through OrderbookManager
- PaperTradingEngine(ExecutionReportPublisher): notifyExecutionReport
- Algorithm: onExecutionReport(TODO , now onExecutionReport is in MarketDataListener)
{
"marketDataPort": 666,
"tradeEnginePort": 677,
"tradeEngineHost": "localhost",
"marketDataHost": "localhost",
"paperTrading": "False",
"demoTrading": "False",
"instrumentPks": [
"eurusd_darwinex"
],
"algorithm": {
"algorithmName": "DQNRSISideQuoting_eurusd_darwinex",
"parameters": {
"style": "level",
"maxBatchSize": 5000.0,
"batchSize": 128.0,
"learningRateNN": 1.0E-4,
"momentumNesterov": 0.0,
"trainingPredictIterationPeriod": -1.0,
"trainingTargetIterationPeriod": -1.0,
"epoch": 100.0,
"maxTimeWaitingActionResultsMs": 3000.0,
"maxTimeWaitingExitMs": 600000.0,
"scoreEnum": "realized_pnl",
"epsilon": 1.0,
"discountFactor": 0.0,
"learningRate": 1.0,
"seed": 1.675680131E9,
"quantity": 0.1,
"first_hour": 0.0,
"last_hour": 24.0,
"l1": 0.0,
"l2": 0.0,
"periods": [
48.56
],
"upperBounds": [
84.0
],
"upperBoundsExits": [
50.0,
45.0
],
"lowerBounds": [
25.0
],
"lowerBoundsExits": [
56.0,
50.0
],
"changeSides": [
0.0,
1.0
],
"volumeCandles": 6000000.0,
"binaryStateOutputs": 1.0,
"numberDecimalsState": 2.0,
"horizonTicksMarketState": 0.0,
"periodsTAStates": [
3.0,
9.0,
13.0,
21.0,
38.0,
64.0
],
"levelToQuotes": [
1.0,
-1.0
],
"stateColumnsFilter": [],
"otherInstrumentsStates": [
"eurgbp_darwinex",
"gbpusd_darwinex"
],
"otherInstrumentsMsPeriods": [
5000.0,
10000.0,
30000.0
]
}
}
}
Is going to connect to a ZeroMqMarketDataConnector that publish on port 666 on localhost Data is going to be received directly in Algorithm(onDepth / onTrade)
Its going to publish OrderRequest on port 677 on localhost ExecutionReports are received in Algorithm from marketDataPort 666
- ConnectorPublisher : publish data to the listeners
- ConnectorProvider : register/deregister listen to ConnectorPublisher and notify listener
- ConnectorListener : listen to ConnectorProvider
- ConnectorRequester : request data and returns a reply REQ/REP
- OrdinaryConnectorPublisherProvider: ConnectorProvider and ConnectorPublisher is a man in the middle for same process communication. Used in backtest to connect MarketDataConnectorPublisher - MarketMakerDataProvider
- ZeroMqProvider : ConnectorProvider to SUB to a publisher
- ZeroMqPuller: ConnectorProvider to PULL data to a zeroMq
- ZeroMqPublisher : ConnectorPublisher to PUB data to a zeroMq
- ZeroMqPusher: ConnectorPublisher to PUSH data to a zeroMq
- ZeroMqRequester: Implementation of a REQ/REP pattern