@nemesis-oss/binance-sdk 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -8
- package/dist/index-BO27qOb5.d.cts +3887 -0
- package/dist/index-BO27qOb5.d.ts +3887 -0
- package/dist/index.cjs +2640 -629
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -8
- package/dist/index.d.ts +62 -8
- package/dist/index.js +2536 -632
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.cjs +2429 -632
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.js +2430 -633
- package/dist/mcp/index.js.map +1 -1
- package/dist/tools/index.d.cts +2 -1
- package/dist/tools/index.d.ts +2 -1
- package/package.json +8 -3
- package/dist/index-D2T_Rhwj.d.cts +0 -2055
- package/dist/index-D2T_Rhwj.d.ts +0 -2055
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { F as FuturesMarket, B as BinanceClient } from './index-
|
|
2
|
-
export { A as Account, a as AccountAsset, b as AccountAssetSchema, c as AccountPosition, d as AccountPositionSchema, e as AccountSchema, f as AggTrade, g as AggTradeSchema, h as AggTradesResponseSchema, i as AlgoOrder, j as AlgoOrderResponseSchema, k as AlgoOrderSchema, l as AlgoOrdersResponseSchema, m as ApiTradingStatus, n as ApiTradingStatusSchema, o as AuthMode, p as AvgPrice, q as AvgPriceSchema, r as Balance, s as BalanceSchema, t as BalancesResponseSchema, u as BaseWS, v as BaseWSOptions, w as BatchOrdersItem, x as BatchOrdersItemSchema, y as BatchOrdersResponseSchema, z as BinanceClientOptions, C as BookTicker, D as BookTickerSchema, E as BracketOrderParams, G as ClosePositionParams, H as CommissionRate, I as CommissionRateSchema, J as ContractType, K as CountdownCancelAll, L as CountdownCancelAllSchema, M as CreateOrderParams, N as CreateOrderParamsSchema, O as DepthSnapshot, P as DepthSnapshotSchema, Q as ExchangeInfo, R as ExchangeInfoSchema, S as ExchangeSymbol, T as ExchangeSymbolSchema, U as FeeBurnStatus, V as FeeBurnStatusSchema, W as FundingRate, X as FundingRateHistorySchema, Y as FundingRateSchema, Z as FuturesAccount, _ as FuturesData, $ as FuturesDataEndpoints, a0 as FuturesMarketWS, a1 as FuturesOps, a2 as FuturesToolkit, a3 as FuturesTrading, a4 as FuturesUserWS, a5 as FuturesUserWSOptions, a6 as HttpClient, a7 as HttpClientOptions, a8 as HttpMethod, a9 as Income, aa as IncomeHistoryResponseSchema, ab as IncomeSchema, ac as Kline, ad as KlineInterval, ae as KlineIntervalSchema, af as KlineSchema, ag as KlinesResponseSchema, ah as LeverageBracket, ai as LeverageBracketResponseSchema, aj as LeverageBracketSchema, ak as LeverageChange, al as LeverageChangeSchema, am as ListenKey, an as ListenKeySchema, ao as LongShortRatioEntry, ap as LongShortRatioEntrySchema, aq as LongShortRatioSchema, ar as MarginTypeChange, as as MarginTypeChangeSchema, at as MarkPriceSpeed, au as MarketDataBase, av as ModifyOrderParams, aw as ModifyOrderParamsSchema, ax as MultiAssetsMargin, ay as MultiAssetsMarginSchema, az as NewOrderAck, aA as NewOrderAckSchema, aB as OpenInterest, aC as OpenInterestHistEntry, aD as OpenInterestHistEntrySchema, aE as OpenInterestHistSchema, aF as OpenInterestSchema, aG as Order, aH as OrderModifyHistoryEntry, aI as OrderModifyHistoryEntrySchema, aJ as OrderModifyHistorySchema, aK as OrderResponseSchema, aL as OrderSchema, aM as OrdersResponseSchema, aN as PositionMarginChange, aO as PositionMarginChangeSchema, aP as PositionMarginHistoryEntry, aQ as PositionMarginHistoryEntrySchema, aR as PositionMarginHistorySchema, aS as PositionMode, aT as PositionModeSchema, aU as PositionRisk, aV as PositionRiskResponseSchema, aW as PositionRiskSchema, aX as PositionSizing, aY as PremiumIndex, aZ as PremiumIndexSchema, a_ as RateLimitOrder, a$ as RateLimitOrderResponseSchema, b0 as RateLimitOrderSchema, b1 as SizePositionParams, b2 as SpotAccount, b3 as SpotAccountInfo, b4 as SpotAccountSchema, b5 as SpotBalance, b6 as SpotBalanceSchema, b7 as SpotBalanceUpdate, b8 as SpotBalanceUpdateSchema, b9 as SpotExecutionReport, ba as SpotExecutionReportSchema, bb as SpotListStatus, bc as SpotListStatusSchema, bd as SpotMarket, be as SpotMarketWS, bf as SpotOCOOrderAck, bg as SpotOCOOrderAckResponseSchema, bh as SpotOCOOrderAckSchema, bi as SpotOCOOrdersResponseSchema, bj as SpotOrder, bk as SpotOrderResponseSchema, bl as SpotOrderSchema, bm as SpotOrdersResponseSchema, bn as SpotOutboundAccountPosition, bo as SpotOutboundAccountPositionSchema, bp as SpotTrade, bq as SpotTradeSchema, br as SpotTradesResponseSchema, bs as SpotTrading, bt as SpotUserDataEvent, bu as SpotUserDataStream, bv as SpotUserWS, bw as SpotUserWSOptions, bx as SymbolRules, by as TakerLongShortRatioEntry, bz as TakerLongShortRatioEntrySchema, bA as TakerLongShortRatioSchema, bB as Ticker24hr, bC as Ticker24hrSchema, bD as TickerPrice, bE as TickerPriceSchema, bF as ToolContext, bG as ToolDefinition, bH as Trade, bI as TradeSchema, bJ as TradesResponseSchema, bK as UserDataAccountUpdate, bL as UserDataAccountUpdateSchema, bM as UserDataEvent, bN as UserDataMarginCall, bO as UserDataMarginCallSchema, bP as UserDataOrderTradeUpdate, bQ as UserDataOrderTradeUpdateSchema, bR as UserDataStream, bS as UserTrade, bT as UserTradeSchema, bU as UserTradesResponseSchema, bV as WsApi, bW as WsApiOptions, bX as WsApiResponse, bY as WsApiResponseSchema, bZ as accountTools, b_ as createFuturesToolkit, b$ as createPaperContext, c0 as derivedTools, c1 as floorToStep, c2 as formatToDecimals, c3 as getBufferedWsEvents, c4 as marketDataTools, c5 as paperTools, c6 as parseSpotUserDataEvent, c7 as parseUserDataEvent, c8 as roundToStep, c9 as spotTools, ca as stepDecimals, cb as symbolRulesFrom, cc as textResult, cd as toAnthropicTool, ce as toJsonSchema, cf as toMCPTool, cg as toOpenAITool, ch as toToolList, ci as toolkitToFormats, cj as tradingTools, ck as wsTools } from './index-D2T_Rhwj.cjs';
|
|
1
|
+
import { F as FuturesMarket, B as BinanceClient } from './index-BO27qOb5.cjs';
|
|
2
|
+
export { A as Account, a as AccountAsset, b as AccountAssetSchema, c as AccountPosition, d as AccountPositionSchema, e as AccountSchema, f as AccountSnapshot, g as AccountSnapshotSchema, h as AggTrade, i as AggTradeSchema, j as AggTradesResponseSchema, k as AlgoOrder, l as AlgoOrderResponseSchema, m as AlgoOrderSchema, n as AlgoOrdersResponseSchema, o as ApiKeyPermissions, p as ApiKeyPermissionsSchema, q as ApiTradingStatus, r as ApiTradingStatusSchema, s as AssetDetail, t as AssetDetailSchema, u as AuthMode, v as AvgPrice, w as AvgPriceSchema, x as Balance, y as BalanceSchema, z as BalancesResponseSchema, C as BaseWS, D as BaseWSOptions, E as BatchOrdersItem, G as BatchOrdersItemSchema, H as BatchOrdersResponseSchema, I as BinanceClientOptions, J as BookTicker, K as BookTickerSchema, L as BorrowRepayParams, M as BorrowRepayParamsSchema, N as BorrowRepayRecordEntry, O as BorrowRepayRecordEntrySchema, P as BorrowRepayRecordResponse, Q as BorrowRepayRecordResponseSchema, R as BorrowRepayResult, S as BorrowRepayResultSchema, T as BracketOrderParams, U as ClosePositionParams, V as CoinMAccount, W as CoinMAccountAsset, X as CoinMAccountAssetSchema, Y as CoinMAccountInfo, Z as CoinMAccountPosition, _ as CoinMAccountPositionSchema, $ as CoinMAccountSchema, a0 as CoinMBalance, a1 as CoinMBalanceResponseSchema, a2 as CoinMBalanceSchema, a3 as CoinMCommissionRate, a4 as CoinMCommissionRateSchema, a5 as CoinMContractType, a6 as CoinMCreateOrderParams, a7 as CoinMCreateOrderParamsSchema, a8 as CoinMIncome, a9 as CoinMIncomeHistoryResponseSchema, aa as CoinMIncomeSchema, ab as CoinMLeverageBracket, ac as CoinMLeverageBracketResponseSchema, ad as CoinMLeverageBracketSchema, ae as CoinMLeverageChange, af as CoinMLeverageChangeSchema, ag as CoinMMarginTypeChange, ah as CoinMMarginTypeChangeSchema, ai as CoinMMarkPriceSpeed, aj as CoinMMarket, ak as CoinMMarketWS, al as CoinMOpenInterestHistEntry, am as CoinMOpenInterestHistEntrySchema, an as CoinMOpenInterestHistSchema, ao as CoinMOrder, ap as CoinMOrderResponseSchema, aq as CoinMOrderSchema, ar as CoinMOrdersResponseSchema, as as CoinMPositionMarginChange, at as CoinMPositionMarginChangeSchema, au as CoinMPositionMode, av as CoinMPositionModeSchema, aw as CoinMPositionRisk, ax as CoinMPositionRiskResponseSchema, ay as CoinMPositionRiskSchema, az as CoinMTrading, aA as CoinMUserDataStream, aB as CoinMUserTrade, aC as CoinMUserTradeSchema, aD as CoinMUserTradesResponseSchema, aE as CoinMUserWS, aF as CoinMUserWSOptions, aG as CommissionRate, aH as CommissionRateSchema, aI as ContractType, aJ as CountdownCancelAll, aK as CountdownCancelAllSchema, aL as CreateOrderParams, aM as CreateOrderParamsSchema, aN as CrossMarginAccount, aO as CrossMarginAccountSchema, aP as DepositAddress, aQ as DepositAddressSchema, aR as DepositHistoryEntry, aS as DepositHistoryEntrySchema, aT as DepositHistoryResponseSchema, aU as DepthSnapshot, aV as DepthSnapshotSchema, aW as DustConversionResult, aX as DustConversionResultSchema, aY as DustLogEntry, aZ as DustLogEntrySchema, a_ as DustLogResponse, a$ as DustLogResponseSchema, b0 as ExchangeInfo, b1 as ExchangeInfoSchema, b2 as ExchangeSymbol, b3 as ExchangeSymbolSchema, b4 as FeeBurnStatus, b5 as FeeBurnStatusSchema, b6 as FundingAsset, b7 as FundingAssetSchema, b8 as FundingAssetsResponseSchema, b9 as FundingRate, ba as FundingRateHistorySchema, bb as FundingRateSchema, bc as FuturesAccount, bd as FuturesData, be as FuturesDataEndpoints, bf as FuturesMarketWS, bg as FuturesOps, bh as FuturesToolkit, bi as FuturesTrading, bj as FuturesUserWS, bk as FuturesUserWSOptions, bl as HttpClient, bm as HttpClientOptions, bn as HttpMethod, bo as Income, bp as IncomeHistoryResponseSchema, bq as IncomeSchema, br as IsolatedMarginAccount, bs as IsolatedMarginAccountSchema, bt as IsolatedMarginAsset, bu as IsolatedMarginAssetSchema, bv as IsolatedMarginSymbol, bw as IsolatedMarginSymbolSchema, bx as IsolatedTransferParams, by as IsolatedTransferParamsSchema, bz as Kline, bA as KlineInterval, bB as KlineIntervalSchema, bC as KlineSchema, bD as KlinesResponseSchema, bE as LeverageBracket, bF as LeverageBracketResponseSchema, bG as LeverageBracketSchema, bH as LeverageChange, bI as LeverageChangeSchema, bJ as ListenKey, bK as ListenKeySchema, bL as LongShortRatioEntry, bM as LongShortRatioEntrySchema, bN as LongShortRatioSchema, bO as MarginAccount, bP as MarginAssetBalance, bQ as MarginAssetBalanceSchema, bR as MarginCreateOrderParams, bS as MarginCreateOrderParamsSchema, bT as MarginForceLiquidationEntry, bU as MarginForceLiquidationEntrySchema, bV as MarginForceLiquidationResponse, bW as MarginForceLiquidationResponseSchema, bX as MarginInterestHistoryEntry, bY as MarginInterestHistoryEntrySchema, bZ as MarginInterestHistoryResponse, b_ as MarginInterestHistoryResponseSchema, b$ as MarginOrder, c0 as MarginOrderResponseSchema, c1 as MarginOrderSchema, c2 as MarginOrdersResponseSchema, c3 as MarginPriceIndex, c4 as MarginPriceIndexSchema, c5 as MarginTrade, c6 as MarginTradeSchema, c7 as MarginTradesResponseSchema, c8 as MarginTrading, c9 as MarginTransferResult, ca as MarginTransferResultSchema, cb as MarginTypeChange, cc as MarginTypeChangeSchema, cd as MarkPriceSpeed, ce as MarketDataBase, cf as MaxBorrowable, cg as MaxBorrowableSchema, ch as MaxTransferable, ci as MaxTransferableSchema, cj as ModifyOrderParams, ck as ModifyOrderParamsSchema, cl as MultiAssetsMargin, cm as MultiAssetsMarginSchema, cn as NewOrderAck, co as NewOrderAckSchema, cp as OpenInterest, cq as OpenInterestHistEntry, cr as OpenInterestHistEntrySchema, cs as OpenInterestHistSchema, ct as OpenInterestSchema, cu as Order, cv as OrderModifyHistoryEntry, cw as OrderModifyHistoryEntrySchema, cx as OrderModifyHistorySchema, cy as OrderResponseSchema, cz as OrderSchema, cA as OrdersResponseSchema, cB as PositionMarginChange, cC as PositionMarginChangeSchema, cD as PositionMarginHistoryEntry, cE as PositionMarginHistoryEntrySchema, cF as PositionMarginHistorySchema, cG as PositionMode, cH as PositionModeSchema, cI as PositionRisk, cJ as PositionRiskResponseSchema, cK as PositionRiskSchema, cL as PositionSizing, cM as PremiumIndex, cN as PremiumIndexSchema, cO as RateLimitOrder, cP as RateLimitOrderResponseSchema, cQ as RateLimitOrderSchema, cR as RateLimitTracker, cS as RateLimitTrackerOptions, cT as RateLimitUsage, cU as SignatureAlgorithm, cV as Signer, cW as SignerOptions, cX as SizePositionParams, cY as SpotAccount, cZ as SpotAccountInfo, c_ as SpotAccountSchema, c$ as SpotBalance, d0 as SpotBalanceSchema, d1 as SpotBalanceUpdate, d2 as SpotBalanceUpdateSchema, d3 as SpotExecutionReport, d4 as SpotExecutionReportSchema, d5 as SpotListStatus, d6 as SpotListStatusSchema, d7 as SpotMarket, d8 as SpotMarketWS, d9 as SpotOCOOrderAck, da as SpotOCOOrderAckResponseSchema, db as SpotOCOOrderAckSchema, dc as SpotOCOOrdersResponseSchema, dd as SpotOrder, de as SpotOrderResponseSchema, df as SpotOrderSchema, dg as SpotOrdersResponseSchema, dh as SpotOutboundAccountPosition, di as SpotOutboundAccountPositionSchema, dj as SpotTrade, dk as SpotTradeSchema, dl as SpotTradesResponseSchema, dm as SpotTrading, dn as SpotUserDataEvent, dp as SpotUserDataStream, dq as SpotUserWS, dr as SpotUserWSOptions, ds as SpotWsApi, dt as SpotWsApiOptions, du as SubAccount, dv as SubAccountDepositAddress, dw as SubAccountDepositAddressSchema, dx as SubAccountDepositHistoryEntry, dy as SubAccountDepositHistoryEntrySchema, dz as SubAccountDepositHistoryResponseSchema, dA as SubAccountEnableResult, dB as SubAccountEnableResultSchema, dC as SubAccountEntry, dD as SubAccountEntrySchema, dE as SubAccountFuturesSummary, dF as SubAccountFuturesSummarySchema, dG as SubAccountListResponse, dH as SubAccountListResponseSchema, dI as SubAccountMarginAccount, dJ as SubAccountMarginAccountSchema, dK as SubAccountSpotAsset, dL as SubAccountSpotAssetSchema, dM as SubAccountSpotAssetsResponse, dN as SubAccountSpotAssetsResponseSchema, dO as SubAccountSpotSummary, dP as SubAccountSpotSummaryEntry, dQ as SubAccountSpotSummaryEntrySchema, dR as SubAccountSpotSummarySchema, dS as SubAccountStatus, dT as SubAccountStatusResponseSchema, dU as SubAccountStatusSchema, dV as SubAccountUniversalTransferEntry, dW as SubAccountUniversalTransferEntrySchema, dX as SubAccountUniversalTransferHistoryResponse, dY as SubAccountUniversalTransferHistoryResponseSchema, dZ as SubAccountUniversalTransferParams, d_ as SubAccountUniversalTransferParamsSchema, d$ as SubAccountUniversalTransferResult, e0 as SubAccountUniversalTransferResultSchema, e1 as SymbolRules, e2 as TakerLongShortRatioEntry, e3 as TakerLongShortRatioEntrySchema, e4 as TakerLongShortRatioSchema, e5 as Ticker24hr, e6 as Ticker24hrSchema, e7 as TickerPrice, e8 as TickerPriceSchema, e9 as ToolContext, ea as ToolDefinition, eb as Trade, ec as TradeFeeEntry, ed as TradeFeeEntrySchema, ee as TradeFeeResponseSchema, ef as TradeSchema, eg as TradesResponseSchema, eh as TradingPolicy, ei as TradingPolicyOptions, ej as TransferType, ek as TransferTypeSchema, el as UniversalTransferHistoryEntry, em as UniversalTransferHistoryEntrySchema, en as UniversalTransferHistoryResponse, eo as UniversalTransferHistoryResponseSchema, ep as UniversalTransferParams, eq as UniversalTransferParamsSchema, er as UniversalTransferResult, es as UniversalTransferResultSchema, et as UserAsset, eu as UserAssetSchema, ev as UserAssetsResponseSchema, ew as UserDataAccountUpdate, ex as UserDataAccountUpdateSchema, ey as UserDataEvent, ez as UserDataMarginCall, eA as UserDataMarginCallSchema, eB as UserDataOrderTradeUpdate, eC as UserDataOrderTradeUpdateSchema, eD as UserDataStream, eE as UserTrade, eF as UserTradeSchema, eG as UserTradesResponseSchema, eH as VirtualSubAccountResult, eI as VirtualSubAccountResultSchema, eJ as Wallet, eK as WithdrawHistoryEntry, eL as WithdrawHistoryEntrySchema, eM as WithdrawHistoryResponseSchema, eN as WithdrawParams, eO as WithdrawParamsSchema, eP as WithdrawResult, eQ as WithdrawResultSchema, eR as WsApi, eS as WsApiOptions, eT as WsApiResponse, eU as WsApiResponseSchema, eV as accountTools, eW as createFuturesToolkit, eX as createPaperContext, eY as derivedTools, eZ as floorToStep, e_ as formatToDecimals, e$ as getBufferedWsEvents, f0 as marketDataTools, f1 as paperTools, f2 as parseSpotUserDataEvent, f3 as parseUserDataEvent, f4 as roundToStep, f5 as spotTools, f6 as stepDecimals, f7 as symbolRulesFrom, f8 as textResult, f9 as toAnthropicTool, fa as toJsonSchema, fb as toMCPTool, fc as toOpenAITool, fd as toToolList, fe as toolkitToFormats, ff as tradingTools, fg as wsTools } from './index-BO27qOb5.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import 'axios';
|
|
5
6
|
import 'node:events';
|
|
6
7
|
|
|
7
8
|
type Environment = 'live' | 'testnet' | 'demo';
|
|
@@ -10,11 +11,17 @@ interface Endpoints {
|
|
|
10
11
|
restFapi: string;
|
|
11
12
|
restFuturesData: string;
|
|
12
13
|
restSpot: string;
|
|
14
|
+
restApiRoot: string;
|
|
15
|
+
restDapiRoot: string;
|
|
16
|
+
restDapi: string;
|
|
13
17
|
wsMarket: string;
|
|
14
18
|
wsUser: string;
|
|
15
19
|
wsApi: string;
|
|
16
20
|
wsSpotMarket: string;
|
|
17
21
|
wsSpotUser: string;
|
|
22
|
+
wsSpotApi: string;
|
|
23
|
+
wsDapiMarket: string;
|
|
24
|
+
wsDapiUser: string;
|
|
18
25
|
}
|
|
19
26
|
declare function resolveEnvironment(options?: {
|
|
20
27
|
testnet?: boolean;
|
|
@@ -23,6 +30,9 @@ declare function resolveEnvironment(options?: {
|
|
|
23
30
|
wsBase?: string;
|
|
24
31
|
wsUserBase?: string;
|
|
25
32
|
wsApiBase?: string;
|
|
33
|
+
dapiBase?: string;
|
|
34
|
+
wsSpotApiBase?: string;
|
|
35
|
+
wsDapiBase?: string;
|
|
26
36
|
}): {
|
|
27
37
|
env: Environment;
|
|
28
38
|
endpoints: Endpoints;
|
|
@@ -300,19 +310,33 @@ declare class BinanceError extends Error {
|
|
|
300
310
|
}
|
|
301
311
|
|
|
302
312
|
declare class BinanceAuthError extends BinanceError {
|
|
303
|
-
readonly missing: 'apiKey' | 'apiSecret';
|
|
304
|
-
constructor(missing: 'apiKey' | 'apiSecret');
|
|
313
|
+
readonly missing: 'apiKey' | 'apiSecret' | 'privateKey';
|
|
314
|
+
constructor(missing: 'apiKey' | 'apiSecret' | 'privateKey');
|
|
305
315
|
}
|
|
306
316
|
|
|
317
|
+
interface BinanceApiErrorContext {
|
|
318
|
+
endpoint?: string;
|
|
319
|
+
method?: string;
|
|
320
|
+
headers?: Record<string, string>;
|
|
321
|
+
}
|
|
307
322
|
declare class BinanceApiError extends BinanceError {
|
|
308
323
|
readonly code: number;
|
|
309
324
|
readonly status: number;
|
|
310
|
-
|
|
325
|
+
readonly endpoint?: string;
|
|
326
|
+
readonly method?: string;
|
|
327
|
+
readonly headers?: Record<string, string>;
|
|
328
|
+
constructor(message: string, code: number, status: number, context?: BinanceApiErrorContext);
|
|
329
|
+
/** -1003 (way too many requests) or HTTP 429/418. */
|
|
330
|
+
isRateLimitError(): boolean;
|
|
331
|
+
/** -1021: request timestamp outside recvWindow, usually caused by local clock drift. */
|
|
332
|
+
isTimestampError(): boolean;
|
|
333
|
+
/** -2010: account has insufficient balance for the requested action. */
|
|
334
|
+
isInsufficientBalance(): boolean;
|
|
311
335
|
}
|
|
312
336
|
|
|
313
337
|
declare class RateLimitError extends BinanceApiError {
|
|
314
338
|
readonly retryAfterMs?: number;
|
|
315
|
-
constructor(message: string, code: number, status: number, retryAfterMs?: number);
|
|
339
|
+
constructor(message: string, code: number, status: number, retryAfterMs?: number, context?: BinanceApiErrorContext);
|
|
316
340
|
}
|
|
317
341
|
|
|
318
342
|
declare class NetworkError extends BinanceError {
|
|
@@ -320,8 +344,38 @@ declare class NetworkError extends BinanceError {
|
|
|
320
344
|
constructor(message: string, cause?: unknown);
|
|
321
345
|
}
|
|
322
346
|
|
|
347
|
+
type PolicyRule = 'readOnly' | 'symbolNotAllowed' | 'maxNotionalPerOrder' | 'notionalUndeterminable' | 'withdrawalsBlocked' | 'transfersBlocked' | 'blockedPath';
|
|
348
|
+
/**
|
|
349
|
+
* Thrown when a request is refused by the client's own {@link TradingPolicy} — before it
|
|
350
|
+
* ever reaches Binance. Distinct from BinanceApiError, which reports an exchange rejection.
|
|
351
|
+
*/
|
|
352
|
+
declare class PolicyViolationError extends BinanceError {
|
|
353
|
+
readonly rule: PolicyRule;
|
|
354
|
+
readonly method: string;
|
|
355
|
+
readonly endpoint: string;
|
|
356
|
+
readonly details?: Record<string, unknown>;
|
|
357
|
+
constructor(rule: PolicyRule, message: string, method: string, endpoint: string, details?: Record<string, unknown>);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Thrown instead of sending a mutating request when the client is in dry-run mode.
|
|
362
|
+
*
|
|
363
|
+
* Dry run deliberately throws rather than returning a synthetic success payload: a fabricated
|
|
364
|
+
* orderId would lead an agent to believe an order exists and then try to manage or cancel it.
|
|
365
|
+
* Failing loudly — while carrying the exact request that *would* have been sent — is the only
|
|
366
|
+
* safe signal. Tool layers should catch this and surface `describe()` back to the model.
|
|
367
|
+
*/
|
|
368
|
+
declare class DryRunError extends BinanceError {
|
|
369
|
+
readonly method: string;
|
|
370
|
+
readonly endpoint: string;
|
|
371
|
+
readonly params: Record<string, unknown>;
|
|
372
|
+
constructor(method: string, endpoint: string, params?: Record<string, unknown>);
|
|
373
|
+
/** Human/LLM-readable description of the suppressed request. */
|
|
374
|
+
describe(): string;
|
|
375
|
+
}
|
|
376
|
+
|
|
323
377
|
declare function createBinanceMcpServer(client: BinanceClient): McpServer;
|
|
324
378
|
|
|
325
|
-
declare const VERSION = "2.
|
|
379
|
+
declare const VERSION = "2.0.0";
|
|
326
380
|
|
|
327
|
-
export { BinanceApiError, BinanceAuthError, BinanceClient, BinanceError, type Endpoints, type Environment, FuturesMarket, NetworkError, type PaperAccount, type PaperOrder, type PaperPosition, type PaperPositionSide, PaperTradingEngine, type PaperTradingOptions, RateLimitError, VERSION, type WsAggTradePayload, WsAggTradePayloadSchema, type WsAssetIndexPayload, WsAssetIndexPayloadSchema, type WsBookTickerPayload, WsBookTickerPayloadSchema, type WsCompositeIndexPayload, WsCompositeIndexPayloadSchema, type WsDepthUpdatePayload, WsDepthUpdatePayloadSchema, type WsForceOrderPayload, WsForceOrderPayloadSchema, type WsKlinePayload, WsKlinePayloadSchema, type WsMarkPricePayload, WsMarkPricePayloadSchema, type WsMiniTickerPayload, WsMiniTickerPayloadSchema, type WsRollingWindowTickerPayload, WsRollingWindowTickerPayloadSchema, type WsSpotAvgPricePayload, WsSpotAvgPricePayloadSchema, type WsStreamPayload, type WsTicker24hrPayload, WsTicker24hrPayloadSchema, type WsTradePayload, WsTradePayloadSchema, createBinanceMcpServer, parseWsPayload, resolveEnvironment };
|
|
381
|
+
export { BinanceApiError, type BinanceApiErrorContext, BinanceAuthError, BinanceClient, BinanceError, DryRunError, type Endpoints, type Environment, FuturesMarket, NetworkError, type PaperAccount, type PaperOrder, type PaperPosition, type PaperPositionSide, PaperTradingEngine, type PaperTradingOptions, type PolicyRule, PolicyViolationError, RateLimitError, VERSION, type WsAggTradePayload, WsAggTradePayloadSchema, type WsAssetIndexPayload, WsAssetIndexPayloadSchema, type WsBookTickerPayload, WsBookTickerPayloadSchema, type WsCompositeIndexPayload, WsCompositeIndexPayloadSchema, type WsDepthUpdatePayload, WsDepthUpdatePayloadSchema, type WsForceOrderPayload, WsForceOrderPayloadSchema, type WsKlinePayload, WsKlinePayloadSchema, type WsMarkPricePayload, WsMarkPricePayloadSchema, type WsMiniTickerPayload, WsMiniTickerPayloadSchema, type WsRollingWindowTickerPayload, WsRollingWindowTickerPayloadSchema, type WsSpotAvgPricePayload, WsSpotAvgPricePayloadSchema, type WsStreamPayload, type WsTicker24hrPayload, WsTicker24hrPayloadSchema, type WsTradePayload, WsTradePayloadSchema, createBinanceMcpServer, parseWsPayload, resolveEnvironment };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { F as FuturesMarket, B as BinanceClient } from './index-
|
|
2
|
-
export { A as Account, a as AccountAsset, b as AccountAssetSchema, c as AccountPosition, d as AccountPositionSchema, e as AccountSchema, f as AggTrade, g as AggTradeSchema, h as AggTradesResponseSchema, i as AlgoOrder, j as AlgoOrderResponseSchema, k as AlgoOrderSchema, l as AlgoOrdersResponseSchema, m as ApiTradingStatus, n as ApiTradingStatusSchema, o as AuthMode, p as AvgPrice, q as AvgPriceSchema, r as Balance, s as BalanceSchema, t as BalancesResponseSchema, u as BaseWS, v as BaseWSOptions, w as BatchOrdersItem, x as BatchOrdersItemSchema, y as BatchOrdersResponseSchema, z as BinanceClientOptions, C as BookTicker, D as BookTickerSchema, E as BracketOrderParams, G as ClosePositionParams, H as CommissionRate, I as CommissionRateSchema, J as ContractType, K as CountdownCancelAll, L as CountdownCancelAllSchema, M as CreateOrderParams, N as CreateOrderParamsSchema, O as DepthSnapshot, P as DepthSnapshotSchema, Q as ExchangeInfo, R as ExchangeInfoSchema, S as ExchangeSymbol, T as ExchangeSymbolSchema, U as FeeBurnStatus, V as FeeBurnStatusSchema, W as FundingRate, X as FundingRateHistorySchema, Y as FundingRateSchema, Z as FuturesAccount, _ as FuturesData, $ as FuturesDataEndpoints, a0 as FuturesMarketWS, a1 as FuturesOps, a2 as FuturesToolkit, a3 as FuturesTrading, a4 as FuturesUserWS, a5 as FuturesUserWSOptions, a6 as HttpClient, a7 as HttpClientOptions, a8 as HttpMethod, a9 as Income, aa as IncomeHistoryResponseSchema, ab as IncomeSchema, ac as Kline, ad as KlineInterval, ae as KlineIntervalSchema, af as KlineSchema, ag as KlinesResponseSchema, ah as LeverageBracket, ai as LeverageBracketResponseSchema, aj as LeverageBracketSchema, ak as LeverageChange, al as LeverageChangeSchema, am as ListenKey, an as ListenKeySchema, ao as LongShortRatioEntry, ap as LongShortRatioEntrySchema, aq as LongShortRatioSchema, ar as MarginTypeChange, as as MarginTypeChangeSchema, at as MarkPriceSpeed, au as MarketDataBase, av as ModifyOrderParams, aw as ModifyOrderParamsSchema, ax as MultiAssetsMargin, ay as MultiAssetsMarginSchema, az as NewOrderAck, aA as NewOrderAckSchema, aB as OpenInterest, aC as OpenInterestHistEntry, aD as OpenInterestHistEntrySchema, aE as OpenInterestHistSchema, aF as OpenInterestSchema, aG as Order, aH as OrderModifyHistoryEntry, aI as OrderModifyHistoryEntrySchema, aJ as OrderModifyHistorySchema, aK as OrderResponseSchema, aL as OrderSchema, aM as OrdersResponseSchema, aN as PositionMarginChange, aO as PositionMarginChangeSchema, aP as PositionMarginHistoryEntry, aQ as PositionMarginHistoryEntrySchema, aR as PositionMarginHistorySchema, aS as PositionMode, aT as PositionModeSchema, aU as PositionRisk, aV as PositionRiskResponseSchema, aW as PositionRiskSchema, aX as PositionSizing, aY as PremiumIndex, aZ as PremiumIndexSchema, a_ as RateLimitOrder, a$ as RateLimitOrderResponseSchema, b0 as RateLimitOrderSchema, b1 as SizePositionParams, b2 as SpotAccount, b3 as SpotAccountInfo, b4 as SpotAccountSchema, b5 as SpotBalance, b6 as SpotBalanceSchema, b7 as SpotBalanceUpdate, b8 as SpotBalanceUpdateSchema, b9 as SpotExecutionReport, ba as SpotExecutionReportSchema, bb as SpotListStatus, bc as SpotListStatusSchema, bd as SpotMarket, be as SpotMarketWS, bf as SpotOCOOrderAck, bg as SpotOCOOrderAckResponseSchema, bh as SpotOCOOrderAckSchema, bi as SpotOCOOrdersResponseSchema, bj as SpotOrder, bk as SpotOrderResponseSchema, bl as SpotOrderSchema, bm as SpotOrdersResponseSchema, bn as SpotOutboundAccountPosition, bo as SpotOutboundAccountPositionSchema, bp as SpotTrade, bq as SpotTradeSchema, br as SpotTradesResponseSchema, bs as SpotTrading, bt as SpotUserDataEvent, bu as SpotUserDataStream, bv as SpotUserWS, bw as SpotUserWSOptions, bx as SymbolRules, by as TakerLongShortRatioEntry, bz as TakerLongShortRatioEntrySchema, bA as TakerLongShortRatioSchema, bB as Ticker24hr, bC as Ticker24hrSchema, bD as TickerPrice, bE as TickerPriceSchema, bF as ToolContext, bG as ToolDefinition, bH as Trade, bI as TradeSchema, bJ as TradesResponseSchema, bK as UserDataAccountUpdate, bL as UserDataAccountUpdateSchema, bM as UserDataEvent, bN as UserDataMarginCall, bO as UserDataMarginCallSchema, bP as UserDataOrderTradeUpdate, bQ as UserDataOrderTradeUpdateSchema, bR as UserDataStream, bS as UserTrade, bT as UserTradeSchema, bU as UserTradesResponseSchema, bV as WsApi, bW as WsApiOptions, bX as WsApiResponse, bY as WsApiResponseSchema, bZ as accountTools, b_ as createFuturesToolkit, b$ as createPaperContext, c0 as derivedTools, c1 as floorToStep, c2 as formatToDecimals, c3 as getBufferedWsEvents, c4 as marketDataTools, c5 as paperTools, c6 as parseSpotUserDataEvent, c7 as parseUserDataEvent, c8 as roundToStep, c9 as spotTools, ca as stepDecimals, cb as symbolRulesFrom, cc as textResult, cd as toAnthropicTool, ce as toJsonSchema, cf as toMCPTool, cg as toOpenAITool, ch as toToolList, ci as toolkitToFormats, cj as tradingTools, ck as wsTools } from './index-D2T_Rhwj.js';
|
|
1
|
+
import { F as FuturesMarket, B as BinanceClient } from './index-BO27qOb5.js';
|
|
2
|
+
export { A as Account, a as AccountAsset, b as AccountAssetSchema, c as AccountPosition, d as AccountPositionSchema, e as AccountSchema, f as AccountSnapshot, g as AccountSnapshotSchema, h as AggTrade, i as AggTradeSchema, j as AggTradesResponseSchema, k as AlgoOrder, l as AlgoOrderResponseSchema, m as AlgoOrderSchema, n as AlgoOrdersResponseSchema, o as ApiKeyPermissions, p as ApiKeyPermissionsSchema, q as ApiTradingStatus, r as ApiTradingStatusSchema, s as AssetDetail, t as AssetDetailSchema, u as AuthMode, v as AvgPrice, w as AvgPriceSchema, x as Balance, y as BalanceSchema, z as BalancesResponseSchema, C as BaseWS, D as BaseWSOptions, E as BatchOrdersItem, G as BatchOrdersItemSchema, H as BatchOrdersResponseSchema, I as BinanceClientOptions, J as BookTicker, K as BookTickerSchema, L as BorrowRepayParams, M as BorrowRepayParamsSchema, N as BorrowRepayRecordEntry, O as BorrowRepayRecordEntrySchema, P as BorrowRepayRecordResponse, Q as BorrowRepayRecordResponseSchema, R as BorrowRepayResult, S as BorrowRepayResultSchema, T as BracketOrderParams, U as ClosePositionParams, V as CoinMAccount, W as CoinMAccountAsset, X as CoinMAccountAssetSchema, Y as CoinMAccountInfo, Z as CoinMAccountPosition, _ as CoinMAccountPositionSchema, $ as CoinMAccountSchema, a0 as CoinMBalance, a1 as CoinMBalanceResponseSchema, a2 as CoinMBalanceSchema, a3 as CoinMCommissionRate, a4 as CoinMCommissionRateSchema, a5 as CoinMContractType, a6 as CoinMCreateOrderParams, a7 as CoinMCreateOrderParamsSchema, a8 as CoinMIncome, a9 as CoinMIncomeHistoryResponseSchema, aa as CoinMIncomeSchema, ab as CoinMLeverageBracket, ac as CoinMLeverageBracketResponseSchema, ad as CoinMLeverageBracketSchema, ae as CoinMLeverageChange, af as CoinMLeverageChangeSchema, ag as CoinMMarginTypeChange, ah as CoinMMarginTypeChangeSchema, ai as CoinMMarkPriceSpeed, aj as CoinMMarket, ak as CoinMMarketWS, al as CoinMOpenInterestHistEntry, am as CoinMOpenInterestHistEntrySchema, an as CoinMOpenInterestHistSchema, ao as CoinMOrder, ap as CoinMOrderResponseSchema, aq as CoinMOrderSchema, ar as CoinMOrdersResponseSchema, as as CoinMPositionMarginChange, at as CoinMPositionMarginChangeSchema, au as CoinMPositionMode, av as CoinMPositionModeSchema, aw as CoinMPositionRisk, ax as CoinMPositionRiskResponseSchema, ay as CoinMPositionRiskSchema, az as CoinMTrading, aA as CoinMUserDataStream, aB as CoinMUserTrade, aC as CoinMUserTradeSchema, aD as CoinMUserTradesResponseSchema, aE as CoinMUserWS, aF as CoinMUserWSOptions, aG as CommissionRate, aH as CommissionRateSchema, aI as ContractType, aJ as CountdownCancelAll, aK as CountdownCancelAllSchema, aL as CreateOrderParams, aM as CreateOrderParamsSchema, aN as CrossMarginAccount, aO as CrossMarginAccountSchema, aP as DepositAddress, aQ as DepositAddressSchema, aR as DepositHistoryEntry, aS as DepositHistoryEntrySchema, aT as DepositHistoryResponseSchema, aU as DepthSnapshot, aV as DepthSnapshotSchema, aW as DustConversionResult, aX as DustConversionResultSchema, aY as DustLogEntry, aZ as DustLogEntrySchema, a_ as DustLogResponse, a$ as DustLogResponseSchema, b0 as ExchangeInfo, b1 as ExchangeInfoSchema, b2 as ExchangeSymbol, b3 as ExchangeSymbolSchema, b4 as FeeBurnStatus, b5 as FeeBurnStatusSchema, b6 as FundingAsset, b7 as FundingAssetSchema, b8 as FundingAssetsResponseSchema, b9 as FundingRate, ba as FundingRateHistorySchema, bb as FundingRateSchema, bc as FuturesAccount, bd as FuturesData, be as FuturesDataEndpoints, bf as FuturesMarketWS, bg as FuturesOps, bh as FuturesToolkit, bi as FuturesTrading, bj as FuturesUserWS, bk as FuturesUserWSOptions, bl as HttpClient, bm as HttpClientOptions, bn as HttpMethod, bo as Income, bp as IncomeHistoryResponseSchema, bq as IncomeSchema, br as IsolatedMarginAccount, bs as IsolatedMarginAccountSchema, bt as IsolatedMarginAsset, bu as IsolatedMarginAssetSchema, bv as IsolatedMarginSymbol, bw as IsolatedMarginSymbolSchema, bx as IsolatedTransferParams, by as IsolatedTransferParamsSchema, bz as Kline, bA as KlineInterval, bB as KlineIntervalSchema, bC as KlineSchema, bD as KlinesResponseSchema, bE as LeverageBracket, bF as LeverageBracketResponseSchema, bG as LeverageBracketSchema, bH as LeverageChange, bI as LeverageChangeSchema, bJ as ListenKey, bK as ListenKeySchema, bL as LongShortRatioEntry, bM as LongShortRatioEntrySchema, bN as LongShortRatioSchema, bO as MarginAccount, bP as MarginAssetBalance, bQ as MarginAssetBalanceSchema, bR as MarginCreateOrderParams, bS as MarginCreateOrderParamsSchema, bT as MarginForceLiquidationEntry, bU as MarginForceLiquidationEntrySchema, bV as MarginForceLiquidationResponse, bW as MarginForceLiquidationResponseSchema, bX as MarginInterestHistoryEntry, bY as MarginInterestHistoryEntrySchema, bZ as MarginInterestHistoryResponse, b_ as MarginInterestHistoryResponseSchema, b$ as MarginOrder, c0 as MarginOrderResponseSchema, c1 as MarginOrderSchema, c2 as MarginOrdersResponseSchema, c3 as MarginPriceIndex, c4 as MarginPriceIndexSchema, c5 as MarginTrade, c6 as MarginTradeSchema, c7 as MarginTradesResponseSchema, c8 as MarginTrading, c9 as MarginTransferResult, ca as MarginTransferResultSchema, cb as MarginTypeChange, cc as MarginTypeChangeSchema, cd as MarkPriceSpeed, ce as MarketDataBase, cf as MaxBorrowable, cg as MaxBorrowableSchema, ch as MaxTransferable, ci as MaxTransferableSchema, cj as ModifyOrderParams, ck as ModifyOrderParamsSchema, cl as MultiAssetsMargin, cm as MultiAssetsMarginSchema, cn as NewOrderAck, co as NewOrderAckSchema, cp as OpenInterest, cq as OpenInterestHistEntry, cr as OpenInterestHistEntrySchema, cs as OpenInterestHistSchema, ct as OpenInterestSchema, cu as Order, cv as OrderModifyHistoryEntry, cw as OrderModifyHistoryEntrySchema, cx as OrderModifyHistorySchema, cy as OrderResponseSchema, cz as OrderSchema, cA as OrdersResponseSchema, cB as PositionMarginChange, cC as PositionMarginChangeSchema, cD as PositionMarginHistoryEntry, cE as PositionMarginHistoryEntrySchema, cF as PositionMarginHistorySchema, cG as PositionMode, cH as PositionModeSchema, cI as PositionRisk, cJ as PositionRiskResponseSchema, cK as PositionRiskSchema, cL as PositionSizing, cM as PremiumIndex, cN as PremiumIndexSchema, cO as RateLimitOrder, cP as RateLimitOrderResponseSchema, cQ as RateLimitOrderSchema, cR as RateLimitTracker, cS as RateLimitTrackerOptions, cT as RateLimitUsage, cU as SignatureAlgorithm, cV as Signer, cW as SignerOptions, cX as SizePositionParams, cY as SpotAccount, cZ as SpotAccountInfo, c_ as SpotAccountSchema, c$ as SpotBalance, d0 as SpotBalanceSchema, d1 as SpotBalanceUpdate, d2 as SpotBalanceUpdateSchema, d3 as SpotExecutionReport, d4 as SpotExecutionReportSchema, d5 as SpotListStatus, d6 as SpotListStatusSchema, d7 as SpotMarket, d8 as SpotMarketWS, d9 as SpotOCOOrderAck, da as SpotOCOOrderAckResponseSchema, db as SpotOCOOrderAckSchema, dc as SpotOCOOrdersResponseSchema, dd as SpotOrder, de as SpotOrderResponseSchema, df as SpotOrderSchema, dg as SpotOrdersResponseSchema, dh as SpotOutboundAccountPosition, di as SpotOutboundAccountPositionSchema, dj as SpotTrade, dk as SpotTradeSchema, dl as SpotTradesResponseSchema, dm as SpotTrading, dn as SpotUserDataEvent, dp as SpotUserDataStream, dq as SpotUserWS, dr as SpotUserWSOptions, ds as SpotWsApi, dt as SpotWsApiOptions, du as SubAccount, dv as SubAccountDepositAddress, dw as SubAccountDepositAddressSchema, dx as SubAccountDepositHistoryEntry, dy as SubAccountDepositHistoryEntrySchema, dz as SubAccountDepositHistoryResponseSchema, dA as SubAccountEnableResult, dB as SubAccountEnableResultSchema, dC as SubAccountEntry, dD as SubAccountEntrySchema, dE as SubAccountFuturesSummary, dF as SubAccountFuturesSummarySchema, dG as SubAccountListResponse, dH as SubAccountListResponseSchema, dI as SubAccountMarginAccount, dJ as SubAccountMarginAccountSchema, dK as SubAccountSpotAsset, dL as SubAccountSpotAssetSchema, dM as SubAccountSpotAssetsResponse, dN as SubAccountSpotAssetsResponseSchema, dO as SubAccountSpotSummary, dP as SubAccountSpotSummaryEntry, dQ as SubAccountSpotSummaryEntrySchema, dR as SubAccountSpotSummarySchema, dS as SubAccountStatus, dT as SubAccountStatusResponseSchema, dU as SubAccountStatusSchema, dV as SubAccountUniversalTransferEntry, dW as SubAccountUniversalTransferEntrySchema, dX as SubAccountUniversalTransferHistoryResponse, dY as SubAccountUniversalTransferHistoryResponseSchema, dZ as SubAccountUniversalTransferParams, d_ as SubAccountUniversalTransferParamsSchema, d$ as SubAccountUniversalTransferResult, e0 as SubAccountUniversalTransferResultSchema, e1 as SymbolRules, e2 as TakerLongShortRatioEntry, e3 as TakerLongShortRatioEntrySchema, e4 as TakerLongShortRatioSchema, e5 as Ticker24hr, e6 as Ticker24hrSchema, e7 as TickerPrice, e8 as TickerPriceSchema, e9 as ToolContext, ea as ToolDefinition, eb as Trade, ec as TradeFeeEntry, ed as TradeFeeEntrySchema, ee as TradeFeeResponseSchema, ef as TradeSchema, eg as TradesResponseSchema, eh as TradingPolicy, ei as TradingPolicyOptions, ej as TransferType, ek as TransferTypeSchema, el as UniversalTransferHistoryEntry, em as UniversalTransferHistoryEntrySchema, en as UniversalTransferHistoryResponse, eo as UniversalTransferHistoryResponseSchema, ep as UniversalTransferParams, eq as UniversalTransferParamsSchema, er as UniversalTransferResult, es as UniversalTransferResultSchema, et as UserAsset, eu as UserAssetSchema, ev as UserAssetsResponseSchema, ew as UserDataAccountUpdate, ex as UserDataAccountUpdateSchema, ey as UserDataEvent, ez as UserDataMarginCall, eA as UserDataMarginCallSchema, eB as UserDataOrderTradeUpdate, eC as UserDataOrderTradeUpdateSchema, eD as UserDataStream, eE as UserTrade, eF as UserTradeSchema, eG as UserTradesResponseSchema, eH as VirtualSubAccountResult, eI as VirtualSubAccountResultSchema, eJ as Wallet, eK as WithdrawHistoryEntry, eL as WithdrawHistoryEntrySchema, eM as WithdrawHistoryResponseSchema, eN as WithdrawParams, eO as WithdrawParamsSchema, eP as WithdrawResult, eQ as WithdrawResultSchema, eR as WsApi, eS as WsApiOptions, eT as WsApiResponse, eU as WsApiResponseSchema, eV as accountTools, eW as createFuturesToolkit, eX as createPaperContext, eY as derivedTools, eZ as floorToStep, e_ as formatToDecimals, e$ as getBufferedWsEvents, f0 as marketDataTools, f1 as paperTools, f2 as parseSpotUserDataEvent, f3 as parseUserDataEvent, f4 as roundToStep, f5 as spotTools, f6 as stepDecimals, f7 as symbolRulesFrom, f8 as textResult, f9 as toAnthropicTool, fa as toJsonSchema, fb as toMCPTool, fc as toOpenAITool, fd as toToolList, fe as toolkitToFormats, ff as tradingTools, fg as wsTools } from './index-BO27qOb5.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import 'axios';
|
|
5
6
|
import 'node:events';
|
|
6
7
|
|
|
7
8
|
type Environment = 'live' | 'testnet' | 'demo';
|
|
@@ -10,11 +11,17 @@ interface Endpoints {
|
|
|
10
11
|
restFapi: string;
|
|
11
12
|
restFuturesData: string;
|
|
12
13
|
restSpot: string;
|
|
14
|
+
restApiRoot: string;
|
|
15
|
+
restDapiRoot: string;
|
|
16
|
+
restDapi: string;
|
|
13
17
|
wsMarket: string;
|
|
14
18
|
wsUser: string;
|
|
15
19
|
wsApi: string;
|
|
16
20
|
wsSpotMarket: string;
|
|
17
21
|
wsSpotUser: string;
|
|
22
|
+
wsSpotApi: string;
|
|
23
|
+
wsDapiMarket: string;
|
|
24
|
+
wsDapiUser: string;
|
|
18
25
|
}
|
|
19
26
|
declare function resolveEnvironment(options?: {
|
|
20
27
|
testnet?: boolean;
|
|
@@ -23,6 +30,9 @@ declare function resolveEnvironment(options?: {
|
|
|
23
30
|
wsBase?: string;
|
|
24
31
|
wsUserBase?: string;
|
|
25
32
|
wsApiBase?: string;
|
|
33
|
+
dapiBase?: string;
|
|
34
|
+
wsSpotApiBase?: string;
|
|
35
|
+
wsDapiBase?: string;
|
|
26
36
|
}): {
|
|
27
37
|
env: Environment;
|
|
28
38
|
endpoints: Endpoints;
|
|
@@ -300,19 +310,33 @@ declare class BinanceError extends Error {
|
|
|
300
310
|
}
|
|
301
311
|
|
|
302
312
|
declare class BinanceAuthError extends BinanceError {
|
|
303
|
-
readonly missing: 'apiKey' | 'apiSecret';
|
|
304
|
-
constructor(missing: 'apiKey' | 'apiSecret');
|
|
313
|
+
readonly missing: 'apiKey' | 'apiSecret' | 'privateKey';
|
|
314
|
+
constructor(missing: 'apiKey' | 'apiSecret' | 'privateKey');
|
|
305
315
|
}
|
|
306
316
|
|
|
317
|
+
interface BinanceApiErrorContext {
|
|
318
|
+
endpoint?: string;
|
|
319
|
+
method?: string;
|
|
320
|
+
headers?: Record<string, string>;
|
|
321
|
+
}
|
|
307
322
|
declare class BinanceApiError extends BinanceError {
|
|
308
323
|
readonly code: number;
|
|
309
324
|
readonly status: number;
|
|
310
|
-
|
|
325
|
+
readonly endpoint?: string;
|
|
326
|
+
readonly method?: string;
|
|
327
|
+
readonly headers?: Record<string, string>;
|
|
328
|
+
constructor(message: string, code: number, status: number, context?: BinanceApiErrorContext);
|
|
329
|
+
/** -1003 (way too many requests) or HTTP 429/418. */
|
|
330
|
+
isRateLimitError(): boolean;
|
|
331
|
+
/** -1021: request timestamp outside recvWindow, usually caused by local clock drift. */
|
|
332
|
+
isTimestampError(): boolean;
|
|
333
|
+
/** -2010: account has insufficient balance for the requested action. */
|
|
334
|
+
isInsufficientBalance(): boolean;
|
|
311
335
|
}
|
|
312
336
|
|
|
313
337
|
declare class RateLimitError extends BinanceApiError {
|
|
314
338
|
readonly retryAfterMs?: number;
|
|
315
|
-
constructor(message: string, code: number, status: number, retryAfterMs?: number);
|
|
339
|
+
constructor(message: string, code: number, status: number, retryAfterMs?: number, context?: BinanceApiErrorContext);
|
|
316
340
|
}
|
|
317
341
|
|
|
318
342
|
declare class NetworkError extends BinanceError {
|
|
@@ -320,8 +344,38 @@ declare class NetworkError extends BinanceError {
|
|
|
320
344
|
constructor(message: string, cause?: unknown);
|
|
321
345
|
}
|
|
322
346
|
|
|
347
|
+
type PolicyRule = 'readOnly' | 'symbolNotAllowed' | 'maxNotionalPerOrder' | 'notionalUndeterminable' | 'withdrawalsBlocked' | 'transfersBlocked' | 'blockedPath';
|
|
348
|
+
/**
|
|
349
|
+
* Thrown when a request is refused by the client's own {@link TradingPolicy} — before it
|
|
350
|
+
* ever reaches Binance. Distinct from BinanceApiError, which reports an exchange rejection.
|
|
351
|
+
*/
|
|
352
|
+
declare class PolicyViolationError extends BinanceError {
|
|
353
|
+
readonly rule: PolicyRule;
|
|
354
|
+
readonly method: string;
|
|
355
|
+
readonly endpoint: string;
|
|
356
|
+
readonly details?: Record<string, unknown>;
|
|
357
|
+
constructor(rule: PolicyRule, message: string, method: string, endpoint: string, details?: Record<string, unknown>);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Thrown instead of sending a mutating request when the client is in dry-run mode.
|
|
362
|
+
*
|
|
363
|
+
* Dry run deliberately throws rather than returning a synthetic success payload: a fabricated
|
|
364
|
+
* orderId would lead an agent to believe an order exists and then try to manage or cancel it.
|
|
365
|
+
* Failing loudly — while carrying the exact request that *would* have been sent — is the only
|
|
366
|
+
* safe signal. Tool layers should catch this and surface `describe()` back to the model.
|
|
367
|
+
*/
|
|
368
|
+
declare class DryRunError extends BinanceError {
|
|
369
|
+
readonly method: string;
|
|
370
|
+
readonly endpoint: string;
|
|
371
|
+
readonly params: Record<string, unknown>;
|
|
372
|
+
constructor(method: string, endpoint: string, params?: Record<string, unknown>);
|
|
373
|
+
/** Human/LLM-readable description of the suppressed request. */
|
|
374
|
+
describe(): string;
|
|
375
|
+
}
|
|
376
|
+
|
|
323
377
|
declare function createBinanceMcpServer(client: BinanceClient): McpServer;
|
|
324
378
|
|
|
325
|
-
declare const VERSION = "2.
|
|
379
|
+
declare const VERSION = "2.0.0";
|
|
326
380
|
|
|
327
|
-
export { BinanceApiError, BinanceAuthError, BinanceClient, BinanceError, type Endpoints, type Environment, FuturesMarket, NetworkError, type PaperAccount, type PaperOrder, type PaperPosition, type PaperPositionSide, PaperTradingEngine, type PaperTradingOptions, RateLimitError, VERSION, type WsAggTradePayload, WsAggTradePayloadSchema, type WsAssetIndexPayload, WsAssetIndexPayloadSchema, type WsBookTickerPayload, WsBookTickerPayloadSchema, type WsCompositeIndexPayload, WsCompositeIndexPayloadSchema, type WsDepthUpdatePayload, WsDepthUpdatePayloadSchema, type WsForceOrderPayload, WsForceOrderPayloadSchema, type WsKlinePayload, WsKlinePayloadSchema, type WsMarkPricePayload, WsMarkPricePayloadSchema, type WsMiniTickerPayload, WsMiniTickerPayloadSchema, type WsRollingWindowTickerPayload, WsRollingWindowTickerPayloadSchema, type WsSpotAvgPricePayload, WsSpotAvgPricePayloadSchema, type WsStreamPayload, type WsTicker24hrPayload, WsTicker24hrPayloadSchema, type WsTradePayload, WsTradePayloadSchema, createBinanceMcpServer, parseWsPayload, resolveEnvironment };
|
|
381
|
+
export { BinanceApiError, type BinanceApiErrorContext, BinanceAuthError, BinanceClient, BinanceError, DryRunError, type Endpoints, type Environment, FuturesMarket, NetworkError, type PaperAccount, type PaperOrder, type PaperPosition, type PaperPositionSide, PaperTradingEngine, type PaperTradingOptions, type PolicyRule, PolicyViolationError, RateLimitError, VERSION, type WsAggTradePayload, WsAggTradePayloadSchema, type WsAssetIndexPayload, WsAssetIndexPayloadSchema, type WsBookTickerPayload, WsBookTickerPayloadSchema, type WsCompositeIndexPayload, WsCompositeIndexPayloadSchema, type WsDepthUpdatePayload, WsDepthUpdatePayloadSchema, type WsForceOrderPayload, WsForceOrderPayloadSchema, type WsKlinePayload, WsKlinePayloadSchema, type WsMarkPricePayload, WsMarkPricePayloadSchema, type WsMiniTickerPayload, WsMiniTickerPayloadSchema, type WsRollingWindowTickerPayload, WsRollingWindowTickerPayloadSchema, type WsSpotAvgPricePayload, WsSpotAvgPricePayloadSchema, type WsStreamPayload, type WsTicker24hrPayload, WsTicker24hrPayloadSchema, type WsTradePayload, WsTradePayloadSchema, createBinanceMcpServer, parseWsPayload, resolveEnvironment };
|