Cancelling and closing: the c parameter
Two things on an exchange can be torn down: a resting order that has not filled yet, and an open position that already has. They are not the same thing, and Autoview keeps them separate. c is the parameter that does the tearing down, and the value you give it decides which of the two you mean.
Here it is in its three forms:
c=order
c=position
c=all
c=order cancels resting orders. c=position closes open positions. c=all does both. There is no fourth value that does something else, so those three are the whole vocabulary.
Cancel an order vs close a position
The distinction matters, so it is worth being precise. A resting order is one you have placed that has not filled. A limit buy sitting below the market, a stop waiting to trigger. Cancelling it removes it from the book. Nothing was bought or sold, you just pull the request back.
A position is what you hold after an order fills. You are long or short something, and closing it means sending the opposite order to flatten back to zero. Money changes hands when a position closes; cancelling an order moves none.
So pick by intent. Want to clear orders you no longer want sitting out there? c=order. Want to get out of a trade you are actually in? c=position. Want a clean slate on both? c=all.
How c routes internally
Each value maps to one job. c=order runs a cancel-all over your open orders. c=position runs a close-all over your open positions. c=all runs a full liquidation, which is the cancel and the close together. That routing is a plain switch on the value, which is why only those three strings do anything; the value is read in lower case, so c=Order and c=ORDER work the same as c=order.
One thing happens automatically. If an alert comes in flat (for example a TradingView strategy that has gone to no position), Autoview treats it as c=all for you. You do not have to write it; a flat signal already means "stand everything down."
Limiting the sweep: cm and cmo
By default c is greedy. It takes every matching order or position. Sometimes you do not want all of them, and that is what cm and cmo are for.
cm is the maximum: how much of the set to act on. It defaults to 100%, which is why a bare c=order clears everything. Set it lower to cap the sweep.
c=position cm=50%That closes only part of what is open rather than all of it. When cm is at or above the full count, the cap does nothing and everything goes.
cmo is the order of the maximum: when cm only lets you act on some of them, which ones get picked first. It defaults to oldest. The accepted values are:
oldestandnewest, by when the order or position was created.lowestandhighest, by price.smallestandbiggest, by size.random, which shuffles and takes whatever falls in the cap.
A worked pairing: close the two biggest positions and leave the rest alone.
c=position cm=2 cmo=biggestAutoview sorts your open positions by size, takes the top two, and closes only those. Note that cmo only bites when cm is actually holding something back. If cm lets everything through, sort order is moot because all of them go anyway. One caveat: not every exchange exposes every field. If a sort method has no data to sort on for your exchange, Autoview logs that it is unsupported rather than guessing.
The cot flag: close on trigger
cot is a different animal from c. It is not an action you fire, it is a flag you attach to an order you are placing. cot=1 turns it on, anything else leaves it off. It tells the exchange that when this order triggers, it should reduce or close a position rather than open or add to one.
It rides along with a normal order line, it does not stand alone:
e=bybit s=BTCUSDT b=sell t=market cot=1Support for the flag depends on the exchange honoring it. It is passed straight through to the venue, so its exact effect is the venue's to define.
The close keyword
close is the other attach-to-an-order flag, and it is the one people mix up with c. Where c is a standalone teardown command, close is a boolean you add to an order to mark it as a closing order rather than an opening one. close=1 sets it.
What that mark does is left to each exchange, because the venues model it differently. On some it sets the order to reduce-first or reduce-only so it cannot accidentally flip you to the other side. On others it picks the close side of a hedged book, or tags an option order as a closing leg. The common thread is the same idea: this order is meant to take a position off, not put one on.
So the short version: reach for c when you want a clean sweep of orders or positions in its own line, and reach for close when you are sending a specific order and want it treated as a closing one.
Things worth knowing
- Three values only.
cunderstandsorder,position, andall. Anything else is ignored as a teardown and the line is treated as a normal command. - A flat signal means all. An alert that arrives flat is run as
c=allwithout you writing it. - cm defaults to 100%, cmo to oldest. Leave them off and
csweeps the whole set, oldest first only when a cap is in play. - cot and close attach to orders. Neither one tears anything down on its own. They modify an order you are already sending.
For every parameter an order line can carry, side, sizing, stops, order type and the rest, see the command reference, or the full alert syntax page.