-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathjsonParser.cpp
More file actions
32 lines (25 loc) · 817 Bytes
/
Copy pathjsonParser.cpp
File metadata and controls
32 lines (25 loc) · 817 Bytes
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
// Backtesting Engine in C++
//
// (c) 2025 Ryan McCaffery | https://mccaffers.com
// This code is licensed under MIT license (see LICENSE.txt for details)
// ---------------------------------------
#include "jsonParser.hpp"
#include "base64.hpp"
#include <iostream>
using json = nlohmann::json;
int JsonParser::parseConfigurationFromBase64(const std::string& input) {
// Ingest parameters
std::string output = Base64::b64decode(input);
// Debug, console print out
std::cout << output;
json j;
try {
j = json::parse(output);
}
catch (json::parse_error& ex) {
std::cerr << "parse error at byte " << ex.byte << std::endl;
}
auto config = j.get<trading_definitions::Configuration>();
std::cout << config.RUN_ID << std::endl;
return 0;
}