@@ -14,50 +14,22 @@ module;
1414#include " shared/utilities/env.hpp"
1515#include " shared/utilities/parameterSweep.hpp"
1616#include " shared/utilities/queueKeys.hpp"
17- #include " shared/redis/redisLoader.hpp"
18- #include " shared/tradingDefinitions/runConfiguration.hpp" // RunConfiguration (json conversion)
19- #include " shared/tradingDefinitions/strategy.hpp"
17+ #include " shared/redis/producer/ redisLoader.hpp"
18+ #include " shared/tradingDefinitions/config/ runConfiguration.hpp" // RunConfiguration -> json
19+ #include " shared/tradingDefinitions/strategy.hpp" // Strategy -> json (makeStrategy result)
2020
2121export module loadCommand;
2222
2323import std; // replaces <print>, <ranges>, <string>, <vector>
2424import randomStrategySweep; // buildRandomStrategySweep
2525import runConfigurationBuilder; // makeRunConfiguration
26+ import makeStrategy; // sweep::makeStrategy
2627
2728export class LoadCommand {
2829public:
2930 static int run ();
3031};
3132
32- using tradingDefinitions::Strategy;
33-
34- Strategy makeStrategy (const sweep::Combination& combo) {
35- using namespace tradingDefinitions ;
36-
37- return Strategy{
38- // Each parameter combination gets its own UUID so a single backtest
39- // result is uniquely identifiable and traceable back to its inputs.
40- .UUID = boost::uuids::to_string (boost::uuids::random_generator ()()),
41- .TRADING_VARIABLES = TradingVariables{
42- .STRATEGY = " RandomStrategy" ,
43- .STOP_DISTANCE_IN_PIPS = combo.getInt (" STOP_DISTANCE_IN_PIPS" ),
44- .LIMIT_DISTANCE_IN_PIPS = combo.getInt (" LIMIT_DISTANCE_IN_PIPS" ),
45- .TRADING_SIZE = 1 ,
46- },
47- .OHLC_VARIABLES = {
48- OHLCVariables{
49- // Only read OHLC params when the sweep actually registers them;
50- // they default to 0 otherwise (see buildRandomStrategySweep).
51- .OHLC_COUNT = combo.has (" OHLC_COUNT" ) ? combo.getInt (" OHLC_COUNT" ) : 0 ,
52- .OHLC_MINUTES = combo.has (" OHLC_MINUTES" ) ? combo.getInt (" OHLC_MINUTES" ) : 0 ,
53- },
54- },
55- .STRATEGY_VARIABLES = StrategyVariables{
56- .OHLC_RSI_VARIABLES = OHLCRSIVariables{.RSI_LONG = 60 , .RSI_SHORT = 40 },
57- },
58- };
59- }
60-
6133int LoadCommand::run () {
6234
6335 // One RUN_ID identifies the whole sweep; each combination becomes its own
@@ -79,7 +51,7 @@ int LoadCommand::run() {
7951 const auto strategyPayloads = combinations
8052 | std::views::transform ([](const sweep::Combination& combo) {
8153 // Pin to JSON explicitly to trigger implicit Strategy conversion
82- const nlohmann::json j = makeStrategy (combo);
54+ const nlohmann::json j = sweep:: makeStrategy (combo);
8355 return j.dump ();
8456 })
8557 | std::ranges::to<std::vector>();
0 commit comments