triangular_arbitrage_bot/src/config.h

61 lines
3.1 KiB
C

#ifndef FUSED_CONFIG_H
#define FUSED_CONFIG_H
#include <stdint.h>
#include <stdbool.h>
#include "book.h"
#define MAX_SYMBOLS 2048
#define MAX_HOLD_CURRENCIES 16
#define MAX_EXCLUDED_CURRENCIES 64
#define MAX_CAPITAL_ENTRIES 16
typedef struct {
char currency[CURRENCY_NAME_LEN]; /* currency ticker */
double amount; /* max capital allocation */
} capital_entry_t;
/* Top-level application configuration parsed from config.yaml */
typedef struct {
/* fh_ob section */
char symbols[MAX_SYMBOLS][SYMBOL_NAME_LEN]; /* subscribed trading symbol names */
uint32_t symbol_count; /* number of symbols in the list */
char log_level[8]; /* log verbosity level string */
char socket_path[256]; /* unix socket path for inter-process comm */
char rest_host[64]; /* KuCoin REST API hostname */
int rest_port; /* KuCoin REST API port */
char ws_url[256]; /* KuCoin WebSocket base URL */
char token_url[256]; /* KuCoin token endpoint URL */
double reconnect_base_delay; /* initial WebSocket reconnect delay (seconds) */
double reconnect_max_delay; /* max WebSocket reconnect delay (seconds) */
double heartbeat_interval; /* WebSocket ping interval (seconds) */
/* oe_em section */
double signal_threshold_bps; /* min predicted bps to fire a signal */
char hold_currencies[MAX_HOLD_CURRENCIES][CURRENCY_NAME_LEN]; /* currencies to hold between legs */
uint32_t hold_currency_count; /* number of hold currencies */
char excluded_currencies[MAX_EXCLUDED_CURRENCIES][CURRENCY_NAME_LEN]; /* currencies to skip */
uint32_t excluded_currency_count; /* number of excluded currencies */
bool kcs_discount_active; /* whether KCS fee discount applies */
char executor_socket_path[256]; /* unix socket path for signal executor */
bool send_signals; /* whether to actually emit signals */
double cooldown_seconds; /* min seconds between signals for same triangle */
double stats_interval_seconds; /* period between stats log dumps */
bool live_mode; /* live trading vs paper/simulation */
/* Capital allocation limits — each entry maps a currency ticker to a max
* quote amount the fused engine may deploy for any one triangle signal. */
capital_entry_t initial_capital[MAX_CAPITAL_ENTRIES];
uint32_t initial_capital_count;
/* KuCoin API credentials (top-level keys in config.yaml) */
char kucoin_api_key[64]; /* KuCoin API key */
char kucoin_api_secret[128]; /* KuCoin API secret */
char kucoin_api_passphrase[64]; /* KuCoin API passphrase */
} config_t;
/* Load and parse YAML config file into config_t */
int config_load(const char *path, config_t *cfg);
#endif