[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D9NE6ZTA8N5HMGG8Q2JRWD":3,"skill-same:01M7D9NE6ZTA8N5HMGG8Q2JRWD":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":14,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7D9NE6ZTA8N5HMGG8Q2JRWD","okx-api",null,"Trading and account access on OKX's v5 API using an API key, passphrase and secret key held by the DIME credential proxy. Covers the whole flow: building OKX's signed string, reading instruments, tickers and orderbook, reading balances and positions, placing, amending and cancelling orders, demo trading, and what to do about private WebSocket streams. Use for ANY request to www.okx.com — including \"buy BTC on OKX\", \"what is my OKX balance\", \"cancel my OKX orders\", \"show my OKX positions\", or a 403 from the credential proxy on an OKX call. Read this BEFORE calling OKX: the signed string covers the request path INCLUDING its query string and uses a timestamp format OKX will reject if you use the obvious one.","tradeparadigm\u002Fdt-apps","tradeparadigm","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F72768132?v=4","01M7D9KY0PDJW6NWY8P936YNEX","Paradigm","01M7D9KY1BYPTKX9MGQHZKW4BP",0,"MIT","https:\u002F\u002Fgithub.com\u002Ftradeparadigm\u002Fdt-apps\u002Fblob\u002Fmain\u002Fapps\u002Fokx\u002Fskills\u002Fokx-api\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: okx-api\ndescription: >\n  Trading and account access on OKX's v5 API using an API key, passphrase and\n  secret key held by the DIME credential proxy. Covers the whole flow: building\n  OKX's signed string, reading instruments, tickers and orderbook, reading\n  balances and positions, placing, amending and cancelling orders, demo\n  trading, and what to do about private WebSocket streams. Use for ANY request\n  to www.okx.com — including \"buy BTC on OKX\", \"what is my OKX balance\",\n  \"cancel my OKX orders\", \"show my OKX positions\", or a 403 from the credential\n  proxy on an OKX call. Read this BEFORE calling OKX: the signed string covers\n  the request path INCLUDING its query string and uses a timestamp format OKX\n  will reject if you use the obvious one.\nmetadata:\n  author: tradeparadigm\n---\n\n# OKX\n\nOKX is a centralised exchange. One API — v5 — serves spot, margin, perpetual\nswaps, futures and options; which one you are trading is determined by the\ninstrument id you pass, not by a different endpoint.\n\nYour `AGENTS.md` already explains the placeholder mechanism in general — how\n`CRED_\u003CNAME>` and `CRED_\u003CNAME>_META` work, what the `sign-` prefix means, and\nhow to name the `X-Dime-Sign-` header. This file assumes that and covers only\nwhat is specific to OKX.\n\n## Host\n\n```\nhttps:\u002F\u002Fwww.okx.com\n```\n\nOne host for everything, live and demo alike.\n\n## What you hold, and what you send\n\nOKX authenticates with three values. **You hold one of them and never see the\nother two.**\n\n| Value | How it reaches OKX | What you do |\n|---|---|---|\n| API key | Proxy attaches `OK-ACCESS-KEY` | nothing |\n| Passphrase | Proxy attaches `OK-ACCESS-PASSPHRASE` | nothing |\n| Secret key | Proxy signs with it | send a `sign-` placeholder + the bytes to sign |\n\nSo a private request from you carries **two** headers you set yourself and one\nplaceholder:\n\n```\nOK-ACCESS-TIMESTAMP: 2026-01-01T00:00:00.000Z\nOK-ACCESS-SIGN:      \u003Cthe sign- placeholder>\nContent-Type:        application\u002Fjson\n```\n\nDo **not** try to set `OK-ACCESS-KEY` or `OK-ACCESS-PASSPHRASE`. You do not have\nthose values, and the proxy adds them on the way out.\n\nIf the credential was enrolled but a call still fails on authentication, check\nthat all three OKX credentials are enrolled. A private call with any one of the\nthree missing is rejected by OKX, and the failure does not say which one.\n\n## The signed string\n\n```\ntimestamp + method + requestPath + body\n```\n\nconcatenated with no separators, where:\n\n- **`timestamp`** is ISO 8601 in UTC with **milliseconds and a trailing `Z`** —\n  `2026-01-01T00:00:00.000Z`. It must be the byte-for-byte same string you put\n  in the `OK-ACCESS-TIMESTAMP` header. A Unix epoch timestamp is rejected, and\n  so is an ISO string without the milliseconds.\n- **`method`** is the HTTP verb in **upper case**: `GET`, `POST`.\n- **`requestPath`** is the path **including the query string** — for a GET that\n  is `\u002Fapi\u002Fv5\u002Faccount\u002Fbalance?ccy=USDT`, not `\u002Fapi\u002Fv5\u002Faccount\u002Fbalance`. This is\n  the most common mistake.\n- **`body`** is the raw JSON body for a POST, byte for byte as you will send\n  it, and the **empty string** for a GET.\n\nThe result is base64, not hex. Bybit uses hex; OKX does not. The credential\ntemplate already sets this, so you do not have to — but if you are comparing\nagainst a Bybit example, that is the difference.\n\n### Worked example\n\nRead your USDT balance.\n\n```\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fbalance?ccy=USDT\n```\n\n1. Take an ISO 8601 UTC timestamp with milliseconds: `2026-01-01T00:00:00.000Z`.\n   Put it in `OK-ACCESS-TIMESTAMP`.\n2. Build the signed string — timestamp, method, path with query, empty body:\n\n   ```\n   2026-01-01T00:00:00.000ZGET\u002Fapi\u002Fv5\u002Faccount\u002Fbalance?ccy=USDT\n   ```\n\n3. Base64-encode **those bytes** and send them in `X-Dime-Sign-\u003Clabel>`, where\n   `\u003Clabel>` is the secret credential's label. (This base64 is the transport for\n   the payload. The base64 of the signature itself is separate, and the proxy\n   does it.)\n4. Put the `sign-` placeholder in `OK-ACCESS-SIGN`.\n\nThe proxy computes HMAC-SHA256 over your bytes with the secret, base64-encodes\nthe digest, writes it into `OK-ACCESS-SIGN` in place of the placeholder, adds\n`OK-ACCESS-KEY` and `OK-ACCESS-PASSPHRASE`, strips the `X-Dime-Sign-` header,\nand forwards. OKX sees an ordinary signed OKX request.\n\n**Serialise a POST body once.** Sign the exact string you send. If you build the\nJSON for signing and let an HTTP library re-serialise it when sending — reordered\nkeys, different spacing, a float rendered differently — OKX recomputes over what\nit received and you get `50113 Invalid Sign`.\n\n## Which calls need the credentials\n\nThe proxy attaches the key and passphrase, and demands the signature\nplaceholder, on exactly these paths:\n\n```\n\u002Fapi\u002Fv5\u002Ftrade\u002F*        \u002Fapi\u002Fv5\u002Faccount\u002F*       \u002Fapi\u002Fv5\u002Fasset\u002F*\n\u002Fapi\u002Fv5\u002Fusers\u002F*        \u002Fapi\u002Fv5\u002Fsubaccount\u002F*    \u002Fapi\u002Fv5\u002Fcopytrading\u002F*\n```\n\nEverything under `\u002Fapi\u002Fv5\u002Fmarket\u002F*` and `\u002Fapi\u002Fv5\u002Fpublic\u002F*` is open. Send those\nwith no auth headers, no timestamp and no signature. The proxy is not watching\nthose paths, so a placeholder sent to one goes to OKX verbatim.\n\n## Market data (public, unsigned)\n\n```\nGET \u002Fapi\u002Fv5\u002Fpublic\u002Finstruments?instType=SWAP\nGET \u002Fapi\u002Fv5\u002Fmarket\u002Fticker?instId=BTC-USDT-SWAP\nGET \u002Fapi\u002Fv5\u002Fmarket\u002Fbooks?instId=BTC-USDT-SWAP&sz=20\nGET \u002Fapi\u002Fv5\u002Fmarket\u002Fcandles?instId=BTC-USDT-SWAP&bar=1H&limit=100\n```\n\n`instId` is OKX's instrument name and encodes the product:\n\n| Shape | Product |\n|---|---|\n| `BTC-USDT` | spot |\n| `BTC-USDT-SWAP` | perpetual swap |\n| `BTC-USD-260327` | dated future |\n| `BTC-USD-260327-80000-C` | option |\n\nCheck `\u002Fapi\u002Fv5\u002Fpublic\u002Finstruments` before your first order on an instrument: it\ncarries `lotSz`, `tickSz` and `minSz`, and an order that is not a multiple of\nthose is rejected.\n\n`ordType` prices and sizes are in **contracts** for SWAP and FUTURES, not in the\nbase coin. `ctVal` on the instrument says how much one contract is worth. This\ncatches people out — \"buy 1 BTC-USDT-SWAP\" is one contract, not one bitcoin.\n\n## Account state (signed)\n\n```\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fbalance\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fbalance?ccy=USDT\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fpositions?instType=SWAP\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fconfig                      # account mode, position mode\nGET \u002Fapi\u002Fv5\u002Ftrade\u002Forders-pending?instType=SWAP  # working orders\nGET \u002Fapi\u002Fv5\u002Ftrade\u002Forders-history?instType=SWAP&limit=50\nGET \u002Fapi\u002Fv5\u002Ftrade\u002Ffills?instType=SWAP&limit=50\n```\n\n`\u002Fapi\u002Fv5\u002Faccount\u002Fconfig` is worth reading once before trading: it tells you the\naccount's `acctLv` (cash, single-currency margin, multi-currency margin,\nportfolio margin) and `posMode` (`net_mode` or `long_short_mode`), and the\ncorrect order parameters differ between them.\n\n## Placing an order\n\n```\nPOST \u002Fapi\u002Fv5\u002Ftrade\u002Forder\nContent-Type: application\u002Fjson\n```\n\n```json\n{\n  \"instId\": \"BTC-USDT-SWAP\",\n  \"tdMode\": \"cross\",\n  \"side\": \"buy\",\n  \"ordType\": \"limit\",\n  \"px\": \"60000\",\n  \"sz\": \"1\",\n  \"clOrdId\": \"myorder1\"\n}\n```\n\n- `tdMode` is required: `cash` for spot, `cross` or `isolated` for margin and\n  derivatives. Getting this wrong is the most common rejection.\n- `side` is `buy` or `sell`, lower case.\n- `ordType`: `limit`, `market`, `post_only`, `fok`, `ioc`.\n- `px` and `sz` are **strings**. A market order omits `px`.\n- `clOrdId` is your own id — letters and digits only, up to 32 characters, **no\n  hyphens**. Set it: it is how you cancel without first looking up OKX's\n  `ordId`, and how a retry after a timeout avoids a duplicate.\n- In `long_short_mode` you must also send `posSide` (`long` or `short`). In\n  `net_mode` you must not.\n\n**A 200 does not mean the order was placed.** OKX answers with an envelope:\n\n```json\n{\"code\":\"0\",\"msg\":\"\",\"data\":[{\"ordId\":\"...\",\"clOrdId\":\"myorder1\",\"sCode\":\"0\",\"sMsg\":\"\"}]}\n```\n\nCheck the **outer `code`** (`\"0\"` is success) and then the **per-order `sCode`**\ninside `data`. A batch can return outer `code: \"1\"` with some orders accepted;\n`sCode` is the one that says what happened to your order.\n\n## Amending and cancelling\n\n```\nPOST \u002Fapi\u002Fv5\u002Ftrade\u002Famend-order   {\"instId\":\"BTC-USDT-SWAP\",\"clOrdId\":\"myorder1\",\"newPx\":\"59000\"}\nPOST \u002Fapi\u002Fv5\u002Ftrade\u002Fcancel-order  {\"instId\":\"BTC-USDT-SWAP\",\"clOrdId\":\"myorder1\"}\nPOST \u002Fapi\u002Fv5\u002Ftrade\u002Fcancel-batch-orders  [{\"instId\":\"BTC-USDT-SWAP\",\"clOrdId\":\"myorder1\"}]\n```\n\nAll are `POST`. `instId` is required alongside the order id. There is no\n\"cancel everything\" endpoint that takes no arguments — list working orders with\n`\u002Fapi\u002Fv5\u002Ftrade\u002Forders-pending` and cancel them in a batch.\n\n## Demo trading\n\nOKX's demo environment is the **same host** with one extra header:\n\n```\nx-simulated-trading: 1\n```\n\nDemo API keys are different keys from live keys, created separately in OKX's\ndemo section. They enrol exactly the same way.\n\nBecause both live and demo use `www.okx.com`, **only one OKX credential set can\nbe enrolled at a time**. Two sets scoped to the same host make each other's\nrequests fail — each one's signing rule demands its own placeholder on the same\npaths. If both a live and a demo set appear to be enrolled, say so rather than\nguessing which is in effect.\n\n## WebSocket\n\n**Public streams work.** `wss:\u002F\u002Fws.okx.com:8443\u002Fws\u002Fv5\u002Fpublic` needs no\nauthentication — subscribe and read.\n\n**Private streams do not work through the credential proxy.** OKX authenticates\n`wss:\u002F\u002Fws.okx.com:8443\u002Fws\u002Fv5\u002Fprivate` with a `login` frame sent after the\nconnection opens, carrying a signature over `timestamp + 'GET' + '\u002Fusers\u002Fself\u002Fverify'`.\nThe proxy signs HTTP requests; it does not sign WebSocket frames.\n\nFor order updates, fills and position changes, poll the signed REST endpoints —\n`\u002Fapi\u002Fv5\u002Ftrade\u002Forders-pending` for working orders, `\u002Fapi\u002Fv5\u002Ftrade\u002Ffills` for\nfills. Say so if asked to stream private data: it is a real limitation, not\nsomething to work around by asking for the secret.\n\n## When something fails\n\n- **403 from the credential proxy**, body naming `placeholder_absent` — you\n  called a signed path without putting the placeholder in `OK-ACCESS-SIGN`. The\n  body lists where it looked.\n- **A key, passphrase or signature error can mean the proxy substituted\n  nothing.** When the host or path is outside what your credentials cover, the\n  proxy forwards the request untouched, your placeholder arrives at OKX as a\n  literal string, and the two injected headers never arrive at all. OKX then\n  complains about whichever it checks first. Check the host and the path before\n  you touch the request.\n- **`50113 Invalid Sign`** — the string you signed is not what OKX\n  reconstructed. In order of likelihood: the query string was left off\n  `requestPath`; the timestamp in the header differs from the one you signed;\n  the body was re-serialised after signing; the method was lower case.\n- **`50102 Timestamp request expired`** — your timestamp is more than 30 seconds\n  from OKX's clock, or it is not in ISO 8601 with milliseconds.\n- **`50111 Invalid OK-ACCESS-KEY` \u002F `50105 Invalid OK-ACCESS-PASSPHRASE`** — the\n  enrolled key or passphrase is wrong, or one of the three credentials was not\n  enrolled. You cannot inspect them; report which call failed and let the user\n  re-enrol.\n- **`51000 Parameter … error`** — usually `tdMode` missing or wrong for the\n  instrument type, or `posSide` sent in `net_mode` (or omitted in\n  `long_short_mode`).\n\n## Reference\n\nFull API documentation: https:\u002F\u002Fwww.okx.com\u002Fdocs-v5\u002Fen\u002F\n\nGo there for anything this file does not cover — full parameter lists, rate\nlimits, the complete error code table. This file is the part OKX's own docs\ncannot tell you: that the key, passphrase and secret are not yours to hold, and\nwhat to send instead.\n","# OKX\n\nOKX is a centralised exchange. One API — v5 — serves spot, margin, perpetual\nswaps, futures and options; which one you are trading is determined by the\ninstrument id you pass, not by a different endpoint.\n\nYour `AGENTS.md` already explains the placeholder mechanism in general — how\n`CRED_\u003CNAME>` and `CRED_\u003CNAME>_META` work, what the `sign-` prefix means, and\nhow to name the `X-Dime-Sign-` header. This file assumes that and covers only\nwhat is specific to OKX.\n\n## Host\n\n```\nhttps:\u002F\u002Fwww.okx.com\n```\n\nOne host for everything, live and demo alike.\n\n## What you hold, and what you send\n\nOKX authenticates with three values. **You hold one of them and never see the\nother two.**\n\n| Value | How it reaches OKX | What you do |\n|---|---|---|\n| API key | Proxy attaches `OK-ACCESS-KEY` | nothing |\n| Passphrase | Proxy attaches `OK-ACCESS-PASSPHRASE` | nothing |\n| Secret key | Proxy signs with it | send a `sign-` placeholder + the bytes to sign |\n\nSo a private request from you carries **two** headers you set yourself and one\nplaceholder:\n\n```\nOK-ACCESS-TIMESTAMP: 2026-01-01T00:00:00.000Z\nOK-ACCESS-SIGN:      \u003Cthe sign- placeholder>\nContent-Type:        application\u002Fjson\n```\n\nDo **not** try to set `OK-ACCESS-KEY` or `OK-ACCESS-PASSPHRASE`. You do not have\nthose values, and the proxy adds them on the way out.\n\nIf the credential was enrolled but a call still fails on authentication, check\nthat all three OKX credentials are enrolled. A private call with any one of the\nthree missing is rejected by OKX, and the failure does not say which one.\n\n## The signed string\n\n```\ntimestamp + method + requestPath + body\n```\n\nconcatenated with no separators, where:\n\n- **`timestamp`** is ISO 8601 in UTC with **milliseconds and a trailing `Z`** —\n  `2026-01-01T00:00:00.000Z`. It must be the byte-for-byte same string you put\n  in the `OK-ACCESS-TIMESTAMP` header. A Unix epoch timestamp is rejected, and\n  so is an ISO string without the milliseconds.\n- **`method`** is the HTTP verb in **upper case**: `GET`, `POST`.\n- **`requestPath`** is the path **including the query string** — for a GET that\n  is `\u002Fapi\u002Fv5\u002Faccount\u002Fbalance?ccy=USDT`, not `\u002Fapi\u002Fv5\u002Faccount\u002Fbalance`. This is\n  the most common mistake.\n- **`body`** is the raw JSON body for a POST, byte for byte as you will send\n  it, and the **empty string** for a GET.\n\nThe result is base64, not hex. Bybit uses hex; OKX does not. The credential\ntemplate already sets this, so you do not have to — but if you are comparing\nagainst a Bybit example, that is the difference.\n\n### Worked example\n\nRead your USDT balance.\n\n```\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fbalance?ccy=USDT\n```\n\n1. Take an ISO 8601 UTC timestamp with milliseconds: `2026-01-01T00:00:00.000Z`.\n   Put it in `OK-ACCESS-TIMESTAMP`.\n2. Build the signed string — timestamp, method, path with query, empty body:\n\n   ```\n   2026-01-01T00:00:00.000ZGET\u002Fapi\u002Fv5\u002Faccount\u002Fbalance?ccy=USDT\n   ```\n\n3. Base64-encode **those bytes** and send them in `X-Dime-Sign-\u003Clabel>`, where\n   `\u003Clabel>` is the secret credential's label. (This base64 is the transport for\n   the payload. The base64 of the signature itself is separate, and the proxy\n   does it.)\n4. Put the `sign-` placeholder in `OK-ACCESS-SIGN`.\n\nThe proxy computes HMAC-SHA256 over your bytes with the secret, base64-encodes\nthe digest, writes it into `OK-ACCESS-SIGN` in place of the placeholder, adds\n`OK-ACCESS-KEY` and `OK-ACCESS-PASSPHRASE`, strips the `X-Dime-Sign-` header,\nand forwards. OKX sees an ordinary signed OKX request.\n\n**Serialise a POST body once.** Sign the exact string you send. If you build the\nJSON for signing and let an HTTP library re-serialise it when sending — reordered\nkeys, different spacing, a float rendered differently — OKX recomputes over what\nit received and you get `50113 Invalid Sign`.\n\n## Which calls need the credentials\n\nThe proxy attaches the key and passphrase, and demands the signature\nplaceholder, on exactly these paths:\n\n```\n\u002Fapi\u002Fv5\u002Ftrade\u002F*        \u002Fapi\u002Fv5\u002Faccount\u002F*       \u002Fapi\u002Fv5\u002Fasset\u002F*\n\u002Fapi\u002Fv5\u002Fusers\u002F*        \u002Fapi\u002Fv5\u002Fsubaccount\u002F*    \u002Fapi\u002Fv5\u002Fcopytrading\u002F*\n```\n\nEverything under `\u002Fapi\u002Fv5\u002Fmarket\u002F*` and `\u002Fapi\u002Fv5\u002Fpublic\u002F*` is open. Send those\nwith no auth headers, no timestamp and no signature. The proxy is not watching\nthose paths, so a placeholder sent to one goes to OKX verbatim.\n\n## Market data (public, unsigned)\n\n```\nGET \u002Fapi\u002Fv5\u002Fpublic\u002Finstruments?instType=SWAP\nGET \u002Fapi\u002Fv5\u002Fmarket\u002Fticker?instId=BTC-USDT-SWAP\nGET \u002Fapi\u002Fv5\u002Fmarket\u002Fbooks?instId=BTC-USDT-SWAP&sz=20\nGET \u002Fapi\u002Fv5\u002Fmarket\u002Fcandles?instId=BTC-USDT-SWAP&bar=1H&limit=100\n```\n\n`instId` is OKX's instrument name and encodes the product:\n\n| Shape | Product |\n|---|---|\n| `BTC-USDT` | spot |\n| `BTC-USDT-SWAP` | perpetual swap |\n| `BTC-USD-260327` | dated future |\n| `BTC-USD-260327-80000-C` | option |\n\nCheck `\u002Fapi\u002Fv5\u002Fpublic\u002Finstruments` before your first order on an instrument: it\ncarries `lotSz`, `tickSz` and `minSz`, and an order that is not a multiple of\nthose is rejected.\n\n`ordType` prices and sizes are in **contracts** for SWAP and FUTURES, not in the\nbase coin. `ctVal` on the instrument says how much one contract is worth. This\ncatches people out — \"buy 1 BTC-USDT-SWAP\" is one contract, not one bitcoin.\n\n## Account state (signed)\n\n```\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fbalance\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fbalance?ccy=USDT\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fpositions?instType=SWAP\nGET \u002Fapi\u002Fv5\u002Faccount\u002Fconfig                      # account mode, position mode\nGET \u002Fapi\u002Fv5\u002Ftrade\u002Forders-pending?instType=SWAP  # working orders\nGET \u002Fapi\u002Fv5\u002Ftrade\u002Forders-history?instType=SWAP&limit=50\nGET \u002Fapi\u002Fv5\u002Ftrade\u002Ffills?instType=SWAP&limit=50\n```\n\n`\u002Fapi\u002Fv5\u002Faccount\u002Fconfig` is worth reading once before trading: it tells you the\naccount's `acctLv` (cash, single-currency margin, multi-currency margin,\nportfolio margin) and `posMode` (`net_mode` or `long_short_mode`), and the\ncorrect order parameters differ between them.\n\n## Placing an order\n\n```\nPOST \u002Fapi\u002Fv5\u002Ftrade\u002Forder\nContent-Type: application\u002Fjson\n```\n\n```json\n{\n  \"instId\": \"BTC-USDT-SWAP\",\n  \"tdMode\": \"cross\",\n  \"side\": \"buy\",\n  \"ordType\": \"limit\",\n  \"px\": \"60000\",\n  \"sz\": \"1\",\n  \"clOrdId\": \"myorder1\"\n}\n```\n\n- `tdMode` is required: `cash` for spot, `cross` or `isolated` for margin and\n  derivatives. Getting this wrong is the most common rejection.\n- `side` is `buy` or `sell`, lower case.\n- `ordType`: `limit`, `market`, `post_only`, `fok`, `ioc`.\n- `px` and `sz` are **strings**. A market order omits `px`.\n- `clOrdId` is your own id — letters and digits only, up to 32 characters, **no\n  hyphens**. Set it: it is how you cancel without first looking up OKX's\n  `ordId`, and how a retry after a timeout avoids a duplicate.\n- In `long_short_mode` you must also send `posSide` (`long` or `short`). In\n  `net_mode` you must not.\n\n**A 200 does not mean the order was placed.** OKX answers with an envelope:\n\n```json\n{\"code\":\"0\",\"msg\":\"\",\"data\":[{\"ordId\":\"...\",\"clOrdId\":\"myorder1\",\"sCode\":\"0\",\"sMsg\":\"\"}]}\n```\n\nCheck the **outer `code`** (`\"0\"` is success) and then the **per-order `sCode`**\ninside `data`. A batch can return outer `code: \"1\"` with some orders accepted;\n`sCode` is the one that says what happened to your order.\n\n## Amending and cancelling\n\n```\nPOST \u002Fapi\u002Fv5\u002Ftrade\u002Famend-order   {\"instId\":\"BTC-USDT-SWAP\",\"clOrdId\":\"myorder1\",\"newPx\":\"59000\"}\nPOST \u002Fapi\u002Fv5\u002Ftrade\u002Fcancel-order  {\"instId\":\"BTC-USDT-SWAP\",\"clOrdId\":\"myorder1\"}\nPOST \u002Fapi\u002Fv5\u002Ftrade\u002Fcancel-batch-orders  [{\"instId\":\"BTC-USDT-SWAP\",\"clOrdId\":\"myorder1\"}]\n```\n\nAll are `POST`. `instId` is required alongside the order id. There is no\n\"cancel everything\" endpoint that takes no arguments — list working orders with\n`\u002Fapi\u002Fv5\u002Ftrade\u002Forders-pending` and cancel them in a batch.\n\n## Demo trading\n\nOKX's demo environment is the **same host** with one extra header:\n\n```\nx-simulated-trading: 1\n```\n\nDemo API keys are different keys from live keys, created separately in OKX's\ndemo section. They enrol exactly the same way.\n\nBecause both live and demo use `www.okx.com`, **only one OKX credential set can\nbe enrolled at a time**. Two sets scoped to the same host make each other's\nrequests fail — each one's signing rule demands its own placeholder on the same\npaths. If both a live and a demo set appear to be enrolled, say so rather than\nguessing which is in effect.\n\n## WebSocket\n\n**Public streams work.** `wss:\u002F\u002Fws.okx.com:8443\u002Fws\u002Fv5\u002Fpublic` needs no\nauthentication — subscribe and read.\n\n**Private streams do not work through the credential proxy.** OKX authenticates\n`wss:\u002F\u002Fws.okx.com:8443\u002Fws\u002Fv5\u002Fprivate` with a `login` frame sent after the\nconnection opens, carrying a signature over `timestamp + 'GET' + '\u002Fusers\u002Fself\u002Fverify'`.\nThe proxy signs HTTP requests; it does not sign WebSocket frames.\n\nFor order updates, fills and position changes, poll the signed REST endpoints —\n`\u002Fapi\u002Fv5\u002Ftrade\u002Forders-pending` for working orders, `\u002Fapi\u002Fv5\u002Ftrade\u002Ffills` for\nfills. Say so if asked to stream private data: it is a real limitation, not\nsomething to work around by asking for the secret.\n\n## When something fails\n\n- **403 from the credential proxy**, body naming `placeholder_absent` — you\n  called a signed path without putting the placeholder in `OK-ACCESS-SIGN`. The\n  body lists where it looked.\n- **A key, passphrase or signature error can mean the proxy substituted\n  nothing.** When the host or path is outside what your credentials cover, the\n  proxy forwards the request untouched, your placeholder arrives at OKX as a\n  literal string, and the two injected headers never arrive at all. OKX then\n  complains about whichever it checks first. Check the host and the path before\n  you touch the request.\n- **`50113 Invalid Sign`** — the string you signed is not what OKX\n  reconstructed. In order of likelihood: the query string was left off\n  `requestPath`; the timestamp in the header differs from the one you signed;\n  the body was re-serialised after signing; the method was lower case.\n- **`50102 Timestamp request expired`** — your timestamp is more than 30 seconds\n  from OKX's clock, or it is not in ISO 8601 with milliseconds.\n- **`50111 Invalid OK-ACCESS-KEY` \u002F `50105 Invalid OK-ACCESS-PASSPHRASE`** — the\n  enrolled key or passphrase is wrong, or one of the three credentials was not\n  enrolled. You cannot inspect them; report which call failed and let the user\n  re-enrol.\n- **`51000 Parameter … error`** — usually `tdMode` missing or wrong for the\n  instrument type, or `posSide` sent in `net_mode` (or omitted in\n  `long_short_mode`).\n\n## Reference\n\nFull API documentation: https:\u002F\u002Fwww.okx.com\u002Fdocs-v5\u002Fen\u002F\n\nGo there for anything this file does not cover — full parameter lists, rate\nlimits, the complete error code table. This file is the part OKX's own docs\ncannot tell you: that the key, passphrase and secret are not yours to hold, and\nwhat to send instead.\n",{"name":5,"metadata":24,"description":25},{"author":9},"Trading and account access on OKX's v5 API using an API key, passphrase and secret key held by the DIME credential proxy. Covers the whole flow: building OKX's signed string, reading instruments, tickers and orderbook, reading balances and positions, placing, amending and cancelling orders, demo trading, and what to do about private WebSocket streams. Use for ANY request to www.okx.com — including \"buy BTC on OKX\", \"what is my OKX balance\", \"cancel my OKX orders\", \"show my OKX positions\", or a 403 from the credential proxy on an OKX call. Read this BEFORE calling OKX: the signed string covers the request path INCLUDING its query string and uses a timestamp format OKX will reject if you use the obvious one.\n","main","4befefc366f86a32c20711cf3798aaf13df1cd59","apps\u002Fokx\u002Fskills\u002Fokx-api","https:\u002F\u002Fgithub.com\u002Ftradeparadigm\u002Fdt-apps","https:\u002F\u002Fgithub.com\u002Ftradeparadigm","https:\u002F\u002Fparadigm.co\u002F","2026-11-13 17:14:22",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add tradeparadigm\u002Fdt-apps --skill okx-api",{"tool":39,"command":40},"bunx","bunx skills add tradeparadigm\u002Fdt-apps --skill okx-api",{"tool":42,"command":43},"pnpm","pnpm dlx skills add tradeparadigm\u002Fdt-apps --skill okx-api","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Ftradeparadigm\u002Fdt-apps\u002Fblob\u002Fmain\u002Fapps\u002Fokx\u002Fskills\u002Fokx-api\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7D9RW0ZFXNH3MCGZE2B9WHY","example-api","A skill body that exists so the fixture is a complete app. It teaches nothing and is never published.","https:\u002F\u002Fgithub.com\u002Ftradeparadigm\u002Fdt-apps\u002Fblob\u002Fmain\u002Fscripts\u002Ftestdata\u002Fapps\u002Fexample\u002Fskills\u002Fexample-api\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7D9RN7GJCJR5QA2ZCE4MPTH","telegram-bot","Send messages, photos and files to Telegram through the user's own bot, using a bot token held by the DIME credential proxy. Covers finding the chats the bot can reach, posting to a private chat, group or channel, editing and deleting what it sent, and sending from a data feed. Use for ANY request to message, notify or alert the user on Telegram, \"send this to my Telegram\", \"post alerts to my channel\", or a 403 from the credential proxy on api.telegram.org.","https:\u002F\u002Fgithub.com\u002Ftradeparadigm\u002Fdt-apps\u002Fblob\u002Fmain\u002Fapps\u002Ftelegram\u002Fskills\u002Ftelegram-bot\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7D9R7K7RPTJ4T7DZRHXD156","paradigm-rfq-trader","Trigger institutional block trades via Paradigm's DRFQv2 flow. The workflow is venue-agnostic — resolve instruments, build the RFQ \u002F order payload, benchmark, run a confirmation gate, submit, verify settlement. Per-venue specifics (fair-value sources, naming conventions, edge syntax, settlement checks) live in references\u002Fvenues.md. In scope today: PRDX (Paradex, primary focus) and DBT (Deribit). Adding more DRFQv2 venues is a references\u002Fvenues.md edit, not a skill-body change. Covers takers (build, benchmark, cross) and makers (poll, price, manage). Every state-changing action goes through an explicit confirmation gate. Needs both Paradigm credentials enrolled. Use when the user asks to \"send a Paradigm block RFQ\", \"block-trade X BTC\", \"send a BTC straddle on Paradex \u002F Deribit\", \"quote rfq_X\", \"hit the best bid\", \"cancel rfq_X\". Does NOT cover pricing a structure without trading (its legs' current marks are paradigm-data-discovery's), small central-order-book trades, post-trade analysis (paradigm-block-analyst), historical tape (paradigm-data-discovery).","https:\u002F\u002Fgithub.com\u002Ftradeparadigm\u002Fdt-apps\u002Fblob\u002Fmain\u002Fapps\u002Fparadigm\u002Fskills\u002Fparadigm-rfq-trader\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7D9QV6WFQDW717AXTW7GJKE","paradigm-options-recap","Options market recap for a requested or default window, invoked via \u002Frecap. Parses \"\u002Frecap [asset] [options] [window]\" (e.g. \"\u002Frecap btc options 8h\") and builds the fixed four-section recap — Snapshot, Biggest Print, Block Flow, Vol Surface — from bounded raw exchange venue files and source tapes, never from Dime hot files, read with the pod's AWS access. Use when the user types \u002Frecap or asks for a market recap, an options flow summary, \"what happened in BTC options\" or \"last Xh of flow\". A single question is not a recap: the biggest print across venues is paradigm-data-discovery's (paradigm-api reads only Paradigm's own tape), and the vol surface, one IV or one venue's data is paradigm-data-discovery's, as are dataset inventory, schema and historical lookups. The output format is fixed — always the same four sections in the same order.","https:\u002F\u002Fgithub.com\u002Ftradeparadigm\u002Fdt-apps\u002Fblob\u002Fmain\u002Fapps\u002Fparadigm\u002Fskills\u002Fparadigm-options-recap\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7D9QJYMTHRTDVJFW3AC0HDN","paradigm-data-discovery","Catalog and query launcher for raw market data available to Dime in s3:\u002F\u002Fdt-exchange-venue-data, s3:\u002F\u002Fdt-paradigm-data, and s3:\u002F\u002Fdt-paradex-data, read with the pod's AWS access. Use for data inventory, coverage, schema and historical analysis, for current venue market data (marks, IV, greeks, OI, funding, spot) on Deribit, OKX, Bybit and Bullish, and for recent block trades when the user has no Paradigm credentials enrolled (with them, paradigm-api reads the live tape). Explains the per-venue raw files and lets the model choose the bounded reads needed for the question. Does not cover account state, positions, vaults, or order placement.","https:\u002F\u002Fgithub.com\u002Ftradeparadigm\u002Fdt-apps\u002Fblob\u002Fmain\u002Fapps\u002Fparadigm\u002Fskills\u002Fparadigm-data-discovery\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7D9Q3F60BDBMC8PEGH1VBZG","paradigm-block-analyst","Cross-venue analysis of Paradigm RFQ block trades using live market data from Deribit, OKX, and Bybit. Invoked as `\u002Fanalyze \u003Crfq_id> \u003Crfq description>`: resolves the rfq_id by searching the Paradigm trade tape via the paradigm-data-discovery skill (the daily execution partitions, keyed by RFQ_ID) for the cleared-block record, then fetches live marks, IVs, and greeks per venue, computes net greeks for multi-leg structures, benchmarks the fill vs mark, reports how much of the structure traded over 24h \u002F 7d \u002F 30d and where else it printed, reads whether the flow moved the vol surface, and outputs a concise analysis. Use when the user runs `\u002Fanalyze \u003Crfq_id> ...`, pastes a Paradigm block trade JSON, or asks to analyze, benchmark, or get market color on a Paradigm RFQ execution. Covers outright calls\u002Fputs (CL\u002FPL), strangles (SN), straddles (ST), butterflies (BF), condors (CO), calendars (CA), risk reversals (RR), covered calls, and custom multi-leg combos (CM). Also handles perp combos. Reads the Paradigm trade tape from S3 with the pod's AWS access.","https:\u002F\u002Fgithub.com\u002Ftradeparadigm\u002Fdt-apps\u002Fblob\u002Fmain\u002Fapps\u002Fparadigm\u002Fskills\u002Fparadigm-block-analyst\u002FSKILL.md",[],[]]