Skip to content

jaggedsoft/gateapi-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gate-api

GateApi - JavaScript client for gate-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.15.3
  • Package version: 5.15.3
  • 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

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install gate-api --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your gate-api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('gate-api') in javascript files from the directory you ran the last command above from.

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
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
MarginApi listMarginCurrencyPairs GET /margin/currency_pairs List all supported currency pairs supported in margin trading
MarginApi listFundingBook GET /margin/funding_book Order book of lending loans
SpotApi listCurrencyPairs GET /spot/currency_pairs List all currency pairs supported
SpotApi getCurrencyPair GET /spot/currency_pairs/{currency_pair} Get detail of one single 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

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.8%
  • Shell 1.2%