Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bybit-api

Package Overview
Dependencies
Maintainers
1
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bybit-api - npm Package Compare versions

Comparing version 2.1.6 to 2.1.7

2

lib/index.d.ts

@@ -7,1 +7,3 @@ export * from './inverse-client';

export * from './logger';
export * from './types/shared';
export * from './types/spot';

@@ -19,2 +19,4 @@ "use strict";

__exportStar(require("./logger"), exports);
__exportStar(require("./types/shared"), exports);
__exportStar(require("./types/spot"), exports);
//# sourceMappingURL=index.js.map

73

lib/inverse-client.d.ts

@@ -5,2 +5,3 @@ import { AxiosRequestConfig } from 'axios';

import SharedEndpoints from './shared-endpoints';
import { SymbolFromLimitParam, SymbolIntervalFromLimitParam, SymbolParam } from './types/shared';
export declare class InverseClient extends SharedEndpoints {

@@ -23,45 +24,15 @@ protected requestWrapper: RequestWrapper;

*/
getKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
/**
* @deprecated use getTickers() instead
*/
getLatestInformation(params?: {
symbol?: string;
}): GenericAPIResponse;
getLatestInformation(params?: Partial<SymbolParam>): GenericAPIResponse;
/**
* @deprecated use getTrades() instead
*/
getPublicTradingRecords(params: {
symbol: string;
from?: number;
limit?: number;
}): GenericAPIResponse;
getTrades(params: {
symbol: string;
from?: number;
limit?: number;
}): GenericAPIResponse;
getMarkPriceKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getIndexPriceKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getPremiumIndexKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getPublicTradingRecords(params: SymbolFromLimitParam): GenericAPIResponse;
getTrades(params: SymbolFromLimitParam): GenericAPIResponse;
getMarkPriceKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
getIndexPriceKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
getPremiumIndexKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
/**

@@ -102,5 +73,3 @@ *

}): GenericAPIResponse;
cancelAllActiveOrders(params: {
symbol: string;
}): GenericAPIResponse;
cancelAllActiveOrders(params: SymbolParam): GenericAPIResponse;
replaceActiveOrder(params: {

@@ -146,5 +115,3 @@ order_id?: string;

}): GenericAPIResponse;
cancelAllConditionalOrders(params: {
symbol: string;
}): GenericAPIResponse;
cancelAllConditionalOrders(params: SymbolParam): GenericAPIResponse;
replaceConditionalOrder(params: {

@@ -170,5 +137,3 @@ stop_order_id?: string;

getUserLeverage(): GenericAPIResponse;
getPosition(params?: {
symbol?: string;
}): GenericAPIResponse;
getPosition(params?: Partial<SymbolParam>): GenericAPIResponse;
/**

@@ -241,18 +206,10 @@ * @deprecated use getPosition() instead

*/
getLastFundingRate(params: {
symbol: string;
}): GenericAPIResponse;
getMyLastFundingFee(params: {
symbol: string;
}): GenericAPIResponse;
getPredictedFunding(params: {
symbol: string;
}): GenericAPIResponse;
getLastFundingRate(params: SymbolParam): GenericAPIResponse;
getMyLastFundingFee(params: SymbolParam): GenericAPIResponse;
getPredictedFunding(params: SymbolParam): GenericAPIResponse;
/**
* LCP Info
*/
getLcpInfo(params: {
symbol: string;
}): GenericAPIResponse;
getLcpInfo(params: SymbolParam): GenericAPIResponse;
getAPIKeyInfo(): GenericAPIResponse;
}

@@ -5,2 +5,3 @@ import { AxiosRequestConfig } from 'axios';

