Kraken command reference

Autoview · Reference

This is the full reference for writing Kraken orders from an Autoview alert. It goes parameter by parameter and order type by order type, and for each order type it shows the exact order Kraken resolves, not just the command you type. If you want the short version, the Kraken cheat sheet has a copy-ready line for each order type. This page is the one you keep open when you need the detail behind those lines.

Every command here was emitted by our command builder, round-tripped through the same parser the trading engine uses, and resolved through the live Kraken zone. The spot market sell and both stop order types were also placed on a live Kraken account at minimum size and then cancelled, so they are confirmed end to end. The resolved-order fields you see are the values the engine built. Nothing is hand-typed or assumed.

On Kraken, Bitcoin is XBT, not BTC. The pair you trade is XBTUSD, not BTCUSD. Get this one right and most symbol errors disappear. Kraken also trades both spot and margin, so unlike a spot-only venue it has real positions and leverage, plus a settle order to close them. The order type you get often depends on which parameters you combine, which the order-type section makes explicit.

How Autoview reads a command

A command is a single line of key=value tokens separated by spaces. e=KRAKEN s=XBTUSD b=sell t=market q=0.0001 is five tokens. The order you write them in does not matter.

  • First occurrence wins. If a key appears twice, Autoview keeps the first and ignores the rest. Write each key once.
  • A line starting with // is a comment and places nothing. Useful for labelling an alert without triggering a trade.
  • You can send several commands at once by separating them with a new line or a pipe (|). Each is parsed on its own.
  • A token that starts with a colon is ignored. TradingView sometimes inserts placeholder tokens like :plot_0=; Autoview skips anything with a leading colon so those never affect the order.

Three tokens matter for every Kraken order: s= (the pair), b= (the side), and q= (the size). The size is not optional in practice. Read the sizing section before you send a real order.

The parameter table

These are the parameters Kraken reads, grouped by what they do. The cheat sheet uses a handful of them; this is the full set.

Routing and identity

ParameterMeaning
e=The exchange. e=KRAKEN for Kraken.
s=The pair. Bitcoin is XBT on Kraken, so it is s=XBTUSD. Required.
id=A reference you choose for the order. It is stored as the order's user reference, which lets a later command find and act on it.

Direction and size

ParameterMeaning
b=Side: b=buy or b=sell. For a margin trade you can also use long and short. Required, no default.
q=Quantity, in base units (the XBT in XBTUSD), for example q=0.0001. A percent of balance also works (q=50%). It defaults to 100% of your balance when omitted, so set it on every order. The minimum on XBTUSD is 0.00005 XBT.

Order type and price

ParameterMeaning
t=Order type: market, limit, post (post-only maker), or settle (settle a margin position). Defaults to limit, so market orders set it explicitly. Stops and targets are made by adding a trigger to a market or limit order, not by a t= of their own.
fp= / p=Limit price. fp= is a fixed, absolute price; p= is an offset from a reference (see relative pricing).
fpx= / px=Trigger price for an entry stop. fpx= is absolute; px= is an offset. Adding it to a market order makes a stop-loss; adding it to a limit order makes a stop-loss-limit. The side stays as you wrote it.
fsl= / sl=Stop price for an attached exit. This is meant to protect a position, so the resulting order is placed on the opposite side. See the side rule below.
ftp= / tp=Take-profit price for an attached exit. Like the stop, it protects a position and is placed on the opposite side.
price=A reference price the relative parameters (p=, px=) offset from. Use price={{close}} in a TradingView alert.

Margin

ParameterMeaning
l=Leverage, for example l=3. Adding it makes the order a margin trade. A margin order without l= is rejected.
ro=Reduce-only. ro=1 marks the order so it can only shrink a position, never extend it.

Cancelling, closing, and wallets

ParameterMeaning
c=Cancel or close. c=order cancels your resting orders on the pair. c=position closes a margin position. c=all is not available on Kraken.
cm= / cmo=Act on a subset: cm= is how many (a count or a percent), cmo= is which ones (newest, oldest, highest, and so on).
edit=Re-price a resting order in place. It finds the order by its reference and amends it rather than cancelling and replacing.
w= / y=Move balances between wallets. w= is the asset (for example w=XXBT) and y=futures sends it from your Spot wallet to your Futures wallet.
d=Dry run. d=1 parses and reports the order but places nothing.

