Skip to main content

A pluggable trading-strategy framework: indicators, market data adapters, backtesting, and a Strategy interface you implement yourself.

Project description

confluence-engine

A pluggable trading-strategy framework for Python: technical indicators, market-data adapters (crypto/forex/idx), a backtester, and a clean Strategy interface you implement yourself. Bring your own signal logic and scoring — the framework stays out of your way.

Install

pip install confluence-engine

Quickstart

from confluence_engine import (
    AdapterConfig, StrategyConfig, BreakoutDemo,
    get_adapter, calculate_indicators, run_backtest,
)

cfg = StrategyConfig()
df = get_adapter("crypto", AdapterConfig(exchange="binance")).fetch_ohlcv("BTC/USDT", "1h", limit=300)
df = calculate_indicators(df, cfg.ema_fast, cfg.ema_slow, cfg.rsi_length)
print(run_backtest(df, BreakoutDemo(), cfg))

Write your own strategy

from confluence_engine import Strategy, Signal, StrategyConfig
import pandas as pd

class MyStrategy:
    name = "my-strategy"
    def generate_signal(self, df: pd.DataFrame, config: StrategyConfig) -> Signal:
        last = df.iloc[-1]
        if last["rsi"] < 25:
            return {"signal": "BUY", "reason": "deeply oversold", "score": 0.8,
                    "stop_loss": None, "take_profit": None}
        return {"signal": "HOLD", "reason": "wait", "score": 0.0,
                "stop_loss": None, "take_profit": None}

Pass an optional scorer=lambda df, config: 0.0..1.0 to run_strategy / run_backtest; signals scoring below config.confidence_threshold are downgraded to HOLD.

License

MIT

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

confluence_engine-0.1.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

confluence_engine-0.1.1-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file confluence_engine-0.1.1.tar.gz.

File metadata

  • Download URL: confluence_engine-0.1.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for confluence_engine-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f16107d85039ae52caefa870e39c91bec636aa493138c69101e8ed0dbe80e2a9
MD5 98f50759040b67bb6ac152b3e0e400df
BLAKE2b-256 3abaf4077f3b6ddc7c538d9ef5acdb08d69ff835a683b9c78852d505eb8c7bfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for confluence_engine-0.1.1.tar.gz:

Publisher: publish.yml on Rustam335/confluence-engine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file confluence_engine-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for confluence_engine-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 47147b1e7f1e35c6858c67285e6194aec7dd33dd01679872bf887c9786dec5c8
MD5 adce250f00b8a0c304df283067a657b9
BLAKE2b-256 9cde907233b72f3ac3bd5489cd7a2845769e2b89a92f2da4820db056ec2b50a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for confluence_engine-0.1.1-py3-none-any.whl:

Publisher: publish.yml on Rustam335/confluence-engine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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