Skip to content

Safety Rules

These rules are non-negotiable for safe live trading with fyers-store.

Core Rules

  • Never retry place_order automatically. Reconcile first.
  • Always run with FYERS_ENVIRONMENT set explicitly.
  • Keep runtime state DB separate from historical cache DB.
  • Treat AuthError as a hard stop; refresh token and restart.
  • Monitor WS disconnects and reconcile on reconnect.

Safe Defaults

  • environment: PAPER and allow_live_orders: false in config/broker.yaml.
  • WS reconnect backoff enabled with conservative defaults.
  • Cache maintenance optional and disabled by default.

Dangerous Patterns (Avoid)

  • Sharing the same DB path for cache and state.
  • Ignoring reconcile failures or suppressing exceptions.
  • Blind retries after network timeouts on order placement.

Scenario Example

Scenario: A network timeout occurs during order placement. What happens: - Order state is unknown. What to do: - Check Order WS updates and orderbook() before any retry. Why: - FYERS does not support idempotency keys, so retrying can duplicate orders.