Skip to content

DataFeed (Developer Guide)

What It Does

The DataFeed drains market WS queues, normalizes messages into bars, and feeds Backtrader with bounded, non-blocking behavior.

Why It Exists

Backtrader expects a pull-based feed. The DataFeed bridges push-based WS messages into a bounded queue and normalizes data consistently.

Config Dependencies

  • config/data_feed.yaml
  • config/fyers_ws.yaml (indirectly via WS adapters)

With Backtrader

Create FyersData with store, dataname, and resolution. Use historical=True for REST-only runs.

Without Backtrader

Use Store queue drain methods directly; DataFeed is optional.

Limitations

  • Live mode relies on the market WS adapter.
  • SymbolUpdate messages are converted into "minimal bars" for tick-like updates.

Scenario Example

Scenario: A strategy falls behind and data backlog grows. - Reduce market_max_messages and batch size. - Use market_backlog_warn_after to surface the issue.