LumiBot Strategy Structure and Safe Broker Data Access
Summary
This overview explains how LumiBot strategies are organized. User strategies inherit from a common Strategy class, whose methods cover the bot lifecycle, strategy helpers, broker interactions, and market data access. It points readers to a copy-and-run example and a fuller class reference for method details.
The document also describes a startup choice for short-lived, read-only integrations. Normal live strategies synchronize balances and positions at construction; a read-only client can skip that startup synchronization and explicitly request fresh broker data before relying on it. This is a practical guide to the access pattern, not a trading strategy or performance analysis. It gives no backtest evidence, and detailed behavior for individual methods is left to the linked API reference.
Key ideas
- LumiBot user strategies inherit from the shared Strategy class.
- Strategy methods cover lifecycle events, helpers, broker access, and market data.
- Read-only clients can skip startup synchronization when they explicitly refresh the broker data they need.
- The overview directs readers to an example and a complete class reference for implementation details.
Tags
Full text
# lumibot.strategies
:orphan:
Strategies
==========================
.. meta::
:description: All user defined strategies should inherit from the Strategy class. LumiBot documentation.
All user defined strategies should inherit from the Strategy class.
from strategies import Strategy
.. code-block:: python
class MyStrategy(Strategy):
pass
The abstract class Strategy has global parameters with default values, and some properties that can be used as helpers to build trading logic.
Short-lived read-only clients
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Normal live strategies synchronize balances and positions during construction. This is the safe default before trading. A short-lived read-only integration that explicitly refreshes only its requested broker data can pass ``synchronize_broker_on_start=False`` to avoid unrelated startup API calls. Such clients must call a fresh broker-backed accessor, such as ``get_positions()``, ``get_orders()``, or ``update_broker_balances(force_update=True)``, before using that state.
The methods of this class can be split into several categories:
**Lifecycle Methods** These are executed at different times during the execution of the bot. These represent the main flow of a strategy, some are mandatory.
**Strategy Methods** These are strategy helper methods.
**Broker Methods** How to interact with the broker (buy, sell, get positions, etc)
**Data Methods** How to get price data easily
All the methods in each of these categories are described below.
Start with :doc:`strategy_api_overview` for a copy-and-run example and the
small set of methods used in most strategies. The generated class reference
below remains the complete source-level API.
Documentation
"""""""""""""""""""
.. automodule:: lumibot.strategies.strategy.Strategy
:members:
:undoc-members:
:show-inheritance:Shown in full with attribution under the source's licence. Licence: GPL-3.0
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.