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 3.9.8 to 3.10.0

1

lib/rest-client-v5.d.ts

@@ -15,2 +15,3 @@ import { APIResponseV3, APIResponseV3WithTime, AccountCoinBalanceV5, AccountInfoV5, AccountMarginModeV5, AccountOrderV5, AccountTypeV5, AddOrReduceMarginParamsV5, AddOrReduceMarginResultV5, AllCoinsBalanceV5, AllowedDepositCoinInfoV5, AmendOrderParamsV5, ApiKeyInfoV5, AssetInfoV5, BatchAmendOrderParamsV5, BatchAmendOrderResultV5, BatchCancelOrderParamsV5, BatchCancelOrderResultV5, BatchCreateOrderResultV5, BatchOrderParamsV5, BatchOrdersResponseV5, BorrowHistoryRecordV5, CancelAllOrdersParamsV5, CancelOrderParamsV5, CategoryCursorListV5, CategoryListV5, CategorySymbolListV5, CategoryV5, ClosedPnLV5, CoinExchangeRecordV5, CoinGreeksV5, CoinInfoV5, CollateralInfoV5, CreateSubApiKeyParamsV5, CreateSubApiKeyResultV5, CreateSubMemberParamsV5, CreateSubMemberResultV5, CursorListV5, CursorRowsV5, DeleteSubMemberParamsV5, DeliveryPriceV5, DeliveryRecordV5, DepositAddressResultV5, DepositRecordV5, ExecutionV5, FeeRateV5, FundingRateHistoryResponseV5, GetAccountCoinBalanceParamsV5, GetAccountHistoricOrdersParamsV5, GetAccountOrdersParamsV5, GetAllCoinsBalanceParamsV5, GetAllowedDepositCoinInfoParamsV5, GetAssetInfoParamsV5, GetBorrowHistoryParamsV5, GetClosedPnLParamsV5, GetCoinExchangeRecordParamsV5, GetDeliveryPriceParamsV5, GetDeliveryRecordParamsV5, GetDepositRecordParamsV5, GetExecutionListParamsV5, GetFeeRateParamsV5, GetFundingRateHistoryParamsV5, GetHistoricalVolatilityParamsV5, GetIndexPriceKlineParamsV5, GetInstrumentsInfoParamsV5, GetInsuranceParamsV5, GetInternalDepositRecordParamsV5, GetInternalTransferParamsV5, GetKlineParamsV5, GetMarkPriceKlineParamsV5, GetOpenInterestParamsV5, GetOptionDeliveryPriceParamsV5, GetOrderbookParamsV5, GetPreUpgradeClosedPnlParamsV5, GetPreUpgradeOrderHistoryParamsV5, GetPreUpgradeTradeHistoryParamsV5, GetPremiumIndexPriceKlineParamsV5, GetPublicTradingHistoryParamsV5, GetRiskLimitParamsV5, GetSettlementRecordParamsV5, GetSpotLeveragedTokenOrderHistoryParamsV5, GetSubAccountDepositRecordParamsV5, GetTickersParamsV5, GetTransactionLogParamsV5, GetUniversalTransferRecordsParamsV5, GetWalletBalanceParamsV5, GetWithdrawalRecordsParamsV5, HistoricalVolatilityV5, InstrumentInfoResponseV5, InsuranceResponseV5, InternalDepositRecordV5, InternalTransferRecordV5, LeverageTokenInfoV5, LeveragedTokenMarketResultV5, MMPModifyParamsV5, MMPStateV5, OHLCKlineV5, OHLCVKlineV5, OpenInterestResponseV5, OptionDeliveryPriceV5, OrderParamsV5, OrderResultV5, OrderSideV5, OrderbookResponseV5, PositionInfoParamsV5, PositionV5, PublicTradeV5, PurchaseSpotLeveragedTokenParamsV5, PurchaseSpotLeveragedTokenResultV5, RedeemSpotLeveragedTokenParamsV5, RedeemSpotLeveragedTokenResultV5, RepayLiabilityParamsV5, RepayLiabilityResultV5, RiskLimitV5, SetAutoAddMarginParamsV5, SetCollateralCoinParamsV5, SetLeverageParamsV5, SetRiskLimitParamsV5, SetRiskLimitResultV5, SetTPSLModeParamsV5, SetTradingStopParamsV5, SettlementRecordV5, SpotBorrowCheckResultV5, SpotLeveragedTokenOrderHistoryV5, SubMemberV5, SwitchIsolatedMarginParamsV5, SwitchPositionModeParamsV5, TPSLModeV5, TickerLinearInverseV5, TickerOptionV5, TickerSpotV5, TransactionLogV5, UnifiedAccountUpgradeResultV5, UniversalTransferParamsV5, UniversalTransferRecordV5, UpdateApiKeyParamsV5, UpdateApiKeyResultV5, WalletBalanceV5, WithdrawParamsV5, WithdrawalRecordV5 } from './types';

}>>;
requestDemoTradingFunds(): Promise<{}>;
/**

@@ -17,0 +18,0 @@ *

@@ -36,2 +36,5 @@ "use strict";

}
requestDemoTradingFunds() {
return this.postPrivate('/v5/account/demo-apply-money');
}
/**

@@ -38,0 +41,0 @@ *

@@ -21,2 +21,8 @@ import { RestClientOptions, WS_KEY_MAP } from '../util';

/**
* Set to `true` to connect to Bybit's V5 demo trading: https://bybit-exchange.github.io/docs/v5/demo
*
* Only the "V5" "market" is supported here.
*/
demoTrading?: boolean;
/**
* The API group this client should connect to.

@@ -39,3 +45,2 @@ *

export interface WebsocketClientOptions extends WSClientConfigurableOptions {
testnet?: boolean;
market: APIMarket;

@@ -42,0 +47,0 @@ pongTimeout: number;

@@ -12,2 +12,6 @@ import { AxiosResponse } from 'axios';

testnet?: boolean;
/**
* Set to `true` to use Bybit's V5 demo trading: https://bybit-exchange.github.io/docs/v5/demo
*/
demoTrading?: boolean;
/** Override the max size of the request window (in ms) */

