OKX CSV export format
parser live🔒 CSV conversion runs in your browser — files are not uploaded
This is the format reference for OKX CSV export (trading history / funding account) — where the file comes from, what each column means, and the export quirks that matter. Our parser reads the layout(s) below and converts it in your browser.
Layout evidence: Layouts per BittyTax’s okx.py and OKX help-center export docs — see research/parser-fixture-validation-2026-10.md.
How to export the file
- OKX → Order Center → Trading history → Download (this is the two-row-per-trade file the converter reads).
- For funding events: account/bills export → Download.
- Do NOT use Order Center → Order history for conversion — see the quirks below.
Column reference
Trading history (transaction history)
| Column | What it means |
|---|---|
id | Event id — the join key: each spot trade is TWO rows sharing this id. |
Order id | Backing order id (fallback grouping key). |
Time | Event timestamp. |
Trade Type | Row class — "Transfer" rows are internal moves. |
Instrument | Pair/instrument code. |
Type | Buy or Sell — each trade has one of each row. |
Amount | This row’s leg quantity. |
Unit (first) | Currency of THIS row’s Amount — there are two columns named "Unit"; the first is used positionally. |
PL | Profit/loss field. |
Fee | Fee — sits on the Buy row in the bought currency, negative-signed. |
Position Change / Position Balance / Balance Change / Balance / Unit (second) | Position and balance bookkeeping columns. |
Funding / account bills
| Column | What it means |
|---|---|
id | Event id. |
Time | Event timestamp. |
Type | Deposit, Withdrawal, Staking Yield, Fee rebate, Stake, Redeem staking, Savings moves, … |
Amount | Signed quantity — negative on withdrawals. |
Before Balance / After Balance | Balance bookkeeping. |
Fee | Fee amount. |
Symbol | Asset. |
Order history — recognized but refused
Order Center → Order history export. States only one leg per order; converting would mean guessing the counter-leg from a price, which the parser refuses to do.
| Column | What it means |
|---|---|
Order ID / Order Time | Order identifiers and time. |
Instrument / Symbol | Pair codes. |
Side / Order Type / Order Amount / Filled Amount / Amount Unit | Order parameters — one leg only. |
Order Price / Avg. Filled Price / Price Unit | Price fields — the counter-leg exists only implicitly. |
PNL / Fee / Fee Unit / Status / Bot ID | Fill bookkeeping. |
Format quirks
- Every spot trade is TWO rows sharing one id — a Type=Buy row and a Type=Sell row, each stating its own Amount+Unit leg. The parser regroups them into single trades.
- The fee sits on the Buy row in the bought currency with a negative sign (abs()ed).
- There are literally two columns named "Unit" — the first (amount currency) is used positionally; the second is balance bookkeeping.
- Order Center → Order history is a different file that states one leg per order — it is detected and refused with a message pointing at the Trading-history export instead.
- Legs that cannot be paired by id fall back to Order id grouping; still-unpaired legs stay as flagged "other" rows — never dropped silently.
- Trade Type "Transfer" rows and internal staking/savings moves are skipped as non-events.
Convert this file (2)
| Convert an OKX CSV to the Koinly format | live |
| Convert an OKX CSV to CoinTracker | live |
All OKX CSV converters · Format reference index · All converters