iamirnet / xtcom
xt.com 的 PHP SDK
1.0.3
2022-04-22 06:50 UTC
README
PHP XT API
本项目旨在帮助您创建与XT API交互的项目。
安装
composer require iamirnet/xtcom
点击获取安装帮助
安装 Composer
如果上述步骤无效,请安装 composer 并重试。
Debian / Ubuntu
sudo apt-get install curl php-curl
curl -s http://getcomposer.org/installer | php
php composer.phar install
未找到 Composer?请使用以下命令代替
php composer.phar require "iamirnet/xtcom"
在 Windows 上安装
下载并安装 composer
- https://getcomposer.org/download/
- 在您的驱动器上创建一个文件夹,例如 C:\iAmirNet\XT
- 运行命令提示符并输入
cd C:\iAmirNet\XT
composer require iamirnet/xtcom
- 完成安装后,将 vendor 文件夹复制到您的项目中。
入门
composer require iamirnet/xtcom
require 'vendor/autoload.php'; // config by specifying api key and secret $api = new \iAmirNet\XT\Client("<api key>","<secret>");
=======
交易市场配置 更多...
//Call this before running any functions print_r($api->marketConfig(/* optional */"btc_usdt"));
蜡烛图数据 更多...
//Call this before running any functions print_r($api->kline("btc_usdt",/* Kline type is optional */ "1min",/* Since is optional */ 0));
聚合市场(行情)更多...
//Call this before running any functions print_r($api->bookTicker("btc_usdt"));
所有市场的最新行情 更多...
//Call this before running any functions print_r($api->bookPrices());
市场深度数据 更多...
//Call this before running any functions print_r($api->depth("btc_usdt"));
最新市场交易记录 更多...
//Call this before running any functions print_r($api->trades("btc_usdt"));
获取服务器时间 更多...
//Call this before running any functions print_r($api->getServerTime());
获取交易(现货)账户资产 更多...
//Call this before running any functions print_r($api->balances());
获取账户类型 更多...
//Call this before running any functions print_r($api->account());
获取特定账户资产 更多...
//Call this before running any functions $accountId = 2; print_r($api->specificAccount($accountId));
下单 更多...
买入
//Call this before running any functions $quantity = 1; $price = 0.0005; print_r($api->buy("btc_usdt", $quantity, $price, "LIMIT"));
卖出
//Call this before running any functions $quantity = 1; $price = 0.0006; print_r($api->sell("btc_usdt", $quantity, $price, "LIMIT"));
批量订单 更多...
//Call this before running any functions $data = [ [ "price" => 10000.123, "amount" => 0.1, "type" => 1 // 1, buy, 0 sell ], [ "price" => 10000.123, "amount" => 0.1, "type" => 0 // 1, buy, 0 sell ], ]; print_r($api->bulkOrders("btc_usdt", $data));
取消订单 更多...
//Call this before running any functions $orderId = 156387346384491; print_r($api->cancel("btc_usdt", $orderId));
取消批量订单 更多...
//Call this before running any functions $data = []; $data[] = 157154392122493; $data[] = 157154392122494; $data[] = 157154392122495; $data[] = 157154392122496; $data[] = 157154392122497; print_r($api->bulkOrdersCancel("btc_usdt", $data));
订单信息 更多...
//Call this before running any functions $orderId = 156387346384491; print_r($api->orderInfo("btc_usdt", $orderId));
获取未完成订单 更多...
$openorders = $api->openOrders("btc_usdt",/* page is optional */ 1,/* pageSize is optional */ 10); print_r($openorders);
获取一批订单信息 更多...
//Call this before running any functions $data = []; $data[] = 157154392122493; $data[] = 157154392122494; $data[] = 157154392122495; $data[] = 157154392122496; $data[] = 157154392122497; print_r($api->bulkOrdersInfo("btc_usdt", $data));
获取交易记录 更多...
$mytrades = $api->myTrades("btc_usdt", /* limit is optional */ 200, /* Start Time is optional */ 1626428273000, /* End Time is optional */ 1626428873020, /* From ID is optional */ 6821734611983271937); print_r($mytrades);
贡献
捐赠
- USDT 或 TRX: TUE8GiY4vmz831N65McwzZVbA9XEDaLinn 😘❤