- Home
- Skills
- Trading & Investing
- ml crypto trading expressions
ml crypto trading expressions
Author and validate safe, deterministic trading expressions for the ml-crypto-trading (MCT) framework.
Free
Works with the AI Agents you already use
ml crypto trading expressions
Example session with this skill installed
Write a dynamic_quantity expression that risks 2% of equity, capped by 95% of available balance, and never drops below min_qty.
- Read your context and instructions
- Compiled the ml crypto trading
The following expression implements fixed-fractional risk management. It calculates the quantity by dividing 2% of total equity by the current close price, ensuring the order respects exchange minimums and total wallet liquidity.
MCT Dynamic Quantity Expression
# Place this in your trading-config.yaml under dynamic_quantity
# or assets[].dynamic_quantity
dynamic_quantity: >-
max(
min_qty,
min(
(equity * 0.02) / close,
(balance * 0.95) / close
)
)
Next steps
1.
Validate Syntax: Run python -c "from src.core.expressions.expression_parser import ExpressionParser; ExpressionParser.validate('max(min_qty, min((equity * 0.02) / close, (balance * 0.95) / close))')" to confirm the AST is valid.
2.
Dry Run: Use the POST /api/v1/expressions/evaluate endpoint with your current equity and balance to see the resulting quantity.
3.
Backtest: Run make run-backtest to ensure this sizing logic doesn't lead to frequent "insufficient margin" errors.
Connects securely to your tools. The creator never sees your data.
About this skill
Writing trading logic in YAML shouldn't feel like guessing. This skill helps you author, debug, and validate spreadsheet-style expressions for position sizing and strategy rules in the ml-crypto-trading (MCT) framework.
What it does
- Position Sizing writes
dynamic_quantityformulas that calculate order sizes based on equity, risk percentages, and consensus signals. - Strategy Triggers drafts boolean expressions for
DYNAMICstrategies to gate entries and exits based on market indicators. - Validation Support generates Python snippets or API requests to test syntax and semantic correctness using the MCT
ExpressionParser. - Volatility Scaling implements ATR-based sizing and risk-parity patterns to protect capital.
- Logic Guardrails applies safety patterns like
max(min_qty, ...)andclamp()to prevent order execution failures or zero-division errors.
How it works
- Scope Definition specifies whether you are building a global
dynamic_quantityrule or a per-asset strategyexpression. - Logic Drafting constructs the formula using allowed arithmetic, logical, and rolling series functions like
highest()orlowest(). - Refinement applies risk limits, flooring against
min_qtyand capping against availablebalance. - Validation Generation provides the specific CLI commands or
curlrequests to verify the expression against your local MCT instance.
Frameworks & tools
Specifically designed for the ml-crypto-trading (MCT) Python project. It uses the project's internal ExpressionParser syntax, including rolling series functions and consensus variables like signal and vote_ratio.
Why this beats prompting it yourself
Generic LLMs often use arbitrary Python or invalid indicators that crash the MCT engine. This skill enforces the strict AST-safe subset of Python permitted by the ExpressionParser, ensuring your formulas actually execute in backtests.
Use cases
- Scaling position size up or down based on model
confidencescores. - Creating mean-reversion strategies using RSI or EMA crossovers in YAML.
- Implementing fixed-fractional risk management based on current
equity. - Gating trades so they only trigger during specific rolling channel breakouts.
Known limitations
Does not support arbitrary Python imports, loops, or attribute access. Expressions are limited to 1000 characters. Strategy scopes cannot access consensus variables like signal.
Limited to MCT ExpressionParser syntax. Max 1000 characters. Strategy expressions cannot access consensus variables. Requires Python 3.11+ for local validation.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 4 days ago
- Free with an Agensi account