Repository navigation
Multi Assets Margin
Your whole portfolio working together. More buying power. More risk. Let's understand both.
Normally, each position uses its own margin. Got $10k in BTC and $5k in USDT? Only the USDT backs your trades.
Multi-Assets Margin changes this. Now your BTC, ETH, and other assets ALL count as collateral. More buying power, better capital efficiency.
BTC: $10,000 → Just sitting there
ETH: $5,000 → Just sitting there
USDT: $3,000 → Available for trading
─────────────
Buying Power: $3,000
BTC: $10,000 → Counts as collateral (at discount)
ETH: $5,000 → Counts as collateral (at discount)
USDT: $3,000 → Full collateral value
─────────────
Buying Power: ~$15,000+ (depending on haircuts)
When you get liquidated, EVERYTHING gets liquidated.
In single-asset mode, losing a BTC trade only affects your BTC margin. In multi-assets mode, a bad trade can wipe out your entire portfolio.
This is powerful. This is dangerous. Use it wisely.
// Get multi-assets margin rules
$rules = Bingx::trade()->getMultiAssetsRules();
print_r($rules);
// Shows which assets can be used as collateral
// and their haircut rates// Switch to multi-assets margin
Bingx::trade()->switchMultiAssetsMode(true);
// Verify it's enabled
$mode = Bingx::trade()->getMultiAssetsMode();
echo "Multi-assets: " . ($mode['multiAssetsMargin'] ? 'ON' : 'OFF') . "\n";// Switch back to single-asset mode
Bingx::trade()->switchMultiAssetsMode(false);Note: You can only switch modes when you have no open positions.
Not all assets count at full value. BingX applies "haircuts" to reduce risk:
| Asset | Typical Haircut | Collateral Value |
|---|---|---|
| USDT | 0% | 100% |
| BTC | 5-10% | 90-95% |
| ETH | 5-10% | 90-95% |
| Other | 10-20% | 80-90% |
Example: $10,000 in BTC with 5% haircut = $9,500 collateral value
$margin = Bingx::trade()->getMultiAssetsMargin();
echo "Total Collateral: {$margin['totalCollateral']}\n";
echo "Total Margin Used: {$margin['totalMargin']}\n";
echo "Available Margin: {$margin['availableMargin']}\n";
echo "Margin Ratio: {$margin['marginRatio']}%\n";
// Breakdown by asset
foreach ($margin['assets'] as $asset) {
echo "{$asset['asset']}: ";
echo "Balance: {$asset['walletBalance']}, ";
echo "Collateral: {$asset['crossMarginAsset']}\n";
}1. Hedged Positions
// Long BTC, Short ETH - natural hedge
// Multi-assets mode gives better margin efficiency
$longBtc = Bingx::trade()->order()
->symbol('BTC-USDT')
->buy()->long()
->margin(5000)
->execute();
$shortEth = Bingx::trade()->order()
->symbol('ETH-USDT')
->sell()->short()
->margin(5000)
->execute();
// Combined margin requirement is LOWER than separate2. Portfolio Strategies
// Multiple correlated positions
// BTC + ETH + SOL long portfolio
// Multi-assets mode reduces total margin needed3. Capital Efficiency
// You hold BTC long-term but want to trade
// Instead of selling BTC for USDT, use BTC as collateral1. Beginners
- Stick with single-asset mode until you understand risk
2. High Leverage
- Multi-assets + high leverage = fast liquidation
3. Uncorrelated Bets
- Long BTC + Long random altcoin = double risk, not hedge
4. "All In" Trades
- Never risk your entire portfolio on one trade
function checkPortfolioRisk(): array
{
$margin = Bingx::trade()->getMultiAssetsMargin();
$marginRatio = (float) $margin['marginRatio'];
$status = match(true) {
$marginRatio < 30 => ['level' => 'SAFE', 'emoji' => '🟢'],
$marginRatio < 50 => ['level' => 'OK', 'emoji' => '🟡'],
$marginRatio < 70 => ['level' => 'CAUTION', 'emoji' => '🟠'],
$marginRatio < 85 => ['level' => 'DANGER', 'emoji' => '🔴'],
default => ['level' => 'CRITICAL', 'emoji' => '🚨']
};
return [
'margin_ratio' => $marginRatio,
'status' => $status['level'],
'emoji' => $status['emoji'],
'total_collateral' => $margin['totalCollateral'],
'available' => $margin['availableMargin']
];
}
// Usage
$risk = checkPortfolioRisk();
echo "{$risk['emoji']} Portfolio: {$risk['status']} ({$risk['margin_ratio']}%)\n";function monitorPortfolio(float $warningThreshold = 50): void
{
while (true) {
$margin = Bingx::trade()->getMultiAssetsMargin();
$ratio = (float) $margin['marginRatio'];
if ($ratio > $warningThreshold) {
sendAlert("⚠️ Portfolio margin at {$ratio}%!");
if ($ratio > 80) {
sendAlert("🚨 CRITICAL: Reduce positions NOW!");
}
}
sleep(60);
}
}function emergencyReduceRisk(): void
{
// 1. Cancel all open orders
Bingx::trade()->cancelAllOrders();
// 2. Get all positions
$positions = Bingx::account()->getPositions();
// 3. Close smallest positions first (preserve winners)
usort($positions, fn($a, $b) =>
abs($a['positionAmt']) <=> abs($b['positionAmt'])
);
foreach ($positions as $pos) {
if (empty($pos['positionAmt'])) continue;
// Close position
Bingx::trade()->closeAllPositions($pos['symbol']);
// Check if margin ratio improved
$margin = Bingx::trade()->getMultiAssetsMargin();
if ($margin['marginRatio'] < 50) {
echo "Margin ratio safe: {$margin['marginRatio']}%\n";
break;
}
}
}// Long spot, short futures = delta neutral
// Collect funding without directional risk
class DeltaNeutralStrategy
{
public function setup(string $symbol, float $size): void
{
// Enable multi-assets mode
Bingx::trade()->switchMultiAssetsMode(true);
// Short futures (to collect positive funding)
Bingx::trade()->order()
->futures()
->symbol($symbol)
->sell()->short()
->type('MARKET')
->quantity($size)
->leverage(1) // Low leverage for safety
->execute();
echo "Delta neutral position opened\n";
echo "Collecting funding every 8 hours\n";
}
public function checkFunding(string $symbol): void
{
$funding = Bingx::market()->getFundingRateInfo($symbol);
$rate = (float) $funding['fundingRate'];
if ($rate > 0) {
echo "🟢 Positive funding: You're earning {$rate}%\n";
} else {
echo "🔴 Negative funding: You're paying {$rate}%\n";
echo "Consider closing position\n";
}
}
}// Long strong asset, short weak asset
// Profit from relative performance
class PairsTrading
{
public function openPair(
string $longSymbol,
string $shortSymbol,
float $margin
): void {
// Long the stronger asset
Bingx::trade()->order()
->futures()
->symbol($longSymbol)
->buy()->long()
->type('MARKET')
->margin($margin / 2)
->leverage(5)
->execute();
// Short the weaker asset
Bingx::trade()->order()
->futures()
->symbol($shortSymbol)
->sell()->short()
->type('MARKET')
->margin($margin / 2)
->leverage(5)
->execute();
echo "Pairs trade opened: Long {$longSymbol}, Short {$shortSymbol}\n";
}
}
// Example: Long BTC, Short ETH
$pairs = new PairsTrading();
$pairs->openPair('BTC-USDT', 'ETH-USDT', 2000);With multi-assets mode, your effective leverage is different:
function calculateEffectiveLeverage(): float
{
$margin = Bingx::trade()->getMultiAssetsMargin();
$positions = Bingx::account()->getPositions();
$totalNotional = 0;
foreach ($positions as $pos) {
if (empty($pos['positionAmt'])) continue;
$totalNotional += abs((float) $pos['notional']);
}
$totalCollateral = (float) $margin['totalCollateral'];
if ($totalCollateral == 0) return 0;
return round($totalNotional / $totalCollateral, 2);
}
$leverage = calculateEffectiveLeverage();
echo "Effective portfolio leverage: {$leverage}x\n";Bingx::trade()->switchMultiAssetsMode(true);Bingx::trade()->switchMultiAssetsMode(false);$mode = Bingx::trade()->getMultiAssetsMode();$margin = Bingx::trade()->getMultiAssetsMargin();$rules = Bingx::trade()->getMultiAssetsRules();Can I switch modes with open positions? No. Close all positions first.
Do all assets count as collateral?
No. Only supported assets. Check getMultiAssetsRules().
What happens during liquidation? All positions are liquidated to cover the debt. Your entire portfolio is at risk.
Is this the same as portfolio margin? Similar concept. BingX calls it "Multi-Assets Margin Mode."
Should I use this? Only if you understand the risks and have a specific strategy that benefits from it.
| Aspect | Single-Asset | Multi-Assets |
|---|---|---|
| Collateral | USDT only | All supported assets |
| Buying Power | Lower | Higher |
| Risk Isolation | Yes | No |
| Liquidation | Per position | Entire portfolio |
| Best For | Beginners, isolated trades | Hedges, portfolio strategies |
Remember: More buying power = more ways to lose money. Use multi-assets margin only when you have a clear strategy that benefits from it.
Questions? Open an issue