Skip to content
Sign In

set - Configure Exchange Settings

Modify exchange-specific settings like leverage, margin mode, and position mode.

What is set?

set allows you to configure exchange-specific trading parameters like leverage, margin mode, and position mode. These settings affect how your subsequent orders behave on the exchange.

Common Use Cases:

  • Set Leverage Level

    Configure 5x, 10x, 20x leverage for futures trading

  • Switch Margin Mode

    Choose between isolated (safer) and cross margin (full account risk)

How Leverage Actually Works

Leverage in Flipr.Cloud operates as a margin reducer, not an amount multiplier. This matches how most exchanges handle it internally. Setting leverage to 5x does NOT make your positions 5x larger — it reduces the margin required to 1/5th.

Example: $10,000 balance, leverage 50x

pos 10% = position worth ~$1,000 notional. At 50x leverage, this only uses ~$20 as margin

Why doesn't leverage auto-multiply the amount?

Many traders set higher leverage specifically to reduce margin per position — for example, to open multiple positions on different pairs without running out of available margin. Auto-multiplying the amount would break this common use case.

How to use leverage as an amount multiplier

If you want to use your balance percentage as margin and leverage it up, use the lev* keyword. It automatically picks up the leverage value from the lev or set leverage command in the same block:

Smart Syntax
ETHUSDT on My_API_Key
lev 50
market long lev*10%
lev* = 50 (from the lev command above). So lev*10% = 50 x 10% = 500% of balance = ~$50,000 notional value.
With $10,000 balance: ~$50,000 notional position, using ~$1,000 as margin at 50x.
If you change lev 50 to lev 100, the amount adjusts automatically.

Quick reference ($10,000 balance, 50x leverage):

CommandNotionalMargin Used
pos 10%~$1,000~$20 at 50x
pos lev*10%~$50,000~$1,000 at 50x
market long lev*5%~$25,000~$500 at 50x

Syntax

Smart Syntax
// Full form
set leverage <value>
set margin <isolated|cross>
set leverage <value> margin <isolated|cross>
// Shorthand aliases (same result)
lev <value>
leverage <value>
// Position mode
set positionMode <oneway|hedge>
set hedge <on|off|true|false|hedge|oneway>
set hedgemode <hedge|oneway>
hedge <on|off>

lev 5 is the same as set leverage 5. hedge on is the same as set hedge on. Use whichever you prefer.

Aliases & Shorthand

You can use shorter forms for common settings. These are all equivalent:

Full FormShorthand
set leverage 5lev 5
set leverage 20leverage 20
set positionMode hedgehedge on
set positionMode onewayhedge off

Parameters

leverageOptional

Type: number | Default: exchange default

Set the leverage multiplier. This determines how much margin is required for your position — higher leverage = less margin required, but higher liquidation risk.

  • set leverage 5 or lev 5 - Conservative 5x leverage
  • set leverage 20 or lev 20 - Moderate 20x leverage
  • set leverage 50 or lev 50 - Aggressive 50x leverage (higher liquidation risk)
marginOptional

Type: string | Options: "isolated", "cross"

Set the margin mode for your positions:

  • isolated - Position risk limited to allocated margin. Use with fixed leverage (e.g., set leverage 20). Safer option.
  • cross - Your entire account balance backs all positions. Leverage is calculated automatically based on position size and available balance. Higher risk.
positionMode / hedgeOptional

Type: string | Options: "oneway", "hedge" (or true/false, on/off, yes/no, 1/0)

Control whether you can have both long and short positions simultaneously:

  • oneway - Only one position direction at a time (default on most exchanges)
  • hedge - Can hold both long and short positions simultaneously

Position-mode changes are supported on Binance Futures, ByBit, Bitget, Bitunix, KuCoin Futures, BloFin and HTX V5. On WEEX, set hedge on verifies that hedge mode is already enabled; it does not switch modes, and set hedge off is unsupported.

Exchange-Specific Quirks

Binance Futures
  • Supports two distinct, mutually exclusive modes:

    - Isolated margin with fixed leverage: set leverage 20

    - Cross margin with auto-calculated leverage: set margin cross

    You cannot combine cross margin with a specific leverage value (e.g., "cross at 10x") because cross automatically determines leverage based on your position size and total account balance.

ByBit

Fully supports all standard parameters without quirks. Most flexible exchange for settings configuration.

