Skip to main content

Strategy Development Requirements

This guide covers critical implementation requirements when developing strategies for the Almanak platform. These are not merely suggestions or best practices - they are necessary for your strategies to function correctly on the platform.

Imports and Project Structure

Relative Imports

When building strategy files, you must use relative imports to refer to files within your strategy folder. This is required for proper packaging and deployment of your strategy to the platform.

Example

If your strategy has the following structure:

my_strategy/
├── strategy.py
├── utils.py
└── models/
└── data_model.py

In strategy.py, you would import from utils.py and models/data_model.py like this:

# Importing from a file in the same directory
from .utils import helper_function

# Importing from a subdirectory
from .models.data_model import DataModel

Without using relative imports, your strategy will not work correctly when deployed to the Almanak platform.

Environment Variables

When configuring environment variables for your strategy deployment, adhere to these strict requirements:

Reserved Prefixes

Do not use variables that start with ALMANAK_ prefix. This naming convention is reserved for internal platform use. Using this prefix will cause conflicts with the platform's own variables and lead to deployment failures.

# ❌ Don't use - will cause deployment failures
ALMANAK_MY_VAR = "value" # This will conflict with platform variables

# ✅ Do use
MY_STRATEGY_VAR = "value" # This follows platform requirements
APP_SECRET_KEY = "secret" # This is also acceptable