Getting started with OKX on Autoview

Autoview

By the end of this guide your OKX account is connected to Autoview, all three credentials are in place, and you've fired one real test order and cancelled it. That last part matters. A dry run tells you your syntax parses. Only a live order tells you the whole chain works.

OKX trades both crypto spot and futures, and one detail trips up almost every new connection: OKX hands you three credentials, not two. Get the third one wrong and nothing connects.

What Autoview does

Autoview executes through a webhook running on our servers. It's on around the clock, and it's source-agnostic: TradingView is one alert sender, but a TrendSpider alert, a Python script, or your own cron job can POST to the same hook. You give Autoview API keys for OKX, an incoming alert fires a command, and Autoview places the order on OKX. No browser needs to be open for that to happen.

There's also a Chrome extension that connects directly to TradingView alerts and runs while your computer and Chrome are on. The setup below works for both. The command syntax differs by one parameter, and I'll flag it where it does. Compare them side by side on the platforms page.

Create your API key on OKX

API keys are the credentials that let Autoview place orders on your account without ever touching your password. You generate them inside OKX, not inside Autoview. OKX keeps its own walkthrough current, so create the key there: OKX API management. Their full API reference lives at OKX API docs.

When OKX creates the key, it asks you to set a passphrase. Write it down. This is the single most common reason an OKX connection fails: the passphrase is a value you set on the API key itself, it is not your account login password, and it is case-sensitive. OKX will not show it to you again.

Two permission rules are non-negotiable:

  • Grant Read and Trade permissions. Autoview needs Read to verify the connection and Trade to place and cancel orders. Without Trade, nothing executes.
  • Never grant Withdraw permission. No automation strategy needs it, and a key that can't move funds off the exchange is a key that can't drain your account if it leaks.

OKX also lets you whitelist IP addresses, so a key only works from an address you approve. On the webhook platform that address is the zone your signals run from. OKX deletes keys with no whitelisted IP after a period of inactivity, so if you trade rarely, either whitelist an IP or expect to recreate the key. Contact support for the zone address before you whitelist.

OKX shows the Secret Key once, at creation. Copy the API Key, the Secret Key, and your passphrase somewhere safe before you leave that screen. Paste them into a plain note first so no stray spaces sneak in.

Add the keys to Autoview

OKX asks for three fields, and Autoview's form matches them one to one. Enter them exactly as OKX gave them:

  • Passphrase: the value you set when creating the key. Not your account password.
  • API Key: the public half OKX displays.
  • Secret Key: the private half OKX shows only once.

Open the OKX configuration in your Autoview account, paste all three fields, and save. Name the key if you plan to run more than one OKX key; on the webhook platform a clear name is what lets you wire it to a specific webhook later. Watch for the confirmation that the account connected.

Fire a test order, then cancel it

This is the step people skip, and then they wonder at 3am why a live signal did nothing. Don't skip it.

A real warning before you send anything: OKX commands hit your live account. Trade a size at or above OKX's minimum for the instrument, and place a limit order far enough from the market that it won't fill while you're testing.

Start with a dry run. Add d=1 to any command and Autoview parses it, shows you exactly what it would have done, and sends nothing to OKX. Get a clean dry run before you send a live one.

OKX uses hyphen-separated instrument codes in the s= symbol. Spot is BTC-USDT, a perpetual swap is BTC-USDT-SWAP, a dated future is BTC-USDT-240329. TradingView's {{ticker}} returns BTCUSDT with no hyphens, so don't pipe it straight into s=; use OKX's own instrument code. A limit buy 5% under the market looks like this:

  • Extension: e=okx s=BTC-USDT b=buy p=-5% q=1
  • Webhook: s=BTC-USDT b=buy p=-5% q=1

The only difference is e=okx, which tells the extension which exchange to route to. On the webhook platform the webhook already knows its exchange, so you leave it out.

The example hard-codes a price offset and a quantity, which is what you want for a controlled test. In real use you'll often want a live value instead. A TradingView alert can write one in: p={{close}} tells TradingView to substitute the candle's close at fire time, and Autoview just receives the number. The {{close}} token is TradingView's, not Autoview's. The alert sender supplies the value, so a Python script or another platform builds the same command its own way and posts a plain number where {{close}} would sit.

Fire it, then open the Autoview log and your OKX orders. You should see the resting limit order in both. Now cancel it:

  • Extension: e=okx s=BTC-USDT c=order
  • Webhook: s=BTC-USDT c=order

Order placed, order cancelled, both confirmed in the log and on OKX. That's the full round trip. Your setup works.

Go live

Connected and tested? Good. A couple of OKX-specific notes before you let real signals run.

OKX futures orders can reject if your account's position mode doesn't match what the order implies, and the fix is to set the position mode to Long/Short on OKX. The reasons and the exact steps live in the common error messages guide. Check it if a futures order comes back rejected.

Most other first-run problems are one of three things. Invalid credentials almost always means a typo on paste or a key created without Trade permission. An authorization error usually means the passphrase is wrong, and the usual culprit is typing the account password instead of the API-key passphrase. If OKX rejects the order itself, the error in your log comes straight from OKX, often because the quantity sat below the instrument's minimum.

When a command behaves oddly, put d=1 back on it. The dry-run output is the fastest way to see what Autoview thinks you asked for versus what you meant. Next you'll want stop-loss, take-profit, and trailing parameters layered onto these same commands, which is where the automation gets interesting.

Connect OKX