OKX
  • Margin mode is persistent per instrument. Once set, it stays until you change it — even across sessions

  • Without margin in your command, OKX uses whatever was last set (by Flipr.Cloud or by the OKX app). Always specify it explicitly to be safe

  • Cannot change margin mode while you have open positions on that instrument

Kraken

Leverage is applied per-order, not per-symbol. The set leverage value is cached and used for subsequent orders in the same block.

Real-World Examples

1. Set 20x Leverage Before Trading

Configure leverage at the start of your webhook to ensure consistent margin requirements.

Smart Syntax
BTCUSDT on My_API_Key
// Set 20x isolated leverage (short form)
lev 20
// Now place orders with 20x leverage
market long 0.01
sl-or-tp short 100%p sl off 2% tp off 5%

Leverage is set once at the beginning. All subsequent orders use 20x leverage and lower margin requirement.

2. Leverage as Amount Multiplier (lev*)

Use 10% of your balance as margin, leveraged up to a larger position.

Smart Syntax
ETHUSDT on My_API_Key
// Set leverage
lev 50
// lev* uses the leverage from the line above
market long lev*10%
sl-or-tp short 100%p sl off 2% tp off 5%

With $10,000 balance: lev*10% = 50 x 10% = 500% of balance = ~$50,000 notional position, using ~$1,000 margin. If you change lev 50 to lev 100, the amount adjusts automatically.

3. Switch to Cross Margin

Use cross margin when you want all positions to share your entire account balance as margin.

Smart Syntax
ETHUSDT on My_API_Key
// Switch to cross margin mode
set margin cross
// Position uses entire balance, leverage auto-calculated
market long 0.1

Cross margin shares your entire account balance across all positions. Effective leverage is automatically calculated based on position size and available balance.

4. Multiple Settings in One Command

Configure leverage, margin mode, and position mode together.

Smart Syntax
BTCUSDT on My_API_Key
// Set both leverage and margin mode at once
set leverage 15 margin isolated
market long 0.01
// Or combine with position mode
set leverage 10 margin isolated hedge on

The parser processes all parameters. Order doesn't matter: set margin isolated leverage 15 works too.

5. Position Mode: Hedge vs One-Way

Enable hedge mode to hold both long and short positions simultaneously.

Smart Syntax
// Enable hedge mode (all equivalent)
hedge on
set positionMode hedge
set hedge on
// Switch back to one-way mode
hedge off
set positionMode oneway

Make sure you have no open positions before switching position mode — most exchanges require it.

6. Inline Margin Mode (Any Exchange)

You can also set margin mode directly in the order command, without a separate set line.

Smart Syntax
ETHUSDT on My_API_Key
market long 0.1 margin isolated

The margin mode is applied before the order executes. Works on all exchanges that support margin modes.

Best Practices

  • Set leverage at webhook start - Configure settings before placing any orders

  • Use lev shorthand - Saves characters and is cleaner: lev 5 instead of set leverage 5

  • Use lev* for leveraged sizing - market long lev*50% automatically scales with your leverage setting

  • Start with lower leverage - Use 5x-10x until comfortable, not 50x-100x

  • Understand margin modes - Isolated risks only position margin, cross risks entire account

  • Check for open positions on OKX - Cannot change settings with open orders

Performance Tip

Combine Leverage + Margin in One Line

When you need to set both leverage and margin mode, write them in a single command instead of two separate lines. This is especially important on OKX, where leverage and margin mode use the same API endpoint internally. Combining them saves one API call.

Slower — 2 API calls
Smart Syntax
ETHUSDT on OKX_F
set leverage 5
set margin isolated
market long 0.1
Faster — 1 API call
Smart Syntax
ETHUSDT on OKX_F
set leverage 5 margin isolated
market long 0.1

On OKX, both settings are applied through a single set-leverage endpoint. Flipr.Cloud automatically detects when both are present in the same command and merges them into one call. On other exchanges, combining them is still cleaner and slightly faster.

Why this matters: Every extra API call adds latency before your order reaches the exchange. One less call means your order gets filled faster. This optimization applies to all OKX instruments — once set, both leverage and margin mode persist until you change them again.

Related Commands

market

- Execute trades using configured leverage

pos

- Position sizing with %, %p, and lev* multiplier

balance

- Check available margin and position sizes

sl-or-tp

- Protect leveraged positions with stop loss