Skip to main content

Strategic High-Throughput Symbolic Trading Engine with iterative R2 fitting, FunctionGemma discovery, and Asymmetric Convexity risk management.

Project description

Sagan Trade

High-fidelity symbolic mathematical engine for institutional alpha generation.

Python License: MIT PyPI

Sagan Trade replaces black-box neural networks with transparent, human-readable mathematical equations discovered via FunctionGemma. It combines the precision of Symbolic Regression with the robustness of Asymmetric Convexity risk management.


🏛️ Institutional Benchmarking

Sagan Trade has been rigorously tested across 5 years of historical market regimes, accounting for institutional trading fees and liquidity constraints.

Long-Term Resilience (5-Year Rolling Audit)

Benchmark: 20-Ticker Diversified Portfolio (Tech, Finance, Energy, Consumer).

Metric Gross of Fees Net of Fees (5bps) S&P 500 (B&H)
Annualized Return 33.27% 12.98% 14.50%
Sharpe Ratio 2.11 1.06 0.85
Max Drawdown -6.91% -7.30% -23.90%
Total Cumulative 426.11% 102.46% 96.80%

[!IMPORTANT] Statistical Significance: The symbolic engine achieves a p-value of 0.0182, indicating that its outperformance against legacy TFT-PINN and LSTM models is statistically significant at the 98% confidence level.


🔬 Core Architecture

1. Symbolic Discovery (FunctionGemma & TCN)

Instead of weight matrices, Sagan discovers market invariants in the form of mathematical expressions using an ultra-fast Temporal Convolutional Network (TCN).

  • 30x Faster Inference: Completely replaced legacy LSTMs with dilated causal convolutions, breaking the sequential bottleneck and achieving $O(1)$ hardware-parallel sequences.
  • Precision: Fits variables to $R^2 > 0.95$ using basis functions (Polynomial, Fourier).
  • Explainability: Every trade is backed by a human-readable formula, e.g., (Close * 0.5) + log(Volume).

2. Asymmetric Convexity Engine

Sagan utilizes a non-linear risk management framework inspired by high-frequency market makers:

  • Downside Convexity: Exponentially scales exposure based on momentum-volatility asymmetry.
  • Adaptive Kelly Sizing: Drawdown-aware fractional Kelly scaling to ensure capital preservation.
  • Asymptotic Shield: Quadratic drawdown protection creates a hard floor on portfolio risk.

🚀 Quick Start

Installation

pip install sagan-trade

Alpha Generation & Execution

import sagan
from sagan.portfolio import AsymmetricRiskEngine

# 1. Discover a symbolic formula for a ticker
model_id = sagan.train(["AAPL"], signals=["Close", "RSI", "Volume"])

# 2. Initialize the SOTA Risk Engine
risk_engine = AsymmetricRiskEngine(target_vol=0.15, max_drawdown_limit=0.075)

# 3. Generate Signal & Predictive Formula
result = sagan.predict()
print(f"Signal: {result['signal']}")
print(f"Formula: {result['formula']}")

🛠️ Components

Component Responsibility
SymbolicRegressor High-precision math fitting with iterative $R^2$ optimization.
AsymmetricRiskEngine Rides upside volatility while aggressively cutting downside tail risk.
BacktestEngine Rigorous walk-forward evaluation with fee-modeling support.
SaganConfig OS-level optimization for Turbo/Eco compute profiles.

License

MIT © 2024 Sagan Labs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sagan_trade-0.7.5.tar.gz (100.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sagan_trade-0.7.5-py3-none-any.whl (98.3 kB view details)

Uploaded Python 3

File details

Details for the file sagan_trade-0.7.5.tar.gz.

File metadata

  • Download URL: sagan_trade-0.7.5.tar.gz
  • Upload date:
  • Size: 100.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for sagan_trade-0.7.5.tar.gz
Algorithm Hash digest
SHA256 bff533be674a023345e6684cbce703aee86b20c0697c493d8308cf2fb2ef0e3e
MD5 12a865ec262cd8088a149bd716aeb7a9
BLAKE2b-256 18112d85686c4dd69b1b102483b42ffebd42e7252e994b1d1ccf7d8266b2e007

See more details on using hashes here.

File details

Details for the file sagan_trade-0.7.5-py3-none-any.whl.

File metadata

  • Download URL: sagan_trade-0.7.5-py3-none-any.whl
  • Upload date:
  • Size: 98.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for sagan_trade-0.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 288479c07d97b8d7404f396626035d46e7023396c632899cd4c75449edc4d9f2
MD5 02ab1d33e8e7b35d8d33ff0eb5a51e4a
BLAKE2b-256 6e33649a83de32c824b1f29e2554c4300b9d00d02aae749665854a054d1d67a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page