Order types and what each resolves to

Here is each order type with the command on the left and the order Kraken actually built on the right. The resolved side is the useful part: it shows that t=post becomes a limit order with a post-only flag, that a trigger turns a market order into a stop-loss, and so on.

CommandKraken resolves
e=KRAKEN s=XBTUSD b=sell t=market q=0.0001Market sell.
e=KRAKEN s=XBTUSD b=sell t=limit fp=100000 q=0.0001Limit sell at 100000.
e=KRAKEN s=XBTUSD b=sell t=post fp=100000 q=0.0001Post-only limit at 100000: it joins the book as a maker order and is rejected rather than crossing the spread.
e=KRAKEN s=XBTUSD b=sell t=market fpx=55000 q=0.0001Stop-loss sell that arms at 55000. The side stays sell, because this is an entry stop.
e=KRAKEN s=XBTUSD b=sell t=limit fp=54000 fpx=55000 q=0.0001Stop-loss-limit: arms at 55000 and rests a limit at 54000.
e=KRAKEN s=XBTUSD b=sell t=settle q=0.0001Settle-position order, used to settle a margin position.

Two points catch people out. A stop is not a t=stop you might expect; it is a market or limit order with a trigger price added, so t=market fpx=55000 is the stop. And the side of a stop or target depends on whether you used the entry form (fpx=) or the attached-exit form (fsl=, ftp=), which the next section explains.

The side rule: entry stops versus attached exits

Kraken gives you two ways to attach a trigger, and they place on different sides on purpose. This is the one rule worth reading twice.

  • fpx= / px= is an entry stop and keeps your side. A b=sell with fpx= resolves to a sell that arms at the trigger. Use it to enter on a breakout or break-down.
  • fsl= / sl= and ftp= / tp= are attached exits and flip to the opposite side. They assume you are protecting a position, so the order is placed to close it. A b=buy with fsl= resolves to a sell stop, and a b=buy with ftp= resolves to a sell take-profit, because both close the long.

The commands and what they resolve to:

CommandKraken resolves
e=KRAKEN s=XBTUSD b=buy t=market fsl=55000 q=0.0001Stop-loss SELL at 55000: the protective stop on a long.
e=KRAKEN s=XBTUSD b=buy t=market ftp=70000 q=0.0001Take-profit SELL at 70000: the target on a long.
e=KRAKEN s=XBTUSD b=buy t=limit fp=71000 ftp=70000 q=0.0001Take-profit-limit SELL: arms at 70000 and rests a limit at 71000.

Each of these is a single order, not a bracket. On Kraken you place one stop or one target at a time, each its own order. There is no one-cancels-other pair that places a stop and a target together. If you want both, send two commands.

Absolute and relative prices

Every price parameter comes in two forms, and the difference is one letter.

  • With the f prefix, the number is absolute. fp=100000 means the price 100000.
  • Without the f, the number is an offset from a reference you supply with price=. p=-50 means fifty below the reference.

Relative pricing is the usual TradingView pattern, because the alert can hand Autoview the candle that fired it:

e=KRAKEN s=XBTUSD b=sell t=limit price={{close}} p=-50 q=0.0001

price={{close}} passes the candle close, and p=-50 rests the limit fifty below it. The same swap works for the entry trigger: px= is the relative form of fpx=. Because Kraken trades around the clock, the live price is always available, so absolute and relative prices both resolve at any hour.

Kraken prices are plain prices, not distances. The stop and target parameters take a price level, the actual number Bitcoin has to reach. They are not point or tick distances from your entry, so there is no separate distance-unit parameter to set. Write the price you mean.

Sizing: base units and percent

q= sets the size, and it reads two ways.

  • A plain number is base units. q=0.0001 is 0.0001 XBT on XBTUSD, passed straight through. The minimum is 0.00005 XBT.
  • A percent is a share of your balance, sized at the current price. q=50% resolved to half of the relevant balance on our test account.

