[go: up one dir, main page]

Skip to content

gateio/gateapi-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gate-api

GateApi - JavaScript 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: 5.26.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://www.gate.io/page/contacts

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

git

If the library is hosted at a git repository, e.g. https://github.com/gateio/gateapi-js then install it via:

    npm install gateio/gateapi-js --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

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

var GateApi = require('gate-api');

var apiInstance = new GateApi.DeliveryApi();
var settle = "usdt"; // String | Settle currency
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.listDeliveryContracts(settle, callback);

Documentation for API Endpoints

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

Class Method HTTP request Description
DeliveryApi listDeliveryContracts GET /delivery/{settle}/contracts List all futures contracts
DeliveryApi getDeliveryContract GET /delivery/{settle}/contracts/{contract} Get a single contract
DeliveryApi listDeliveryOrderBook GET /delivery/{settle}/order_book Futures order book
DeliveryApi listDeliveryTrades GET /delivery/{settle}/trades Futures trading history
DeliveryApi listDeliveryCandlesticks GET /delivery/{settle}/candlesticks Get futures candlesticks
DeliveryApi listDeliveryTickers GET /delivery/{settle}/tickers List futures tickers
DeliveryApi listDeliveryInsuranceLedger GET /delivery/{settle}/insurance Futures insurance balance history
FlashSwapApi listFlashSwapCurrencies GET /flash_swap/currencies List all supported currencies in flash swap
FuturesApi listFuturesContracts GET /futures/{settle}/contracts List all futures contracts
FuturesApi getFuturesContract GET /futures/{settle}/contracts/{contract} Get a single contract
FuturesApi listFuturesOrderBook GET /futures/{settle}/order_book Futures order book
FuturesApi listFuturesTrades GET /futures/{settle}/trades Futures trading history
FuturesApi listFuturesCandlesticks GET /futures/{settle}/candlesticks Get futures candlesticks
FuturesApi listFuturesTickers GET /futures/{settle}/tickers List futures tickers
FuturesApi listFuturesFundingRateHistory GET /futures/{settle}/funding_rate Funding rate history
FuturesApi listFuturesInsuranceLedger GET /futures/{settle}/insurance Futures insurance balance history
FuturesApi listContractStats GET /futures/{settle}/contract_stats Futures stats
FuturesApi getIndexConstituents GET /futures/{settle}/index_constituents/{index} Get index constituents
FuturesApi listLiquidatedOrders GET /futures/{settle}/liq_orders Retrieve liquidation history
MarginApi listMarginCurrencyPairs GET /margin/currency_pairs List all supported currency pairs supported in margin trading
MarginApi getMarginCurrencyPair GET /margin/currency_pairs/{currency_pair} Query one single margin currency pair
MarginApi listFundingBook GET /margin/funding_book Order book of lending loans
MarginApi listCrossMarginCurrencies GET /margin/cross/currencies Currencies supported by cross margin.
MarginApi getCrossMarginCurrency GET /margin/cross/currencies/{currency} Retrieve detail of one single currency supported by cross margin
OptionsApi listOptionsUnderlyings GET /options/underlyings List all underlyings
OptionsApi listOptionsExpirations GET /options/expirations List all expiration times
OptionsApi listOptionsContracts GET /options/contracts List all the contracts with specified underlying and expiration time
OptionsApi getOptionsContract GET /options/contracts/{contract} Query specified contract detail
OptionsApi listOptionsSettlements GET /options/settlements List settlement history
OptionsApi getOptionsSettlement GET /options/settlements/{contract} Get specified contract's settlement
OptionsApi listOptionsOrderBook GET /options/order_book Futures order book
OptionsApi listOptionsTickers GET /options/tickers List tickers of options contracts
OptionsApi listOptionsUnderlyingTickers GET /options/underlying/tickers/{underlying} Get underlying ticker
OptionsApi listOptionsCandlesticks GET /options/candlesticks Get futures candlesticks
OptionsApi listOptionsUnderlyingCandlesticks GET /options/underlying/candlesticks Mark price candlesticks of an underlying
OptionsApi listOptionsTrades GET /options/trades Options trade history
SpotApi listCurrencies GET /spot/currencies List all currencies' details
SpotApi getCurrency GET /spot/currencies/{currency} Get details of a specific currency
SpotApi listCurrencyPairs GET /spot/currency_pairs List all currency pairs supported
SpotApi getCurrencyPair GET /spot/currency_pairs/{currency_pair} Get details of a specifc order
SpotApi listTickers GET /spot/tickers Retrieve ticker information
SpotApi listOrderBook GET /spot/order_book Retrieve order book
SpotApi listTrades GET /spot/trades Retrieve market trades
SpotApi listCandlesticks GET /spot/candlesticks Market candlesticks
SpotApi getSystemTime GET /spot/time Get server current time
WalletApi listCurrencyChains GET /wallet/currency_chains List chains supported for specified currency

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.