-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrunCommand.cpp
More file actions
37 lines (30 loc) · 1 KB
/
Copy pathrunCommand.cpp
File metadata and controls
37 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Backtesting Engine in C++
//
// (c) 2026 Ryan McCaffery | https://mccaffers.com
// This code is licensed under MIT license (see LICENSE.txt for details)
// ---------------------------------------
#include "runCommand.hpp"
#include <iostream>
#include <string>
#include "backtestRunner.hpp"
#include "jsonParser.hpp"
#include "redisRunner.hpp"
namespace {
int runBacktestFromBase64(const std::string& questdbHost,
const std::string& base64Config) {
auto config = JsonParser::parseConfigurationFromBase64(base64Config);
return runBacktest(questdbHost, config);
}
} // namespace
int RunCommand::run(int argc, const char* argv[]) {
if (argc < 3) {
std::cerr << "Usage: BacktestingEngine run <questdb-host>\n"
<< " BacktestingEngine run <questdb-host> <base64-config>"
<< std::endl;
return 1;
}
if (argc == 3) {
return RedisRunner::run(argv[2]);
}
return runBacktestFromBase64(argv[2], argv[3]);
}