feat: make balance wait between live legs configurable, default off
This commit is contained in:
parent
2c3796005b
commit
7253d34983
|
|
@ -12,6 +12,7 @@ fused_engine:
|
|||
heartbeat_interval: 18.0
|
||||
cooldown_seconds: 0.0
|
||||
kcs_discount_active: false
|
||||
balance_wait_enabled: false
|
||||
initial_capital:
|
||||
USDT: 5
|
||||
USDC: 5
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ static void handle_value(parse_state_t *st, const char *val) {
|
|||
st->cfg->stats_interval_seconds = atof(val);
|
||||
} else if (strcmp(key, "concurrent_slots") == 0) {
|
||||
st->cfg->concurrent_slots = atoi(val);
|
||||
} else if (strcmp(key, "balance_wait_enabled") == 0) {
|
||||
st->cfg->balance_wait_enabled = (strcmp(val, "true") == 0 || strcmp(val, "yes") == 0);
|
||||
}
|
||||
} else if (strcmp(st->section, "executor") == 0) {
|
||||
return;
|
||||
|
|
@ -127,6 +129,7 @@ int config_load(const char *path, config_t *cfg) {
|
|||
cfg->stats_interval_seconds = 60.0;
|
||||
cfg->concurrent_slots = 1;
|
||||
cfg->live_mode = false;
|
||||
cfg->balance_wait_enabled = false;
|
||||
|
||||
FILE *f = fopen(path, "r");
|
||||
if (!f) {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ typedef struct {
|
|||
double stats_interval_seconds; /* period between stats log dumps */
|
||||
int concurrent_slots; /* number of executor threads (1 = single-threaded) */
|
||||
bool live_mode; /* live trading vs paper/simulation */
|
||||
bool balance_wait_enabled; /* wait for WS balance settlement between legs */
|
||||
|
||||
/* Capital allocation limits — each entry maps a currency ticker to a max
|
||||
* quote amount the fused engine may deploy for any one triangle signal. */
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ void executor_execute_triangle(executor_thread_t *et,
|
|||
fills[leg][3] = total_funds;
|
||||
|
||||
/* ── Balance wait (live only): wait for KuCoin to settle before next leg ── */
|
||||
if (sig->live && leg < 2) {
|
||||
if (sig->live && leg < 2 && et->cfg->balance_wait_enabled) {
|
||||
const char *pair = sl->symbol;
|
||||
const char *dash = strchr(pair, '-');
|
||||
char out_ccy[16] = {0};
|
||||
|
|
|
|||
Loading…
Reference in New Issue