UNPKG

bybit-api-gnome

Version:

Forked for Lick Hunter, Complete & robust node.js SDK for Bybit's REST APIs and WebSockets v5, with TypeScript & integration tests.

120 lines 3.32 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SpotClient = void 0; const BaseRestClient_1 = __importDefault(require("./util/BaseRestClient")); const requestUtils_1 = require("./util/requestUtils"); /** * @deprecated Use SpotV3Client instead, which leverages the newer v3 APIs * REST API client for Spot APIs (v1) */ class SpotClient extends BaseRestClient_1.default { getClientType() { return requestUtils_1.REST_CLIENT_TYPE_ENUM.spot; } fetchServerTime() { return this.getServerTime(); } async getServerTime() { const res = await this.get('/spot/v1/time'); return res.result.serverTime; } /** * * Market Data Endpoints * **/ getSymbols() { return this.get('/spot/v1/symbols'); } getOrderBook(symbol, limit) { return this.get('/spot/quote/v1/depth', { symbol, limit, }); } getMergedOrderBook(symbol, scale, limit) { return this.get('/spot/quote/v1/depth/merged', { symbol, scale, limit, }); } getTrades(symbol, limit) { return this.get('/spot/quote/v1/trades', { symbol, limit, }); } getCandles(symbol, interval, limit, startTime, endTime) { return this.get('/spot/quote/v1/kline', { symbol, interval, limit, startTime, endTime, }); } get24hrTicker(symbol) { return this.get('/spot/quote/v1/ticker/24hr', { symbol }); } getLastTradedPrice(symbol) { return this.get('/spot/quote/v1/ticker/price', { symbol }); } getBestBidAskPrice(symbol) { return this.get('/spot/quote/v1/ticker/book_ticker', { symbol }); } /** * Account Data Endpoints */ submitOrder(params) { return this.postPrivate('/spot/v1/order', params); } getOrder(params) { return this.getPrivate('/spot/v1/order', params); } cancelOrder(params) { return this.deletePrivate('/spot/v1/order', params); } cancelOrderBatch(params) { const orderTypes = params.orderTypes ? params.orderTypes.join(',') : undefined; return this.deletePrivate('/spot/order/batch-cancel', { ...params, orderTypes, }); } getOpenOrders(symbol, orderId, limit) { return this.getPrivate('/spot/v1/open-orders', { symbol, orderId, limit, }); } getPastOrders(symbol, orderId, limit) { return this.getPrivate('/spot/v1/history-orders', { symbol, orderId, limit, }); } getMyTrades(symbol, limit, fromId, toId) { return this.getPrivate('/spot/v1/myTrades', { symbol, limit, fromId, toId, }); } /** * Wallet Data Endpoints */ getBalances() { return this.getPrivate('/spot/v1/account'); } } exports.SpotClient = SpotClient; //# sourceMappingURL=spot-client.js.map