mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
- [Huobi Swaps](./examples/php/)
|
||||
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
include './ccxt.php';
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
$exchange = new \ccxt\huobipro(array(
|
||||
'apiKey' => 'YOUR_API_KEY', // ←------------ replace with your keys
|
||||
'secret' => 'YOUR_SECRET_KEY',
|
||||
// 'verbose' => true, // uncomment if debug output is needed
|
||||
));
|
||||
|
||||
try {
|
||||
|
||||
$markets = $exchange->load_markets ();
|
||||
|
||||
// creating a linear swap (limit) order
|
||||
$symbol = 'ADA/USDT:USDT';
|
||||
$order_type = 'limit';
|
||||
$side = 'buy';
|
||||
$offset = 'open';
|
||||
$leverage = 1;
|
||||
$amount = 1;
|
||||
$price = 1;
|
||||
|
||||
$params = array (
|
||||
'offset' => $offset,
|
||||
'lever_rate' => $leverage,
|
||||
);
|
||||
|
||||
$order = $exchange->create_order ($symbol, $order_type, $side, $amount, $price, $params);
|
||||
var_dump ($order['id']);
|
||||
|
||||
} catch (\ccxt\NetworkError $e) {
|
||||
echo '[Network Error] ' . $e->getMessage() . "\n";
|
||||
} catch (\ccxt\ExchangeError $e) {
|
||||
echo '[Exchange Error] ' . $e->getMessage() . "\n";
|
||||
} catch (Exception $e) {
|
||||
echo '[Error] ' . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user