Leave q= off and Autoview uses 100% of the balance. This is the single most important line on the page. An order with no q= sells (or buys) your entire balance of that asset. Always set the size you mean. Set it explicitly on every order, every time.

Margin: leverage and reduce-only

Kraken trades on margin as well as spot, and two parameters cover it.

CommandKraken resolves
e=KRAKEN s=XBTUSD b=buy t=market q=0.0001 l=3Market buy on margin at 3x leverage.
e=KRAKEN s=XBTUSD b=sell t=market q=0.0001 ro=1Market sell marked reduce-only, so it can only shrink a position.

Adding l= is what makes an order a margin trade; a margin order without it is rejected. ro=1 is a safety flag for exits: it tells Kraken the order should never open or extend a position, only reduce one. Spot orders ignore both.

Cancelling, closing, and editing

How you close depends on what you are closing. You cancel resting orders, you close a margin position, and on spot you exit a holding by selling it.

CommandEffect
e=KRAKEN s=XBTUSD c=orderCancel your resting orders on the pair.
e=KRAKEN s=XBTUSD c=positionClose your open margin position on the pair. A spot holding is not a position; sell it instead.
e=KRAKEN s=XBTUSD b=sell t=market q=0.0001Exit a spot holding by selling the amount you want to release.

There is no c=all on Kraken. To clear the book you cancel orders with c=order; to flatten a margin position you use c=position; to release a spot holding you sell it.

Cancelling only part of the set

When you have several resting orders, cm= and cmo= let you act on a subset. cm= is how many (a count or a percent), and cmo= is which ones, by newest, oldest, highest, lowest, biggest, or smallest.

e=KRAKEN s=XBTUSD c=order cm=2 cmo=newest

That cancels the two newest resting orders and leaves the rest working. Without cmo= the engine still honours cm= and takes them in the order it finds them.

Editing a resting order

edit= re-prices a resting order in place. You point it at the order by the reference you gave when you placed it, and Autoview amends the live order rather than cancelling and replacing it. It runs on the cancel path, so it shares the same matching as c=order.

Moving balances between wallets

Kraken keeps separate Spot and Futures wallets, and a command can move balance between them. w= names the asset and y=futures sends it from Spot to Futures.

e=KRAKEN s=XBTUSD w=XXBT y=futures q=0.0001

That moves 0.0001 XBT from your Spot wallet to your Futures wallet. Use the Kraken asset key for w= (Bitcoin's key is XXBT). The amount follows the same rules as an order size, so set it explicitly.

What Kraken does not accept

A few things look like they should work and do not. Knowing them saves a debugging session.

  • No immediate-or-cancel or fill-or-kill. Kraken on Autoview has no t=ioc or t=fok; the maker control you have is post-only with t=post. (Immediate-or-cancel and fill-or-kill belong to other exchange types.)
  • No trigger price source. Kraken stops trigger on the last traded price. There is no parameter to switch a trigger to index or mark price.
  • No trailing stop. ts= is not read on Kraken.
  • No one-cancels-other pair and no combined bracket. A stop and a target are separate orders here. Send two commands if you want both.
  • No c=all. Cancel orders with c=order, close a margin position with c=position, and sell to release a spot holding.
  • One command, one account. You cannot list several accounts with a=acct1,acct2; send a separate command per account.
  • Staking is not driven from a command. The wallet move with y=futures works, but Kraken has retired the public staking endpoint, so y=stake and y=unstake do not go through.

Everything else on this page resolved to exactly what is described when run through the live Kraken zone.

Testing and going live

Append d=1 to any command and Autoview parses it, reports what it would have done, and places nothing:

e=KRAKEN s=XBTUSD b=sell t=market q=0.0001 d=1

That is the safest first run for a command you have just written. Read the log, confirm the pair and side are right and the size is what you meant, then drop d=1 to send it for real. Because Kraken orders are real money from the first fill, keep your first live size small and grow it once the alert behaves. For more on reading the log, see test and debug your setup.

Back to the cheat sheet