Multi-Strategy Setup
fyers-store supports multiple brokers per Store so strategies can share adapters while keeping order routing isolated.
Recommended Pattern
- One Store instance.
- One Broker per strategy.
- Store routes order WS updates by order id ownership.
store = FyersStore(rest_adapter=rest, market_ws_adapter=data_ws, order_ws_adapter=order_ws)
broker_a = FyersBroker(store=store)
broker_b = FyersBroker(store=store)
What NOT To Do
- Do not share a Broker between strategies.
- Do not bypass Store routing by draining the WS queue manually unless you own routing.
Failure Handling
If two brokers claim the same order id, the Store raises an error to prevent cross-strategy leakage.
Scenario Example
Scenario: Strategy A receives updates for Strategy B. - This usually means order id ownership was not registered. - Ensure broker.submit_order_intent or broker.buy/sell is used so ownership is recorded.