{"id":36334722,"url":"https://github.com/zhouaini528/exchanges-php","last_synced_at":"2026-01-11T12:04:33.181Z","repository":{"id":45249998,"uuid":"180393126","full_name":"zhouaini528/exchanges-php","owner":"zhouaini528","description":"This is a virtual currency SDK that brings together multiple exchanges","archived":false,"fork":false,"pushed_at":"2025-10-13T03:33:25.000Z","size":334,"stargazers_count":252,"open_issues_count":12,"forks_count":68,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-10-26T19:42:26.995Z","etag":null,"topics":["api","binance","bitcoin","bitmex","btc","exchange","huobi","okex","okx","websocket"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhouaini528.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-04-09T15:06:51.000Z","updated_at":"2025-10-13T03:32:43.000Z","dependencies_parsed_at":"2022-08-22T09:30:24.969Z","dependency_job_id":"d4aa5d79-a45a-4646-861b-515da6ad2d18","html_url":"https://github.com/zhouaini528/exchanges-php","commit_stats":{"total_commits":271,"total_committers":4,"mean_commits":67.75,"dds":"0.014760147601476037","last_synced_commit":"087a683f66f645a6cd50b0caf115ed27e84bf563"},"previous_names":[],"tags_count":90,"template":false,"template_full_name":null,"purl":"pkg:github/zhouaini528/exchanges-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhouaini528%2Fexchanges-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhouaini528%2Fexchanges-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhouaini528%2Fexchanges-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhouaini528%2Fexchanges-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhouaini528","download_url":"https://codeload.github.com/zhouaini528/exchanges-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhouaini528%2Fexchanges-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28302210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T11:18:18.743Z","status":"ssl_error","status_checked_at":"2026-01-11T11:07:56.842Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","binance","bitcoin","bitmex","btc","exchange","huobi","okex","okx","websocket"],"created_at":"2026-01-11T12:04:33.096Z","updated_at":"2026-01-11T12:04:33.172Z","avatar_url":"https://github.com/zhouaini528.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Introduction\nThis SDK brings together the APIs of the many exchanges currently trading the most, allowing developers to focus only on the business layer. It is based on [Bitmex](https://github.com/zhouaini528/bitmex-php) [Okex](https://github.com/zhouaini528/okex-php) [Huobi](https://github.com/zhouaini528/huobi-php) [Binance](https://github.com/zhouaini528/binance-php) and so on, and these underlying APIs are encapsulated again. Its advantages support multiple platforms at the same time, support unified parameter input and output, also support native parameter input, and simple quantitative trading to fully meet your needs. Even if you have special requirements, you can use the method [getPlatform()](https://github.com/zhouaini528/exchanges-php#support-for-original-parameters) to return the instance and call the underlying API.\n\n[中文文档](https://github.com/zhouaini528/exchanges-php/blob/master/README_CN.md)\n\n### Other exchanges API\n\n[Exchanges](https://github.com/zhouaini528/exchanges-php) It includes all of the following exchanges and is highly recommended.\n\n[Bitmex](https://github.com/zhouaini528/bitmex-php) Support [Websocket](https://github.com/zhouaini528/bitmex-php/blob/master/README.md#Websocket)\n\n[Okex](https://github.com/zhouaini528/okex-php) Support [Websocket](https://github.com/zhouaini528/okex-php/blob/master/README.md#Websocket)\n\n[Huobi](https://github.com/zhouaini528/huobi-php) Support [Websocket](https://github.com/zhouaini528/huobi-php/blob/master/README.md#Websocket)\n\n[Binance](https://github.com/zhouaini528/binance-php) Support [Websocket](https://github.com/zhouaini528/binance-php/blob/master/README.md#Websocket)\n\n[Kucoin](https://github.com/zhouaini528/kucoin-php)\n\n[Mxc](https://github.com/zhouaini528/Mxc-php)\n\n[Coinbase](https://github.com/zhouaini528/coinbase-php)\n\n[ZB](https://github.com/zhouaini528/zb-php)\n\n[Bitfinex](https://github.com/zhouaini528/bitfinex-php)\n\n[Bittrex](https://github.com/zhouaini528/bittrex-php)\n\n[Kraken](https://github.com/zhouaini528/kraken-php)\n\n[Gate](https://github.com/zhouaini528/gate-php)   \n\n[Bigone](https://github.com/zhouaini528/bigone-php)\n\n[Bybit](https://github.com/zhouaini528/bybit-php)\n\n[Bitget](https://github.com/zhouaini528/bitget-php)   \n\n[Poloniex](https://github.com/zhouaini528/poloniex-php)\n\n[Coinex](https://github.com/zhouaini528/coinex-php)\n\n**If you don't find the exchange SDK you want, you can tell me and I'll join them.**\n\n#### Install\n```\ncomposer require linwj/exchanges\n```\n\n#### Exchanges initialization\n```php\n//Public\n$exchanges=new Exchanges('binance');\n$exchanges=new Exchanges('bitmex');\n$exchanges=new Exchanges('okex');\n$exchanges=new Exchanges('huobi');\n$exchanges=new Exchanges('kucoin');\n...\n...\n\n//Private\n$exchanges=new Exchanges('binance',$key,$secret);\n$exchanges=new Exchanges('bitmex',$key,$secret);\n$exchanges=new Exchanges('okex',$key,$secret,$passphrase);\n$exchanges=new Exchanges('huobi',$key,$secret,$account_id);\n$exchanges=new Exchanges('kucoin',$key,$secret,$passphrase);\n...\n...\n```\n[Get Huobi Spot $account_id](https://github.com/zhouaini528/exchanges-php/blob/master/tests/huobi.php#L101)\n\n#### Uniform parameter return\n\nAll submitted parameters and return as long as the first character for the underlined ` _ ` all for custom parameters.\n\n```php\n/**\n * Buy()   Sell()   Show() Uniform parameter return\n * @return [\n *      ***Return to original data\n *      ...\n *      ...\n *      ***Returns custom data in a uniform return parameter format with '_' underscore\n *      _status=\u003eNEW  PART_FILLED  FILLED  CANCELING  CANCELLED  FAILURE\n *      _filled_qty=\u003eNumber of transactions completed\n *      _price_avg=\u003eAverage transaction price\n *      _filed_amount=\u003etransaction price\n *      _order_id=\u003esystem ID\n *      _client_id=\u003ecustom ID\n * ]\n *\n * */\n \n /**\n * System error\n * http request code 400 403 500 503\n * @return [\n *      _error=\u003e[\n *          ***Return to original data\n *          ...\n *          ...\n *          ***Returns custom data in a uniform return parameter format with '_' underscore\n *          _method =\u003e POST\n *          _url =\u003e https://testnet.bitmex.com/api/v1/order\n *          _httpcode =\u003e 400\n *      ]\n * ]\n * */\n```\nThe Buy Sell method has a waiting time of [2 seconds](https://github.com/zhouaini528/exchanges-php/blob/master/src/Config/Exchanges.php) by default. Because the exchange is a matching transaction, the inquiry needs to wait. The default 2-second query can be turned off as：[buy($data,false)](https://github.com/zhouaini528/exchanges-php/blob/master/src/Api/Trader.php#L41)\n\nBuy and sell query uniform parameter return [detail](https://github.com/zhouaini528/exchanges-php/blob/master/src/Api/Trader.php#L59)\n\nSystem error unified parameter return [binance](https://github.com/zhouaini528/exchanges-php/blob/master/tests/binance.php#L33)\n[okex](https://github.com/zhouaini528/exchanges-php/blob/master/tests/okex.php#L35)\n[huobi](https://github.com/zhouaini528/exchanges-php/blob/master/tests/huobi.php#L35)\n[bitmex](https://github.com/zhouaini528/exchanges-php/blob/master/tests/bitmex.php#L35)\n[kucoin](https://github.com/zhouaini528/exchanges-php/blob/master/tests/kucoin.php#L35)\n\nThe SDK currently only supports REST requests, and does not support Websocket for the time being. It will be added later.\n\nSupport for more request Settings [More](https://github.com/zhouaini528/exchanges-php/blob/master/tests/okex.php#L53)\n```php\n$exchanges-\u003esetOptions([\n    //Set the request timeout to 60 seconds by default\n    'timeout'=\u003e10,\n    \n    //https://github.com/guzzle/guzzle\n    'proxy'=\u003e[],\n\n    //https://www.php.net/manual/en/book.curl.php\n    'curl'=\u003e[],\n]);\n```\n\n#### Spot Trader\n##### Market\n```php\n//binance\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'BTCUSDT',\n    '_number'=\u003e'0.01',\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'symbol'=\u003e'BTCUSDT',\n    'type'=\u003e'MARKET',\n    'quantity'=\u003e'0.01',\n]);\n\n//okex default V3\n//$exchanges-\u003esetPlatform('spot')-\u003esetVersion('v5');// Use V5\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'BTC-USDT',\n    '_price'=\u003e'10',\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'instrument_id'=\u003e'btc-usdt',\n    'type'=\u003e'market',\n    'notional'=\u003e'10'\n]);\n\n//huobi\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'btcusdt',\n    '_price'=\u003e'10',\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'account-id'=\u003e$account_id,\n    'symbol'=\u003e'btcusdt',\n    'type'=\u003e'buy-market',\n    'amount'=\u003e10\n]);\n\n```\n##### Limit\n```php\n//binance\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'BTCUSDT',\n    '_number'=\u003e'0.01',\n    '_price'=\u003e'2000',\n]); \n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'symbol'=\u003e'BTCUSDT',\n    'type'=\u003e'LIMIT',\n    'quantity'=\u003e'0.01',\n    'price'=\u003e'2000',\n    'timeInForce'=\u003e'GTC',\n]);\n\n//okex default V3\n//$exchanges-\u003esetPlatform('spot')-\u003esetVersion('v5');// Use V5\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'BTC-USDT',\n    '_number'=\u003e'0.001',\n    '_price'=\u003e'2000',\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'instrument_id'=\u003e'btc-usdt',\n    'price'=\u003e'100',\n    'size'=\u003e'0.001',\n]);\n\n//huobi\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'btcusdt',\n    '_number'=\u003e'0.001',\n    '_price'=\u003e'2000',\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'account-id'=\u003e$account_id,\n    'symbol'=\u003e'btcusdt',\n    'type'=\u003e'buy-limit',\n    'amount'=\u003e'0.001',\n    'price'=\u003e'2001',\n]);\n```\n#### Future Trader\n##### Market\n```php\n//binance\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'BTCUSDT',\n    '_number'=\u003e'0.001',\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'symbol'=\u003e'BTCUSDT',\n    'quantity'=\u003e'0.001',\n    'type'=\u003e'MARKET',\n]);\n\n//bitmex\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'XBTUSD',\n    '_number'=\u003e'1',\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'symbol'=\u003e'XBTUSD',\n    'orderQty'=\u003e'1',\n    'ordType'=\u003e'Market',\n]);\n\n//okex default V3\n//$exchanges-\u003esetPlatform('future')-\u003esetVersion('v5');// Use V5\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'BTC-USD-190628',\n    '_number'=\u003e'1',\n    '_entry'=\u003etrue,//buy=ture |  buy=false\n]);\n$exchanges-\u003etrader()-\u003esell([\n    '_symbol'=\u003e'BTC-USD-190628',\n    '_number'=\u003e'1',\n    '_entry'=\u003etrue,//sell=ture |  sell=false\n]);\n\n\n\n\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'instrument_id'=\u003e'BTC-USD-190628',\n    'size'=\u003e1,\n    'type'=\u003e1,//1:open long 2:open short 3:close long 4:close short\n    //'price'=\u003e2000,\n    'leverage'=\u003e10,//10x or 20x leverage\n    'match_price' =\u003e 1,\n    'order_type'=\u003e0,\n]);\n\n//huobi\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'ETC191227',\n    '_number'=\u003e'1',\n    '_entry'=\u003etrue,//true:open  false:close\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'symbol'=\u003e'XRP',//string false \"BTC\",\"ETH\"...\n    'contract_type'=\u003e'quarter',//string false Contract Type (\"this_week\": \"next_week\": \"quarter\":)\n    'contract_code'=\u003e'XRP190927',//string false BTC180914\n    //'price'=\u003e'0.3',// decimal true Price\n    'volume'=\u003e'1',//long true Numbers of orders (amount)\n    //'direction'=\u003e'buy',// string  true    Transaction direction\n    'offset'=\u003e'open',// string  true    \"open\", \"close\"\n    'order_price_type'=\u003e'opponent',//\"limit\", \"opponent\"\n    'lever_rate'=\u003e20,//int true Leverage rate [if“Open”is multiple orders in 10 rate, there will be not multiple orders in 20 rate\n]);\n```\n##### Limit\n```php\n//binance\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'BTCUSDT',\n    '_number'=\u003e'0.001',\n    '_price'=\u003e'6000'\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'symbol'=\u003e'BTCUSDT',\n    'quantity'=\u003e'0.001',\n    'type'=\u003e'LIMIT',\n    'price'=\u003e'6500',\n    'timeInForce'=\u003e'GTC',\n]);\n\n//bitmex\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'XBTUSD',\n    '_number'=\u003e'1',\n    '_price'=\u003e100\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'symbol'=\u003e'XBTUSD',\n    'price'=\u003e'100',\n    'orderQty'=\u003e'1',\n    'ordType'=\u003e'Limit',\n]);\n\n//okex default V3\n//$exchanges-\u003esetPlatform('future')-\u003esetVersion('v5');// Use V5\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'BTC-USD-190628',\n    '_number'=\u003e'1',\n    '_price'=\u003e'2000',\n    '_entry'=\u003etrue,//open long\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'instrument_id'=\u003e'BTC-USD-190628',\n    'size'=\u003e1,\n    'type'=\u003e1,//1:open long 2:open short 3:close long 4:close short\n    'price'=\u003e2000,\n    'leverage'=\u003e10,//10x or 20x leverage\n    'match_price' =\u003e 0,\n    'order_type'=\u003e0,\n]);\n\n//huobi\n$exchanges-\u003etrader()-\u003ebuy([\n    '_symbol'=\u003e'XRP190927',\n    '_number'=\u003e'1',\n    '_price'=\u003e'0.3',\n    '_entry'=\u003etrue,//true:open  false:close\n]);\n//Support for original parameters\n$exchanges-\u003etrader()-\u003ebuy([\n    'symbol'=\u003e'XRP',//string false \"BTC\",\"ETH\"...\n    'contract_type'=\u003e'quarter',//string false Contract Type (\"this_week\": \"next_week\": \"quarter\":)\n    'contract_code'=\u003e'XRP190927',// string  false   BTC180914\n    'price'=\u003e'0.3',//decimal true Price\n    'volume'=\u003e'1',//long true Numbers of orders (amount)\n    //'direction'=\u003e'buy',// string  true Transaction direction\n    'offset'=\u003e'open',// string  true    \"open\", \"close\"\n    'order_price_type'=\u003e'limit',//\"limit\", \"opponent\"\n    'lever_rate'=\u003e20,//int true Leverage rate [if“Open”is multiple orders in 10 rate, there will be not multiple orders in 20 rate\n]);\n```\n\n#### Get Order Details\n```php\n//binance\n$exchanges-\u003etrader()-\u003eshow([\n    '_symbol'=\u003e'BTCUSDT',\n    '_order_id'=\u003e'324314658',\n    //'_client_id'=\u003e'1bc3e974577a6ad9ce730006eafb5522',\n]);\n\n//bitmex\n$exchanges-\u003etrader()-\u003eshow([\n    '_symbol'=\u003e'XBTUSD',\n    '_order_id'=\u003e'7d03ac2a-b24d-f48c-95f4-2628e6411927',\n    //'_client_id'=\u003e'1bc3e974577a6ad9ce730006eafb5522',\n]);\n\n//okex default V3\n//$exchanges-\u003esetPlatform('spot')-\u003esetVersion('v5');// Use V5\n$exchanges-\u003etrader()-\u003eshow([\n    '_symbol'=\u003e'BTC-USDT',\n    '_order_id'=\u003e'2671215997495296',\n    //'_client_id'=\u003e'1bc3e974577a6ad9ce730006eafb5522',\n]);\n$exchanges-\u003etrader()-\u003eshow([\n    '_symbol'=\u003e'BTC-USD-190927',\n    '_order_id'=\u003e'2671566274710528',\n    //'_client_id'=\u003e'1bc3e974577a6ad9ce730006eafb5522',\n]);\n$exchanges-\u003etrader()-\u003eshow([\n    '_symbol'=\u003e'BTC-USD-SWAP',\n    '_order_id'=\u003e'2671566274710528',\n    //'_client_id'=\u003e'1bc3e974577a6ad9ce730006eafb5522',\n]);\n\n//huobi spot\n$exchanges-\u003etrader()-\u003eshow([\n    '_order_id'=\u003e'29897313869',\n    //'_client_id'=\u003e'1bc3e974577a6ad9ce730006eafb5522',\n]);\n//huobi future\n$exchanges-\u003etrader()-\u003eshow([\n    '_symbol'=\u003e'XRP190927',\n    '_order_id'=\u003e'2715696586',\n    //'_client_id'=\u003e'1bc3e974577a6ad9ce730006eafb5522',\n]);\n\n```\n\n#### Get accounts or positions\n```php\n//binance\n//Get current account information.\n$exchanges-\u003eaccount()-\u003eget();\n\n//bitmex\n//bargaining transaction\n$exchanges-\u003eaccount()-\u003eget([\n    //Default return all\n    //'_symbol'=\u003e'XBTUSD'\n]);\n\n//okex  spot\n//This endpoint supports getting the balance, amount available/on hold of a token in spot account.\n$exchanges-\u003eaccount()-\u003eget([\n    '_symbol'=\u003e'BTC',\n]);\n\n//okex future\n//Get the information of holding positions of a contract.\n$exchanges-\u003eaccount()-\u003eget([\n    '_symbol'=\u003e'BTC-USD-190628',\n]);\n\n//okex swap\n$exchanges-\u003eaccount()-\u003eget([\n    '_symbol'=\u003e'BTC-USD-SWAP',\n]);\n\n//huobi spot\n$exchanges-\u003eaccount()-\u003eget([\n    '_symbol'=\u003e'btcusdt',\n]);\n\n//huobi future\n$exchanges-\u003eaccount()-\u003eget([\n    '_symbol'=\u003e'BTC190927',\n]);\n```\n\n#### Support for original parameters\nBelow is the call to the underlying API to initiate a new order instance\n\nThe following is the call to the underlying API to initiate a new order instance. There are two ways to call the underlying API.\n\nMethod 1: through $exchanges -\u003e getplatform ()\n\n```php\n//binance\n$exchanges=new Exchanges('binance',$key,$secret);\n$exchanges-\u003egetPlatform('spot')-\u003etrade()-\u003epostOrder([\n    'symbol'=\u003e'BTCUSDT',\n    'side'=\u003e'BUY',\n    'type'=\u003e'LIMIT',\n    'quantity'=\u003e'0.01',\n    'price'=\u003e'2000',\n    'timeInForce'=\u003e'GTC',\n]);\n$exchanges-\u003egetPlatform('future')-\u003etrade()-\u003epostOrder([\n    'symbol'=\u003e'BTCUSDT',\n    'side'=\u003e'BUY',\n    'type'=\u003e'LIMIT',\n    'quantity'=\u003e'0.01',\n    'price'=\u003e'2000',\n    'timeInForce'=\u003e'GTC',\n]);\n\n\n//bitmex\n$exchanges=new Exchanges('bitmex',$key,$secret);\n$exchanges-\u003egetPlatform()-\u003eorder()-\u003epost([\n    'symbol'=\u003e'XBTUSD',\n    'price'=\u003e'100',\n    'side'=\u003e'Buy',\n    'orderQty'=\u003e'1',\n    'ordType'=\u003e'Limit',\n]);\n\n\n//okex\n$exchanges=new Exchanges('okex',$key,$secret);\n$exchanges-\u003egetPlatform('spot')-\u003eorder()-\u003epost([\n    'instrument_id'=\u003e'btc-usdt',\n    'side'=\u003e'buy',\n    'price'=\u003e'100',\n    'size'=\u003e'0.001',\n    //'type'=\u003e'market',\n    //'notional'=\u003e'100'\n]);\n$exchanges-\u003egetPlatform('future')-\u003eorder()-\u003epost([\n    'instrument_id'=\u003e'btc-usd-190628',\n    'type'=\u003e'1',\n    'price'=\u003e'100',\n    'size'=\u003e'1',\n]);\n$result=$exchanges-\u003egetPlatform('swap')-\u003eorder()-\u003epost([\n    'instrument_id'=\u003e'BTC-USD-SWAP',\n    'type'=\u003e'1',\n    'price'=\u003e'5000',\n    'size'=\u003e'1',\n]);\n\n\n//huobi\n$exchanges=new Exchanges('huobi',$key,$secret);\n$exchanges-\u003egetPlatform('spot')-\u003eorder()-\u003epostPlace([\n    'account-id'=\u003e$account_id,\n    'symbol'=\u003e'btcusdt',\n    'type'=\u003e'buy-limit',\n    'amount'=\u003e'0.001',\n    'price'=\u003e'100',\n]);\n\n$exchanges-\u003egetPlatform('future')-\u003econtract()-\u003epostOrder([\n    'symbol'=\u003e'XRP',//string    false   \"BTC\",\"ETH\"...\n    'contract_type'=\u003e'quarter',//   string  false   Contract Type (\"this_week\": \"next_week\": \"quarter\":)\n    'contract_code'=\u003e'XRP190927',// string  false   BTC180914\n    'price'=\u003e'0.3',//   decimal true    Price\n    'volume'=\u003e'1',//    long    true    Numbers of orders (amount)\n    'direction'=\u003e'buy',//   string  true    Transaction direction\n    'offset'=\u003e'open',// string  true    \"open\", \"close\"\n    'order_price_type'=\u003e'limit',//\"limit\", \"opponent\"\n    'lever_rate'=\u003e20,//int  true    Leverage rate [if“Open”is multiple orders in 10 rate, there will be not multiple orders in 20 rate\n    //'client_order_id'=\u003e'',//long  false   Clients fill and maintain themselves, and this time must be greater than last time\n]);\n\n```\n\nMethod 2: directly instantiate the underlying exchange. The following code is equivalent to mode 1.\n\n```php\n//binance\n$binance=new Binance($key,$secret);\n$binance-\u003etrade()-\u003epostOrder([\n    'symbol'=\u003e'BTCUSDT',\n    'side'=\u003e'BUY',\n    'type'=\u003e'LIMIT',\n    'quantity'=\u003e'0.01',\n    'price'=\u003e'2000',\n    'timeInForce'=\u003e'GTC',\n]);\n\n$binance=new BinanceFuture($key,$secret);\n$binance-\u003etrade()-\u003epostOrder([\n    'symbol'=\u003e'BTCUSDT',\n    'side'=\u003e'BUY',\n    'type'=\u003e'LIMIT',\n    'quantity'=\u003e'0.01',\n    'price'=\u003e'2000',\n    'timeInForce'=\u003e'GTC',\n]);\n\n\n//bitmex\n$bitmex=new Bitmex($key,$secret);\n$bitmex-\u003eorder()-\u003epost([\n    'symbol'=\u003e'XBTUSD',\n    'price'=\u003e'100',\n    'side'=\u003e'Buy',\n    'orderQty'=\u003e'1',\n    'ordType'=\u003e'Limit',\n]);\n\n\n//okex\n$okex=new OkexSpot($key,$secret,$passphrase);\n$okex-\u003eorder()-\u003epost([\n    'instrument_id'=\u003e'btc-usdt',\n    'side'=\u003e'buy',\n    'price'=\u003e'100',\n    'size'=\u003e'0.001',\n    //'type'=\u003e'market',\n    //'notional'=\u003e'100'\n]);\n\n$okex=new OkexFuture($key,$secret,$passphrase);\n$okex-\u003eorder()-\u003epost([\n    'instrument_id'=\u003e'btc-usd-190628',\n    'type'=\u003e'1',\n    'price'=\u003e'100',\n    'size'=\u003e'1',\n]);\n\n$okex=new OkexSwap($key,$secret,$passphrase);\n$okex-\u003eorder()-\u003epost([\n    'instrument_id'=\u003e'BTC-USD-SWAP',\n    'type'=\u003e'1',\n    'price'=\u003e'5000',\n    'size'=\u003e'1',\n]);\n\n\n//huobi\n$huobi=new HuobiSpot($key,$secret);\n$huobi-\u003eorder()-\u003epostPlace([\n    'account-id'=\u003e$account_id,\n    'symbol'=\u003e'btcusdt',\n    'type'=\u003e'buy-limit',\n    'amount'=\u003e'0.001',\n    'price'=\u003e'100',\n]);\n\n$huobi=new HuobiFuture($key,$secret);\n$huobi-\u003econtract()-\u003epostOrder([\n    'symbol'=\u003e'XRP',//string    false   \"BTC\",\"ETH\"...\n    'contract_type'=\u003e'quarter',//   string  false   Contract Type (\"this_week\": \"next_week\": \"quarter\":)\n    'contract_code'=\u003e'XRP190927',// string  false   BTC180914\n    'price'=\u003e'0.3',//   decimal true    Price\n    'volume'=\u003e'1',//    long    true    Numbers of orders (amount)\n    'direction'=\u003e'buy',//   string  true    Transaction direction\n    'offset'=\u003e'open',// string  true    \"open\", \"close\"\n    'order_price_type'=\u003e'limit',//\"limit\", \"opponent\"\n    'lever_rate'=\u003e20,//int  true    Leverage rate [if“Open”is multiple orders in 10 rate, there will be not multiple orders in 20 rate\n    //'client_order_id'=\u003e'',//long  false   Clients fill and maintain themselves, and this time must be greater than last time\n]);\n```\n\n[More Tests](https://github.com/zhouaini528/exchanges-php/tree/master/tests)\n\n[More API](https://github.com/zhouaini528/exchanges-php/tree/master/src/Api)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhouaini528%2Fexchanges-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhouaini528%2Fexchanges-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhouaini528%2Fexchanges-php/lists"}