Next funding settles in --:--:--Same $10,000 SOXL long, one week: $30 more on Bitget than on MEXCOpen MEXC →

· four exchange APIs · rebuilt daily

Language models fail at arithmetic in ai onchain analysis

How it works: The mechanics, from the beginning.

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.

Where ai onchain analysis works for traders

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.

The structural failure of text generation in position sizing

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.

Cost differences across execution venues

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.

VenueFutures Maker FeeFutures Taker Fee
MEXC0.0000%0.0200%
Bitget0.0200%0.0300%
Bybit0.0200%0.0550%
OKX0.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.

AssetLowest 8h Funding Rate (Long)Highest 8h Funding Rate (Long)8h Spread24h Volume
ETHOKX (-0.0106%)MEXC (-0.0081%)0.0066%$4,122,340,287
BTCOKX (+0.0023%)MEXC (+0.0070%)0.0047%$3,814,597,589
ZECOKX (-0.0101%)Bitget (+0.0572%)0.0673%$1,721,179,172
SOLMEXC (-0.0028%)Bybit (+0.0072%)0.0100%$626,534,635
JCTBitget (-0.0291%)MEXC (+0.9704%)0.9995%$379,284,092
XRPBitget (-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.

Designing execution workflows without mathematical hallucination

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.

Can language models accurately calculate liquidation price?

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.

Where is AI effective in onchain research?

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.

How do funding rates differ between perpetual exchanges?

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.

Why should traders separate code parsing from risk calculations?

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.

Read next

Brickell Tax Savings Are Erased By Venue Funding Rate SpreadsFlorida tax benefits draw crypto capital to Brickell, but carry cost spreads across perpetual…Funding Payments Exceed Perpetual Trading Fees Within 48 HoursFor perpetual futures positions held over two days, cumulative funding payments exceed…Cross-venue funding spreads shift monthly holding costs by 3.39%Divergent funding rates and exchange fee tiers create significant holding cost variances for…