bybit-api-node
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,2 +0,2 @@ | ||
import { AccountCoinBalanceResponseV3, AccountCoinBalancesRequestV3, AccountCoinBalancesResponseV3, APIKeyInfoV3, APIResponseV3WithTime, APIResponseWithTime, AssetInfoRequestV3, AssetInfoResponseV3, CoinInfoQueryResponseV3, CreateSubAPIKeyRequestV3, CreateSubAPIKeyResponseV3, CreateSubMemberRequestV3, CreateSubMemberResponseV3, DepositAddressResponseV3, DepositRecordQueryRequestV3, DepositRecordQueryResponseV3, InternalTransferRequestV3, ModifyAPIKeyRequestV3, QueryDepositAddressRequestV3, QueryInternalTransfersRequestV3, QueryInternalTransferSResponseV3, QuerySubAccountDepositAddressRequestV3, SingleAccountCoinBalanceRequestV3, SubAccountTransferRequestV3, SubAccountTransferResponseV3, SubDepositRecordQueryRequestV3, SubMemberResponseV3, SupportedDepositListRequestV3, SupportedDepositListResponseV3, TransferCoinListRequestV3, UniversalTransferCreateResponse, UniversalTransferListRequestV3, UniversalTransferListResponseV3, UniversalTransferRequestV3, WithdrawCreateRequestV3, WithdrawRecordQueryRequestV3, WithdrawRecordsQueryResponseV3 } from './types'; | ||
import { APIKeyInfoV3, APIResponseV3WithTime, APIResponseWithTime, AccountCoinBalanceResponseV3, AccountCoinBalancesRequestV3, AccountCoinBalancesResponseV3, AssetInfoRequestV3, AssetInfoResponseV3, CoinInfoQueryResponseV3, CreateSubAPIKeyRequestV3, CreateSubAPIKeyResponseV3, CreateSubMemberRequestV3, CreateSubMemberResponseV3, DepositAddressResponseV3, DepositRecordQueryRequestV3, DepositRecordQueryResponseV3, InternalTransferRequestV3, ModifyAPIKeyRequestV3, QueryDepositAddressRequestV3, QueryInternalTransferSResponseV3, QueryInternalTransfersRequestV3, QuerySubAccountDepositAddressRequestV3, SingleAccountCoinBalanceRequestV3, SubAccountTransferRequestV3, SubAccountTransferResponseV3, SubDepositRecordQueryRequestV3, SubMemberResponseV3, SupportedDepositListRequestV3, SupportedDepositListResponseV3, TransferCoinListRequestV3, UniversalTransferCreateResponse, UniversalTransferListRequestV3, UniversalTransferListResponseV3, UniversalTransferRequestV3, WithdrawCreateRequestV3, WithdrawRecordQueryRequestV3, WithdrawRecordsQueryResponseV3 } from './types'; | ||
import BaseRestClient from './util/BaseRestClient'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { AccountAssetInformationRequest, APIResponseWithTime, DepositRecordsRequest, EnableUniversalTransferRequest, InternalTransferRequest, SubAccountTransferRequest, SupportedDepositListRequest, TransferQueryRequest, UniversalTransferRequest, WithdrawalRecordsRequest, WithdrawalRequest } from './types'; | ||
import { APIResponseWithTime, AccountAssetInformationRequest, DepositRecordsRequest, EnableUniversalTransferRequest, InternalTransferRequest, SubAccountTransferRequest, SupportedDepositListRequest, TransferQueryRequest, UniversalTransferRequest, WithdrawalRecordsRequest, WithdrawalRequest } from './types'; | ||
import BaseRestClient from './util/BaseRestClient'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -45,5 +45,16 @@ export declare const linearPositionModeEnum: { | ||
readonly RISK_LIMIT_NOT_EXISTS: 30090; | ||
readonly SUB_USER_ALREADY_EXISTS: 31005; | ||
readonly LEVERAGE_NOT_MODIFIED: 34036; | ||
readonly SAME_SLTP_MODE: 37002; | ||
readonly COPY_TRADE_NOT_OPEN_ORDER: 39426; | ||
readonly V5_ORDER_NOT_FOUND: 110001; | ||
readonly V5_INSUFFICIENT_BALANCE: 110007; | ||
readonly V5_API_KEY_PERMISSION_DENIED: 10005; | ||
readonly V5_CROSS_ISOLATED_MARGIN_NOT_CHANGED: 110026; | ||
readonly V5_LEVERAGE_NOT_CHANGED: 110043; | ||
readonly V5_MARGIN_MODE_NOT_CHANGED: 110073; | ||
readonly V5_TPSL_NOT_CHANGED: 10001; | ||
readonly V5_RISK_ID_NOT_CHANGED: 10001; | ||
readonly V5_AUTO_ADD_MARGIN_NOT_CHANGED: 10001; | ||
readonly V5_TPSL_ERROR_NO_POSITION: 10001; | ||
readonly QTY_EXCEEDS_MAX_LIMIT: 130006; | ||
@@ -58,2 +69,3 @@ readonly ORDER_NOT_FOUND_OR_TOO_LATE_LINEAR: 130010; | ||
readonly SAME_SLTP_MODE_LINEAR: 130150; | ||
readonly TRANSFER_ID_EXISTS: 131214; | ||
readonly RISK_ID_NOT_MODIFIED: 134026; | ||
@@ -66,2 +78,8 @@ readonly CONTRACT_ORDER_NOT_EXISTS: 140001; | ||
readonly CONTRACT_SET_LEVERAGE_NOT_MODIFIED: 140043; | ||
readonly SUB_USER_NOT_FOUND: 141009; | ||
readonly SPOT_LEVERAGE_TOKEN_INSUFFICIENT_BALANCE: 175006; | ||
readonly SPOT_LEVERAGE_TOKEN_ORDER_NOT_FOUND: 175007; | ||
readonly SPOT_LEVERAGE_QUIZ_REQUIRED: 175010; | ||
readonly SPOT_MARGIN_NOT_ENABLED: 176008; | ||
readonly SPOT_MARGIN_QUESTIONNAIRE_NOT_SUBMIT: 176037; | ||
/** E.g. USDC Options trading, trying to access a symbol that is no longer active */ | ||
@@ -68,0 +86,0 @@ readonly CONTRACT_NAME_NOT_EXIST: 3100111; |
@@ -48,5 +48,16 @@ "use strict"; | ||
RISK_LIMIT_NOT_EXISTS: 30090, | ||
SUB_USER_ALREADY_EXISTS: 31005, | ||
LEVERAGE_NOT_MODIFIED: 34036, | ||
SAME_SLTP_MODE: 37002, | ||
COPY_TRADE_NOT_OPEN_ORDER: 39426, | ||
V5_ORDER_NOT_FOUND: 110001, | ||
V5_INSUFFICIENT_BALANCE: 110007, | ||
V5_API_KEY_PERMISSION_DENIED: 10005, | ||
V5_CROSS_ISOLATED_MARGIN_NOT_CHANGED: 110026, | ||
V5_LEVERAGE_NOT_CHANGED: 110043, | ||
V5_MARGIN_MODE_NOT_CHANGED: 110073, | ||
V5_TPSL_NOT_CHANGED: 10001, | ||
V5_RISK_ID_NOT_CHANGED: 10001, | ||
V5_AUTO_ADD_MARGIN_NOT_CHANGED: 10001, | ||
V5_TPSL_ERROR_NO_POSITION: 10001, | ||
QTY_EXCEEDS_MAX_LIMIT: 130006, | ||
@@ -61,2 +72,3 @@ ORDER_NOT_FOUND_OR_TOO_LATE_LINEAR: 130010, | ||
SAME_SLTP_MODE_LINEAR: 130150, | ||
TRANSFER_ID_EXISTS: 131214, | ||
RISK_ID_NOT_MODIFIED: 134026, | ||
@@ -69,2 +81,8 @@ CONTRACT_ORDER_NOT_EXISTS: 140001, | ||
CONTRACT_SET_LEVERAGE_NOT_MODIFIED: 140043, | ||
SUB_USER_NOT_FOUND: 141009, | ||
SPOT_LEVERAGE_TOKEN_INSUFFICIENT_BALANCE: 175006, | ||
SPOT_LEVERAGE_TOKEN_ORDER_NOT_FOUND: 175007, | ||
SPOT_LEVERAGE_QUIZ_REQUIRED: 175010, | ||
SPOT_MARGIN_NOT_ENABLED: 176008, | ||
SPOT_MARGIN_QUESTIONNAIRE_NOT_SUBMIT: 176037, | ||
/** E.g. USDC Options trading, trying to access a symbol that is no longer active */ | ||
@@ -71,0 +89,0 @@ CONTRACT_NAME_NOT_EXIST: 3100111, |
@@ -1,2 +0,2 @@ | ||
import { APIResponseWithTime, APIResponseV3, UMCandlesRequest, UMCategory, UMFundingRateHistoryRequest, UMInstrumentInfoRequest, UMOpenInterestRequest, UMOptionDeliveryPriceRequest, UMPublicTradesRequest, ContractOrderRequest, ContractHistoricOrdersRequest, ContractCancelOrderRequest, ContractModifyOrderRequest, ContractActiveOrdersRequest, ContractPositionsRequest, ContractSetAutoAddMarginRequest, ContractSetMarginSwitchRequest, ContractSetPositionModeRequest, ContractSetTPSLRequest, ContractUserExecutionHistoryRequest, ContractClosedPNLRequest, ContractWalletFundRecordRequest, PaginatedResult, ContractHistoricOrder, ContractSymbolTicker, ContractListResult } from './types'; | ||
import { APIResponseV3, APIResponseWithTime, ContractActiveOrdersRequest, ContractCancelOrderRequest, ContractClosedPNLRequest, ContractHistoricOrder, ContractHistoricOrdersRequest, ContractListResult, ContractModifyOrderRequest, ContractOrderRequest, ContractPositionsRequest, ContractSetAutoAddMarginRequest, ContractSetMarginSwitchRequest, ContractSetPositionModeRequest, ContractSetTPSLRequest, ContractSymbolTicker, ContractUserExecutionHistoryRequest, ContractWalletFundRecordRequest, PaginatedResult, UMCandlesRequest, UMCategory, UMFundingRateHistoryRequest, UMInstrumentInfoRequest, UMOpenInterestRequest, UMOptionDeliveryPriceRequest, UMPublicTradesRequest } from './types'; | ||
import BaseRestClient from './util/BaseRestClient'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { APIResponseWithTime, CopyTradingCancelOrderRequest, CopyTradingCloseOrderRequest, CopyTradingOrderListRequest, CopyTradingOrderRequest, CopyTradingTradingStopRequest, CopyTradingTransferRequest, APIResponseV3 } from './types'; | ||
import { APIResponseV3, APIResponseWithTime, CopyTradingCancelOrderRequest, CopyTradingCloseOrderRequest, CopyTradingOrderListRequest, CopyTradingOrderRequest, CopyTradingTradingStopRequest, CopyTradingTransferRequest } from './types'; | ||
import BaseRestClient from './util/BaseRestClient'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -7,2 +7,3 @@ export * from './account-asset-client'; | ||
export * from './linear-client'; | ||
export * from './rest-client-v5'; | ||
export * from './spot-client'; | ||
@@ -9,0 +10,0 @@ export * from './spot-client-v3'; |
@@ -19,2 +19,3 @@ "use strict"; | ||
__exportStar(require("./linear-client"), exports); | ||
__exportStar(require("./rest-client-v5"), exports); | ||
__exportStar(require("./spot-client"), exports); | ||
@@ -21,0 +22,0 @@ __exportStar(require("./spot-client-v3"), exports); |
@@ -16,2 +16,3 @@ "use strict"; | ||
exports.InverseClient = void 0; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const util_1 = require("./util"); | ||
@@ -18,0 +19,0 @@ const BaseRestClient_1 = __importDefault(require("./util/BaseRestClient")); |
@@ -16,2 +16,3 @@ "use strict"; | ||
exports.InverseFuturesClient = void 0; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const requestUtils_1 = require("./util/requestUtils"); | ||
@@ -18,0 +19,0 @@ const BaseRestClient_1 = __importDefault(require("./util/BaseRestClient")); |
@@ -16,2 +16,3 @@ "use strict"; | ||
exports.LinearClient = void 0; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const requestUtils_1 = require("./util/requestUtils"); | ||
@@ -18,0 +19,0 @@ const BaseRestClient_1 = __importDefault(require("./util/BaseRestClient")); |
@@ -1,2 +0,2 @@ | ||
import { APIResponseWithTime, APIResponseV3, SpotOrderQueryById, SpotBalances, KlineInterval, NewSpotOrderV3, SpotMyTradesRequest, SpotLeveragedTokenPRHistoryRequest, SpotCrossMarginBorrowingInfoRequest, SpotCrossMarginRepaymentHistoryRequest, SpotCancelOrderBatchRequest } from './types'; | ||
import { APIResponseV3, APIResponseWithTime, KlineInterval, NewSpotOrderV3, SpotBalances, SpotCancelOrderBatchRequest, SpotCrossMarginBorrowingInfoRequest, SpotCrossMarginRepaymentHistoryRequest, SpotLeveragedTokenPRHistoryRequest, SpotMyTradesRequest, SpotOrderQueryById } from './types'; | ||
import BaseRestClient from './util/BaseRestClient'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -126,2 +126,3 @@ "use strict"; | ||
limit, | ||
orderCategory, | ||
}); | ||
@@ -128,0 +129,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { NewSpotOrder, APIResponse, KlineInterval, OrderSide, OrderTypeSpot, SpotBalances, SpotLastPrice, SpotOrderQueryById, SpotSymbolInfo } from './types'; | ||
import { APIResponse, KlineInterval, NewSpotOrder, OrderSide, OrderTypeSpot, SpotBalances, SpotLastPrice, SpotOrderQueryById, SpotSymbolInfo } from './types'; | ||
import BaseRestClient from './util/BaseRestClient'; | ||
@@ -3,0 +3,0 @@ /** |
export * from './response'; | ||
export * from './request'; | ||
export * from './shared'; | ||
export * from './v5-shared'; | ||
export * from './websockets'; |
@@ -16,3 +16,4 @@ "use strict"; | ||
__exportStar(require("./shared"), exports); | ||
__exportStar(require("./v5-shared"), exports); | ||
__exportStar(require("./websockets"), exports); | ||
//# sourceMappingURL=index.js.map |
export * from './account-asset'; | ||
export * from './copy-trading'; | ||
export * from './contract'; | ||
export * from './linear'; | ||
@@ -10,2 +11,8 @@ export * from './inverse'; | ||
export * from './unified-margin'; | ||
export * from './contract'; | ||
export * from './v5-account'; | ||
export * from './v5-asset'; | ||
export * from './v5-market'; | ||
export * from './v5-position'; | ||
export * from './v5-trade'; | ||
export * from './v5-user'; | ||
export * from './v5-spot-leverage-token'; |
@@ -15,2 +15,3 @@ "use strict"; | ||
__exportStar(require("./copy-trading"), exports); | ||
__exportStar(require("./contract"), exports); | ||
__exportStar(require("./linear"), exports); | ||
@@ -23,3 +24,9 @@ __exportStar(require("./inverse"), exports); | ||
__exportStar(require("./unified-margin"), exports); | ||
__exportStar(require("./contract"), exports); | ||
__exportStar(require("./v5-account"), exports); | ||
__exportStar(require("./v5-asset"), exports); | ||
__exportStar(require("./v5-market"), exports); | ||
__exportStar(require("./v5-position"), exports); | ||
__exportStar(require("./v5-trade"), exports); | ||
__exportStar(require("./v5-user"), exports); | ||
__exportStar(require("./v5-spot-leverage-token"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -139,2 +139,3 @@ import { LinearPositionIdx, linearPositionModeEnum, positionTpSlModeEnum } from '../../constants/enum'; | ||
tp_size?: number; | ||
position_idx?: 0 | 1 | 2; | ||
} | ||
@@ -141,0 +142,0 @@ export interface LinearGetTradeRecordsRequest { |
@@ -1,2 +0,2 @@ | ||
import { numberInString, OrderSide } from '../shared'; | ||
import { OrderSide, numberInString } from '../shared'; | ||
export declare type OrderTypeSpot = 'LIMIT' | 'MARKET' | 'LIMIT_MAKER'; | ||
@@ -3,0 +3,0 @@ export declare type OrderTimeInForce = 'GTC' | 'FOK' | 'IOC'; |
@@ -7,1 +7,8 @@ export * from './account-asset'; | ||
export * from './unified-margin'; | ||
export * from './v5-account'; | ||
export * from './v5-asset'; | ||
export * from './v5-market'; | ||
export * from './v5-position'; | ||
export * from './v5-trade'; | ||
export * from './v5-user'; | ||
export * from './v5-spot-leverage-token'; |
@@ -19,2 +19,9 @@ "use strict"; | ||
__exportStar(require("./unified-margin"), exports); | ||
__exportStar(require("./v5-account"), exports); | ||
__exportStar(require("./v5-asset"), exports); | ||
__exportStar(require("./v5-market"), exports); | ||
__exportStar(require("./v5-position"), exports); | ||
__exportStar(require("./v5-trade"), exports); | ||
__exportStar(require("./v5-user"), exports); | ||
__exportStar(require("./v5-spot-leverage-token"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { APIResponseWithTime, APIResponseV3, UMCategory, UMCandlesRequest, UMInstrumentInfoRequest, UMFundingRateHistoryRequest, UMOptionDeliveryPriceRequest, UMPublicTradesRequest, UMOpenInterestRequest, UMOrderRequest, UMModifyOrderRequest, UMCancelOrderRequest, UMActiveOrdersRequest, UMHistoricOrdersRequest, UMBatchOrder, UMBatchOrderReplace, UMBatchOrderCancel, UMCancelAllOrdersRequest, UMPositionsRequest, UMSetTPSLRequest, UM7DayTradingHistoryRequest, UMOptionsSettlementHistoryRequest, UMPerpSettlementHistoryRequest, UMTransactionLogRequest, InternalTransferRequest, UMExchangeCoinsRequest, UMBorrowHistoryRequest, UMPaginatedResult, UMHistoricOrder, UMInstrumentInfo } from './types'; | ||
import { APIResponseV3, APIResponseWithTime, InternalTransferRequest, UM7DayTradingHistoryRequest, UMActiveOrdersRequest, UMBatchOrder, UMBatchOrderCancel, UMBatchOrderReplace, UMBorrowHistoryRequest, UMCancelAllOrdersRequest, UMCancelOrderRequest, UMCandlesRequest, UMCategory, UMExchangeCoinsRequest, UMFundingRateHistoryRequest, UMHistoricOrder, UMHistoricOrdersRequest, UMInstrumentInfo, UMInstrumentInfoRequest, UMModifyOrderRequest, UMOpenInterestRequest, UMOptionDeliveryPriceRequest, UMOptionsSettlementHistoryRequest, UMOrderRequest, UMPaginatedResult, UMPerpSettlementHistoryRequest, UMPositionsRequest, UMPublicTradesRequest, UMSetTPSLRequest, UMTransactionLogRequest } from './types'; | ||
import BaseRestClient from './util/BaseRestClient'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { APIResponseWithTime, APIResponseV3, USDCOptionsActiveOrdersRealtimeRequest, USDCOptionsActiveOrdersRequest, USDCOptionsCancelAllOrdersRequest, USDCOptionsCancelOrderRequest, USDCOptionsContractInfoRequest, USDCOptionsDeliveryHistoryRequest, USDCOptionsDeliveryPriceRequest, USDCOptionsHistoricalVolatilityRequest, USDCOptionsHistoricOrdersRequest, USDCOptionsModifyMMPRequest, USDCOptionsModifyOrderRequest, USDCOptionsOrderExecutionRequest, USDCOptionsOrderRequest, USDCOptionsPositionsInfoExpiryRequest, USDCOptionsRecentTradesRequest, USDCPositionsRequest, USDCTransactionLogRequest } from './types'; | ||
import { APIResponseV3, APIResponseWithTime, USDCOptionsActiveOrdersRealtimeRequest, USDCOptionsActiveOrdersRequest, USDCOptionsCancelAllOrdersRequest, USDCOptionsCancelOrderRequest, USDCOptionsContractInfoRequest, USDCOptionsDeliveryHistoryRequest, USDCOptionsDeliveryPriceRequest, USDCOptionsHistoricOrdersRequest, USDCOptionsHistoricalVolatilityRequest, USDCOptionsModifyMMPRequest, USDCOptionsModifyOrderRequest, USDCOptionsOrderExecutionRequest, USDCOptionsOrderRequest, USDCOptionsPositionsInfoExpiryRequest, USDCOptionsRecentTradesRequest, USDCPositionsRequest, USDCTransactionLogRequest } from './types'; | ||
import BaseRestClient from './util/BaseRestClient'; | ||
@@ -64,3 +64,7 @@ /** | ||
getHistoricOrders(params: USDCOptionsHistoricOrdersRequest): Promise<APIResponseV3<any>>; | ||
/** Query trade history. The endpoint only supports up to 30 days of queried records. An error will be returned if startTime is more than 30 days. */ | ||
/** | ||
* Query trade history. | ||
* The endpoint only supports up to 30 days of queried records. | ||
* An error will be returned if startTime is more than 30 days. | ||
*/ | ||
getOrderExecutionHistory(params: USDCOptionsOrderExecutionRequest): Promise<APIResponseV3<any>>; | ||
@@ -75,3 +79,5 @@ /** -> Account API */ | ||
/** | ||
* If USDC derivatives account balance is greater than X, you can open PORTFOLIO_MARGIN, and if it is less than Y, it will automatically close PORTFOLIO_MARGIN and change back to REGULAR_MARGIN. X and Y will be adjusted according to operational requirements. | ||
* If USDC derivatives account balance is greater than X, you can open PORTFOLIO_MARGIN, | ||
* and if it is less than Y, it will automatically close PORTFOLIO_MARGIN and change back to REGULAR_MARGIN. | ||
* X and Y will be adjusted according to operational requirements. | ||
* Rest API returns the result of checking prerequisites. You could get the real status of margin mode change by subscribing margin mode. | ||
@@ -78,0 +84,0 @@ */ |
@@ -118,3 +118,7 @@ "use strict"; | ||
} | ||
/** Query trade history. The endpoint only supports up to 30 days of queried records. An error will be returned if startTime is more than 30 days. */ | ||
/** | ||
* Query trade history. | ||
* The endpoint only supports up to 30 days of queried records. | ||
* An error will be returned if startTime is more than 30 days. | ||
*/ | ||
getOrderExecutionHistory(params) { | ||
@@ -137,3 +141,5 @@ return this.postPrivate('/option/usdc/openapi/private/v1/execution-list', params); | ||
/** | ||
* If USDC derivatives account balance is greater than X, you can open PORTFOLIO_MARGIN, and if it is less than Y, it will automatically close PORTFOLIO_MARGIN and change back to REGULAR_MARGIN. X and Y will be adjusted according to operational requirements. | ||
* If USDC derivatives account balance is greater than X, you can open PORTFOLIO_MARGIN, | ||
* and if it is less than Y, it will automatically close PORTFOLIO_MARGIN and change back to REGULAR_MARGIN. | ||
* X and Y will be adjusted according to operational requirements. | ||
* Rest API returns the result of checking prerequisites. You could get the real status of margin mode change by subscribing margin mode. | ||
@@ -140,0 +146,0 @@ */ |
@@ -1,2 +0,2 @@ | ||
import { APIResponseWithTime, SymbolLimitParam, SymbolPeriodLimitParam, APIResponseV3, USDCKlineRequest, USDCLast500TradesRequest, USDCOpenInterestRequest, USDCOrderFilter, USDCPerpActiveOrdersRequest, USDCPerpCancelOrderRequest, USDCPerpHistoricOrdersRequest, USDCPerpModifyOrderRequest, USDCPerpOrderRequest, USDCPositionsRequest, USDCSymbolDirectionLimit, USDCSymbolDirectionLimitCursor, USDCTransactionLogRequest } from './types'; | ||
import { APIResponseV3, APIResponseWithTime, SymbolLimitParam, SymbolPeriodLimitParam, USDCKlineRequest, USDCLast500TradesRequest, USDCOpenInterestRequest, USDCOrderFilter, USDCPerpActiveOrdersRequest, USDCPerpCancelOrderRequest, USDCPerpHistoricOrdersRequest, USDCPerpModifyOrderRequest, USDCPerpOrderRequest, USDCPositionsRequest, USDCSymbolDirectionLimit, USDCSymbolDirectionLimitCursor, USDCTransactionLogRequest } from './types'; | ||
import BaseRestClient from './util/BaseRestClient'; | ||
@@ -59,3 +59,5 @@ /** | ||
/** | ||
* If USDC derivatives account balance is greater than X, you can open PORTFOLIO_MARGIN, and if it is less than Y, it will automatically close PORTFOLIO_MARGIN and change back to REGULAR_MARGIN. X and Y will be adjusted according to operational requirements. | ||
* If USDC derivatives account balance is greater than X, you can open PORTFOLIO_MARGIN, | ||
* and if it is less than Y, it will automatically close PORTFOLIO_MARGIN and change back to REGULAR_MARGIN. | ||
* X and Y will be adjusted according to operational requirements. | ||
* Rest API returns the result of checking prerequisites. You could get the real status of margin mode change by subscribing margin mode. | ||
@@ -62,0 +64,0 @@ */ |
@@ -127,3 +127,5 @@ "use strict"; | ||
/** | ||
* If USDC derivatives account balance is greater than X, you can open PORTFOLIO_MARGIN, and if it is less than Y, it will automatically close PORTFOLIO_MARGIN and change back to REGULAR_MARGIN. X and Y will be adjusted according to operational requirements. | ||
* If USDC derivatives account balance is greater than X, you can open PORTFOLIO_MARGIN, | ||
* and if it is less than Y, it will automatically close PORTFOLIO_MARGIN and change back to REGULAR_MARGIN. | ||
* X and Y will be adjusted according to operational requirements. | ||
* Rest API returns the result of checking prerequisites. You could get the real status of margin mode change by subscribing margin mode. | ||
@@ -130,0 +132,0 @@ */ |
@@ -15,5 +15,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const axios_1 = __importDefault(require("axios")); | ||
const requestUtils_1 = require("./requestUtils"); | ||
const node_support_1 = require("./node-support"); | ||
const requestUtils_1 = require("./requestUtils"); | ||
// axios.interceptors.request.use((request) => { | ||
@@ -111,3 +112,3 @@ // console.log(new Date(), 'Starting Request', JSON.stringify(request, null, 2)); | ||
} | ||
return this.signRequest(params, method, signMethod); | ||
return this.signRequest(params || {}, method, signMethod); | ||
}); | ||
@@ -132,3 +133,3 @@ } | ||
} | ||
const signResult = yield this.prepareSignParams(method, 'usdc', params, isPublicApi); | ||
const signResult = yield this.prepareSignParams(method, 'v5auth', params, isPublicApi); | ||
options.headers['X-BAPI-SIGN-TYPE'] = 2; | ||
@@ -140,3 +141,2 @@ options.headers['X-BAPI-API-KEY'] = this.key; | ||
if (method === 'GET') { | ||
// const serialisedParams = signResult.serializedParams; | ||
return Object.assign(Object.assign({}, options), { params: signResult.originalParams }); | ||
@@ -146,3 +146,3 @@ } | ||
} | ||
const signResult = yield this.prepareSignParams(method, 'keyInBody', params, isPublicApi); | ||
const signResult = yield this.prepareSignParams(method, 'v2auth', params, isPublicApi); | ||
if (method === 'GET' || this.isSpotV1Client()) { | ||
@@ -223,3 +223,3 @@ return Object.assign(Object.assign({}, options), { params: signResult.paramsWithSign }); | ||
// usdc is different for some reason | ||
if (signMethod === 'usdc') { | ||
if (signMethod === 'v5auth') { | ||
const sortProperties = false; | ||
@@ -236,3 +236,3 @@ const signRequestParams = method === 'GET' | ||
// spot/v2 derivatives | ||
if (signMethod === 'keyInBody') { | ||
if (signMethod === 'v2auth') { | ||
res.originalParams.api_key = key; | ||
@@ -253,2 +253,3 @@ res.originalParams.timestamp = timestamp; | ||
res.sign = yield node_support_1.signMessage(res.serializedParams, this.secret); | ||
// @ts-ignore | ||
res.paramsWithSign = Object.assign(Object.assign({}, res.originalParams), { sign: res.sign }); | ||
@@ -255,0 +256,0 @@ return res; |
@@ -16,3 +16,5 @@ "use strict"; | ||
const encoder = new TextEncoder(); | ||
// eslint-disable-next-line no-undef | ||
const key = yield window.crypto.subtle.importKey('raw', encoder.encode(secret), { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign']); | ||
// eslint-disable-next-line no-undef | ||
const signature = yield window.crypto.subtle.sign('HMAC', key, encoder.encode(message)); | ||
@@ -19,0 +21,0 @@ return Array.prototype.map |
@@ -41,3 +41,3 @@ export interface RestClientOptions { | ||
export declare function isWsPong(msg: any): boolean; | ||
export declare const APIID = "trademania"; | ||
export declare const APIID = "bybitapinode"; | ||
/** | ||
@@ -44,0 +44,0 @@ * Used to switch how authentication/requests work under the hood (primarily for SPOT since it's different there) |
@@ -43,2 +43,3 @@ "use strict"; | ||
exports.getRestBaseUrl = getRestBaseUrl; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function isWsPong(msg) { | ||
@@ -45,0 +46,0 @@ if (!msg) { |
@@ -274,3 +274,3 @@ "use strict"; | ||
default: { | ||
throw neverGuard(market, `getWsKeyForTopic(): Unhandled market`); | ||
throw neverGuard(market, 'getWsKeyForTopic(): Unhandled market'); | ||
} | ||
@@ -297,3 +297,3 @@ } | ||
default: { | ||
throw neverGuard(market, `getWsKeyForTopic(): Unhandled market`); | ||
throw neverGuard(market, 'getWsKeyForTopic(): Unhandled market'); | ||
} | ||
@@ -300,0 +300,0 @@ } |
@@ -15,3 +15,4 @@ import WebSocket from 'isomorphic-ws'; | ||
* A "Set" is used to ensure we only subscribe to a topic once (tracking a list of unique topics we're expected to be connected to) | ||
* Note: Accurate duplicate tracking only works for plaintext topics. E.g. JSON objects may not be seen as duplicates if keys are in different orders. If that's needed, check the FTX implementation. | ||
* Note: Accurate duplicate tracking only works for plaintext topics. | ||
* E.g. JSON objects may not be seen as duplicates if keys are in different orders. If that's needed, check the FTX implementation. | ||
*/ | ||
@@ -18,0 +19,0 @@ declare type WsTopicList = Set<WsTopic>; |
@@ -16,2 +16,4 @@ "use strict"; | ||
exports.WebsocketClient = void 0; | ||
/* eslint-disable max-len */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const events_1 = require("events"); | ||
@@ -31,2 +33,3 @@ const isomorphic_ws_1 = __importDefault(require("isomorphic-ws")); | ||
const loggerCategory = { category: 'bybit-ws' }; | ||
// eslint-disable-next-line no-redeclare | ||
class WebsocketClient extends events_1.EventEmitter { | ||
@@ -41,2 +44,3 @@ constructor(options, logger) { | ||
// add default error handling so this doesn't crash node (if the user didn't set a handler) | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
this.on('error', () => { }); | ||
@@ -125,3 +129,3 @@ } | ||
default: { | ||
throw util_1.neverGuard(this.options.market, `prepareRESTClient(): Unhandled market`); | ||
throw util_1.neverGuard(this.options.market, 'prepareRESTClient(): Unhandled market'); | ||
} | ||
@@ -176,3 +180,3 @@ } | ||
default: { | ||
throw util_1.neverGuard(this.options.market, `connectAll(): Unhandled market`); | ||
throw util_1.neverGuard(this.options.market, 'connectAll(): Unhandled market'); | ||
} | ||
@@ -215,3 +219,3 @@ } | ||
default: { | ||
throw util_1.neverGuard(this.options.market, `connectPublic(): Unhandled market`); | ||
throw util_1.neverGuard(this.options.market, 'connectPublic(): Unhandled market'); | ||
} | ||
@@ -249,3 +253,3 @@ } | ||
default: { | ||
throw util_1.neverGuard(this.options.market, `connectPrivate(): Unhandled market`); | ||
throw util_1.neverGuard(this.options.market, 'connectPrivate(): Unhandled market'); | ||
} | ||
@@ -349,3 +353,3 @@ } | ||
this.logger.warning('Cannot authenticate websocket, either api or private keys missing.', Object.assign(Object.assign({}, loggerCategory), { wsKey })); | ||
throw new Error(`Cannot auth - missing api or secret in config`); | ||
throw new Error('Cannot auth - missing api or secret in config'); | ||
} | ||
@@ -446,3 +450,3 @@ this.logger.debug("Getting auth'd request params", Object.assign(Object.assign({}, loggerCategory), { wsKey })); | ||
this.logger.silly(`Subscribing to topics in batches of ${maxTopicsPerEvent}`); | ||
for (var i = 0; i < topics.length; i += maxTopicsPerEvent) { | ||
for (let i = 0; i < topics.length; i += maxTopicsPerEvent) { | ||
const batch = topics.slice(i, i + maxTopicsPerEvent); | ||
@@ -472,3 +476,3 @@ this.logger.silly(`Subscribing to batch of ${batch.length}`); | ||
this.logger.silly(`Unsubscribing to topics in batches of ${maxTopicsPerEvent}`); | ||
for (var i = 0; i < topics.length; i += maxTopicsPerEvent) { | ||
for (let i = 0; i < topics.length; i += maxTopicsPerEvent) { | ||
const batch = topics.slice(i, i + maxTopicsPerEvent); | ||
@@ -489,3 +493,3 @@ this.logger.silly(`Unsubscribing to batch of ${batch.length}`); | ||
try { | ||
this.logger.silly(`Sending upstream ws message: `, Object.assign(Object.assign({}, loggerCategory), { wsMessage, | ||
this.logger.silly('Sending upstream ws message: ', Object.assign(Object.assign({}, loggerCategory), { wsMessage, | ||
wsKey })); | ||
@@ -502,3 +506,3 @@ if (!wsKey) { | ||
catch (e) { | ||
this.logger.error(`Failed to send WS message`, Object.assign(Object.assign({}, loggerCategory), { wsMessage, | ||
this.logger.error('Failed to send WS message', Object.assign(Object.assign({}, loggerCategory), { wsMessage, | ||
wsKey, exception: e })); | ||
@@ -531,3 +535,3 @@ } | ||
if (util_1.WS_AUTH_ON_CONNECT_KEYS.includes(wsKey)) { | ||
this.logger.info(`Sending auth request...`); | ||
this.logger.info('Sending auth request...'); | ||
yield this.sendAuthRequest(wsKey); | ||
@@ -671,3 +675,3 @@ } | ||
this.logger.error('getWsUrl(): Unhandled wsKey: ', Object.assign(Object.assign({}, loggerCategory), { wsKey })); | ||
throw util_1.neverGuard(wsKey, `getWsUrl(): Unhandled wsKey`); | ||
throw util_1.neverGuard(wsKey, 'getWsUrl(): Unhandled wsKey'); | ||
} | ||
@@ -738,3 +742,3 @@ } | ||
if (!dumpScale) { | ||
throw new Error(`Dumpscale must be provided for merged orderbooks`); | ||
throw new Error('Dumpscale must be provided for merged orderbooks'); | ||
} | ||
@@ -741,0 +745,0 @@ break; |
{ | ||
"name": "bybit-api-node", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Complete & robust node.js client 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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
512767
189
10360