5.28.0 • Published 2 years ago

jb-gate-api v5.28.0

Weekly downloads
-
License
Unlicense
Repository
github
Last release
2 years ago

gate-api@5.26.0

TypeScript NodeJS client for gate-api.

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.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 4.26.0
  • Package version:
  • Build package: org.openapitools.codegen.languages.TypeScriptNodeClientCodegen For more information, please visit https://www.gate.io/page/contacts

Environment

  • Node.js

Language level

  • ES2017

It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via package.json. (Reference) This package is targeting Node.js applications only, because it's not safe to store API secret in browser. gateapi-js can be used in browser but with public endpoints only.

Versioning

Trying our best to follow the semantic versioning, while enjoying recent features provided by programming language and libraries, from 4.15.2, one major versioning difference will be introduced:

If extra code rewrite is required when you upgrade the SDK, such as:

  • some outdated programming language version support is dropped
  • API method signature has breaking changes.

the MAJOR version will be incremented, but the MINOR and PATCH version are still following REST API's instead of resetting to 0, so that you can recognize it has some breaking changes, but still getting the idea of from which REST API version the change is introduced.

For example, the previous REST API and SDK version are both 4.14.0. But if we decide to introduce some breaking changes in SDK along with REST API 4.15.2 upgrade, then the version of next SDK release will be 5.15.2(the MAJOR version is incremented to denote breaking changes, but the MINOR and PATCH version are identical to REST API's instead of resetting them to 0)

If MAJOR version is incremented, make sure you read the release note on Releases page

Installation

npm install gate-api

Getting Started

Please follow the installation instruction and execute the following TypeScript code:

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"

const api = new GateApi.DeliveryApi(client);
const settle = "usdt"; // 'btc' | 'usdt' | 'usd' | Settle currency
api.listDeliveryContracts(settle)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Documentation for API Endpoints

All URIs are relative to https://api.gateio.ws/api/v4

ClassMethodHTTP requestDescription
DeliveryApilistDeliveryContractsGET /delivery/{settle}/contractsList all futures contracts
DeliveryApigetDeliveryContractGET /delivery/{settle}/contracts/{contract}Get a single contract
DeliveryApilistDeliveryOrderBookGET /delivery/{settle}/order_bookFutures order book
DeliveryApilistDeliveryTradesGET /delivery/{settle}/tradesFutures trading history
DeliveryApilistDeliveryCandlesticksGET /delivery/{settle}/candlesticksGet futures candlesticks
DeliveryApilistDeliveryTickersGET /delivery/{settle}/tickersList futures tickers
DeliveryApilistDeliveryInsuranceLedgerGET /delivery/{settle}/insuranceFutures insurance balance history
DeliveryApilistDeliveryAccountsGET /delivery/{settle}/accountsQuery futures account
DeliveryApilistDeliveryAccountBookGET /delivery/{settle}/account_bookQuery account book
DeliveryApilistDeliveryPositionsGET /delivery/{settle}/positionsList all positions of a user
DeliveryApigetDeliveryPositionGET /delivery/{settle}/positions/{contract}Get single position
DeliveryApiupdateDeliveryPositionMarginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
DeliveryApiupdateDeliveryPositionLeveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
DeliveryApiupdateDeliveryPositionRiskLimitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
DeliveryApilistDeliveryOrdersGET /delivery/{settle}/ordersList futures orders
DeliveryApicreateDeliveryOrderPOST /delivery/{settle}/ordersCreate a futures order
DeliveryApicancelDeliveryOrdersDELETE /delivery/{settle}/ordersCancel all `open` orders matched
DeliveryApigetDeliveryOrderGET /delivery/{settle}/orders/{order_id}Get a single order
DeliveryApicancelDeliveryOrderDELETE /delivery/{settle}/orders/{order_id}Cancel a single order
DeliveryApigetMyDeliveryTradesGET /delivery/{settle}/my_tradesList personal trading history
DeliveryApilistDeliveryPositionCloseGET /delivery/{settle}/position_closeList position close history
DeliveryApilistDeliveryLiquidatesGET /delivery/{settle}/liquidatesList liquidation history
DeliveryApilistDeliverySettlementsGET /delivery/{settle}/settlementsList settlement history
DeliveryApilistPriceTriggeredDeliveryOrdersGET /delivery/{settle}/price_ordersList all auto orders
DeliveryApicreatePriceTriggeredDeliveryOrderPOST /delivery/{settle}/price_ordersCreate a price-triggered order
DeliveryApicancelPriceTriggeredDeliveryOrderListDELETE /delivery/{settle}/price_ordersCancel all open orders
DeliveryApigetPriceTriggeredDeliveryOrderGET /delivery/{settle}/price_orders/{order_id}Get a single order
DeliveryApicancelPriceTriggeredDeliveryOrderDELETE /delivery/{settle}/price_orders/{order_id}cancel a price-triggered order
FlashSwapApilistFlashSwapCurrenciesGET /flash_swap/currenciesList all supported currencies in flash swap
FlashSwapApilistFlashSwapOrdersGET /flash_swap/ordersList all flash swap orders
FlashSwapApicreateFlashSwapOrderPOST /flash_swap/ordersCreate a flash swap order
FlashSwapApigetFlashSwapOrderGET /flash_swap/orders/{order_id}Get a single flash swap order\'s detail
FlashSwapApipreviewFlashSwapOrderPOST /flash_swap/orders/previewInitiate a flash swap order preview
FuturesApilistFuturesContractsGET /futures/{settle}/contractsList all futures contracts
FuturesApigetFuturesContractGET /futures/{settle}/contracts/{contract}Get a single contract
FuturesApilistFuturesOrderBookGET /futures/{settle}/order_bookFutures order book
FuturesApilistFuturesTradesGET /futures/{settle}/tradesFutures trading history
FuturesApilistFuturesCandlesticksGET /futures/{settle}/candlesticksGet futures candlesticks
FuturesApilistFuturesTickersGET /futures/{settle}/tickersList futures tickers
FuturesApilistFuturesFundingRateHistoryGET /futures/{settle}/funding_rateFunding rate history
FuturesApilistFuturesInsuranceLedgerGET /futures/{settle}/insuranceFutures insurance balance history
FuturesApilistContractStatsGET /futures/{settle}/contract_statsFutures stats
FuturesApigetIndexConstituentsGET /futures/{settle}/index_constituents/{index}Get index constituents
FuturesApilistLiquidatedOrdersGET /futures/{settle}/liq_ordersRetrieve liquidation history
FuturesApilistFuturesAccountsGET /futures/{settle}/accountsQuery futures account
FuturesApilistFuturesAccountBookGET /futures/{settle}/account_bookQuery account book
FuturesApilistPositionsGET /futures/{settle}/positionsList all positions of a user
FuturesApigetPositionGET /futures/{settle}/positions/{contract}Get single position
FuturesApiupdatePositionMarginPOST /futures/{settle}/positions/{contract}/marginUpdate position margin
FuturesApiupdatePositionLeveragePOST /futures/{settle}/positions/{contract}/leverageUpdate position leverage
FuturesApiupdatePositionRiskLimitPOST /futures/{settle}/positions/{contract}/risk_limitUpdate position risk limit
FuturesApisetDualModePOST /futures/{settle}/dual_modeEnable or disable dual mode
FuturesApigetDualModePositionGET /futures/{settle}/dual_comp/positions/{contract}Retrieve position detail in dual mode
FuturesApiupdateDualModePositionMarginPOST /futures/{settle}/dual_comp/positions/{contract}/marginUpdate position margin in dual mode
FuturesApiupdateDualModePositionLeveragePOST /futures/{settle}/dual_comp/positions/{contract}/leverageUpdate position leverage in dual mode
FuturesApiupdateDualModePositionRiskLimitPOST /futures/{settle}/dual_comp/positions/{contract}/risk_limitUpdate position risk limit in dual mode
FuturesApilistFuturesOrdersGET /futures/{settle}/ordersList futures orders
FuturesApicreateFuturesOrderPOST /futures/{settle}/ordersCreate a futures order
FuturesApicancelFuturesOrdersDELETE /futures/{settle}/ordersCancel all `open` orders matched
FuturesApigetFuturesOrderGET /futures/{settle}/orders/{order_id}Get a single order
FuturesApiamendFuturesOrderPUT /futures/{settle}/orders/{order_id}Amend an order
FuturesApicancelFuturesOrderDELETE /futures/{settle}/orders/{order_id}Cancel a single order
FuturesApigetMyTradesGET /futures/{settle}/my_tradesList personal trading history
FuturesApilistPositionCloseGET /futures/{settle}/position_closeList position close history
FuturesApilistLiquidatesGET /futures/{settle}/liquidatesList liquidation history
FuturesApilistPriceTriggeredOrdersGET /futures/{settle}/price_ordersList all auto orders
FuturesApicreatePriceTriggeredOrderPOST /futures/{settle}/price_ordersCreate a price-triggered order
FuturesApicancelPriceTriggeredOrderListDELETE /futures/{settle}/price_ordersCancel all open orders
FuturesApigetPriceTriggeredOrderGET /futures/{settle}/price_orders/{order_id}Get a single order
FuturesApicancelPriceTriggeredOrderDELETE /futures/{settle}/price_orders/{order_id}cancel a price-triggered order
MarginApilistMarginCurrencyPairsGET /margin/currency_pairsList all supported currency pairs supported in margin trading
MarginApigetMarginCurrencyPairGET /margin/currency_pairs/{currency_pair}Query one single margin currency pair
MarginApilistFundingBookGET /margin/funding_bookOrder book of lending loans
MarginApilistMarginAccountsGET /margin/accountsMargin account list
MarginApilistMarginAccountBookGET /margin/account_bookList margin account balance change history
MarginApilistFundingAccountsGET /margin/funding_accountsFunding account list
MarginApilistLoansGET /margin/loansList all loans
MarginApicreateLoanPOST /margin/loansLend or borrow
MarginApimergeLoansPOST /margin/merged_loansMerge multiple lending loans
MarginApigetLoanGET /margin/loans/{loan_id}Retrieve one single loan detail
MarginApicancelLoanDELETE /margin/loans/{loan_id}Cancel lending loan
MarginApiupdateLoanPATCH /margin/loans/{loan_id}Modify a loan
MarginApilistLoanRepaymentsGET /margin/loans/{loan_id}/repaymentList loan repayment records
MarginApirepayLoanPOST /margin/loans/{loan_id}/repaymentRepay a loan
MarginApilistLoanRecordsGET /margin/loan_recordsList repayment records of a specific loan
MarginApigetLoanRecordGET /margin/loan_records/{loan_record_id}Get one single loan record
MarginApiupdateLoanRecordPATCH /margin/loan_records/{loan_record_id}Modify a loan record
MarginApigetAutoRepayStatusGET /margin/auto_repayRetrieve user auto repayment setting
MarginApisetAutoRepayPOST /margin/auto_repayUpdate user\'s auto repayment setting
MarginApigetMarginTransferableGET /margin/transferableGet the max transferable amount for a specific margin currency
MarginApigetMarginBorrowableGET /margin/borrowableGet the max borrowable amount for a specific margin currency
MarginApilistCrossMarginCurrenciesGET /margin/cross/currenciesCurrencies supported by cross margin.
MarginApigetCrossMarginCurrencyGET /margin/cross/currencies/{currency}Retrieve detail of one single currency supported by cross margin
MarginApigetCrossMarginAccountGET /margin/cross/accountsRetrieve cross margin account
MarginApilistCrossMarginAccountBookGET /margin/cross/account_bookRetrieve cross margin account change history
MarginApilistCrossMarginLoansGET /margin/cross/loansList cross margin borrow history
MarginApicreateCrossMarginLoanPOST /margin/cross/loansCreate a cross margin borrow loan
MarginApigetCrossMarginLoanGET /margin/cross/loans/{loan_id}Retrieve single borrow loan detail
MarginApilistCrossMarginRepaymentsGET /margin/cross/repaymentsRetrieve cross margin repayments
MarginApirepayCrossMarginLoanPOST /margin/cross/repaymentsWhen the liquidity of the currency is insufficient and the transaction risk is high, the currency will be disabled, and funds cannot be transferred.When the available balance of cross-margin is insufficient, the balance of the spot account can be used for repayment. Please ensure that the balance of the spot account is sufficient, and system uses cross-margin account for repayment first
MarginApigetCrossMarginTransferableGET /margin/cross/transferableGet the max transferable amount for a specific cross margin currency
MarginApigetCrossMarginBorrowableGET /margin/cross/borrowableGet the max borrowable amount for a specific cross margin currency
OptionsApilistOptionsUnderlyingsGET /options/underlyingsList all underlyings
OptionsApilistOptionsExpirationsGET /options/expirationsList all expiration times
OptionsApilistOptionsContractsGET /options/contractsList all the contracts with specified underlying and expiration time
OptionsApigetOptionsContractGET /options/contracts/{contract}Query specified contract detail
OptionsApilistOptionsSettlementsGET /options/settlementsList settlement history
OptionsApigetOptionsSettlementGET /options/settlements/{contract}Get specified contract\'s settlement
OptionsApilistMyOptionsSettlementsGET /options/my_settlementsList my options settlements
OptionsApilistOptionsOrderBookGET /options/order_bookFutures order book
OptionsApilistOptionsTickersGET /options/tickersList tickers of options contracts
OptionsApilistOptionsUnderlyingTickersGET /options/underlying/tickers/{underlying}Get underlying ticker
OptionsApilistOptionsCandlesticksGET /options/candlesticksGet futures candlesticks
OptionsApilistOptionsUnderlyingCandlesticksGET /options/underlying/candlesticksMark price candlesticks of an underlying
OptionsApilistOptionsTradesGET /options/tradesOptions trade history
OptionsApilistOptionsAccountGET /options/accountsList options account
OptionsApilistOptionsAccountBookGET /options/account_bookList account changing history
OptionsApilistOptionsPositionsGET /options/positionsList user\'s positions of specified underlying
OptionsApigetOptionsPositionGET /options/positions/{contract}Get specified contract position
OptionsApilistOptionsPositionCloseGET /options/position_closeList user\'s liquidation history of specified underlying
OptionsApilistOptionsOrdersGET /options/ordersList futures orders
OptionsApicreateOptionsOrderPOST /options/ordersCreate an options order
OptionsApicancelOptionsOrdersDELETE /options/ordersCancel all `open` orders matched
OptionsApigetOptionsOrderGET /options/orders/{order_id}Get a single order
OptionsApicancelOptionsOrderDELETE /options/orders/{order_id}Cancel a single order
OptionsApilistMyOptionsTradesGET /options/my_tradesList personal trading history
SpotApilistCurrenciesGET /spot/currenciesList all currencies\' details
SpotApigetCurrencyGET /spot/currencies/{currency}Get details of a specific currency
SpotApilistCurrencyPairsGET /spot/currency_pairsList all currency pairs supported
SpotApigetCurrencyPairGET /spot/currency_pairs/{currency_pair}Get details of a specifc order
SpotApilistTickersGET /spot/tickersRetrieve ticker information
SpotApilistOrderBookGET /spot/order_bookRetrieve order book
SpotApilistTradesGET /spot/tradesRetrieve market trades
SpotApilistCandlesticksGET /spot/candlesticksMarket candlesticks
SpotApigetFeeGET /spot/feeQuery user trading fee rates
SpotApilistSpotAccountsGET /spot/accountsList spot accounts
SpotApicreateBatchOrdersPOST /spot/batch_ordersCreate a batch of orders
SpotApilistAllOpenOrdersGET /spot/open_ordersList all open orders
SpotApicreateCrossLiquidateOrderPOST /spot/cross_liquidate_ordersclose position when cross-currency is disabled
SpotApilistOrdersGET /spot/ordersList orders
SpotApicreateOrderPOST /spot/ordersCreate an order
SpotApicancelOrdersDELETE /spot/ordersCancel all `open` orders in specified currency pair
SpotApicancelBatchOrdersPOST /spot/cancel_batch_ordersCancel a batch of orders with an ID list
SpotApigetOrderGET /spot/orders/{order_id}Get a single order
SpotApicancelOrderDELETE /spot/orders/{order_id}Cancel a single order
SpotApilistMyTradesGET /spot/my_tradesList personal trading history
SpotApigetSystemTimeGET /spot/timeGet server current time
SpotApilistSpotPriceTriggeredOrdersGET /spot/price_ordersRetrieve running auto order list
SpotApicreateSpotPriceTriggeredOrderPOST /spot/price_ordersCreate a price-triggered order
SpotApicancelSpotPriceTriggeredOrderListDELETE /spot/price_ordersCancel all open orders
SpotApigetSpotPriceTriggeredOrderGET /spot/price_orders/{order_id}Get a single order
SpotApicancelSpotPriceTriggeredOrderDELETE /spot/price_orders/{order_id}cancel a price-triggered order
WalletApilistCurrencyChainsGET /wallet/currency_chainsList chains supported for specified currency
WalletApigetDepositAddressGET /wallet/deposit_addressGenerate currency deposit address
WalletApilistWithdrawalsGET /wallet/withdrawalsRetrieve withdrawal records
WalletApilistDepositsGET /wallet/depositsRetrieve deposit records
WalletApitransferPOST /wallet/transfersTransfer between trading accounts
WalletApilistSubAccountTransfersGET /wallet/sub_account_transfersRetrieve transfer records between main and sub accounts
WalletApitransferWithSubAccountPOST /wallet/sub_account_transfersTransfer between main and sub accounts
WalletApilistWithdrawStatusGET /wallet/withdraw_statusRetrieve withdrawal status
WalletApilistSubAccountBalancesGET /wallet/sub_account_balancesRetrieve sub account balances
WalletApilistSubAccountMarginBalancesGET /wallet/sub_account_margin_balancesQuery sub accounts\' margin balances
WalletApilistSubAccountFuturesBalancesGET /wallet/sub_account_futures_balancesQuery sub accounts\' futures account balances
WalletApilistSubAccountCrossMarginBalancesGET /wallet/sub_account_cross_margin_balancesQuery subaccount\'s cross_margin account info
WalletApilistSavedAddressGET /wallet/saved_addressQuery saved address
WalletApigetTradeFeeGET /wallet/feeRetrieve personal trading fee
WalletApigetTotalBalanceGET /wallet/total_balanceRetrieve user\'s total balances
WithdrawalApiwithdrawPOST /withdrawalsWithdraw
WithdrawalApicancelWithdrawalDELETE /withdrawals/{withdrawal_id}Cancel withdrawal with specified ID

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

apiv4

  • Type: Gate APIv4

https://www.gate.io/docs/apiv4/en/index.html#apiv4-signed-request-requirements