forge.strategy

Forge API 1

The strategy file: ``class MyStrategy(fg.Strategy)``, its settings and its checks.

A strategy file holds one class that subclasses ``fg.Strategy`` and sets ``FORGE_API = 1``. Its settings are declared with ``fg.param``; the optional hooks (``setup``, ``compute``, ``on_bar`` and the others listed in the reference) are plain methods. Nothing in this module needs the engine: a strategy imports only ``forge``.

NameKindSummary
InvalidParamsexceptionRaise it in setup(self, ctx) to reject this combination of settings.
MetaclassWhat a strategy is called and how it is found: a title, a short code, an author and tags.
RequiresclassThe account behaviour a strategy needs: ``account = fg.Requires(hedging=True)``.
StrategyclassOne strategy class per file, with ``FORGE_API = 1`` at the top of the file.
RequirementFailedexceptionA condition the strategy requires was false.
requirefunctionStop the run with ``message`` unless ``condition`` is true.