Skip to content

Commit

Permalink
add transfer id and sub account cross margin balances
Browse files Browse the repository at this point in the history
  • Loading branch information
revilwang committed Jul 15, 2022
1 parent c5d1905 commit 5e8d57d
Show file tree
Hide file tree
Showing 20 changed files with 2,683 additions and 40 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ APIv4 provides spot, margin and futures trading operations. There are public API

This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 4.25.1
- Package version: 5.25.1
- API version: 4.26.0
- Package version: 5.26.0
- Build package: org.openapitools.codegen.languages.PhpClientCodegen
For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts)

Expand Down Expand Up @@ -259,6 +259,8 @@ Class | Method | HTTP request | Description
*WalletApi* | [**listSubAccountBalances**](docs/Api/WalletApi.md#listsubaccountbalances) | **GET** /wallet/sub_account_balances | Retrieve sub account balances
*WalletApi* | [**listSubAccountMarginBalances**](docs/Api/WalletApi.md#listsubaccountmarginbalances) | **GET** /wallet/sub_account_margin_balances | Query sub accounts' margin balances
*WalletApi* | [**listSubAccountFuturesBalances**](docs/Api/WalletApi.md#listsubaccountfuturesbalances) | **GET** /wallet/sub_account_futures_balances | Query sub accounts' futures account balances
*WalletApi* | [**listSubAccountCrossMarginBalances**](docs/Api/WalletApi.md#listsubaccountcrossmarginbalances) | **GET** /wallet/sub_account_cross_margin_balances | Query subaccount's cross_margin account info
*WalletApi* | [**listSavedAddress**](docs/Api/WalletApi.md#listsavedaddress) | **GET** /wallet/saved_address | Query saved address
*WalletApi* | [**getTradeFee**](docs/Api/WalletApi.md#gettradefee) | **GET** /wallet/fee | Retrieve personal trading fee
*WalletApi* | [**getTotalBalance**](docs/Api/WalletApi.md#gettotalbalance) | **GET** /wallet/total_balance | Retrieve user's total balances
*WithdrawalApi* | [**withdraw**](docs/Api/WithdrawalApi.md#withdraw) | **POST** /withdrawals | Withdraw
Expand Down Expand Up @@ -346,19 +348,23 @@ Class | Method | HTTP request | Description
- [PositionCloseOrder](docs/Model/PositionCloseOrder.md)
- [RepayRequest](docs/Model/RepayRequest.md)
- [Repayment](docs/Model/Repayment.md)
- [SavedAddress](docs/Model/SavedAddress.md)
- [SpotAccount](docs/Model/SpotAccount.md)
- [SpotPricePutOrder](docs/Model/SpotPricePutOrder.md)
- [SpotPriceTrigger](docs/Model/SpotPriceTrigger.md)
- [SpotPriceTriggeredOrder](docs/Model/SpotPriceTriggeredOrder.md)
- [SubAccountBalance](docs/Model/SubAccountBalance.md)
- [SubAccountCrossMarginBalance](docs/Model/SubAccountCrossMarginBalance.md)
- [SubAccountFuturesBalance](docs/Model/SubAccountFuturesBalance.md)
- [SubAccountMarginBalance](docs/Model/SubAccountMarginBalance.md)
- [SubAccountTransfer](docs/Model/SubAccountTransfer.md)
- [SubCrossMarginAccount](docs/Model/SubCrossMarginAccount.md)
- [SystemTime](docs/Model/SystemTime.md)
- [Ticker](docs/Model/Ticker.md)
- [TotalBalance](docs/Model/TotalBalance.md)
- [Trade](docs/Model/Trade.md)
- [TradeFee](docs/Model/TradeFee.md)
- [TransactionID](docs/Model/TransactionID.md)
- [Transfer](docs/Model/Transfer.md)
- [TriggerOrderResponse](docs/Model/TriggerOrderResponse.md)
- [WithdrawStatus](docs/Model/WithdrawStatus.md)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gateio/gateapi-php",
"version": "5.25.1",
"version": "5.26.0",
"description": "Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf.",
"keywords": [
"gate",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/Api/SpotApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ $apiInstance = new GateApi\Api\SpotApi(
);
$associate_array['status'] = 'status_example'; // string | Only list the orders with this status
$associate_array['market'] = 'BTC_USDT'; // string | Currency pair
$associate_array['account'] = 'account_example'; // string | Trading account
$associate_array['account'] = 'account_example'; // string | Trading account type. Portfolio margin account must set to `cross_margin`
$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['offset'] = 0; // int | List offset, starting from 0

Expand All @@ -1412,7 +1412,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | **string**| Only list the orders with this status |
**market** | **string**| Currency pair | [optional]
**account** | **string**| Trading account | [optional]
**account** | **string**| Trading account type. Portfolio margin account must set to `cross_margin` | [optional]
**limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100]
**offset** | **int**| List offset, starting from 0 | [optional] [default to 0]

Expand Down Expand Up @@ -1517,7 +1517,7 @@ $apiInstance = new GateApi\Api\SpotApi(
$config
);
$market = 'BTC_USDT'; // string | Currency pair
$account = 'account_example'; // string | Trading account
$account = 'account_example'; // string | Trading account type. Portfolio margin account must set to `cross_margin`

try {
$result = $apiInstance->cancelSpotPriceTriggeredOrderList($market, $account);
Expand All @@ -1536,7 +1536,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**market** | **string**| Currency pair | [optional]
**account** | **string**| Trading account | [optional]
**account** | **string**| Trading account type. Portfolio margin account must set to `cross_margin` | [optional]

### Return type

Expand Down
139 changes: 135 additions & 4 deletions docs/Api/WalletApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Method | HTTP request | Description
[**listSubAccountBalances**](WalletApi.md#listSubAccountBalances) | **GET** /wallet/sub_account_balances | Retrieve sub account balances
[**listSubAccountMarginBalances**](WalletApi.md#listSubAccountMarginBalances) | **GET** /wallet/sub_account_margin_balances | Query sub accounts' margin balances
[**listSubAccountFuturesBalances**](WalletApi.md#listSubAccountFuturesBalances) | **GET** /wallet/sub_account_futures_balances | Query sub accounts' futures account balances
[**listSubAccountCrossMarginBalances**](WalletApi.md#listSubAccountCrossMarginBalances) | **GET** /wallet/sub_account_cross_margin_balances | Query subaccount's cross_margin account info
[**listSavedAddress**](WalletApi.md#listSavedAddress) | **GET** /wallet/saved_address | Query saved address
[**getTradeFee**](WalletApi.md#getTradeFee) | **GET** /wallet/fee | Retrieve personal trading fee
[**getTotalBalance**](WalletApi.md#getTotalBalance) | **GET** /wallet/total_balance | Retrieve user's total balances

Expand Down Expand Up @@ -281,7 +283,7 @@ Name | Type | Description | Notes

## transfer

> transfer($transfer)
> \GateApi\Model\TransactionID transfer($transfer)
Transfer between trading accounts

Expand All @@ -306,7 +308,8 @@ $apiInstance = new GateApi\Api\WalletApi(
$transfer = new \GateApi\Model\Transfer(); // \GateApi\Model\Transfer |

try {
$apiInstance->transfer($transfer);
$result = $apiInstance->transfer($transfer);
print_r($result);
} catch (GateApi\GateApiException $e) {
echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL;
} catch (Exception $e) {
Expand All @@ -324,7 +327,7 @@ Name | Type | Description | Notes

### Return type

void (empty response body)
[**\GateApi\Model\TransactionID**](../Model/TransactionID.md)

### Authorization

Expand All @@ -333,7 +336,7 @@ void (empty response body)
### HTTP request headers

- **Content-Type**: application/json
- **Accept**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../../README.md#documentation-for-models)
Expand Down Expand Up @@ -723,6 +726,134 @@ Name | Type | Description | Notes
[[Back to README]](../../README.md)


## listSubAccountCrossMarginBalances

> \GateApi\Model\SubAccountCrossMarginBalance[] listSubAccountCrossMarginBalances($sub_uid)
Query subaccount's cross_margin account info

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure Gate APIv4 authorization: apiv4
$config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET');


$apiInstance = new GateApi\Api\WalletApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$associate_array['sub_uid'] = '10003'; // string | Sub account user ID. Return records related to all sub accounts if not specified

try {
$result = $apiInstance->listSubAccountCrossMarginBalances($associate_array);
print_r($result);
} catch (GateApi\GateApiException $e) {
echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL;
} catch (Exception $e) {
echo 'Exception when calling WalletApi->listSubAccountCrossMarginBalances: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters

Note: the input parameter is an associative array with the keys listed as the parameter name below.


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**sub_uid** | **string**| Sub account user ID. Return records related to all sub accounts if not specified | [optional]

### Return type

[**\GateApi\Model\SubAccountCrossMarginBalance[]**](../Model/SubAccountCrossMarginBalance.md)

### Authorization

[apiv4](../../README.md#apiv4)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../../README.md#documentation-for-models)
[[Back to README]](../../README.md)


## listSavedAddress

> \GateApi\Model\SavedAddress[] listSavedAddress($currency, $chain, $limit)
Query saved address

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure Gate APIv4 authorization: apiv4
$config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET');


$apiInstance = new GateApi\Api\WalletApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$associate_array['currency'] = 'USDT'; // string | Currency
$associate_array['chain'] = ''; // string | Chain name
$associate_array['limit'] = '50'; // string | Maximum number returned, 100 at most

try {
$result = $apiInstance->listSavedAddress($associate_array);
print_r($result);
} catch (GateApi\GateApiException $e) {
echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL;
} catch (Exception $e) {
echo 'Exception when calling WalletApi->listSavedAddress: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters

Note: the input parameter is an associative array with the keys listed as the parameter name below.


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**currency** | **string**| Currency |
**chain** | **string**| Chain name | [optional] [default to &#39;&#39;]
**limit** | **string**| Maximum number returned, 100 at most | [optional] [default to &#39;50&#39;]

### Return type

[**\GateApi\Model\SavedAddress[]**](../Model/SavedAddress.md)

### Authorization

[apiv4](../../README.md#apiv4)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../../README.md#documentation-for-models)
[[Back to README]](../../README.md)


## getTradeFee

> \GateApi\Model\TradeFee getTradeFee($currency_pair)
Expand Down
1 change: 1 addition & 0 deletions docs/Model/MarginCurrencyPair.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ Name | Type | Description | Notes
**min_base_amount** | **string** | Minimum base currency to loan, &#x60;null&#x60; means no limit | [optional]
**min_quote_amount** | **string** | Minimum quote currency to loan, &#x60;null&#x60; means no limit | [optional]
**max_quote_amount** | **string** | Maximum borrowable amount for quote currency. Base currency limit is calculated by quote maximum and market price. &#x60;null&#x60; means no limit | [optional]
**status** | **int** | Currency pair status - &#x60;0&#x60;: disabled - &#x60;1&#x60;: enabled | [optional]

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
14 changes: 14 additions & 0 deletions docs/Model/SavedAddress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# # SavedAddress

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**currency** | **string** | Currency | [optional]
**chain** | **string** | Chain name | [optional]
**address** | **string** | Address | [optional]
**name** | **string** | Name | [optional]
**tag** | **string** | Tag | [optional]
**verified** | **string** | Whether to pass the verification 0-unverified, 1-verified | [optional]

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
2 changes: 1 addition & 1 deletion docs/Model/SpotPricePutOrder.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Name | Type | Description | Notes
**side** | **string** | Order side - buy: buy side - sell: sell side |
**price** | **string** | Order price |
**amount** | **string** | Order amount |
**account** | **string** | Trading type - normal: spot trading - margin: margin trading | [default to 'normal']
**account** | **string** | Trading account type. Portfolio margin account must set to &#x60;cross_margin&#x60; - normal: spot trading - margin: margin trading - cross_margin: cross_margin trading | [default to 'normal']
**time_in_force** | **string** | time_in_force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only | [optional] [default to 'gtc']

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
10 changes: 10 additions & 0 deletions docs/Model/SubAccountCrossMarginBalance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# # SubAccountCrossMarginBalance

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**uid** | **string** | User ID | [optional]
**available** | [**\GateApi\Model\SubCrossMarginAccount**](.md) | 账户余额信息 | [optional]

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
24 changes: 24 additions & 0 deletions docs/Model/SubCrossMarginAccount.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# # SubCrossMarginAccount

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**user_id** | **int** | User ID of the cross margin account. 0 means that the subaccount has not yet opened a cross margin account | [optional]
**locked** | **bool** | Whether account is locked | [optional]
**balances** | [**map[string,\GateApi\Model\CrossMarginBalance]**](CrossMarginBalance.md) | | [optional]
**total** | **string** | Total account value in USDT, i.e., the sum of all currencies&#39; &#x60;(available+freeze)*price*discount&#x60; | [optional]
**borrowed** | **string** | Total borrowed value in USDT, i.e., the sum of all currencies&#39; &#x60;borrowed*price*discount&#x60; | [optional]
**borrowed_net** | **string** | Total borrowed value in USDT * borrowed factor | [optional]
**net** | **string** | Total net assets in USDT | [optional]
**leverage** | **string** | Position leverage | [optional]
**interest** | **string** | Total unpaid interests in USDT, i.e., the sum of all currencies&#39; &#x60;interest*price*discount&#x60; | [optional]
**risk** | **string** | Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: &#x60;total / (borrowed+interest)&#x60; | [optional]
**total_initial_margin** | **string** | Total initial margin | [optional]
**total_margin_balance** | **string** | Total margin balance | [optional]
**total_maintenance_margin** | **string** | Total maintenance margin | [optional]
**total_initial_margin_rate** | **string** | Total initial margin rate | [optional]
**total_maintenance_margin_rate** | **string** | Total maintenance margin rate | [optional]
**total_available_margin** | **string** | Total available margin | [optional]

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
9 changes: 9 additions & 0 deletions docs/Model/TransactionID.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# # TransactionID

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**tx_id** | **int** | Order id | [optional]

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
Loading

0 comments on commit 5e8d57d

Please sign in to comment.