# OKX, in one book with the bank and the cards

URL: https://www.orla.finance/en/okx
Markdown twin of that page. Append `.md` to any Orla page URL to get one.

A key, a secret and a passphrase, and your OKX history arrives as ledger lines with a cost basis behind them.

Read only, and refused if the key can trade or withdraw. How we check that is below.

#### The spot side becomes a ledger. The derivative side stays a balance

Only one of the two can honestly become tax rows, so the line is drawn here.

- Spot fills become two legs at the price they happened at, and the fee its own row.
- Margin and perpetual positions are not booked as trades: a position is not a disposal, and inventing one would poison the gains report.
- Balances mirror regardless, so the total is right even where the history stops.
- Deposits and withdrawals become transfers and pair with your own wallets.
- The first sync reaches back to 1 January of the previous calendar year, then keeps up hourly.

#### Three credentials, and a permission string we read before saving any of them

OKX is the one venue that needs a passphrase as well as a key and a secret.

- What OKX asks for: Three fields, not two: an API key, a secret and the passphrase you set when you created the key. All three are needed before anything can be read.
- What we ask OKX: Their own answer: OKX reports the permissions on a key as a list, and if that list mentions trading or withdrawal the key is rejected outright.
- If the list is absent: Refused. An answer without permissions counts as no answer: a venue that renamed the field would otherwise pass every key as read only.
- Where the secrets live: Encrypted at rest, all three, and never returned by our API again.
- If the key stops working: Sync stops after repeated auth failures, the space owner gets one message, and you replace the credentials in place.

#### Withdrawing to your own wallet does not create a gain

Paired, it is one internal move; unpaired, it is not counted as a sale.

Exchanges connect on every plan, the free one included. A plan counts the rows synced in a month, not the connections.
