Skip to main content

edenalpha

Write trading strategies in Python. Run them against the EdenAlpha engine — the same engine, fills, charges, and risk controls behind every EdenAlpha backtest, paper deployment, and live deployment. This SDK's client and CLI currently expose hosted backtesting; deployment happens in the web app.

# my_strategy.py
from edenalpha import strategy, Feature

@strategy(features=[Feature(name="rsi", period=14)])
def decide(ctx):
    if ctx.position.is_open and ctx.features["rsi_14"] > 55:
        return "EXIT"
    if not ctx.position.is_open and ctx.features["rsi_14"] < 30:
        return "BUY"
    return "HOLD"
pip install edenalpha
edenalpha login                       # paste an API key from Settings -> API keys
edenalpha backtest my_strategy.py \
    --symbol RELIANCE --timeframe 15m \
    --start 2026-06-01 --end 2026-07-01

How it works

Your function is the agent; EdenAlpha is the world. On every bar close the engine hands you a Ctx — the bar, your declared indicators (computed server-side, identical to the web rule builder), your position, your cash, and the available bar history — and you answer BUY, SELL (opens a short), EXIT, or HOLD. Hosted backtests expose the full run through the current bar; paper deployments expose a rolling window from deployment time. Fills, charges, sizing, stop-losses, and square-off stay in the engine, so a backtest here is directly comparable to every other EdenAlpha run. The same strategy contract powers paper deployments in the EdenAlpha web app (currently operator-gated); this package's client and CLI expose hosted backtesting.

  • Sizing is server-owned. You return direction; quantity comes from the run's sizing configuration. A strategy that can't over-size in a backtest can't over-size live.
  • Broker-agnostic. Nothing in this contract names a broker; execution routing happens server-side behind your deployment settings.
  • Typed everywhere. Ctx, Bar, Position, Decision are Pydantic models with full annotations (py.typed shipped) — your IDE's autocomplete is the API reference.
  • Unit-testable. @strategy returns a callable: build a fake Ctx and assert on the returned Decision in plain pytest, no network involved.

Python API

import edenalpha

client = edenalpha.Client()          # auth: EDENALPHA_API_KEY or `edenalpha login`
outcome = client.backtest(
    "my_strategy.py",
    symbol="RELIANCE", timeframe="15m",
    start="2026-06-01", end="2026-07-01",
)
print(outcome.summary.net_return_pct)
for trade in outcome.trades:
    print(trade["entry_time"], trade["net_pnl"])

Errors are typed (AuthenticationError, ScopeError, InsufficientCreditsError, RateLimitError, StrategyError) and retriable statuses (429/5xx) are retried with backoff automatically.

Hosted execution

client.backtest(...) runs your file on EdenAlpha compute next to the data (requires the backtest:hosted scope). Hosted strategies are single self-contained files with an import allowlist (numpy, pandas, and the computation-flavored stdlib). Inside hosted compute, auth is ambient — the runner injects the session; your code never handles keys.

Declared features

Any indicator from the EdenAlpha catalog (the same one behind the web rule builder — Strategies → Reference lists all ~57):

Feature(name="rsi", period=14)                      # ctx.features["rsi_14"]
Feature(name="vwap")                                # ctx.features["vwap"]
Feature(name="sma", period=50, alias="slow_ma")     # ctx.features["slow_ma"]
Feature(name="macd", params={"fast": 12, "slow": 26, "signal": 9},
        outputs={"line": "macd", "signal": "macd_sig", "histogram": "macd_hist"})

Raw OHLCV (open, high, low, close, volume) is always present in ctx.features. Prefer declared features over hand-rolled ones — they're computed by the exact code that will feed your strategy in paper/live, so train/serve skew can't happen.

Requirements & license

Python 3.10+. MIT licensed — the SDK is open; the EdenAlpha engine and platform are a separate, server-side service.

Metadata

Release files for edenalpha 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for edenalpha 0.1.0
File Size Uploaded Provenance Actions
edenalpha-0.1.0.tar.gz 12.5 kB With provenance Details for edenalpha-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for edenalpha 0.1.0
File Interpreter ABI Platform Actions
edenalpha-0.1.0-py3-none-any.whl Python 3 none any Details for edenalpha-0.1.0-py3-none-any.whl

Total release size: 28.9 kB

Release files / edenalpha-0.1.0.tar.gz

Download URL edenalpha-0.1.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cfed9efe5bea227cb5a2fd2026b88d6a51b782d1bda314a058c41478ec1e9150
BLAKE2b-256 checksum
How to use checksums
3ab1a97bc86514d0a0be418f39031dbd51314329f3ec6810e3ac22c184fc84ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Release files / edenalpha-0.1.0-py3-none-any.whl

Download URL edenalpha-0.1.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b6797f408ba1992d98faae46cc2efe0a2053ea8e94a7bd7d33b866760ed94c8
BLAKE2b-256 checksum
How to use checksums
a26e1a6885bf431e73de39f5d4f6172016df6f8c1f015839a713ce251591dbdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Security for edenalpha 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for edenalpha-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page