Known gaps¶
slick-trader is under active development. This page lists stubs, half-wired paths and sharp
edges found by reading the code at 0.10.0. Each item says what the code does and what that means
for you. Anything not confirmed by reading the exact lines is left out.
Engine and startup¶
wait_for_brokers_ready does not wait¶
TradingEngine::wait_for_brokers_ready
loops on while (!(timed_out = now < end)). The loop leaves after one pass unless the deadline
has already passed, so waiting_time_out never delays anything. It also reads the control queue
record without a null check, so a config with no brokers array dereferences a null pointer.
What it means: configure at least one broker. Do not rely on waiting_time_out to hold startup
until slow brokers have registered.
web_service needs a strategies block¶
The web server is constructed with *strategy_manager_, and the strategy manager is only created
when the config has a strategies key. A web_service block without strategies dereferences a
null pointer. With strategies.enabled false there is no MANUAL strategy, so every
POST /api/orders answers 404.
What it means: keep both blocks in the config, see Configuration.
StrategyManager::shutdown() is never called¶
The engine stops strategies through stop() but never calls shutdown(), so a strategy's
on_shutdown hook does not run.
What it means: release resources in on_stop, not on_shutdown.
initialize() failures are ignored¶
StrategyManager::load_strategies ignores the return value of a strategy's initialize(). A
strategy that refuses to start, such as OrderStacker with a bad config, is still added and its
default subscriptions still go out.
Misleading log line¶
When the plugin folder has no plugins, the warning "No strategy plugins found in" prints the configs folder, not the plugins folder.
Reserved Python and Lua options¶
SLICK_TRADER_ENABLE_PYTHON_STRATEGY and SLICK_TRADER_ENABLE_LUA_STRATEGY only define
SLICK_TRADER_PYTHON_SUPPORT and SLICK_TRADER_LUA_SUPPORT. Nothing reads either macro, so there
is no script-based strategy support.
Debug logging needs a single-config Debug build¶
The DEBUG define, and with it the console log sink, is set only when CMAKE_BUILD_TYPE is
Debug. A Visual Studio or other multi-config build does not set it.
Strategies and risk¶
Plugins load once and run unisolated¶
Strategy binaries are loaded when the engine starts and are never unloaded or rescanned. Only parameters change live. Plugins run in-process on the worker thread with no exception guard around dispatch, so a crash in a plugin takes the engine down. See Writing a strategy.
Several objects are shared across threads without locks¶
The web thread calls StrategyBase::submit_order, get_order, the start and stop helpers and the
RiskManager setters directly, while the strategy worker thread touches the same maps.
PositionTracker, PnLCalculator and RiskManager have no locks, and the comment in
position_tracker.hpp that mentions a position_update_queue describes something that does not
exist. A race has not been reproduced, but the code does not prevent one.
REST start and stop run on_start and on_stop on the web thread, and cancel_all_orders()
there touches maps the worker owns.
What it means: treat dashboard actions during heavy strategy activity as unproven under ThreadSanitizer.
Risk checks have holes¶
- Market orders skip the order-value check, because their price is NaN.
- There is no quantity check, and a modify is not risk-checked.
- The position-limit check ignores open working orders.
max_loss_per_strategyis checked once a second by the strategy manager and measures lifetime loss, not daily loss.close_all_positionsskips risk checks and sends IOC limits 10% through the mark. That rule is wrong for negative prices, and a position restored from the position store has no broker mapping, so it stays open.- A per-instrument entry under
risk_limits.instrumentsdefaults to 1,000,000 and 100,000, not to the strategy's own limits. POST /api/strategies/:id/resumeafter a loss-limit halt re-halts within a second, because the loss check also runs on stopped strategies.PUT /api/strategies/:id/risk, halts and strategy start and stop changes live in memory only.
A rejected modify marks the live order REJECTED¶
StrategyBase::on_order_reject marks the order REJECTED even when the reject answers a modify,
and the web server then drops it from /api/orders. The order may still be resting at the broker.
Example strategy config and comments¶
- A
PUTthat changesinstrumentorbrokeronMarketMakeris not reflected in its subscriptions. Restart the engine for that. - In
NLEVEL_WMIDmodeMarketMaker::on_quotealso sets the fair value and the EMAs. strategies/market_maker.jsonusesBTC/USDon Coinbase, where the product id isBTC-USD, andnlevel_depth20, which is clamped to 10.- The header comments in
market_maker.cppandorder_stacker.cpplistALPACAas a broker, and theon_stopthread comment inorder_stacker.cppis out of date.
PENDING_CANCEL is never set¶
The status exists in the enum, but nothing in the engine assigns it.
Positions and PnL¶
avg_price goes stale after a FIFO close¶
PositionTracker does not recompute avg_price after a fill closes lots, so unrealized and total
PnL are overstated until the position goes flat.
Fills without a fee cost nothing¶
set_fee_structure is only called in tests, and the call in trading_engine.cpp is commented
out. A fill that arrives with no fee is booked at zero cost. IBroker::get_fees and the fee in
the register event are unused, so MarketMaker's taker_fee_rate_ is always 0.
Restarts can book a fill twice¶
The position store drops replayed fills only for brokers that keep a fill journal. No in-tree broker does. Coinbase tracks cumulative fill state in memory, so after a restart a snapshot can book an order's whole cumulative fill again.
Endpoints value positions differently¶
GET /api/positions values a position with no mark against 0 and uses the mid. GET /api/pnl
marks a long at the bid and a short at the ask.
Brokers¶
Hyperliquid order entry cannot connect¶
HyperliquidOrderConnector::private_key_ is read but never assigned. No code reads
HYPERLIQUID_PRIVATE_KEY, although the error message names it. connect() always logs "Private
key not set" and the order worker never starts.
What it means: Hyperliquid is market data only in this release.
Other Hyperliquid gaps¶
register_order_connectorpublishesBrokerId::COINBASEand a 0.005 fee, whileget_feessays 0.0005. Only the log is affected.on_user_fillsetsremaining_quantityto 0, so a partial fill reads asFILLED.abs(fee)turns a maker rebate into a cost.BRACKETorders go out as plain limit orders.- A failed modify or cancel logs an error and publishes no event, so a modified order stays in
PENDING_MODIFY. unsubscriberemoves the instrument from local lists only. The venue subscription stays open.- The register event does not copy
shm_name. - Market data has no reconnect path,
md_connectedstays true after a drop, andsubscribe_all()is never called. - Neither Hyperliquid connector has reconnect or resubscribe logic.
DAYthrows and becomes a reject.
Coinbase gaps¶
unsubscribeunsubscribesLEVEL2andORDER_BOOKtogether.DAYis rejected.GTDis mapped without an end time in the call.- There is no fill journal, so fills in flight at a crash are lost.
- Market-by-order subscriptions are ignored with a warning.
- Futures positions on the user channel are logged only.
- Candle and status handlers are
TODO. - The connectors
memcpy31 bytes from astd::stringinto the instrument name field, which over-reads a name shorter than 31 characters.
Connector keys differ¶
Market-data connectors read shm_name, order connectors read callback_shm_name, and Coinbase
queue_size and control_size each feed two buffers with different defaults. See
Configuration.
Web API and dashboard¶
No authentication¶
Neither REST nor WebSocket checks credentials or the Origin header. The server listens on every
interface, because config_.host is only logged. CORS is * by default and the server ignores
Content-Type, so a page on another site can place orders with a simple cross-site POST.
What it means: bind it to a trusted network or put an authenticating proxy in front. See REST API.
No OPTIONS route¶
There is no handler for OPTIONS, HEAD or PATCH, and a POST to an unknown path gets no
reply. uWebSockets closes the connection, so a browser CORS preflight fails.
POST /api/orders validation¶
- A limit order with no
pricepasses validation, because the checkprice <= 0.0is false for NaN, and it is queued with a null price. quantityis never checked for sign.- Every order is submitted with
post_onlytrue except on CME and ICE. The Hyperliquid connector turns that into ALO whatever the time in force. - The response omits the generated
client_order_id. Read it fromGET /api/orders.
Persistence¶
PUT /api/ladder-configreplaces the in-memory config before it parsesdefault_qty, so a non-numeric value answers 400 but is already stored. It never persists, so the typed default quantity is lost on restart.PUT /api/strategies/:id/configanswers 200 even when persisting finds no file or fails. Only a log line says so.
Smaller points¶
POST /api/strategies/:id/haltandresumedo not check that the strategy exists, andGET /api/pnl/:idreturns zeros for an unknown id.pnl_updateis driven by top-of-book events only. A fill alone sends none.- A stale
TODO: Implement actual strategy controlcomment sits above working code. - The browser policy helper and
scripts/slick-trader-web.batare Windows only. - The ladder hard-codes broker ids 5 and 6 as the CME and ICE grid brokers.
config/config_real.json(untracked) uses keys no code reads. Start fromconfig/config_example.json.