set - Configure Exchange Settings
Modify exchange-specific settings like leverage, margin mode, and position mode.
Supported Exchanges
Leverage: Binance Futures, ByBit, Bitget, Bitunix, BloFin, KuCoin, BitMEX, HTX, Phemex, Toobit, Kraken, Bitfinex, WEEX.
Margin mode: Binance Futures, ByBit, Bitget, Bitunix, KuCoin, Toobit, OKX, HTX V5, WEEX. HTX V5 selects margin mode for subsequent orders and leverage settings. Availability depends on the market and account; these futures settings do not apply to spot.
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:
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):
| Command | Notional | Margin 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 |
Performance tip: if your strategy hardcodes the amount in the webhook (e.g. market long 2.2 instead of market long lev*10%), you skip 2 API calls (balance + price fetch) and execution is ~3x faster.
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 Form | Shorthand |
|---|---|
set leverage 5 | lev 5 |
set leverage 20 | leverage 20 |
set positionMode hedge | hedge on |
set positionMode oneway | hedge off |
Parameters
leverageOptionalType: 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 5orlev 5- Conservative 5x leverageset leverage 20orlev 20- Moderate 20x leverageset leverage 50orlev 50- Aggressive 50x leverage (higher liquidation risk)
Changing leverage can affect existing open positions. Some exchanges will automatically adjust your position's margin when you change leverage settings.
marginOptionalType: 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.
Important: Cross margin does NOT mean "maximum leverage." It means your entire account balance is shared across all positions, with leverage automatically calculated based on position size.
positionMode / hedgeOptionalType: 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
Supports two distinct, mutually exclusive modes:
- Isolated margin with fixed leverage:
set leverage 20- Cross margin with auto-calculated leverage:
set margin crossYou 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.
Fully supports all standard parameters without quirks. Most flexible exchange for settings configuration.
Margin mode is persistent per instrument. Once set, it stays until you change it — even across sessions
Without
marginin your command, OKX uses whatever was last set (by Flipr.Cloud or by the OKX app). Always specify it explicitly to be safeCannot change margin mode while you have open positions on that instrument
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.
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.
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.
ETHUSDT on My_API_Key
// Switch to cross margin mode
set margin cross
// Position uses entire balance, leverage auto-calculated
market long 0.1Cross 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.
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 onThe 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.
// Enable hedge mode (all equivalent)
hedge on
set positionMode hedge
set hedge on
// Switch back to one-way mode
hedge off
set positionMode onewayMake 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.
ETHUSDT on My_API_Key
market long 0.1 margin isolatedThe 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
levshorthand - Saves characters and is cleaner:lev 5instead ofset leverage 5Use
lev*for leveraged sizing -market long lev*50%automatically scales with your leverage settingStart 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
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.
ETHUSDT on OKX_F
set leverage 5
set margin isolated
market long 0.1ETHUSDT on OKX_F
set leverage 5 margin isolated
market long 0.1On 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.
High Leverage = High Risk
- - Higher leverage means lower margin requirement but faster liquidation
- - At 100x leverage, a 1% move against you = liquidation
- - At 10x leverage, you have ~10% buffer before liquidation
- - Cross margin risks your ENTIRE account balance on one position
- - Test with small amounts and low leverage first!
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