Aller au contenu
Toutes les sources

OKX dans TaxChain

Bêta

TaxChain lit OKX et est testé sur ses réponses documentées et enregistrées, mais pas encore rapproché de données réelles. Comparez les chiffres au relevé de OKX avant de déclarer.

Cette page est en anglais, pour dire exactement ce que disent la documentation de la plateforme et le code de TaxChain. Les titres et le reste du site sont dans votre langue.

A large centralised exchange with spot, margin, perpetuals, futures, options and earn products. TaxChain reads the spot trades and internal transfers in OKX's Trading history export, the file OKX documents today, though it has not yet been checked against a real export. An API sync through CCXT exists but is offered only on a sandbox stack, reads spot trades, deposits, withdrawals and converts, and has a paging defect.

Modes d'import

  • Import de fichierBêta

    OKX Trading history, as CSV

    The Trading history file from OKX's Order center, with the columns OKX documents: User ID, Order ID, Time, Trade Type, Symbol, Action, Amount, Trading Unit, Filled Price, PnL, Fee, Fee Unit, Position Change, Position Balance, Balance Change, Balance and Balance Unit [1]. It is recognised on upload. The 2023 version of the file (id, Order id, Time, Trade Type, Instrument, Type, Amount, Unit, PL, Fee and the balance columns) is read the same way [2].

    Two layouts TaxChain read before are still read: trades with Bill ID, Time, Instrument, Underlying, Side, Filled Price, Filled Qty, Fee, P&L, Balance Change and Margin Mode, and funding rows with Bill ID, Time, Currency, Type, Amount, Fee and Balance. OKX does not document either.

    OKX does not say whether a fill is one row of the file or one row per coin. TaxChain reads it as one row per coin, because the file is the trading account's bill list and OKX's bills API documents one bill per currency, quantity and fee apart [3], and because an open-source parser written against real OKX exports found a Buy row for the coin received and a Sell row for the coin given [2]. Rows of the same order, instrument and time are taken together as one trade: the base coin's row gives the side, Amount gives each side's quantity, and the fee is on top of it.

    What the file does not settle is reported, not guessed. A fill with only its quote row, unequal numbers of base and quote rows, a Balance Change that moves against the side, or quantities that disagree with Filled Price by more than 1% are errors. A fill with only its base row is read from Filled Price, with a warning; so is a Balance Change that is not Amount plus Fee.

    Only Spot and Transfer rows are read. Margin, perpetual, futures and options rows are reported as errors, one per row, not read as spot purchases. Transfer rows are moves between your own funding and trading accounts and are imported as such; a transfer of a fiat currency is skipped.

    OKX's Funding history file (deposits, withdrawals, staking and earn income) is not recognised in the columns real exports have had: only the older Bill ID funding layout above is read, and in it only the types Deposit, Withdrawal and Transfer; any other type is reported as an error.

  • Connexion APIPas encore proposé

    CCXT `okx` (www.okx.com) [4]

    An API key with the Read permission only, its secret and its passphrase. OKX keys always come with a passphrase, and TaxChain asks for it.

    Not offered in production. Like every CCXT exchange it can be connected only on a sandbox stack, which talks to OKX demo trading [5].

    The API holds little history. Spot fills come from the last 3 months only [6] and trading account bills from the last 7 days [3]. A first sync cannot reach older trades.

    Paging is wrong for OKX. OKX returns the newest 100 fills of a range, and the sync stops after that first page, so an account with more than 100 spot fills in the window gets only the newest 100 while the sync reports success. This is a known defect, kept as an expected failure in the tests.

    Deposits and withdrawals are paged from a start time with OKX's `before` parameter [7]. Whether OKX then returns the oldest or the newest 100 records after it is not documented, so whether an account with more than 100 of either is read in full is unchecked.

    Only spot fills are requested. Margin fills (a separate instrument type at OKX) and all derivatives are not.

    OKX's full history is available by API in other forms TaxChain does not read yet: quarterly bill files of the trading account since February 2021 [8], and the funding account's bill history since February 2021 [9]. Reading both would cover trades, income and transfers for a whole tax year.

  • Adresse de portefeuilleNon disponible

    None

    An exchange account has no public address of its own to read. Your own wallets that send to or receive from OKX can be added as chain sources.

Ce qui est lu

