Skip to content

Commit 0e6cb85

Browse files
committed
add spot cross margin API
1 parent 137958f commit 0e6cb85

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1884
-447
lines changed

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## gate-api@4.20.1
1+
## gate-api@5.21.2
22

33
TypeScript NodeJS client for gate-api.
44

@@ -8,7 +8,7 @@ APIv4 provides spot, margin and futures trading operations. There are public API
88

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

11-
- API version: 4.20.1
11+
- API version: 4.21.2
1212
- Package version:
1313
- Build package: org.openapitools.codegen.languages.TypeScriptNodeClientCodegen
1414
For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts)
@@ -160,6 +160,14 @@ Class | Method | HTTP request | Description
160160
*MarginApi* | [**updateLoanRecord**](docs/MarginApi.md#updateLoanRecord) | **PATCH** /margin/loan_records/{loan_record_id} | Modify a loan record
161161
*MarginApi* | [**getAutoRepayStatus**](docs/MarginApi.md#getAutoRepayStatus) | **GET** /margin/auto_repay | Retrieve user auto repayment setting
162162
*MarginApi* | [**setAutoRepay**](docs/MarginApi.md#setAutoRepay) | **POST** /margin/auto_repay | Update user\'s auto repayment setting
163+
*MarginApi* | [**listCrossMarginCurrencies**](docs/MarginApi.md#listCrossMarginCurrencies) | **GET** /margin/cross/currencies | Currencies supported by cross margin.
164+
*MarginApi* | [**getCrossMarginCurrency**](docs/MarginApi.md#getCrossMarginCurrency) | **GET** /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin
165+
*MarginApi* | [**getCrossMarginAccount**](docs/MarginApi.md#getCrossMarginAccount) | **GET** /margin/cross/accounts | Retrieve cross margin account
166+
*MarginApi* | [**listCrossMarginLoans**](docs/MarginApi.md#listCrossMarginLoans) | **GET** /margin/cross/loans | List cross margin borrow history
167+
*MarginApi* | [**createCrossMarginLoan**](docs/MarginApi.md#createCrossMarginLoan) | **POST** /margin/cross/loans | Create a cross margin borrow loan
168+
*MarginApi* | [**getCrossMarginLoan**](docs/MarginApi.md#getCrossMarginLoan) | **GET** /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail
169+
*MarginApi* | [**listCrossMarginRepayments**](docs/MarginApi.md#listCrossMarginRepayments) | **GET** /margin/cross/repayments | Retrieve cross margin repayments
170+
*MarginApi* | [**repayCrossMarginLoan**](docs/MarginApi.md#repayCrossMarginLoan) | **POST** /margin/cross/repayments | Repay cross margin loan
163171
*SpotApi* | [**listCurrencies**](docs/SpotApi.md#listCurrencies) | **GET** /spot/currencies | List all currencies\' detail
164172
*SpotApi* | [**getCurrency**](docs/SpotApi.md#getCurrency) | **GET** /spot/currencies/{currency} | Get detail of one particular currency
165173
*SpotApi* | [**listCurrencyPairs**](docs/SpotApi.md#listCurrencyPairs) | **GET** /spot/currency_pairs | List all currency pairs supported
@@ -194,6 +202,7 @@ Class | Method | HTTP request | Description
194202
*WalletApi* | [**listSubAccountBalances**](docs/WalletApi.md#listSubAccountBalances) | **GET** /wallet/sub_account_balances | Retrieve sub account balances
195203
*WalletApi* | [**getTradeFee**](docs/WalletApi.md#getTradeFee) | **GET** /wallet/fee | Retrieve personal trading fee
196204
*WithdrawalApi* | [**withdraw**](docs/WithdrawalApi.md#withdraw) | **POST** /withdrawals | Withdraw
205+
*WithdrawalApi* | [**cancelWithdrawal**](docs/WithdrawalApi.md#cancelWithdrawal) | **DELETE** /withdrawals/{withdrawal_id} | Cancel withdrawal with specified ID
197206

198207

199208
## Documentation for Models
@@ -204,6 +213,12 @@ Class | Method | HTTP request | Description
204213
- [CancelOrderResult](docs/CancelOrderResult.md)
205214
- [Contract](docs/Contract.md)
206215
- [ContractStat](docs/ContractStat.md)
216+
- [CrossMarginAccount](docs/CrossMarginAccount.md)
217+
- [CrossMarginBalance](docs/CrossMarginBalance.md)
218+
- [CrossMarginCurrency](docs/CrossMarginCurrency.md)
219+
- [CrossMarginLoan](docs/CrossMarginLoan.md)
220+
- [CrossMarginRepayRequest](docs/CrossMarginRepayRequest.md)
221+
- [CrossMarginRepayment](docs/CrossMarginRepayment.md)
207222
- [Currency](docs/Currency.md)
208223
- [CurrencyPair](docs/CurrencyPair.md)
209224
- [DeliveryContract](docs/DeliveryContract.md)

api/futuresApi.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,11 +861,14 @@ export class FuturesApi {
861861
* @param settle Settle currency
862862
* @param contract Futures contract
863863
* @param leverage New position leverage
864+
* @param opts Optional parameters
865+
* @param opts.crossLeverageLimit Cross margin leverage(valid only when `leverage` is 0)
864866
*/
865867
public async updatePositionLeverage(
866868
settle: 'btc' | 'usdt',
867869
contract: string,
868870
leverage: string,
871+
opts: { crossLeverageLimit?: string },
869872
): Promise<{ response: AxiosResponse; body: Position }> {
870873
const localVarPath =
871874
this.client.basePath +
@@ -897,8 +900,16 @@ export class FuturesApi {
897900
throw new Error('Required parameter leverage was null or undefined when calling updatePositionLeverage.');
898901
}
899902

903+
opts = opts || {};
900904
localVarQueryParameters['leverage'] = ObjectSerializer.serialize(leverage, 'string');
901905

906+
if (opts.crossLeverageLimit !== undefined) {
907+
localVarQueryParameters['cross_leverage_limit'] = ObjectSerializer.serialize(
908+
opts.crossLeverageLimit,
909+
'string',
910+
);
911+
}
912+
902913
const config: AxiosRequestConfig = {
903914
method: 'POST',
904915
params: localVarQueryParameters,
@@ -1063,11 +1074,13 @@ export class FuturesApi {
10631074
* @param settle Settle currency
10641075
* @param contract Futures contract
10651076
* @param change Margin change. Use positive number to increase margin, negative number otherwise.
1077+
* @param dualSide Long or short position
10661078
*/
10671079
public async updateDualModePositionMargin(
10681080
settle: 'btc' | 'usdt',
10691081
contract: string,
10701082
change: string,
1083+
dualSide: 'dual_long' | 'dual_short',
10711084
): Promise<{ response: AxiosResponse; body: Array<Position> }> {
10721085
const localVarPath =
10731086
this.client.basePath +
@@ -1105,8 +1118,17 @@ export class FuturesApi {
11051118
);
11061119
}
11071120

1121+
// verify required parameter 'dualSide' is not null or undefined
1122+
if (dualSide === null || dualSide === undefined) {
1123+
throw new Error(
1124+
'Required parameter dualSide was null or undefined when calling updateDualModePositionMargin.',
1125+
);
1126+
}
1127+
11081128
localVarQueryParameters['change'] = ObjectSerializer.serialize(change, 'string');
11091129

1130+
localVarQueryParameters['dual_side'] = ObjectSerializer.serialize(dualSide, "'dual_long' | 'dual_short'");
1131+
11101132
const config: AxiosRequestConfig = {
11111133
method: 'POST',
11121134
params: localVarQueryParameters,

0 commit comments

Comments
 (0)