· four exchange APIs · rebuilt daily

The finding
When applying ai onchain analysis to derivative positions, language models accurately parse smart contract code but fail on arithmetic, misestimating margin mechanics by up to 100%.
Using raw text generation for position sizing creates unmanaged liquidation risk.
Deterministic scripts must handle numbers while models handle code summarisation.
Language models process unstructured text and source code efficiently. In onchain operations, their primary utility lies in three tasks: summarizing governance forum threads, labeling function signatures in unverified contracts, and converting raw transaction execution traces into chronological steps.
When reading smart contract code, a transformer model identifies structural patterns instantly. It can highlight whether a contract contains minting privileges, unconstrained pause functions, or custom transfer hooks. For governance tracking, a model can condense lengthy proposal discussions into core parameters without missing state changes.
Worth knowing
Code analysis models identify access control roles reliably, but cannot verify whether variable math overflows in custom bytecode execution.
These tasks share a common structure: they map text to text. The input is a sequence of words or bytecode instructions, and the output is a qualitative summary. Because success depends on pattern matching rather than precise numerical calculation, language models deliver high accuracy in these contexts.
Language models do not calculate numbers. They predict the most probable next character token based on training statistics. When prompted to compute position leverage, liquidation distance, or funding drag, the model generates digits that look structurally plausible rather than performing arithmetic.
Consider a trader evaluating order execution across perpetual venues. On Bitget, the futures taker fee is 0.0003, while Bybit charges 0.00055. On a position entering and exiting via taker orders, that difference is 0.00025 or 0.025 percentage points per round trip. A language model prompted directly for this round-trip calculation frequently rounds, drops decimals, or invents standard values like 0.05% based on typical industry context.
Where this goes wrong
Prompting a raw language model to calculate liquidation prices or collateral ratios will produce hallucinated outputs that trigger premature liquidations.
The risk escalates when calculating funding costs over time. On JCT, the 8-hour funding rate on MEXC is +0.9704%, while Bitget sits at -0.0291%. The spread across venues is 0.9995 percentage points per 8-hour period. If a model misinterprets the sign or misplaced decimal point during multi-day projections, the calculated holding cost diverges completely from actual account equity.
Execution fees and funding rates vary significantly across perpetual futures venues. Calculating holding cost requires tracking both taker fee schedules and 8-hour funding rates for your chosen collateral asset.
| Venue | Futures Maker Fee | Futures Taker Fee |
|---|---|---|
| MEXC | 0.0000% | 0.0200% |
| Bitget | 0.0200% | 0.0300% |
| Bybit | 0.0200% | 0.0550% |
| OKX | 0.0200% | 0.0500% |
Fee schedules establish the baseline cost of entering and exiting positions. MEXC offers 0.0% maker fees and a 0.0200% taker fee, while Bybit charges 0.0550% for taker orders. Over high transaction volumes, these fee gaps alter net trading performance regardless of entry accuracy.
| Asset | Lowest 8h Funding Rate (Long) | Highest 8h Funding Rate (Long) | 8h Spread | 24h Volume |
|---|---|---|---|---|
| ETH | OKX (-0.0106%) | MEXC (-0.0081%) | 0.0066% | $4,122,340,287 |
| BTC | OKX (+0.0023%) | MEXC (+0.0070%) | 0.0047% | $3,814,597,589 |
| ZEC | OKX (-0.0101%) | Bitget (+0.0572%) | 0.0673% | $1,721,179,172 |
| SOL | MEXC (-0.0028%) | Bybit (+0.0072%) | 0.0100% | $626,534,635 |
| JCT | Bitget (-0.0291%) | MEXC (+0.9704%) | 0.9995% | $379,284,092 |
| XRP | Bitget (-0.0016%) | MEXC (+0.0065%) | 0.0081% | $345,282,167 |
Funding rate spreads represent another major structural expense. Holding a long position in ZEC costs +0.0572% per 8 hours on Bitget, whereas holding the same long position on OKX yields a payment of -0.0101%. That creates an 8-hour spread of 0.0673 percentage points between the two exchanges.
To safely incorporate artificial intelligence into automated trading systems, separate data parsing from quantitative calculation. A model can extract event logs from an onchain transaction, but external code must calculate position size and leverage.
What to do instead
Use language models strictly to convert unformatted contract events into JSON parameters, then pass those parameters to a Python script for mathematical processing.
In an effective architecture, the language model acts solely as an interface layer. It ingests complex contract code, governance text, or transaction traces, then emits structured data schemas. A execution engine reads those schemas, queries venue fee APIs, and computes margin requirements using explicit floating-point arithmetic.
No. Language models perform text completion rather than arithmetic computation, causing them to hallucinate numeric values. Always compute liquidation thresholds using dedicated code scripts or platform calculators.
AI excels at summarising governance proposals, reading smart contract functions, and labeling address transaction histories. It reduces manual reading time when auditing textual and structural data across blockchain protocols.
Funding rates fluctuate based on venue open interest and long-short imbalances. For example, 8-hour funding for ZEC ranges from -0.0101% on OKX to +0.0572% on Bitget, creating a spread of 0.0673 percentage points per interval.
Separating parsing from calculation prevents model hallucination from impacting risk parameters. Using models for qualitative text extraction and deterministic scripts for numerical math maintains exact trade execution safety.