跳到主要内容

Safety

Three guards designed to keep an off-script command from doing damage. All three are state that lives in the CLI, not the exchange.

GuardScopePersistence
SimulationAll write-ops on every accountPersistent (per CLI install)
FatfingerSingle-order size cap, per symbolPersistent
WhitelistSymbols that survive close longs/shorts/allPersistent

Simulation

Aliases: sim, dry-run.

simulation # show status
simulation on # enable
simulation off # disable
simulation status # same as bare form
sim on
dry-run off

When ON, every write-op (place / cancel / close / move / bump) short-circuits at simulationGate(ctx) before any exchange call. Reads (positions, orders, margin, etc.) are unaffected.

Persisted to ~/.tealstreet/simulation.json. Source: SimulationCommand.ts.

Use simulation when porting a new alias or recipe. Confirm the chain prints the right intent before you flip simulation off.


Fatfinger

A per-symbol cap on individual order size, in contracts. Checked just before placeOrder on:

  • buy, sell
  • scale, swarm
  • chase
  • twap

Reduce-only orders are skipped — closing a position cannot blow it up.

FormEffect
fatfingerList all configured limits
fatfinger <contracts>Set on focused symbol
fatfinger 0.5 BTCUSDTSet on named symbol
unfatfinger <symbol>Remove for one symbol
unfatfinger allRemove every limit

Persisted to ~/.tealstreet/fatfingers.json. Source: FatfingerCommand.ts, TradingBaseCommand.ts:enforceFatfinger.


Whitelist

Symbols you don't want a global "close all" to touch. Applies to:

  • close longs
  • close shorts
  • close allpos / close all

Per-symbol close calls (close BTCUSDT, close long) ignore the whitelist — the guard is only for the global variants.

FormEffect
whitelistList
whitelist BTCUSDTAdd (uppercased before store)
unwhitelist BTCUSDTRemove
unwhitelist allRemove every entry

Persisted to ~/.tealstreet/whitelist.json. Source: WhitelistCommand.ts.


Combining guards

These layer. Simulation short-circuits before fatfinger checks; fatfinger fires before the exchange call.

simulation on
buy 99999 BTCUSDT # blocked by simulation — no fatfinger needed

simulation off
fatfinger 0.5 BTCUSDT
buy $5000000 BTCUSDT # blocked by fatfinger

whitelist BTCUSDT
close longs # touches every long except BTCUSDT