crosstrade
crosstrade is a shared-core trading package for two runtime surfaces:
- Gymnasium backtests for
stable-baselines3 - MT5 live trading sessions driven by the same portfolio, execution, and risk logic
The intended model stack is crosstrade + crosslearn + stable-baselines3. The deprecated timeseries_trader and timeseries_agent workflows are no longer part of the package.
Install
Core package:
pip install crosstrade
With Chronos embeddings:
pip install "crosstrade[chronos]"
With MT5 live trading support:
pip install "crosstrade[extra]"
Public API
from crosstrade import (
FeaturePipeline,
TradingEnv,
build_offline_embeddings,
evaluate_policy,
load_binance_ohlcv,
make_offline_env,
make_online_env,
)
from crosstrade.core import ExecutionConfig, RiskConfig
Backtest Example
import pandas as pd
from crosstrade import FeaturePipeline, make_online_env
from crosstrade.core import ExecutionConfig, RiskConfig
df = pd.read_csv("notebooks/data/DOGEUSDT_train.csv")
pipeline = FeaturePipeline(add_technical=True)
featured = pipeline.fit_transform(df)
env = make_online_env(
featured,
window_size=30,
frame_bound=(30, len(featured)),
feature_columns=["open", "high", "low", "close", "volume"],
execution_config=ExecutionConfig(commission_rate=0.001, spread=0.05),
risk_config=RiskConfig(stop_loss_pct=0.02, take_profit_pct=0.04),
)
Live Trading Example
from stable_baselines3 import PPO
from crosstrade import FeaturePipeline
from crosstrade.live import MT5Broker, MT5TradingSession
broker = MT5Broker(symbol="DOGUSD", timeframe="M5")
model = PPO.load("models/ppo_doge")
pipeline = FeaturePipeline(add_technical=True)
session = MT5TradingSession(
broker=broker,
policy=model,
feature_pipeline=pipeline,
feature_columns=["open", "high", "low", "close", "volume"],
window_size=30,
poll_interval=60.0,
)
Set MT5_SERVER, MT5_LOGIN, and MT5_PASSWORD in the environment before running live sessions.
License
CrossLearn is released under the Apache License 2.0. See the LICENSE.
Metadata
Release files for crosstrade 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crosstrade-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / crosstrade-0.1.0-py3-none-any.whl
| Download URL | crosstrade-0.1.0-py3-none-any.whl |
|---|---|
| Size | 43.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1823ed4702088053dd6c37a296661556fbd52afb5e77edef77b776a0da9b72b0
|
|
BLAKE2b-256 checksum How to use checksums |
697afb37816990709b12d5f807ca0a1b633e58047c3458668eb826a9b055e37e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.0 CPython/3.14.3
|