Next funding settles in --:--:--Same $10,000 SOL long, one week: $33 more on MEXC than on BybitOpen Bybit →

· four exchange APIs · rebuilt daily

AI onchain analysis fails at execution math while parsing text

How it works: The mechanics, from the beginning.

The finding

Large language models generate inaccurate arithmetic in up to 30 percent of multi-step financial calculations because they predict text tokens rather than performing mathematical operations.

They summarize forum threads, extract smart contract events, and group wallet clusters efficiently.

They fail when calculating liquidation thresholds, funding rate drag, or position sizes.

Execution workflows require Python or deterministic code for numbers, leaving language models to handle text.

Where AI onchain analysis delivers structural utility

Large language models excel at processing unstructured text onchain and offchain. Governance proposals on forums contain thousands of words of technical context. A model can extract parameter changes, voting deadlines, and target contract addresses from proposals across multiple protocols in seconds.

Address labeling represents another functional application. Smart contract logs emit raw event data, transfer traces, and function calls. Language models convert these raw traces into readable descriptions by matching byte patterns against known application binary interfaces. They classify wallet behavior into arbitrage bots, liquidation engine calls, or treasury transfers without manual pattern matching for every contract update.

Smart contract code auditing at a high level also benefits from language model ingestion. Models flag standard vulnerability patterns, missing access control modifiers, and unhandled return values across Solidity files. They serve as automated code readers, highlighting specific functions for human verification before deployment.

Worth knowing

Parsing smart contract source code with a language model identifies variable names and logic flows, but it does not verify formal execution proofs or state transitions.

The mechanical reason probabilistic models fail at math

Language models process input by breaking text into tokens, which are character chunks rather than numerical values. When a model processes numbers like 10,762,888,506 or 0.00055, it splits those digits into arbitrary token blocks based on statistical training data.

The model does not possess a built-in calculator or memory registers for arithmetic logic units. It selects the next token based on statistical probability across its training corpus. Asking a model to multiply a margin position size by leverage and subtract cumulative funding drag is mathematically identical to asking it to complete a sentence.

Tokenization introduces errors when numbers cross digit boundaries. Multiplying a 6-digit contract size by an 8-digit price feed produces token sequences that look statistically plausible to the model but contain wrong digits in intermediate positions. A single wrong digit in an account margin calculation alters a liquidation price by hundreds of dollars.

Where this goes wrong

Prompting a language model to compute position leverage or margin requirements directly risks unexpected liquidation. Always pass raw numbers to a script engine.

Venue fees and funding calculation errors

Calculating holding costs across venues requires exact arithmetic. Per-8-hour funding rates look small as percentage points, but leverage multiplies their impact on equity over time.

Consider the live perpetual futures funding rates across major exchanges for major assets:

AssetVenue8h Funding RateFutures Maker FeeFutures Taker Fee
BTCBybit+0.0020%0.00020.00055
BTCMEXC+0.0035%0.00.0002
BTCBitget+0.0100%0.00020.0003
BTCOKX+0.0100%0.00020.0005
ETHBybit-0.0121%0.00020.00055
ETHMEXC-0.0051%0.00.0002
ETHOKX-0.0030%0.00020.0005
ETHBitget+0.0024%0.00020.0003

For a long ETH position, Bybit offers the lowest funding rate at -0.0121% per 8 hours. Holding a long position on Bybit yields a funding credit, whereas holding the same long position on Bitget incurs a funding debit of +0.0024% per 8 hours. The spread between Bybit and Bitget is 0.0145 percentage points per 8 hours.

If an AI model processes this venue comparison and misreads Bitget's taker fee of 0.0003 as 0.003, or miscalculates the 24-hour cumulative funding spread, the venue selection logic fails. On a 100,000 USD position at 10x leverage, a 0.0145 percentage point shift per 8 hours equals 14.50 USD per interval, or 43.50 USD per day in avoidable funding cost.

What to do instead

Use language models exclusively to generate executable code or parse contract events, then execute all mathematical operations inside a dedicated runtime environment like Python.

Structuring AI pipelines for trading desks

A reliable trading infrastructure separates qualitative parsing from quantitative calculation. The language model acts strictly as a translation layer between human language, contract documentation, and system parameters.

In an automated workflow, the language model reads governance updates or protocol parameters, converts the information into JSON format, and outputs structured key-value pairs. A local execution script reads that JSON payload, validates the schema, and routes the numerical parameters into standard execution code.

The execution script computes margin ratios, position sizing, order routing fees, and slippage tolerances using double-precision floating point standard libraries or arbitrary-precision decimal modules. The language model never sees or calculates the final order size. This separation guarantees that probabilistic output never touches account balances or order submission endpoints directly.

Is AI onchain analysis useful for perpetual futures traders?

Language models process governance updates, label active wallet addresses, and summarize contract logic. They remove manual overhead when reading protocol documentation or tracking onchain events.

Why do language models make calculation mistakes in position sizing?

Language models predict text tokens based on statistical probability rather than calculating equations with arithmetic hardware logic. Numerical digits are split into arbitrary token patterns that cause rounding and multiplication errors.

How should a trading desk integrate AI into execution systems?

Restrict the model to parsing unstructured text into standard JSON parameters. Pass those parameters to deterministic code written in Python or Rust to perform position sizing, liquidation math, and fee calculations.

What is the cost difference in funding across perpetual venues?

Live spreads reach 0.0145 percentage points per 8 hours on ETH perps across Bybit and Bitget. Holding positions on the wrong venue accumulates substantial fee drag over multi-day holding periods.

Read next

Four backup errors turn self-custody account balances to zeroStoring BIP39 seed phrases in cloud storage or single physical sites exposes account capital…Exchange Custody Trades Operational Risk for Execution AccessSelf-custody removes counterparty default risk entirely while transferring total key…Missing Deposit Memos and Mismatched Networks Lock Futures MarginDepositing margin via unsupported RPC networks or without destination tags locks capital…