Commit Graph

9 Commits

Author SHA1 Message Date
nicolas d569063c75 fix: register reconnected WS socket in epoll, arm ping timer after connect
- events.c: EPOLL_CTL_MOD failure falls through to EPOLL_CTL_ADD (handles
  stale fd reuse after close)
- events.c: defer timer_fd registration until ping_interval_ms is known
  (hot thread starts before WS connection is established)
- events.h: replace unused next_ping_ms with ping_timer_armed flag
- main.c: remove stale epoll entry before WS reconnect, re-register new
  socket with O_NONBLOCK
- evaluate.c: fix order_param assignment — only overwrite with fills[leg][4]
  on buy legs (leg 0) and non-leg-0 entries; sell leg 0 preserves
  original quote_volume
2026-06-02 09:42:13 -03:00
nicolas 2c8cfc74b5 cleanup: remove dead config fields (executor_socket_path, cooldown_seconds, stats_interval_seconds), add concurrent_slots to example 2026-05-29 10:31:49 -03:00
nicolas 405fc557dc remove fee table path: fee rate now computed solely from formula fee_category * 0.001 * taker_fee_coeff 2026-05-29 09:49:37 -03:00
nicolas b714ac132e perf: replace SPSC signal queue with per-executor atomic slot delivery 2026-05-28 22:15:59 -03:00
nicolas 174b7570fa feat: concurrent executor slots; fix: fundsIncrement for market buys, remove double-counted leg0 fee hold
- Add concurrent_slots config (fused_engine section, default 1)
- Create executor_shared_t with shared in_flight table + queue mutex for multi-thread
- Move in_flight state from executor_thread_t to executor_shared_t (cross-thread isolation)
- event_executor_thread: per-thread entry point, N threads created in main.c
- Add fundsIncrement to trading_pair_t, triangle_t, signal_leg_t (fetch from KuCoin API)
- Use funds_increment for rounding market buy quote_cost (evaluate.c) and increment floor (executor.c)
- Fix leg 0: remove double-counted apply_fee_hold (evaluate already accounts via ff)
2026-05-27 13:18:53 -03:00
nicolas 562fddf124 cleanup: remove Python executor, dead config/HTTP server; add balance wait; fix fee hold, PnL, warnings
- Remove executor/ and common/ Python directories (dead code after C migration)
- Remove src/http_server.c/.h (was for Python executor, generates warnings)
- Remove dead config keys: socket_path, executor_socket_path, send_signals, rest_host, rest_port
- Remove dead UDS code in events.c/h (send_signal_to_executor, unix_* functions)
- Fix fee hold on leg 0 buys (apply_fee_hold to prevent Balance insufficient)
- Fix PnL leg0_in to use fills[0][4] instead of wrong currency field
- Fix REST keepalive warmup currency (use initial_capital[0] instead of hardcoded USDT)
- Add balance wait between legs via /account/balance WS + eventfd wake
- Fix all strncpy truncation warnings in config.c, symbols_api.c, ws_client.c
2026-05-27 12:14:10 -03:00
nicolas 46084de4b2 fix: keepalive, connection health check, log file, single-line reports, timings fix
- Move REST keepalive to poll loop (async, not blocking signal execution)
- Fix ensure_connected to detect RST connections (recv < 0, not just == 0)
- Add log_set_file() + log file /tmp/engine.log (background thread writes)
- Single-line FILLED/FAILED reports (no multi-line fills inside brackets)
- Fix timing clock (use CLOCK_REALTIME consistently, not mixing with MONOTONIC)
- Add ORDER/FILL/REJECTED intermediate output lines
- Add session warmup at executor_thread_create
- Fix FILL latency (use order-fire time, not signal-received time)
- Paper mode: add clientOid to test endpoint, fix fee simulation
- Concurrency: add primary_quote isolation
2026-05-27 00:15:08 -03:00
nicolas c1c4aa4be8 docs: add docstrings to ~50 undocumented functions across C source files 2026-05-24 23:32:33 -03:00
nicolas 2a82086683 Add initial triangular arbitrage bot
Two-process architecture: a C17 fused engine (WebSocket order book
mirror, triangle enumeration, real-time profitability evaluation)
communicating via Unix domain socket to a Python 3 executor (order
placement with paper/live trading modes, REST control API).
Targets KuCoin spot market.
2026-05-24 16:12:04 -03:00