Skip to content

Commit

Permalink
Merge pull request #32 from JJ-Cro/Update04102024
Browse files Browse the repository at this point in the history
v1.0.17: feat(): Added endpoints, updated types
  • Loading branch information
tiagosiebler authored Oct 4, 2024
2 parents 9fdab78 + dbc1684 commit 0ef3e92
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/endpointFunctionList.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ This table includes all endpoints from the official Exchange API docs and corres
| `cancelAllOpenOptionsOrders()` | :closed_lock_with_key: | DELETE | `/options/orders` |
| `getOptionsOrder()` | :closed_lock_with_key: | GET | `/options/orders/{order_id}` |
| `cancelOptionsOrder()` | :closed_lock_with_key: | DELETE | `/options/orders/{order_id}` |
| `submitOptionsCountdownCancel()` | :closed_lock_with_key: | POST | `/options/countdown_cancel_all` |
| `getOptionsPersonalHistory()` | :closed_lock_with_key: | GET | `/options/my_trades` |
| `setOptionsMMPSettings()` | :closed_lock_with_key: | POST | `/options/mmp` |
| `getOptionsMMPSettings()` | :closed_lock_with_key: | GET | `/options/mmp` |
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gateio-api",
"version": "1.0.16",
"version": "1.0.17",
"description": "Complete & robust Node.js SDK for Gate.io's REST APIs, WebSockets & WebSocket APIs, with TypeScript declarations.",
"scripts": {
"clean": "rm -rf dist/*",
Expand Down
30 changes: 25 additions & 5 deletions src/RestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
import {
BatchAmendOrderReq,
DeleteAllFuturesOrdersReq,
GetFundingRatesReq,
GetFuturesAccountBookReq,
GetFuturesAutoOrdersReq,
GetFuturesCandlesReq,
Expand Down Expand Up @@ -1949,11 +1950,7 @@ export class RestClient extends BaseRestClient {
* r: string;
* }[]>
*/
getFundingRates(params: {
settle: 'btc' | 'usdt' | 'usd';
contract: string;
limit?: number;
}): Promise<
getFundingRates(params: GetFundingRatesReq): Promise<
{
t: number;
r: string;
Expand Down Expand Up @@ -3267,6 +3264,29 @@ export class RestClient extends BaseRestClient {
return this.deletePrivate(`/options/orders/${params.order_id}`);
}

/**
* Countdown cancel orders for options
*
* Option order heartbeat detection. When the timeout set by the user is reached,
* if there is no cancel or new countdown set, related pending orders will be
* automatically cancelled. This endpoint can be called repeatedly to set a new
* countdown or cancel the countdown.
*
* @param params Parameters for setting countdown cancel orders
* @returns Promise<{
* triggerTime: number;
* }>
*/
submitOptionsCountdownCancel(params: {
timeout: number;
contract?: string;
underlying?: string;
}): Promise<{
triggerTime: number;
}> {
return this.postPrivate('/options/countdown_cancel_all', { body: params });
}

/**
* List personal trading history
*
Expand Down
8 changes: 8 additions & 0 deletions src/types/request/futures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export interface GetFuturesStatsReq {
limit?: number;
}

export interface GetFundingRatesReq {
settle: 'btc' | 'usdt' | 'usd';
contract: string;
limit?: number;
from?: number;
to?: number;
}

export interface GetLiquidationHistoryReq {
settle: 'btc' | 'usdt' | 'usd';
contract?: string;
Expand Down
2 changes: 2 additions & 0 deletions src/types/response/futures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export interface FuturesTicker {
basis_value: string;
lowest_ask: string;
highest_bid: string;
lowest_size: string;
highest_size: string;
}

export interface FuturesStats {
Expand Down
1 change: 1 addition & 0 deletions src/types/response/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,5 @@ export interface PushOrder {
| 'REFUSED'
| 'RECEIVING'
| 'RECEIVED';
message: string;
}

0 comments on commit 0ef3e92

Please sign in to comment.