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``.
| Name | Kind | Summary |
|---|---|---|
| InvalidParams | exception | Raise it in setup(self, ctx) to reject this combination of settings. |
| Meta | class | What a strategy is called and how it is found: a title, a short code, an author and tags. |
| Requires | class | The account behaviour a strategy needs: ``account = fg.Requires(hedging=True)``. |
| Strategy | class | One strategy class per file, with ``FORGE_API = 1`` at the top of the file. |
| RequirementFailed | exception | A condition the strategy requires was false. |
| require | function | Stop the run with ``message`` unless ``condition`` is true. |