Coinrule X Strategies
A standard library of open-source trading strategies designed for the Coinrule X execution platform.
Strategies in this repository act as signal generators and are executed using Coinrule X's managed execution and risk engine.
Strategy Architecture
Strategies in this repository are signal generators that can operate in two modes:
Entry-Only Strategies (entry_only: true)
- Generate entry signals only
- Exits are fully managed by the Coinrule X risk engine
- Mandatory managed risk management (stop-loss, take-profit, trailing, breakeven)
- Best for: trend-following, momentum, breakout strategies
Entry & Exit Strategies (entry_only: false)
- Generate both entry and exit signals
- Strategy controls when to close positions
- Optional risk management (disabled by default, can be enabled per user)
- Best for: mean-reversion, arbitrage, custom exit logic strategies
All position execution is handled by the Coinrule X execution layer, ensuring consistent behavior and safety guarantees across all strategies.
This separation allows:
- reproducible and auditable strategy logic
- flexible risk control (managed or strategy-driven)
- safe execution without exposing private keys
- configurable preferences per user
Execution & Risk Management
Coinrule X provides a configurable risk framework that behaves differently based on strategy type:
For Entry-Only Strategies
Risk management is mandatory and enforced:
- mandatory stop-loss on every position
- take-profit via fixed target or trailing stop
- optional breakeven logic with partial position closes
- configurable position sizing per strategy
Exits are triggered exclusively by the risk engine (SL/TP/trailing/breakeven).
For Entry & Exit Strategies
Risk management is optional (disabled by default):
- strategy controls exit timing via exit signals
- users can opt-in to enable risk management as a safety layer
- when enabled, risk engine acts as a backstop (e.g., emergency stop-loss)
- position sizing remains configurable
Risk Model Options
When risk management is enabled (mandatory for entry-only, optional for entry & exit):
- Stop-loss: mandatory, configurable distance
- Take-profit: fixed percentage target or trailing stop
- Trailing stop: optional activation after a defined profit threshold
- Breakeven logic: partial position close, stop moved to entry, trailing enabled for remainder
Customization
Users can adjust risk parameters per strategy:
- stop-loss distance
- take-profit method and target
- trailing activation threshold
- breakeven behavior
- position sizing
For entry & exit strategies, users can also toggle whether managed risk management is enabled.
Repository Structure
Strategies are organized into individual folders under coinrule_x_strategies/strategies/.
The repository uses a scalable registry system with support for sub-registries.
-
coinrule_x_strategies/registry.yamlMain entry point including all registered strategies. -
coinrule_x_strategies/strategies/<strategy_name>/registry.yamlStrategy-specific metadata and configuration, including theentry_onlyflag. -
coinrule_x_strategies/strategies/<strategy_name>/strategy.pyStrategy implementation (entry signals, and optionally exit signals).
Each strategy folder also includes a dedicated README.md describing its logic, use cases, and risk profile.
Registry Configuration
Each strategy's registry.yaml must include the entry_only field:
name: my_strategy
version: 1.0.0
entry_only: true # true = entry signals only, managed risk required
# false = entry & exit signals, optional risk management
category: trend
# ... other metadata
Multi-Timeframe Strategies
Strategies can operate on multiple timeframes simultaneously using the market_mode and market_aliases settings.
Registry Configuration
name: volatility_breakout
version: 1.0.0
settings:
market_mode: "multi" # "single" (default) or "multi"
market_aliases: ["ltf", "htf"] # Labels for each timeframe
Indicator Binding
For multi-timeframe strategies, indicators must be bound to specific market aliases using a tuple syntax:
# Single-market strategy (default)
def indicators(self) -> Dict[str, Indicator]:
return {
"rsi": RSI(14),
"ema": EMA(50),
}
# Multi-market strategy
def indicators(self) -> Dict[str, Tuple[Indicator, str]]:
return {
# Indicators bound to lower timeframe
"rsi_ltf": (RSI(14), "ltf"),
"ema_ltf": (EMA(50), "ltf"),
"candle": (Candle(), "ltf"),
# Indicators bound to higher timeframe
"rsi_htf": (RSI(14), "htf"),
"ema_htf": (EMA(50), "htf"),
}
The runner will:
- Subscribe to candle streams for each market alias (e.g., 5m for
ltf, 1h forhtf) - Feed candles to indicators based on their market binding
- Provide indicator history to
evaluate()with values from the correct timeframe
Installation
pip install crx-strategies
Available Strategies
- Trend Rider: A trend-following strategy designed to capitalize on strong directional markets. It enters positions only when multiple trend and momentum indicators align, aiming to stay in trades during sustained moves while avoiding choppy conditions.
- Bounce Recovery: A mean-reversion strategy designed to capture controlled pullbacks and oversold conditions. Aim to profit from short-term price rebounds while applying strict risk controls to avoid prolonged drawdowns.
- Volatility Breakout: A strategy designed to trade sudden expansions in volatility after periods of compression. Aim to capture fast, directional moves triggered by volatility regime shifts.
Contributing
Contributions are welcome.
To add a new strategy:
-
Create a new folder under
coinrule_x_strategies/strategies/. -
Implement your strategy class by inheriting from
Strategybase class. -
Add a
registry.yamlfile with strategy metadata. -
Validate your registry file using the included script:
# Using installed CLI coinrule_x-validate-strategies coinrule_x_strategies/strategies/<your_strategy>/registry.yaml # Or using poetry during development poetry run python coinrule_x_strategies/validation.py coinrule_x_strategies/strategies/<your_strategy>/registry.yaml
-
Register your strategy by adding its sub-registry path to
coinrule_x_strategies/registry.yaml.
All strategies should:
- generate entry signals (and optionally exit signals)
- specify
entry_only: trueorentry_only: falsein registry - remain stateless
- avoid embedding execution or position management logic
Submission Process
- Fork the Repository: Create a fork of the repository to your own GitHub account.
- Create a Feature Branch: Create a new branch for your changes (e.g.,
feat/add-abc-strategy). - Implement & Test: Apply your changes and ensure all tests pass.
- Create Pull Request: Submit a pull request to the main repository.
Note: Version numbers and the official CHANGELOG will be updated by maintainers upon release.
Development Guidelines
- Type Hinting: All methods must be fully type-hinted.
- Pandas/Numpy: Use vectorized operations where possible for performance.
- Zero Dependencies: Do not add new external dependencies without prior discussion.
Disclaimer
Strategies provided in this repository are open-source and intended for systematic trading experimentation. They do not constitute financial or investment advice. Trading involves risk, and users are fully responsible for their configuration and capital allocation.
Metadata
Release files for crx-strategies 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| crx_strategies-1.2.1.tar.gz | 25.2 kB | Without provenance | Details for crx_strategies-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crx_strategies-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for crx_strategies-1.2.1-py3-none-any.whl |
Total release size: 59.7 kB
Release files / crx_strategies-1.2.1.tar.gz
| Download URL | crx_strategies-1.2.1.tar.gz |
|---|---|
| Size | 25.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90a31be643c0c22c092ff8dea1618cfbcf0c0764c7a487f2bb81ba5dcbc187c8
|
|
BLAKE2b-256 checksum How to use checksums |
a506417fa804202dd810b6a4eb71fe54f939074362ed1132d2191386a40775a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1013-azure
|
Release files / crx_strategies-1.2.1-py3-none-any.whl
| Download URL | crx_strategies-1.2.1-py3-none-any.whl |
|---|---|
| Size | 34.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d449ffb0620b3f0be12583d8d9735081cfb6b509132016048eb005850364fb9
|
|
BLAKE2b-256 checksum How to use checksums |
b3adf1bd59d284910a853908255cc98d90f2dae2c2c4bc328da76e6af5dd2cc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1013-azure
|
Security for crx-strategies 1.2.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.