import SharedEndpoints from './shared-endpoints';
import { SymbolFromLimitParam, SymbolIntervalFromLimitParam, SymbolParam } from './types/shared';
export declare class InverseFuturesClient extends SharedEndpoints {

@@ -23,34 +24,10 @@ protected requestWrapper: RequestWrapper;

*/
getKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
/**
* Public trading records
*/
getTrades(params: {
symbol: string;
from?: number;
limit?: number;
}): GenericAPIResponse;
getMarkPriceKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getIndexPriceKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getPremiumIndexKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getTrades(params: SymbolFromLimitParam): GenericAPIResponse;
getMarkPriceKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
getIndexPriceKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
getPremiumIndexKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
/**

@@ -89,5 +66,3 @@ *

}): GenericAPIResponse;
cancelAllActiveOrders(params: {
symbol: string;
}): GenericAPIResponse;
cancelAllActiveOrders(params: SymbolParam): GenericAPIResponse;
replaceActiveOrder(params: {

@@ -133,5 +108,3 @@ order_id?: string;

}): GenericAPIResponse;
cancelAllConditionalOrders(params: {
symbol: string;
}): GenericAPIResponse;
cancelAllConditionalOrders(params: SymbolParam): GenericAPIResponse;
replaceConditionalOrder(params: {

@@ -156,5 +129,3 @@ stop_order_id?: string;

*/
getPosition(params?: {
symbol?: string;
}): GenericAPIResponse;
getPosition(params?: Partial<SymbolParam>): GenericAPIResponse;
changePositionMargin(params: {

@@ -224,17 +195,9 @@ symbol: string;

*/
getLastFundingRate(params: {
symbol: string;
}): GenericAPIResponse;
getMyLastFundingFee(params: {
symbol: string;
}): GenericAPIResponse;
getPredictedFunding(params: {
symbol: string;
}): GenericAPIResponse;
getLastFundingRate(params: SymbolParam): GenericAPIResponse;
getMyLastFundingFee(params: SymbolParam): GenericAPIResponse;
getPredictedFunding(params: SymbolParam): GenericAPIResponse;
/**
* LCP Info
*/
getLcpInfo(params: {
symbol: string;
}): GenericAPIResponse;
getLcpInfo(params: SymbolParam): GenericAPIResponse;
}

@@ -5,2 +5,3 @@ import { AxiosRequestConfig } from 'axios';

import SharedEndpoints from './shared-endpoints';
import { SymbolIntervalFromLimitParam, SymbolLimitParam, SymbolParam } from '.';
export declare class LinearClient extends SharedEndpoints {

@@ -23,33 +24,8 @@ protected requestWrapper: RequestWrapper;

*/
getKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getTrades(params: {
symbol: string;
limit?: number;
}): GenericAPIResponse;
getLastFundingRate(params: {
symbol: string;
}): GenericAPIResponse;
getMarkPriceKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getIndexPriceKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getPremiumIndexKline(params: {
symbol: string;
interval: string;
from: number;
limit?: number;
}): GenericAPIResponse;
getKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
getTrades(params: SymbolLimitParam): GenericAPIResponse;
getLastFundingRate(params: SymbolParam): GenericAPIResponse;
getMarkPriceKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
getIndexPriceKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
getPremiumIndexKline(params: SymbolIntervalFromLimitParam): GenericAPIResponse;
/**

@@ -89,5 +65,3 @@ *

}): GenericAPIResponse;
cancelAllActiveOrders(params: {
symbol: string;
}): GenericAPIResponse;
cancelAllActiveOrders(params: SymbolParam): GenericAPIResponse;
replaceActiveOrder(params: {

@@ -144,5 +118,3 @@ order_id?: string;

}): GenericAPIResponse;
cancelAllConditionalOrders(params: {
symbol: string;
}): GenericAPIResponse;
cancelAllConditionalOrders(params: SymbolParam): GenericAPIResponse;
replaceConditionalOrder(params: {

@@ -168,5 +140,3 @@ stop_order_id?: string;

*/
getPosition(params?: {
symbol?: string;
}): GenericAPIResponse;
getPosition(params?: Partial<SymbolParam>): GenericAPIResponse;
setAutoAddMargin(params?: {

@@ -227,5 +197,3 @@ symbol: string;

*/
getRiskLimitList(params: {
symbol: string;
}): GenericAPIResponse;
getRiskLimitList(params: SymbolParam): GenericAPIResponse;
setRiskLimit(params: {

@@ -239,8 +207,4 @@ symbol: string;

*/
getPredictedFundingFee(params: {
symbol: string;
}): GenericAPIResponse;
getLastFundingFee(params: {
symbol: string;
}): GenericAPIResponse;
getPredictedFundingFee(params: SymbolParam): GenericAPIResponse;
getLastFundingFee(params: SymbolParam): GenericAPIResponse;
}

@@ -0,1 +1,2 @@

import { APIResponse, AssetExchangeRecordsReq, CoinParam, SymbolInfo, SymbolLimitParam, SymbolParam, SymbolPeriodLimitParam, WalletFundRecordsReq, WithdrawRecordsReq } from './types/shared';
import { GenericAPIResponse } from './util/requestUtils';

@@ -10,12 +11,8 @@ import RequestWrapper from './util/requestWrapper';

*/
getOrderBook(params: {
symbol: string;
}): GenericAPIResponse;
getOrderBook(params: SymbolParam): GenericAPIResponse;
/**
* Get latest information for symbol
*/
getTickers(params?: {
symbol?: string;
}): GenericAPIResponse;
getSymbols(): GenericAPIResponse;
getTickers(params?: Partial<SymbolParam>): GenericAPIResponse;
getSymbols(): Promise<APIResponse<SymbolInfo[]>>;
/**

@@ -26,16 +23,5 @@ *

*/
getOpenInterest(params: {
symbol: string;
period: string;
limit?: number;
}): GenericAPIResponse;
getLatestBigDeal(params: {
symbol: string;
limit?: number;
}): GenericAPIResponse;
getLongShortRatio(params: {
symbol: string;
period: string;
limit?: number;
}): GenericAPIResponse;
getOpenInterest(params: SymbolPeriodLimitParam): GenericAPIResponse;
getLatestBigDeal(params: SymbolLimitParam): GenericAPIResponse;
getLongShortRatio(params: SymbolPeriodLimitParam): GenericAPIResponse;
/**

@@ -52,27 +38,6 @@ *

*/
getWalletBalance(params: {
coin?: string;
}): GenericAPIResponse;
getWalletFundRecords(params?: {
start_date?: string;
end_date?: string;
currency?: string;
coin?: string;
wallet_fund_type?: string;
page?: number;
limit?: number;
}): GenericAPIResponse;
getWithdrawRecords(params: {
start_date?: string;
end_date?: string;
coin?: string;
status?: string;
page?: number;
limit?: number;
}): GenericAPIResponse;
getAssetExchangeRecords(params?: {
limit?: number;
from?: number;
direction?: string;
}): GenericAPIResponse;
getWalletBalance(params?: Partial<CoinParam>): GenericAPIResponse;
getWalletFundRecords(params?: WalletFundRecordsReq): GenericAPIResponse;
getWithdrawRecords(params: WithdrawRecordsReq): GenericAPIResponse;
getAssetExchangeRecords(params?: AssetExchangeRecordsReq): GenericAPIResponse;
/**

@@ -79,0 +44,0 @@ *

export declare type KlineInterval = '1m' | '3m' | '5m' | '15m' | '30m' | '1h' | '2h' | '4h' | '6h' | '12h' | '1d' | '1w' | '1M';
export declare type numberInString = string;
export interface APIResponse<T> {
ret_code: number;
ret_msg: "OK" | string;
ext_code: string;
ext_info: string;
result: T;
}
/**
* Request Parameter Types
*/
export interface SymbolParam {
symbol: string;
}
export interface SymbolLimitParam {
symbol: string;
limit?: number;
}
export interface SymbolPeriodLimitParam {
symbol: string;
period: string;
limit?: number;
}
export interface SymbolFromLimitParam {
symbol: string;
from?: number;
limit?: number;
}
export interface SymbolIntervalFromLimitParam {
symbol: string;
interval: string;
from: number;
limit?: number;
}
export interface CoinParam {
coin: string;
}
export interface WalletFundRecordsReq {
start_date?: string;
end_date?: string;
currency?: string;
coin?: string;
wallet_fund_type?: string;
page?: number;
limit?: number;
}
export interface WithdrawRecordsReq {
start_date?: string;
end_date?: string;
coin?: string;
status?: string;
page?: number;
limit?: number;
}
export interface AssetExchangeRecordsReq {
limit?: number;
from?: number;
direction?: string;
}
/**
* Response types
*/
export interface LeverageFilter {
min_leverage: numberInString;
max_leveage: numberInString;
leverage_step: numberInString;
}
export interface PriceFilter {
min_price: numberInString;
max_price: numberInString;
tick_size: numberInString;
}
export interface LotSizeFilter {
max_trading_qty: number;
min_trading_qty: number;
qty_step: number;
}
export interface SymbolInfo {
name: string;
alias: string;
status: 'Trading' | string;
base_currency: string;
quote_currency: string;
price_scale: number;
taker_fee: numberInString;
maker_fee: numberInString;
leverage_filter: LeverageFilter;
price_filter: PriceFilter;
lot_size_filter: LotSizeFilter;
}

@@ -12,8 +12,8 @@ import { AxiosRequestConfig, Method } from 'axios';

constructor(key: string | undefined, secret: string | undefined, baseUrl: string, options?: RestClientOptions, requestOptions?: AxiosRequestConfig);
get(endpoint: string, params?: any): GenericAPIResponse;
post(endpoint: string, params?: any): GenericAPIResponse;
get<T>(endpoint: string, params?: any): Promise<T>;
post<T>(endpoint: string, params?: any): Promise<T>;
/**
* @private Make a HTTP request to a specific endpoint. Private endpoints are automatically signed.
*/
_call(method: Method, endpoint: string, params?: any): GenericAPIResponse;
_call<T>(method: Method, endpoint: string, params?: any): Promise<T>;
/**

@@ -20,0 +20,0 @@ * @private generic handler to parse request exceptions

@@ -378,2 +378,4 @@ "use strict";

try {
// any message can clear the pong timer - wouldn't get a message if the ws dropped
this.clearPongTimer(wsKey);
const msg = JSON.parse(event && event.data || event);

@@ -414,3 +416,2 @@ if ('success' in msg || (msg === null || msg === void 0 ? void 0 : msg.pong)) {

this.logger.silly('Received pong', Object.assign(Object.assign({}, loggerCategory), { wsKey }));
this.clearPongTimer(wsKey);
}

@@ -417,0 +418,0 @@ else {

{
"name": "bybit-api",
"version": "2.1.6",
"version": "2.1.7",
"description": "Node.js connector for Bybit's REST APIs and WebSockets, with TypeScript & integration tests.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc