PHP Examples
Binance Set Futures Leverage
Binance Set Futures Leverage — CCXT PHP code example.
<?php
include './ccxt.php';
// /docs/manual#instantiation
date_default_timezone_set('UTC');
$exchange_id = 'binance';
$exchange_class = "\\ccxt\\$exchange_id";
$exchange = new $exchange_class(array(
'apiKey' => 'YOUR_API_KEY',
'secret' => 'YOUR_SECRET',
'options' => array(
'defaultType' => 'future'
),
));
$exchange->load_markets(); // /docs/manual#loading-markets
// $exchange->verbose = true; // verbose mode on, uncomment for debugging
$symbol = 'BTC/USDT';
$market = $exchange->market($symbol);
// /docs/manual#passing-parameters-to-api-methods
$params = array(
'symbol' => $market['id'], // convert a unified CCXT symbol to an exchange-specific market id
'leverage' => 10,
);
// /docs/manual#implicit-api-methods
$response = $exchange->fapiPrivate_post_leverage($params);
print_r ($response);