Skip to content
Sign In

Learning / Syntax / market()

market - Execute Instant Market Orders

Execute trades immediately at the current market price. The fastest way to enter or exit positions.

Syntax

Smart Syntax
market long|short <amount>
pos <target>
market long|short <amount> reduce
market long|short <amount> ts <activation>/<callback>
market long|short <amount> sl off <sl> tp off <tp> ts <activation>/<callback>

Parameters

long | shortRequired

Type: direction keyword | Values: long, short (buy, sell as aliases)

Specifies whether to go long (buy) or short (sell). Not required when using the pos command.


amountRequired

Type: number or string

The quantity to trade. Can be specified in several ways:

FormatDescriptionExample
0.01Direct quantity0.01 BTC
50%Percentage of total balanceHalf your balance
50%%Percentage of available balanceHalf your free balance
50%pPercentage of positionHalf your position size
2%rRisk at the inline stop loss2% of total USDT balance; Bybit / WEEX linear futures

n%rBybit / WEEX USDT Futures

Size a market entry from a risk budget at its inline stop. Supported on Bybit and WEEX USDT-settled linear futures; Bybit contracts must have a contract size of 1. Quantity = (total USDT balance × risk percentage) / distance between the reference price and the stop price. With a 1,000 USDT balance, 2% risk and a stop 3% away, the position value is about 666.67 USDT before quantity rounding. Leverage changes the margin required, not this risk budget.

Smart Syntax
ADAUSDT on My_Bybit_Key
market long 2%r sl off 3%

Each entry risks its own percentage, including additions on the same side. Its SL and optional TP protect only that entry's executed quantity, leaving earlier trades' protection unchanged. Opposite positions can coexist in hedge mode. In one-way mode, close the opposite position before entering. Additions require compatible quantity-scoped protection. Bybit rejects existing full-position SL/TP or trailing protection; WEEX checks for existing full-position closing orders on the same side. Include a stop in the same market command. Use sl off with a percentage or price distance, or sl at/sl @ with an absolute price. The risk percentage must be greater than 0 and at most 100. An optional TP can use off, at orrr; it is rounded to the exchange tick before entry. Explicit SL/TP quantities, entry-relative stops, trailing stops, reduce-only orders and leverage multipliers are not supported with %r. Position targets and limit/stop entries cannot use %r. Market and position-mode checks must pass before the entry is submitted.


posAlternative

Type: number or string | Aliases: position, target

Target position size after the order executes. Flipr.Cloud calculates the required trade automatically.

How it works:

  • Long 0.5 BTC + pos 1.0 → buys 0.5 BTC
  • Long 0.5 BTC + pos -0.5 → sells 1.0 BTC (close and reverse)
  • pos 0 → closes entire position

reduceOptional

Type: flag | Default: omitted (false)

Add reduce keyword to make the order reduce-only (will only reduce your position size, never increase it). Ignored on spot markets.


sl / tpOptional

Type: inline parameters

Add stop loss and/or take profit directly to your market order. The argument order is important:

PositionArgumentRequiredDescription
1amountOptionalQuantity to close. When omitted, uses the parent market order size. Use 100%p explicitly for the full live position.
2priceRequiredPrice WITH PREFIX: off or at/@. For entry-relative offsets, use off e2%.
3triggerOptionalTrigger type (default: last). Values: mark, last, index

Valid price prefixes:

Price formatMeaningExample
offOffset from current pricesl off 2% → 2% from current price
at / @Absolute pricetp at 50000 → exactly $50,000
off e…Entry-relative offsetsl off e2% → 2% from your entry price
rrRisk/Reward ratio (TP only)tp rr3 → TP at 3× SL distance

tsOptionalBinance / HTX / WEEX

Type: inline trailing stop | Supported markets: Binance Futures, HTX V5 and WEEX Futures

Add ts to a market entry to place a native trailing stop after the entry order is filled. It can be used by itself or together with fixed sl and tp.

