Skip to content

Commit

Permalink
add spot v3
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Mar 9, 2022
1 parent 4e6fedb commit 9e733bc
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 24 deletions.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,17 @@ $mexc=new MxcSpot($key,$secret);
$mexc->setOptions([
//Set the request timeout to 60 seconds by default
'timeout'=>10,
//https://github.com/guzzle/guzzle
'proxy'=>[],
//https://www.php.net/manual/en/book.curl.php
'curl'=>[],

//If you are developing locally and need an agent, you can set this
//'proxy'=>true,
//More flexible Settings
/* 'proxy'=>[
'http' => 'http://127.0.0.1:12333',
'https' => 'http://127.0.0.1:12333',
'no' => ['.cn']
], */

//Close the certificate
//'verify'=>false,
//Set Demo Trading
'headers'=>['x-simulated-trading'=>1]
]);
```

### Mxc Spot API
### Mxc Spot API,[Support Spot V3](https://github.com/zhouaini528/mxc-php/blob/master/tests/spot_v3)

Order Book [More](https://github.com/zhouaini528/mxc-php/blob/master/tests/spot/market.php)

Expand Down
19 changes: 7 additions & 12 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,17 @@ $mexc=new MxcSpot($key,$secret);
$mexc->setOptions([
//Set the request timeout to 60 seconds by default
'timeout'=>10,
//https://github.com/guzzle/guzzle
'proxy'=>[],
//https://www.php.net/manual/en/book.curl.php
'curl'=>[],

//If you are developing locally and need an agent, you can set this
//'proxy'=>true,
//More flexible Settings
/* 'proxy'=>[
'http' => 'http://127.0.0.1:12333',
'https' => 'http://127.0.0.1:12333',
'no' => ['.cn']
], */

//Close the certificate
//'verify'=>false,
//Set Demo Trading
'headers'=>['x-simulated-trading'=>1]
]);
```

### Mxc 现货交易 API
### Mxc 现货交易 API[支持现货V3接口](https://github.com/zhouaini528/mxc-php/blob/master/tests/spot_v3)

行情数据 [More](https://github.com/zhouaini528/mxc-php/blob/master/tests/spot/market.php)

Expand Down
36 changes: 36 additions & 0 deletions tests/spot_v3/accounts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php


/**
* @author lin <[email protected]>
*
* Fill in your key and secret and pass can be directly run
*
* Most of them are unfinished and need your help
* https://github.com/zhouaini528/Mxc-php.git
* */
use Lin\Mxc\MxcSpotV3;

require __DIR__ .'../../../vendor/autoload.php';

include 'key_secret.php';

$mexc=new MxcSpotV3($key,$secret);

//You can set special needs
$mexc->setOptions([
//Set the request timeout to 60 seconds by default
'timeout'=>10,

]);

try {
$result=$mexc->privates()->getAccount();
print_r($result);
}catch (\Exception $e){
print_r(json_decode($e->getMessage(),true));
}




70 changes: 70 additions & 0 deletions tests/spot_v3/market.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php


/**
* @author lin <[email protected]>
*
* Fill in your key and secret and pass can be directly run
*
* Most of them are unfinished and need your help
* https://github.com/zhouaini528/Mxc-php.git
* */
use Lin\Mxc\MxcSpotV3;

require __DIR__ .'../../../vendor/autoload.php';

include 'key_secret.php';

$mexc=new MxcSpotV3();

//You can set special needs
$mexc->setOptions([
//Set the request timeout to 60 seconds by default
'timeout'=>10,

]);
/*
try {
$result=$mexc->publics()->getTime();
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}
//try {
// $result=$mexc->publics()->getExchangeInfo();
// print_r($result);
//}catch (\Exception $e){
// print_r($e->getMessage());
//}
try {
$result=$mexc->publics()->getDepth([
'symbol'=>'BTCUSDT',
'limit'=>10
]);
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}
try {
$result=$mexc->publics()->getTrades([
'symbol'=>'BTCUSDT',
'limit'=>10
]);
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}
*/
try {
$result=$mexc->publics()->getKline([
'symbol'=>'BTCUSDT',
'interval'=>'60m'
]);
print_r($result);
}catch (\Exception $e){
print_r($e->getMessage());
}

0 comments on commit 9e733bc

Please sign in to comment.