A python framework that can be used to create, test and deploy trading algorithms.
Project description
Dijkies
Dijkies is a Python framework for creating, testing, and deploying algorithmic trading strategies in a clean, modular, and exchange-agnostic way.
The core idea behind Dijkies is to separate trading logic from execution and infrastructure, allowing the same strategy code to be reused for:
- Historical backtesting
- Paper trading
- Live trading
Philosophy
In Dijkies, a strategy is responsible only for making decisions — when to buy, when to sell, and how much. Everything else, such as order execution, fee calculation, balance management, and exchange communication, is handled by dedicated components.
This separation ensures that strategies remain:
- Easy to reason about
- Easy to test
- Easy to reuse across environments
A strategy written once can be backtested on historical data and later deployed to a real exchange without modification.
How It Works
At a high level, Dijkies operates as follows:
- Market data (candles) is fetched from an exchange or data provider
- A rolling window of historical data is passed to a strategy
- The strategy analyzes the data and generates buy/sell signals
- Orders are placed through a standardized execution interface
- Account state is updated accordingly
- Results are collected (during backtesting) or executed live
Key Design Principles
-
Strategy–Executor separation
Trading logic is completely decoupled from execution logic. -
Single interface for backtesting and live trading
Switching between backtesting and live trading requires no strategy changes. -
Explicit state management
All balances and positions are tracked in a transparentStateobject. -
Minimal assumptions
Dijkies does not enforce indicators, timeframes, or asset types. -
Composable and extensible
New exchanges, execution models, and risk layers can be added easily.
Who Is This For?
Dijkies is designed for:
- Developers building algorithmic trading systems
- Quantitative traders who want full control over strategy logic
- Anyone who wants to move from backtesting to production without rewriting code
What Dijkies Is Not
- A no-code trading bot
- A black-box strategy optimizer
- A fully managed trading platform
Dijkies provides the building blocks, not the trading edge.
Quick Start
This quick start shows how to define a strategy, fetch market data, and run a backtest in just a few steps.
1. Define a Strategy
A strategy is a class that inherits from Strategy and implements the execute method.
It receives a rolling dataframe of candles and decides when to place orders.
from dijkies.strategy import Strategy
from dijkies.executors import ExchangeAssetClient
from ta.momentum import RSIIndicator
import pandas as pd
class RSIStrategy(Strategy):
# Amount of historical data passed into execute()
analysis_dataframe_size_in_minutes = 60 * 24 * 30 # 30 days
def __init__(
self,
executor: ExchangeAssetClient,
lower_threshold: float,
higher_threshold: float,
) -> None:
self.lower_threshold = lower_threshold
self.higher_threshold = higher_threshold
super().__init__(executor)
def execute(self, candle_df: pd.DataFrame) -> None:
candle_df["rsi"] = RSIIndicator(candle_df.close).rsi()
previous = candle_df.iloc[-2]
current = candle_df.iloc[-1]
# Buy when RSI crosses below lower threshold
if previous.rsi > self.lower_threshold and current.rsi < self.lower_threshold:
self.executor.place_market_buy_order(
self.executor.state.base,
self.executor.state.quote_available,
)
# Sell when RSI crosses above higher threshold
if previous.rsi < self.higher_threshold and current.rsi > self.higher_threshold:
self.executor.place_market_sell_order(
self.executor.state.base,
self.executor.state.base_available,
)
2. fetch data for your backtest
Market data is provided as a pandas DataFrame containing OHLCV candles.
from dijkies.exchange_market_api import BitvavoMarketAPI
market_api = BitvavoMarketAPI()
candle_df = market_api.get_candles(base="XRP", lookback_in_minutest=60*24*365)
3. Set Up State and BacktestingExecutor
Market data is provided as a pandas DataFrame containing OHLCV candles.
from dijkies.executors import BacktestExchangeAssetClient, State
state = State(
base="XRP",
total_base=0,
total_quote=1000,
)
executor = BacktestExchangeAssetClient(
state=state,
fee_limit_order=0.0015,
fee_market_order=0.0025,
)
4. Run the Backtest
Use the Backtester to run the strategy over historical data.
from dijkies.backtest import Backtester
strategy = RSIStrategy(
executor=executor,
lower_threshold=35,
higher_threshold=65,
)
backtester = Backtester()
results = backtester.run(
candle_df=candle_df,
strategy=strategy,
)
results.total_value_strategy.plot()
results.total_value_hodl.plot()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dijkies-0.0.0.tar.gz.
File metadata
- Download URL: dijkies-0.0.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e75d84693f62a517ef8953be5752cfd7210974fa342e0d25044c705c15b40d43
|
|
| MD5 |
7ee7b08b7e8860ac78377bf15ab01740
|
|
| BLAKE2b-256 |
14970d89f889a26ddfaf2ae53048af4c059090ad4f648adf92828a0acb9d9371
|
File details
Details for the file dijkies-0.0.0-py3-none-any.whl.
File metadata
- Download URL: dijkies-0.0.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0042b366f6166aa30758745bab699e7940da9d03e70c06444aa2dc77835fe0c
|
|
| MD5 |
bc2a65e54f291258e6027429aef64ed6
|
|
| BLAKE2b-256 |
68cdccf357edd301add139bbbaaafead4f0471fce1148c7d71dc19bd50a03c62
|