4#include <nlohmann/json.hpp>
6#include <unordered_map>
33 }
catch (
const std::exception&) {
45 config.
name = j.value(
"name",
"");
46 config.
enabled = j.value(
"enabled",
true);
49 if (j.contains(
"risk_limits")) {
50 const auto& rl = j[
"risk_limits"];
52 if (rl.contains(
"max_position_size")) {
56 if (rl.contains(
"max_order_value")) {
60 if (rl.contains(
"max_orders_per_second")) {
64 if (rl.contains(
"max_loss_per_strategy")) {
69 if (rl.contains(
"instruments") && rl[
"instruments"].is_object()) {
70 for (
const auto& [instrument, inst_limits] : rl[
"instruments"].items()) {
73 if (inst_limits.contains(
"max_position_size")) {
77 if (inst_limits.contains(
"max_order_value")) {
87 if (j.contains(
"parameters") && j[
"parameters"].is_object()) {
price_t to_price_t(double value)
qty_t to_qty_t(double value)
uint32_t max_orders_per_second
price_t max_loss_per_strategy
std::unordered_map< std::string, InstrumentRiskLimits > instrument_limits
static StrategyConfig from_json(const nlohmann::json &j)
nlohmann::json parameters
T get_parameter(const std::string &key, const T &default_value) const