Skip to content

Commit

Permalink
flash swap api; missing fields in futures auto order; wallet sub acco…
Browse files Browse the repository at this point in the history
…unt balances
  • Loading branch information
revilwang committed May 27, 2022
1 parent 86527b7 commit 152a040
Show file tree
Hide file tree
Showing 33 changed files with 1,473 additions and 72 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## gate-api@5.23.4
## gate-api@5.24.0

TypeScript NodeJS client for gate-api.

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

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

- API version: 4.23.4
- API version: 4.24.0
- Package version:
- Build package: org.openapitools.codegen.languages.TypeScriptNodeClientCodegen
For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts)
Expand Down Expand Up @@ -106,6 +106,11 @@ Class | Method | HTTP request | Description
*DeliveryApi* | [**cancelPriceTriggeredDeliveryOrderList**](docs/DeliveryApi.md#cancelPriceTriggeredDeliveryOrderList) | **DELETE** /delivery/{settle}/price_orders | Cancel all open orders
*DeliveryApi* | [**getPriceTriggeredDeliveryOrder**](docs/DeliveryApi.md#getPriceTriggeredDeliveryOrder) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a single order
*DeliveryApi* | [**cancelPriceTriggeredDeliveryOrder**](docs/DeliveryApi.md#cancelPriceTriggeredDeliveryOrder) | **DELETE** /delivery/{settle}/price_orders/{order_id} | Cancel a single order
*FlashSwapApi* | [**listFlashSwapCurrencies**](docs/FlashSwapApi.md#listFlashSwapCurrencies) | **GET** /flash_swap/currencies | List all supported currencies in flash swap
*FlashSwapApi* | [**listFlashSwapOrders**](docs/FlashSwapApi.md#listFlashSwapOrders) | **GET** /flash_swap/orders | List all flash swap orders
*FlashSwapApi* | [**createFlashSwapOrder**](docs/FlashSwapApi.md#createFlashSwapOrder) | **POST** /flash_swap/orders | Create a flash swap order
*FlashSwapApi* | [**getFlashSwapOrder**](docs/FlashSwapApi.md#getFlashSwapOrder) | **GET** /flash_swap/orders/{order_id} | Get a single flash swap order\'s detail
*FlashSwapApi* | [**previewFlashSwapOrder**](docs/FlashSwapApi.md#previewFlashSwapOrder) | **POST** /flash_swap/orders/preview | Initiate a flash swap order preview
*FuturesApi* | [**listFuturesContracts**](docs/FuturesApi.md#listFuturesContracts) | **GET** /futures/{settle}/contracts | List all futures contracts
*FuturesApi* | [**getFuturesContract**](docs/FuturesApi.md#getFuturesContract) | **GET** /futures/{settle}/contracts/{contract} | Get a single contract
*FuturesApi* | [**listFuturesOrderBook**](docs/FuturesApi.md#listFuturesOrderBook) | **GET** /futures/{settle}/order_book | Futures order book
Expand All @@ -115,6 +120,7 @@ Class | Method | HTTP request | Description
*FuturesApi* | [**listFuturesFundingRateHistory**](docs/FuturesApi.md#listFuturesFundingRateHistory) | **GET** /futures/{settle}/funding_rate | Funding rate history
*FuturesApi* | [**listFuturesInsuranceLedger**](docs/FuturesApi.md#listFuturesInsuranceLedger) | **GET** /futures/{settle}/insurance | Futures insurance balance history
*FuturesApi* | [**listContractStats**](docs/FuturesApi.md#listContractStats) | **GET** /futures/{settle}/contract_stats | Futures stats
*FuturesApi* | [**getIndexConstituents**](docs/FuturesApi.md#getIndexConstituents) | **GET** /futures/{settle}/index_constituents/{index} | Get index constituents
*FuturesApi* | [**listLiquidatedOrders**](docs/FuturesApi.md#listLiquidatedOrders) | **GET** /futures/{settle}/liq_orders | Retrieve liquidation history
*FuturesApi* | [**listFuturesAccounts**](docs/FuturesApi.md#listFuturesAccounts) | **GET** /futures/{settle}/accounts | Query futures account
*FuturesApi* | [**listFuturesAccountBook**](docs/FuturesApi.md#listFuturesAccountBook) | **GET** /futures/{settle}/account_book | Query account book
Expand Down Expand Up @@ -230,6 +236,8 @@ Class | Method | HTTP request | Description
*WalletApi* | [**transferWithSubAccount**](docs/WalletApi.md#transferWithSubAccount) | **POST** /wallet/sub_account_transfers | Transfer between main and sub accounts
*WalletApi* | [**listWithdrawStatus**](docs/WalletApi.md#listWithdrawStatus) | **GET** /wallet/withdraw_status | Retrieve withdrawal status
*WalletApi* | [**listSubAccountBalances**](docs/WalletApi.md#listSubAccountBalances) | **GET** /wallet/sub_account_balances | Retrieve sub account balances
*WalletApi* | [**listSubAccountMarginBalances**](docs/WalletApi.md#listSubAccountMarginBalances) | **GET** /wallet/sub_account_margin_balances | Query sub accounts\' margin balances
*WalletApi* | [**listSubAccountFuturesBalances**](docs/WalletApi.md#listSubAccountFuturesBalances) | **GET** /wallet/sub_account_futures_balances | Query sub accounts\' futures account balances
*WalletApi* | [**getTradeFee**](docs/WalletApi.md#getTradeFee) | **GET** /wallet/fee | Retrieve personal trading fee
*WalletApi* | [**getTotalBalance**](docs/WalletApi.md#getTotalBalance) | **GET** /wallet/total_balance | Retrieve user\'s total balances
*WithdrawalApi* | [**withdraw**](docs/WithdrawalApi.md#withdraw) | **POST** /withdrawals | Withdraw
Expand Down Expand Up @@ -260,12 +268,17 @@ Class | Method | HTTP request | Description
- [DeliveryContract](docs/DeliveryContract.md)
- [DeliverySettlement](docs/DeliverySettlement.md)
- [DepositAddress](docs/DepositAddress.md)
- [FlashSwapCurrency](docs/FlashSwapCurrency.md)
- [FlashSwapOrder](docs/FlashSwapOrder.md)
- [FlashSwapOrderPreview](docs/FlashSwapOrderPreview.md)
- [FlashSwapOrderRequest](docs/FlashSwapOrderRequest.md)
- [FundingAccount](docs/FundingAccount.md)
- [FundingBookItem](docs/FundingBookItem.md)
- [FundingRateRecord](docs/FundingRateRecord.md)
- [FuturesAccount](docs/FuturesAccount.md)
- [FuturesAccountBook](docs/FuturesAccountBook.md)
- [FuturesCandlestick](docs/FuturesCandlestick.md)
- [FuturesIndexConstituents](docs/FuturesIndexConstituents.md)
- [FuturesInitialOrder](docs/FuturesInitialOrder.md)
- [FuturesLiquidate](docs/FuturesLiquidate.md)
- [FuturesOrder](docs/FuturesOrder.md)
Expand All @@ -276,6 +289,7 @@ Class | Method | HTTP request | Description
- [FuturesPriceTriggeredOrder](docs/FuturesPriceTriggeredOrder.md)
- [FuturesTicker](docs/FuturesTicker.md)
- [FuturesTrade](docs/FuturesTrade.md)
- [IndexConstituent](docs/IndexConstituent.md)
- [InsuranceRecord](docs/InsuranceRecord.md)
- [LedgerRecord](docs/LedgerRecord.md)
- [Loan](docs/Loan.md)
Expand Down Expand Up @@ -313,6 +327,8 @@ Class | Method | HTTP request | Description
- [SpotPriceTrigger](docs/SpotPriceTrigger.md)
- [SpotPriceTriggeredOrder](docs/SpotPriceTriggeredOrder.md)
- [SubAccountBalance](docs/SubAccountBalance.md)
- [SubAccountFuturesBalance](docs/SubAccountFuturesBalance.md)
- [SubAccountMarginBalance](docs/SubAccountMarginBalance.md)
- [SubAccountTransfer](docs/SubAccountTransfer.md)
- [Ticker](docs/Ticker.md)
- [TotalBalance](docs/TotalBalance.md)
Expand Down
4 changes: 3 additions & 1 deletion api/apis.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export * from './apiClient';
export * from './deliveryApi';
import { DeliveryApi } from './deliveryApi';
export * from './flashSwapApi';
import { FlashSwapApi } from './flashSwapApi';
export * from './futuresApi';
import { FuturesApi } from './futuresApi';
export * from './marginApi';
Expand All @@ -14,4 +16,4 @@ import { WalletApi } from './walletApi';
export * from './withdrawalApi';
import { WithdrawalApi } from './withdrawalApi';

export const APIS = [DeliveryApi, FuturesApi, MarginApi, OptionsApi, SpotApi, WalletApi, WithdrawalApi];
export const APIS = [DeliveryApi, FlashSwapApi, FuturesApi, MarginApi, OptionsApi, SpotApi, WalletApi, WithdrawalApi];
239 changes: 239 additions & 0 deletions api/flashSwapApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
/**
* Gate API v4
* 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.
*
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/* tslint:disable:no-unused-locals */
import { FlashSwapCurrency } from '../model/flashSwapCurrency';
import { FlashSwapOrder } from '../model/flashSwapOrder';
import { FlashSwapOrderPreview } from '../model/flashSwapOrderPreview';
import { FlashSwapOrderRequest } from '../model/flashSwapOrderRequest';
import { ObjectSerializer } from '../model/models';
import { ApiClient } from './apiClient';
import { AxiosRequestConfig, AxiosResponse } from 'axios';

// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================

export class FlashSwapApi {
protected client: ApiClient;

constructor(client?: ApiClient) {
if (client) {
this.client = client;
} else {
this.client = new ApiClient();
}
}

/**
*
* @summary List all supported currencies in flash swap
*/
public async listFlashSwapCurrencies(): Promise<{ response: AxiosResponse; body: Array<FlashSwapCurrency> }> {
const localVarPath = this.client.basePath + '/flash_swap/currencies';
const localVarQueryParameters: any = {};
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}

const config: AxiosRequestConfig = {
method: 'GET',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
};

const authSettings = [];
return this.client.request<Array<FlashSwapCurrency>>(config, 'Array<FlashSwapCurrency>', authSettings);
}

/**
*
* @summary List all flash swap orders
* @param opts Optional parameters
* @param opts.status Flash swap order status &#x60;1&#x60; - success &#x60;2&#x60; - failure
* @param opts.sellCurrency Currency to sell which can be retrieved from supported currency list API &#x60;GET /flash_swap/currencies&#x60;
* @param opts.buyCurrency Currency to buy which can be retrieved from supported currency list API &#x60;GET /flash_swap/currencies&#x60;
* @param opts.reverse If results are sorted by id in reverse order. Default to &#x60;true&#x60; - &#x60;true&#x60;: sort by id in descending order(recent first) - &#x60;false&#x60;: sort by id in ascending order(oldest first)
* @param opts.limit Maximum number of records to be returned in a single list
* @param opts.page Page number
*/
public async listFlashSwapOrders(opts: {
status?: number;
sellCurrency?: string;
buyCurrency?: string;
reverse?: boolean;
limit?: number;
page?: number;
}): Promise<{ response: AxiosResponse; body: Array<FlashSwapOrder> }> {
const localVarPath = this.client.basePath + '/flash_swap/orders';
const localVarQueryParameters: any = {};
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}

opts = opts || {};
if (opts.status !== undefined) {
localVarQueryParameters['status'] = ObjectSerializer.serialize(opts.status, 'number');
}

if (opts.sellCurrency !== undefined) {
localVarQueryParameters['sell_currency'] = ObjectSerializer.serialize(opts.sellCurrency, 'string');
}

if (opts.buyCurrency !== undefined) {
localVarQueryParameters['buy_currency'] = ObjectSerializer.serialize(opts.buyCurrency, 'string');
}

if (opts.reverse !== undefined) {
localVarQueryParameters['reverse'] = ObjectSerializer.serialize(opts.reverse, 'boolean');
}

if (opts.limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(opts.limit, 'number');
}

if (opts.page !== undefined) {
localVarQueryParameters['page'] = ObjectSerializer.serialize(opts.page, 'number');
}

const config: AxiosRequestConfig = {
method: 'GET',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
};

const authSettings = ['apiv4'];
return this.client.request<Array<FlashSwapOrder>>(config, 'Array<FlashSwapOrder>', authSettings);
}

/**
* Initiate a flash swap preview in advance because order creation requires a preview result
* @summary Create a flash swap order
* @param flashSwapOrderRequest
*/
public async createFlashSwapOrder(
flashSwapOrderRequest: FlashSwapOrderRequest,
): Promise<{ response: AxiosResponse; body: FlashSwapOrder }> {
const localVarPath = this.client.basePath + '/flash_swap/orders';
const localVarQueryParameters: any = {};
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}

// verify required parameter 'flashSwapOrderRequest' is not null or undefined
if (flashSwapOrderRequest === null || flashSwapOrderRequest === undefined) {
throw new Error(
'Required parameter flashSwapOrderRequest was null or undefined when calling createFlashSwapOrder.',
);
}

const config: AxiosRequestConfig = {
method: 'POST',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
data: ObjectSerializer.serialize(flashSwapOrderRequest, 'FlashSwapOrderRequest'),
};

const authSettings = ['apiv4'];
return this.client.request<FlashSwapOrder>(config, 'FlashSwapOrder', authSettings);
}

/**
*
* @summary Get a single flash swap order\'s detail
* @param orderId Flash swap order ID
*/
public async getFlashSwapOrder(orderId: number): Promise<{ response: AxiosResponse; body: FlashSwapOrder }> {
const localVarPath =
this.client.basePath +
'/flash_swap/orders/{order_id}'.replace('{' + 'order_id' + '}', encodeURIComponent(String(orderId)));
const localVarQueryParameters: any = {};
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}

// verify required parameter 'orderId' is not null or undefined
if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling getFlashSwapOrder.');
}

const config: AxiosRequestConfig = {
method: 'GET',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
};

const authSettings = ['apiv4'];
return this.client.request<FlashSwapOrder>(config, 'FlashSwapOrder', authSettings);
}

/**
*
* @summary Initiate a flash swap order preview
* @param flashSwapOrderRequest
*/
public async previewFlashSwapOrder(
flashSwapOrderRequest: FlashSwapOrderRequest,
): Promise<{ response: AxiosResponse; body: FlashSwapOrderPreview }> {
const localVarPath = this.client.basePath + '/flash_swap/orders/preview';
const localVarQueryParameters: any = {};
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}

// verify required parameter 'flashSwapOrderRequest' is not null or undefined
if (flashSwapOrderRequest === null || flashSwapOrderRequest === undefined) {
throw new Error(
'Required parameter flashSwapOrderRequest was null or undefined when calling previewFlashSwapOrder.',
);
}

const config: AxiosRequestConfig = {
method: 'POST',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
data: ObjectSerializer.serialize(flashSwapOrderRequest, 'FlashSwapOrderRequest'),
};

const authSettings = ['apiv4'];
return this.client.request<FlashSwapOrderPreview>(config, 'FlashSwapOrderPreview', authSettings);
}
}
Loading

0 comments on commit 152a040

Please sign in to comment.