@@ -55,3 +59,3 @@ recv_window?: number;

export declare function serializeParams(params?: object, strict_validation?: boolean, sortProperties?: boolean, encodeSerialisedValues?: boolean): string;
export declare function getRestBaseUrl(useTestnet: boolean, restInverseOptions: RestClientOptions): string;
export declare function getRestBaseUrl(useTestnet: boolean, restClientOptions: RestClientOptions): string;
export declare function isWsPong(msg: any): boolean;

@@ -58,0 +62,0 @@ export declare function isTopicSubscriptionConfirmation(msg: unknown): msg is WebsocketTopicSubscriptionConfirmationEvent;

10

lib/util/requestUtils.js

@@ -29,10 +29,14 @@ "use strict";

exports.serializeParams = serializeParams;
function getRestBaseUrl(useTestnet, restInverseOptions) {
function getRestBaseUrl(useTestnet, restClientOptions) {
const exchangeBaseUrls = {
livenet: 'https://api.bybit.com',
testnet: 'https://api-testnet.bybit.com',
demoLivenet: 'https://api-demo.bybit.com',
};
if (restInverseOptions.baseUrl) {
return restInverseOptions.baseUrl;
if (restClientOptions.baseUrl) {
return restClientOptions.baseUrl;
}
if (restClientOptions.demoTrading) {
return exchangeBaseUrls.demoLivenet;
}
if (useTestnet) {

@@ -39,0 +43,0 @@ return exchangeBaseUrls.testnet;

import WebSocket from 'isomorphic-ws';
import { APIMarket, CategoryV5, WsKey } from '../types';
import { APIMarket, CategoryV5, WebsocketClientOptions, WsKey } from '../types';
import { DefaultLogger } from './logger';

@@ -52,3 +52,3 @@ interface NetworkMapV3 {

export declare function getWsKeyForTopic(market: APIMarket, topic: string, isPrivate?: boolean, category?: CategoryV5): WsKey;
export declare function getWsUrl(wsKey: WsKey, wsUrl: string | undefined, isTestnet: boolean, logger: typeof DefaultLogger): string;
export declare function getWsUrl(wsKey: WsKey, wsClientOptions: WebsocketClientOptions, logger: typeof DefaultLogger): string;
export declare function getMaxTopicsPerSubscribeEvent(market: APIMarket, wsKey: WsKey): number | null;

@@ -55,0 +55,0 @@ export declare function getUsdcWsKeyForTopic(topic: string, subGroup: 'option' | 'perp'): WsKey;

@@ -346,6 +346,13 @@ "use strict";

exports.getWsKeyForTopic = getWsKeyForTopic;
function getWsUrl(wsKey, wsUrl, isTestnet, logger) {
function getWsUrl(wsKey, wsClientOptions, logger) {
const wsUrl = wsClientOptions.wsUrl;
if (wsUrl) {
return wsUrl;
}
// https://bybit-exchange.github.io/docs/v5/demo
const isDemoTrading = wsClientOptions.demoTrading;
if (isDemoTrading) {
return 'wss://stream-demo.bybit.com/v5/private';
}
const isTestnet = wsClientOptions.testnet;
const networkKey = isTestnet ? 'testnet' : 'livenet';

@@ -352,0 +359,0 @@ switch (wsKey) {

@@ -384,3 +384,3 @@ "use strict";

const authParams = yield this.getAuthParams(wsKey);
const url = (0, util_1.getWsUrl)(wsKey, this.options.wsUrl, this.isTestnet(), this.logger);
const url = (0, util_1.getWsUrl)(wsKey, this.options, this.logger);
const ws = this.connectToWsUrl(url + authParams, wsKey);

@@ -387,0 +387,0 @@ return this.wsStore.setWs(wsKey, ws);

{
"name": "bybit-api",
"version": "3.9.8",
"version": "3.10.0",
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",

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

@@ -38,2 +38,3 @@ # Node.js & JavaScript SDK for Bybit REST API & WebSockets

- [bitget-api](https://www.npmjs.com/package/bitget-api)
- [bitmart-api](https://www.npmjs.com/package/bitmart-api)
- Try my misc utilities:

@@ -40,0 +41,0 @@ - [orderbooks](https://www.npmjs.com/package/orderbooks)

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