OpérationStatut
Spot tradesFrom the Trading history CSV, both sides of each fill; the row structure is inferred from OKX's bills API and an open-source parser, not yet checked against a real current export. By API (sandbox only): the last 3 months, the newest 100 fills at most.Lu en partie
Trading feesWith each fill, in the asset OKX names (the Fee Unit or feeCcy), otherwise the coin of the row that carries it. A positive fee is a maker rebate and is left out, with a warning.Lu
Transfers between your OKX accountsTransfer rows of the Trading history file, as moves between your own accounts (no gain or loss).Lu
Deposits and withdrawalsNot in the Trading history file, and OKX's Funding history file is not recognised; only rows of the older Bill ID funding layout of type Deposit, Withdrawal or Transfer are read. By API (sandbox only), with the withdrawal fee, full paging past 100 unchecked. Some held states pass as completed (see Limitations).Lu en partie
ConvertsBy API only, and a convert buy comes out reversed. The CSV reader has no convert rows.Lu en partie
Perpetuals and futures: realised P&L and fundingThe sync requests spot fills only. Funding bills (OKX bill type 8) are named "fee" by CCXT and skipped, and liquidation and delivery bills are named "trade" and skipped [4].Non lu
OptionsNon lu
Margin trades and borrowing interestMargin fills are not requested, and interest deduction bills (type 7) are skipped.Non lu
Staking, Simple Earn and other earn productsThis income is booked in the funding account [9]. The sync reads the trading account's bills only.Non lu
Airdrops, event rewards and referral rewardsFunding account bills; not read.Non lu
Card or fiat purchasesFunding account bills; not read.Non lu
NFTsThe OKX Web3 wallet is self-custodial and read, if at all, as a chain source.Sans objet

Limites

  • The Trading history reader has not been checked against a real OKX export of today's file. Read the import's warnings and errors, and compare a few trades with OKX's own history.
  • Margin, perpetual, futures and options rows of the Trading history file are reported as errors and not imported. Add their results with the TaxChain CSV template.
  • Deposits, withdrawals, staking, Earn, airdrops and rewards from OKX's Funding history file are not read from it: add them with the TaxChain CSV template.
  • An API connection cannot replace a file for a full tax year: OKX keeps 3 months of fills and 7 days of trading bills behind the endpoints the sync uses [6] [3].
  • Converts bought through OKX Convert are read in the wrong direction: for a convert buy, CCXT reports the coin received as the coin given [10] [4]. Check every convert after a sync.
  • An automatic token conversion bill (type 4) that credits the account is booked as an airdrop, and its debit leg is dropped.
  • Deposits held by OKX (suspended coin, blacklisted address, frozen account, KYC limit) and withdrawals waiting on the Travel Rule vendor or on OKX's hot wallet are imported as if completed, because CCXT does not know those states [7].
  • Nothing from the funding account other than deposits, withdrawals and converts is read: add staking, Earn, airdrops and rewards with the TaxChain CSV template.
  • CSV times are read in the time zone the Time header names, such as Time(UTC+8); a header with no zone is read as UTC. OKX lets you pick the time zone when you export [1]; whether the file then names it in the header is unchecked, so choose UTC.
  • OKX on-screen history shows 90 days, but downloads reach back to January or February 2021 [11] [1]. Activity before 2021 has to be requested from OKX support.

Comment cela a été vérifié

  • 19 novembre 2026The CSV reader tested on sample rows in its own layout: both sides of buys and sells, fee asset by side, a named fee unit, maker rebates, derivatives refused, display time zones.
  • 20 novembre 2026A file with the columns OKX documents for its Trading history export: not recognised (then an expected failure). A funding row of a type OKX documents for income (staking yield, airdrop) is reported as an error, not dropped.
  • 21 novembre 2026Fixed: the Trading history export OKX documents is recognised on upload and read. Tested on OKX's documented fill (buy 0.00192834 BTC at 51,858 USDT, fee 0.00000192834 BTC) written as the two bills OKX's bills API documents, which comes out as one buy with both sides, the fee on top and no warning; on the 2023 file as BittyTax reads it, under its preamble (a sell from its Sell and Buy rows with the fee in USDT, a Transfer row, a perpetual row reported); and on what the file cannot settle (a lone quote row, a balance moving against the side, quantities disagreeing with the price: errors; a lone base row: read from the price, with a warning). Each check was mutation-tested. Not yet run on a real export.
  • 20 novembre 2026OKX's documented fills-history, deposit, withdrawal and convert responses, and two bills CCXT recorded from OKX, read through CCXT's own OKX parsers and TaxChain's normalizers. A spot fill, a deposit and a withdrawal with its fee come out right; a convert buy comes out reversed, a funding bill is skipped, an auto token conversion becomes an airdrop, and OKX deposit and withdrawal states CCXT does not know pass as settled. The last four are kept as expected failures.
  • 20 novembre 2026The OKX sync run through the real CCXT client against a server that answers as OKX documents fills-history: 60 fills in the window are all read; of 250, only the newest 100 are (expected failure).
  • 19 novembre 2026CCXT's recorded OKX responses (one spot fill, one trade bill, one funding bill) through the normalizers, with every other CCXT venue.