FormatMeaning
ts 2%/1.5%Activate after a favorable 2% move, then trail by 1.5%
ts @65000/1000Activate at 65000; convert 1000 quote-currency units to a callback percentage
ts @65000 off 1000Same as above, with explicit offset syntax
ts @65000/0.5% markUse mark price on Binance or WEEX; HTX supports last price only

Examples

Example 1: Simple Buy Order

Smart Syntax
BTCUSDT on My_API_Key
market long 0.01

Buys 0.01 BTC at the current market price immediately.


Example 2: Close Position Instantly

Smart Syntax
ETHUSDT on My_API_Key
pos 0

Closes your entire position regardless of size or direction. Works for both long and short.


Example 3: Use 50% of Balance

Smart Syntax
BTCUSDT on My_API_Key
market long 50%

Calculates 50% of your account balance and buys that amount of BTC at market price.


Example 4: Flip from Long to Short

Smart Syntax
ETHUSDT on My_API_Key
// First close any existing position
pos 0

// Then open a short with 75% of available balance
market short 75%%

First closes any open position, then opens a short position using 75% of available balance.


Example 5: Reduce-Only Order (Futures)

Smart Syntax
BTCUSDT on My_API_Key
// Close 50% of position, will NOT increase if you're flat
market short 50%p reduce

The reduce keyword ensures this order can only reduce your position size. If you're long 1 BTC, it sells 0.5 BTC. If you're flat (no position), the order is rejected. This prevents accidentally opening a position when you meant to close.


Example 6: Market with Inline SL/TP

Smart Syntax
BTCUSDT on My_API_Key
// Enter long with stop loss and take profit
market long 0.01 sl off 2% tp off 5%

Opens a 0.01 BTC long position with SL at -2% and TP at +5% from current price.


Example 7: Entry-Relative SL/TP

Smart Syntax
ETHUSDT on My_API_Key
// SL/TP relative to entry price, not current price
market long 0.5 sl off e2% tp off e5%

Use off before the e value to calculate SL/TP from the position's entry price. For a long position with a $3000 entry price, the calculated SL is $2940 (-2%) and TP is $3150 (+5%).


Example 8: Partial SL/TP with Custom Amount

Smart Syntax
BTCUSDT on My_API_Key
// Close only 50% at TP, use full position for SL
market long 0.02 sl off 2% tp 50%p off 5%

Opens 0.02 BTC long. SL closes 100% (default), TP closes only 50%. The argument order is: tp [amount] prefix value [trigger]


Example 9: Market with Inline Trailing Stop

Smart Syntax
BTCUSDT on Binance_F
// Enter long, keep fixed protection, and add native trailing stop
market long 0.01 sl off 2% tp off 3% ts 2%/1.5%

Opens a long position, places fixed SL/TP, and creates a Binance trailing stop that activates after a favorable 2% move with a 1.5% callback.

Key Concepts

Market vs Limit Orders

  • Market orders execute immediately at whatever price is currently available
  • They guarantee execution but not price
  • Use when speed matters more than getting a specific price
  • Be cautious on low-liquidity markets where slippage can be significant

Position Targeting

The position parameter is powerful for strategy automation:

  • You specify where you want to end up, not what to trade
  • Flipr.Cloud handles the math and determines buy/sell direction
  • Especially useful when you don't know your current position state

Exchange-Specific Behavior

Market orders are supported across all exchanges, but inline SL/TP behavior varies:

ExchangeInline TP/SLNotes
BitgetNativeFull support including partial quantities
ByBitNativePartial: requires tpSize = slSize
BitunixFull onlyPartial via separate endpoint
BinanceOrder-levelCreates separate stop orders
KuCoinNativeVia st-orders (ignores partial qty)
HTXTrigger ordersCCXT limitation - uses separate triggers
PhemexFallbackError 11074 if existing positions - auto fallback

Related Commands

limit - Place orders at specific price levels

stoploss - Standalone stop loss orders

takeprofit - Standalone take profit orders

trailing-stop - Native trailing stops for Binance Futures, HTX V5 and WEEX Futures

rem / cancel - Cancel pending orders