Simple Gate.io api for Node.js to access Gate.io REST API.
const api = require('gtapi')
let ac = new api(<apiKey>, <secret>);
async function test(){
let r = await ac.get('/account/detail')
console.log(r) // {user_id: 21521911,..}
}
test()
const {call} = require('gtapi')
let apiKey = <apiKey>;
let secret = <secret>;
async function test(){
let data = ''
let r = await call('/unified/accounts', {data, apiKey, secret})
console.log(r) // {balances:{BTC:{available: '0',..},..},..}
}
test()
npm i gtapi
function call(path, {data, apiKey, secret, method, testnet} )
- path = eg: "/account/detail" ref
- apiKey = Gate.io apiKey
- secret = Gate.io api secret
- optional
- data = params to be passed in, can be object {symbol:'BTC_USDT'} or query string (symbol=BTCUSDT&key=value)
- method = "GET" (default) OR "POST"
- testnet = 0 (default) | 1 (to use testnet)
api.get(path[, data][, {testnet}])
api.post(path[, data][, {testnet}])
- data (optional) = refer above
return object (result from Gate.io api)
global.gtLimit = global.gateLimit = global["x-gate-ratelimit-requests-remain"];
global.gtLimitMax = global.gateLimitMax = global["x-gate-ratelimit-limit"];
global.gtLimits = global.gateLimits = {
gateLimit: global.gateLimit,
gateLimitMax: global.gateLimitMax,
};