Ce qui le rendrait Vérifié

A real OKX Trading history export, supplied by the owner, read without errors and reconciled through the engine against the account's balances, confirming one row per coin per fill.

A reader for the Funding history file in its real columns (deposits, withdrawals, staking and earn income, rewards), tested on a real export.

Fix the paging so it walks fills-history backwards by billId (OKX returns the newest page first), and treat only OKX's final states as settled.

Read the convert side correctly (a buy gives the quote), and map OKX bill types explicitly instead of through CCXT's names: funding (8), liquidation (5), delivery (3), interest (7), auto conversion (4).

To cover a whole tax year, read the trading account's quarterly bill files and the funding account's bill history, both available by API since February 2021.

Then sync a seeded OKX demo account on the sandbox stack, and reconcile a real account (supplied by the owner) through the engine against OKX's own statement.

Comment l'ajouter

  • On okx.com, open Assets, then Order center, then the Trading history tab, and choose Download [1].
  • Pick the date range, UTC as the time zone, and CSV, and export. OKX prepares the file; download it when it is ready, and do not open and re-save it.
  • Upload the Trading history file to TaxChain; it is recognised as OKX. Read the warnings and errors the import lists: derivatives rows and any fill the file does not settle are among them.
  • Download the Funding history tab too for your records [11], but TaxChain does not read it yet: enter deposits, withdrawals and earn income with the TaxChain CSV template.

Références

  1. [1]How can I view my order history, position history, and trading history?. OKX Help Center. Downloads from Assets > Order center as CSV or PDF, from 28 January 2021; lists each export's columns.
  2. [2]BittyTax OKX parser (src/bittytax/conv/parsers/okx.py) and its issue 293, OKX parser update required. BittyTax. Written against real OKX exports from 2023: the Trading Account History file (id, Order id, Time, Trade Type, Instrument, Type, Amount, Unit, PL, Fee, Position Change, Position Balance, Balance Change, Balance, Unit) has one row per coin of a spot fill, a Buy row for the coin received and a Sell row for the coin given, paired by id or else by order; some fills had one of the two rows missing.
  3. [3]API v5: Get bills details (last 7 days) and (last 3 months). OKX. Trading account bills, sorted most recent first; 7 days (account/bills) or 3 months (account/bills-archive). One bill per balance currency: sz is the quantity, fee is negative when charged, balChg is the signed change net of the fee.
  4. [4]CCXT 4.5.93, okx exchange class (myokx extends it). CCXT. fetchMyTrades reads fills-history for SPOT unless told otherwise; fetchLedger reads account/bills and sends no start time; parseConversion takes baseCcy as the coin given; parseLedgerEntryType maps bill type 8 (funding) to fee and 4 (auto token conversion) to rebate.
  5. [5]API v5: Demo trading services. OKX. Demo requests carry the header x-simulated-trading: 1.
  6. [6]API v5: Get transaction details (last 3 months), GET /api/v5/trade/fills-history. OKX. instType required; data from the last 3 months; at most 100 rows a request; begin/end filter on ts, after/before page on billId.
  7. [7]API v5: Get deposit history and Get withdrawal history. OKX. Reverse chronological; 100 most recent by default, 100 at most; after/before page on ts. Deposit states 0, 1, 2, 8, 11–14; withdrawal states include 17 and 19.
  8. [8]API v5: Apply bills details (since 2021) and Get bills details (since 2021). OKX. Quarterly files of trading account bills since 1 February 2021, except the current quarter; applied for (12 a day), ready in about 2 hours; unified account only.
  9. [9]API v5: Asset bills details and Asset bills history. OKX. Funding account bills: past month (asset/bills) or all time since 1 February 2021 (asset/bills-history). Types include staking yield, Simple Earn, airdrops, rewards, converts and fiat purchases.
  10. [10]API v5: Get convert history, GET /api/v5/asset/convert/history. OKX. side is the trade side based on baseCcy: buy means the base was received.
  11. [11]How do I download my account statements?. OKX Help Center. Trading and funding history downloadable back to 1 February 2021; on-screen history shows 90 days.

Dernière vérification par rapport à la documentation de la plateforme et au code de TaxChain le 21 novembre 2026.