Path: blob/master/bitget-php-sdk-api/test/api/MixOrderTest.php
735 views
<?php123namespace test\api;45use bitget\api\BitgetApi;6use bitget\api\v1\MixOrderApi;7use bitget\internal\BitgetApiClient;8use bitget\internal\BitgetRestClient;910class MixOrderTest11{12var MixOrderApi $mixOrderApi;13var BitgetApi $bitgetApi;1415public function __construct()16{17$restClient = new BitgetRestClient();18$this->mixOrderApi = $restClient->getMixClient()->getOrderApi();19$this->bitgetApi = new BitgetApi(new BitgetApiClient());20}2122public function testPlaceOrder()23{24$params = array("symbol" => "BTCUSDT_UMCBL",25"marginCoin" => "USDT",26"side" => "open_long",27"orderType" => "limit",28"price" => "27012",29"size" => "0.01",30"timInForceValue" => "normal");31return $this->mixOrderApi->placeOrder($params);32}3334public function testPost()35{36$params = array("symbol" => "BTCUSDT_UMCBL",37"marginCoin" => "USDT",38"side" => "open_long",39"orderType" => "limit",40"price" => "27012",41"size" => "0.01",42"timInForceValue" => "normal");43return $this->bitgetApi->post("/api/mix/v1/order/placeOrder", $params);44}4546public function testGet()47{48$params = array("productType" => "umcbl");49return $this->bitgetApi->get("/api/mix/v1/account/accounts", $params);50}5152public function testGetWithEncodeParams()53{54$params = array("symbol" => 'AIUSDT',55"businessType" => "spot");56return $this->bitgetApi->get("/api/v2/common/trade-rate", $params);57}5859public function testGetWithNoParams()60{61$params = array();62return $this->bitgetApi->get("/api/spot/v1/account/getInfo", $params);63}64}6566