@yuants/vendor-binance 0.10.5 → 0.10.7

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.
@@ -204,4 +204,24 @@ export const getMarginInterestRateHistory = (params) => {
204
204
  const credential = getDefaultCredential();
205
205
  return requestPrivate(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/interestRateHistory', params);
206
206
  };
207
+ /**
208
+ *获取用户持仓
209
+ * @param credential
210
+ * https://developers.binance.com/docs/zh-CN/wallet/asset/user-assets#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0
211
+ * @param params
212
+ * @returns
213
+ */
214
+ export const getUserAsset = (credential, params) => {
215
+ return requestPrivate(credential, 'POST', 'https://api.binance.com/sapi/v3/asset/getUserAsset', params);
216
+ };
217
+ /**
218
+ * 查询资金账户
219
+ * @param credential
220
+ * https://developers.binance.com/docs/zh-CN/wallet/asset/funding-wallet?utm_source=chatgpt.com
221
+ * @param params
222
+ * @returns
223
+ */
224
+ export const getFundingAsset = (credential, params) => {
225
+ return requestPrivate(credential, 'POST', 'https://api.binance.com/sapi/v1/asset/get-funding-asset', params);
226
+ };
207
227
  //# sourceMappingURL=private-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA0B,cAAc,EAAE,MAAM,UAAU,CAAC;AAsOxF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,UAAuB,EAA4C,EAAE,CACzG,cAAc,CACZ,UAAU,EACV,KAAK,EACL,0CAA0C,CAC3C,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,UAAuB,EAA0C,EAAE,CACrG,cAAc,CACZ,UAAU,EACV,KAAK,EACL,6CAA6C,CAC9C,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,M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ACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,UAAuB,EACvB,MAQC,EAC2B,EAAE,CAC9B,cAAc,CAAoB,UAAU,EAAE,KAAK,EAAE,2CAA2C,EAAE,MAAM,CAAC,CAAC;AAE5G;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,UAAuB,EACvB,MAuBC,EAC2C,EAAE,CAC9C,cAAc,CACZ,UAAU,EACV,MAAM,EACN,oDAAoD,EACpD,MAAM,CACP,CAAC;AAEJ;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,UAAuB,EACvB,MAUC,EAC6C,EAAE,CAChD,cAAc,CACZ,UAAU,EACV,KAAK,EACL,2CAA2C,EAC3C,MAAM,CACP,CAAC;AAWJ;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA4B,EAA0B,EAAE;IACxF,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAC1C,OAAO,cAAc,CACnB,UAAU,EACV,KAAK,EACL,iDAAiD,EACjD,MAAM,CACP,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,MAG/C,EAKC,EAAE;IACF,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAC1C,OAAO,cAAc,CAKnB,UAAU,EAAE,KAAK,EAAE,kEAAkE,EAAE,MAAM,CAAC,CAAC;AACnG,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,MAM5C,EAOC,EAAE;IACF,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAC1C,OAAO,cAAc,CAOnB,UAAU,EAAE,KAAK,EAAE,4DAA4D,EAAE,MAAM,CAAC,CAAC;AAC7F,CAAC,CAAC","sourcesContent":["import { getDefaultCredential, IApiError, ICredential, requestPrivate } from './client';\nexport type { ICredential };\n\nexport interface IUnifiedAccountInfo {\n uniMMR: string;\n accountEquity: string;\n actualEquity: string;\n accountInitialMargin: string;\n accountMaintMargin: string;\n accountStatus: string;\n virtualMaxWithdrawAmount: string;\n totalAvailableBalance: string;\n totalMarginOpenLoss: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAsset {\n asset: string;\n crossWalletBalance: string;\n crossUnPnl: string;\n maintMargin: string;\n initialMargin: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmPosition {\n symbol: string;\n initialMargin: string;\n maintMargin: string;\n unrealizedProfit: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n leverage: string;\n entryPrice: string;\n maxNotional: string;\n bidNotional: string;\n askNotional: string;\n positionSide: string;\n positionAmt: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAccount {\n assets: IUnifiedUmAsset[];\n positions: IUnifiedUmPosition[];\n}\n\nexport interface IUnifiedUmOpenOrder {\n avgPrice: string;\n clientOrderId: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n origQty: string;\n origType: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n time: number;\n timeInForce: string;\n type: string;\n updateTime: number;\n selfTradePreventionMode: string;\n goodTillDate: number;\n}\n\nexport interface IUnifiedAccountBalanceEntry {\n asset: string;\n totalWalletBalance: string;\n crossMarginAsset: string;\n crossMarginBorrowed: string;\n crossMarginFree: string;\n crossMarginInterest: string;\n crossMarginLocked: string;\n umWalletBalance: string;\n umUnrealizedPNL: string;\n cmWalletBalance: string;\n cmUnrealizedPNL: string;\n updateTime: number;\n}\n\nexport interface ISpotAccountInfo {\n makerCommission: number;\n takerCommission: number;\n buyerCommission: number;\n sellerCommission: number;\n commissionRates: {\n maker: string;\n taker: string;\n buyer: string;\n seller: string;\n };\n canTrade: boolean;\n canWithdraw: boolean;\n canDeposit: boolean;\n brokered: boolean;\n requireSelfTradePrevention: boolean;\n preventSor: boolean;\n updateTime: number;\n balances: {\n asset: string;\n free: string;\n locked: string;\n }[];\n permissions: string[];\n uid: number;\n}\n\nexport interface ISpotOrder {\n symbol: string;\n orderId: number;\n orderListId: number;\n clientOrderId: string;\n price: string;\n origQty: string;\n executedQty: string;\n origQuoteOrderQty: string;\n cummulativeQuoteQty: string;\n status: string;\n timeInForce: string;\n type: string;\n side: string;\n stopPrice: string;\n icebergQty: string;\n time: number;\n updateTime: number;\n isWorking: boolean;\n}\n\nexport interface ISpotNewOrderResponse {\n symbol: string;\n orderId: number;\n clientOrderId: string;\n transactTime: number;\n}\n\nexport interface IAssetTransferResponse {\n tranId: number;\n}\n\nexport interface IDepositAddress {\n address: string;\n coin: string;\n tag: string;\n url: string;\n}\n\nexport interface ISubAccountSummary {\n email: string;\n isFreeze: boolean;\n createTime: number;\n isManagedSubAccount: boolean;\n isAssetManagementSubAccount: boolean;\n}\n\nexport interface ISubAccountListResponse {\n subAccounts: ISubAccountSummary[];\n}\n\nexport interface IWithdrawRecord {\n id: string;\n amount: string;\n transactionFee: string;\n coin: string;\n status: number;\n address: string;\n txId: string;\n applyTime: Date;\n network: string;\n transferType: number;\n info: string;\n confirmNo: number;\n walletType: number;\n txKey: string;\n completeTime: Date;\n}\n\nexport interface IDepositRecord {\n id: string;\n amount: string;\n coin: string;\n network: string;\n status: number;\n address: string;\n addressTag: string;\n txId: string;\n insertTime: number;\n transferType: number;\n confirmTimes: string;\n unlockConfirm: number;\n walletType: number;\n}\n\nexport interface IUnifiedUmOrderResponse {\n clientOrderId: string;\n cumQty: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n avgPrice: string;\n origQty: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n timeInForce: string;\n type: string;\n selfTradePreventionMode: string;\n goodTillDate: number;\n updateTime: number;\n}\n\nexport interface IUMIncomeRecord {\n symbol: string;\n incomeType: string;\n income: string;\n asset: string;\n info: string;\n time: number;\n tranId: string;\n tradeId: string;\n}\n\n/**\n * 查询账户信息(USER_DATA)\n *\n * 查询账户信息\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Information\n */\nexport const getUnifiedAccountInfo = (credential: ICredential): Promise<IUnifiedAccountInfo | IApiError> =>\n requestPrivate<IUnifiedAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/account',\n );\n\n/**\n * 获取UM账户信息\n *\n * 现有UM账户资产和仓位信息\n *\n * 权重: 5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Account-Detail\n */\nexport const getUnifiedUmAccount = (credential: ICredential): Promise<IUnifiedUmAccount | IApiError> =>\n requestPrivate<IUnifiedUmAccount | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/account',\n );\n\n/**\n * 查看当前全部UM挂单(USER_DATA)\n *\n * 查看当前全部UM挂单,请小心使用不带symbol参数的调用\n *\n * 权重: 带symbol 1 - 不带 40\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders\n */\nexport const getUnifiedUmOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<IUnifiedUmOpenOrder[]> =>\n requestPrivate<IUnifiedUmOpenOrder[]>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/openOrders',\n params,\n );\n\n/**\n * 查询账户余额(USER_DATA)\n *\n * 查询账户余额\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Balance\n */\nexport const getUnifiedAccountBalance = (\n credential: ICredential,\n params?: {\n assets?: string;\n },\n): Promise<IUnifiedAccountBalanceEntry[] | IApiError> =>\n requestPrivate<IUnifiedAccountBalanceEntry[] | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/balance',\n params,\n );\n\n/**\n * 账户信息 (USER_DATA)\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api#%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF-user_data\n */\nexport const getSpotAccountInfo = (\n credential: ICredential,\n params?: {\n omitZeroBalances?: boolean;\n },\n): Promise<ISpotAccountInfo | IApiError> =>\n requestPrivate<ISpotAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/account',\n params,\n );\n\n/**\n * Current open orders (USER_DATA)\n *\n * 权重: 带symbol: 6 不带: 80\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/account-endpoints#%E6%9F%A5%E7%9C%8B%E8%B4%A6%E6%88%B7%E5%BD%93%E5%89%8D%E6%8C%82%E5%8D%95-user_data\n */\nexport const getSpotOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<ISpotOrder[] | IApiError> =>\n requestPrivate<ISpotOrder[] | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/openOrders',\n params,\n );\n\n/**\n * New order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * Cancel order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E8%AE%A2%E5%8D%95-trade\n */\nexport const deleteSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n newClientOrderId?: string;\n cancelRestrictions?: string;\n },\n): Promise<ISpotOrder | IApiError> =>\n requestPrivate<ISpotOrder | IApiError>(\n credential,\n 'DELETE',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * 用户万向划转(USER_DATA)\n *\n * 用户万向划转\n *\n * 您需要开通api key 允许万向划转权限来调用此接口。\n *\n * 权重: 900\n *\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-universal-transfer\n */\nexport const postAssetTransfer = (\n credential: ICredential,\n params: {\n type: string;\n asset: string;\n amount: number;\n fromSymbol?: string;\n toSymbol?: string;\n },\n): Promise<IAssetTransferResponse | IApiError> =>\n requestPrivate<IAssetTransferResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/asset/transfer',\n params,\n );\n\n/**\n * 统一账户资金归集(TRADE)\n *\n * 资金归集到统一账户钱包\n *\n * 权重: 750\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Fund-Auto-collection\n *\n * ISSUE(2024-07-18): 目前这是唯一能够将资金从原 U 本位合约账户转入统一账户的接口。\n */\nexport const postUnifiedAccountAutoCollection = (credential: ICredential): Promise<{ msg: string }> =>\n requestPrivate<{ msg: string }>(credential, 'POST', 'https://papi.binance.com/papi/v1/auto-collection');\n\n/**\n * 获取充值地址(支持多网络)(USER_DATA)\n *\n * 获取充值地址\n *\n * 权重: 10\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-address\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n coin: string;\n network?: string;\n amount?: number;\n },\n): Promise<IDepositAddress> =>\n requestPrivate<IDepositAddress>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/address',\n params,\n );\n\n/**\n * 查询子账户列表(适用主账户)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/sub_account/account-management/Query-Sub-account-List\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n email?: string;\n isFreeze?: number;\n page?: number;\n limit?: number;\n },\n): Promise<ISubAccountListResponse | IApiError> =>\n requestPrivate<ISubAccountListResponse | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/sub-account/list',\n params,\n );\n\n/**\n * 提币(USER_DATA)\n *\n * 权重: 600\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n coin: string;\n withdrawOrderId?: string;\n network?: string;\n address: string;\n addressTag?: string;\n amount: number;\n transactionFeeFlag?: boolean;\n name?: string;\n walletType?: number;\n },\n): Promise<{ id: string } | IApiError> =>\n requestPrivate<{ id: string } | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/capital/withdraw/apply',\n params,\n );\n\n/**\n * 获取提币历史(支持多网络)(USER_DATA)\n *\n * 获取提币历史 (支持多网络)\n *\n * 请求权重(IP)#\n * 18000 请求限制: 每秒10次\n *\n * 本接口特别采用每秒UID速率限制,用户的总秒级 UID 速率限制为180000/秒。从该接口收到的响应包含key X-SAPI-USED-UID-WEIGHT-1S,该key定义了当前 UID 使用的权重\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw-history\n */\nexport const getWithdrawHistory = (\n credential: ICredential,\n params?: {\n coin?: string;\n withdrawOrderId?: string;\n status?: number;\n offset?: number;\n limit?: number;\n startTime?: number;\n endTime?: number;\n },\n): Promise<IWithdrawRecord[]> =>\n requestPrivate<IWithdrawRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/withdraw/history',\n params,\n );\n\n/**\n * 获取充值历史(支持多网络)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-history\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n includeSource?: boolean;\n coin?: string;\n status?: number;\n startTime?: number;\n endTime?: number;\n offset?: number;\n limit?: number;\n txId?: string;\n },\n): Promise<IDepositRecord[]> =>\n requestPrivate<IDepositRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/hisrec',\n params,\n );\n\n/**\n * UM下单(TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/New-UM-Order\n */\nexport const postUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n positionSide?: string;\n type: string;\n timeInForce?: string;\n quantity: number;\n reduceOnly?: string;\n price?: number;\n newClientOrderId?: string;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n goodTillDate?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\nexport const deleteUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'DELETE',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\n/**\n * 获取UM损益资金流水(USER_DATA)\n *\n * 权重: 30\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Income-History\n */\nexport const getUMIncome = (\n credential: ICredential,\n params?: {\n symbol?: string;\n incomeType?: string;\n startTime?: number;\n endTime?: number;\n recvWindow?: number;\n limit?: number;\n timestamp?: number;\n },\n): Promise<IUMIncomeRecord[]> =>\n requestPrivate<IUMIncomeRecord[]>(credential, 'GET', 'https://api.binance.com/papi/v1/um/income', params);\n\n/**\n * Cancel an Existing Order and Send a New Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E5%B9%B6%E9%87%8D%E6%96%B0%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrderCancelReplace = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n cancelReplaceMode: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n cancelNewClientOrderId?: string;\n cancelOrigClientOrderId?: string;\n cancelOrderId?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order/cancelReplace',\n params,\n );\n\n/**\n * Modify Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Modify-UM-Order\n */\nexport const putUmOrder = (\n credential: ICredential,\n params: {\n orderId?: number;\n origClientOrderId?: string;\n symbol: string;\n side: string;\n quantity?: number;\n price?: number;\n priceMatch?: string;\n recvWindow?: number;\n timestamp?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'PUT',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取所有全仓杠杆交易对(MARKET_DATA)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/market-data/Get-All-Cross-Margin-Pairs\n */\nexport const getMarginAllPairs = (params?: { symbol?: string }): Promise<IMarginPair[]> => {\n const credential = getDefaultCredential();\n return requestPrivate<IMarginPair[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/margin/allPairs',\n params,\n );\n};\n\n/**\n * Get a future hourly interest rate\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Get-a-future-hourly-interest-rate\n */\nexport const getMarginNextHourlyInterestRate = (params: {\n assets: string;\n isIsolated: boolean;\n}): Promise<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/next-hourly-interest-rate', params);\n};\n\n/**\n * Query Margin Interest Rate History\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History\n */\nexport const getMarginInterestRateHistory = (params: {\n asset: string;\n vipLevel?: number;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/interestRateHistory', params);\n};\n"]}
1
+ {"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA0B,cAAc,EAAE,MAAM,UAAU,CAAC;AAsOxF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,UAAuB,EAA4C,EAAE,CACzG,cAAc,CACZ,UAAU,EACV,KAAK,EACL,0CAA0C,CAC3C,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,UAAuB,EAA0C,EAAE,CACrG,cAAc,CACZ,UAAU,EACV,KAAK,EACL,6CAA6C,CAC9C,CAAC;AAEJ;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GAAG,CAC1B,UAAuB,EACvB,MAKC,EACD,EAAE;IACF,OAAO,cAAc,CAWnB,UAAU,EAAE,MAAM,EAAE,oDAAoD,EAAE,MAAM,CAAC,CAAC;AACtF,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,UAAuB,EACvB,MAKC,EACD,EAAE;IACF,OAAO,cAAc,CAWnB,UAAU,EAAE,MAAM,EAAE,yDAAyD,EAAE,MAAM,CAAC,CAAC;AAC3F,CAAC,CAAC","sourcesContent":["import { getDefaultCredential, IApiError, ICredential, requestPrivate } from './client';\nexport type { ICredential };\n\nexport interface IUnifiedAccountInfo {\n uniMMR: string;\n accountEquity: string;\n actualEquity: string;\n accountInitialMargin: string;\n accountMaintMargin: string;\n accountStatus: string;\n virtualMaxWithdrawAmount: string;\n totalAvailableBalance: string;\n totalMarginOpenLoss: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAsset {\n asset: string;\n crossWalletBalance: string;\n crossUnPnl: string;\n maintMargin: string;\n initialMargin: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmPosition {\n symbol: string;\n initialMargin: string;\n maintMargin: string;\n unrealizedProfit: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n leverage: string;\n entryPrice: string;\n maxNotional: string;\n bidNotional: string;\n askNotional: string;\n positionSide: string;\n positionAmt: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAccount {\n assets: IUnifiedUmAsset[];\n positions: IUnifiedUmPosition[];\n}\n\nexport interface IUnifiedUmOpenOrder {\n avgPrice: string;\n clientOrderId: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n origQty: string;\n origType: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n time: number;\n timeInForce: string;\n type: string;\n updateTime: number;\n selfTradePreventionMode: string;\n goodTillDate: number;\n}\n\nexport interface IUnifiedAccountBalanceEntry {\n asset: string;\n totalWalletBalance: string;\n crossMarginAsset: string;\n crossMarginBorrowed: string;\n crossMarginFree: string;\n crossMarginInterest: string;\n crossMarginLocked: string;\n umWalletBalance: string;\n umUnrealizedPNL: string;\n cmWalletBalance: string;\n cmUnrealizedPNL: string;\n updateTime: number;\n}\n\nexport interface ISpotAccountInfo {\n makerCommission: number;\n takerCommission: number;\n buyerCommission: number;\n sellerCommission: number;\n commissionRates: {\n maker: string;\n taker: string;\n buyer: string;\n seller: string;\n };\n canTrade: boolean;\n canWithdraw: boolean;\n canDeposit: boolean;\n brokered: boolean;\n requireSelfTradePrevention: boolean;\n preventSor: boolean;\n updateTime: number;\n balances: {\n asset: string;\n free: string;\n locked: string;\n }[];\n permissions: string[];\n uid: number;\n}\n\nexport interface ISpotOrder {\n symbol: string;\n orderId: number;\n orderListId: number;\n clientOrderId: string;\n price: string;\n origQty: string;\n executedQty: string;\n origQuoteOrderQty: string;\n cummulativeQuoteQty: string;\n status: string;\n timeInForce: string;\n type: string;\n side: string;\n stopPrice: string;\n icebergQty: string;\n time: number;\n updateTime: number;\n isWorking: boolean;\n}\n\nexport interface ISpotNewOrderResponse {\n symbol: string;\n orderId: number;\n clientOrderId: string;\n transactTime: number;\n}\n\nexport interface IAssetTransferResponse {\n tranId: number;\n}\n\nexport interface IDepositAddress {\n address: string;\n coin: string;\n tag: string;\n url: string;\n}\n\nexport interface ISubAccountSummary {\n email: string;\n isFreeze: boolean;\n createTime: number;\n isManagedSubAccount: boolean;\n isAssetManagementSubAccount: boolean;\n}\n\nexport interface ISubAccountListResponse {\n subAccounts: ISubAccountSummary[];\n}\n\nexport interface IWithdrawRecord {\n id: string;\n amount: string;\n transactionFee: string;\n coin: string;\n status: number;\n address: string;\n txId: string;\n applyTime: Date;\n network: string;\n transferType: number;\n info: string;\n confirmNo: number;\n walletType: number;\n txKey: string;\n completeTime: Date;\n}\n\nexport interface IDepositRecord {\n id: string;\n amount: string;\n coin: string;\n network: string;\n status: number;\n address: string;\n addressTag: string;\n txId: string;\n insertTime: number;\n transferType: number;\n confirmTimes: string;\n unlockConfirm: number;\n walletType: number;\n}\n\nexport interface IUnifiedUmOrderResponse {\n clientOrderId: string;\n cumQty: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n avgPrice: string;\n origQty: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n timeInForce: string;\n type: string;\n selfTradePreventionMode: string;\n goodTillDate: number;\n updateTime: number;\n}\n\nexport interface IUMIncomeRecord {\n symbol: string;\n incomeType: string;\n income: string;\n asset: string;\n info: string;\n time: number;\n tranId: string;\n tradeId: string;\n}\n\n/**\n * 查询账户信息(USER_DATA)\n *\n * 查询账户信息\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Information\n */\nexport const getUnifiedAccountInfo = (credential: ICredential): Promise<IUnifiedAccountInfo | IApiError> =>\n requestPrivate<IUnifiedAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/account',\n );\n\n/**\n * 获取UM账户信息\n *\n * 现有UM账户资产和仓位信息\n *\n * 权重: 5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Account-Detail\n */\nexport const getUnifiedUmAccount = (credential: ICredential): Promise<IUnifiedUmAccount | IApiError> =>\n requestPrivate<IUnifiedUmAccount | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/account',\n );\n\n/**\n * 查看当前全部UM挂单(USER_DATA)\n *\n * 查看当前全部UM挂单,请小心使用不带symbol参数的调用\n *\n * 权重: 带symbol 1 - 不带 40\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders\n */\nexport const getUnifiedUmOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<IUnifiedUmOpenOrder[]> =>\n requestPrivate<IUnifiedUmOpenOrder[]>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/openOrders',\n params,\n );\n\n/**\n * 查询账户余额(USER_DATA)\n *\n * 查询账户余额\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Balance\n */\nexport const getUnifiedAccountBalance = (\n credential: ICredential,\n params?: {\n assets?: string;\n },\n): Promise<IUnifiedAccountBalanceEntry[] | IApiError> =>\n requestPrivate<IUnifiedAccountBalanceEntry[] | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/balance',\n params,\n );\n\n/**\n * 账户信息 (USER_DATA)\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api#%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF-user_data\n */\nexport const getSpotAccountInfo = (\n credential: ICredential,\n params?: {\n omitZeroBalances?: boolean;\n },\n): Promise<ISpotAccountInfo | IApiError> =>\n requestPrivate<ISpotAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/account',\n params,\n );\n\n/**\n * Current open orders (USER_DATA)\n *\n * 权重: 带symbol: 6 不带: 80\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/account-endpoints#%E6%9F%A5%E7%9C%8B%E8%B4%A6%E6%88%B7%E5%BD%93%E5%89%8D%E6%8C%82%E5%8D%95-user_data\n */\nexport const getSpotOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<ISpotOrder[] | IApiError> =>\n requestPrivate<ISpotOrder[] | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/openOrders',\n params,\n );\n\n/**\n * New order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * Cancel order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E8%AE%A2%E5%8D%95-trade\n */\nexport const deleteSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n newClientOrderId?: string;\n cancelRestrictions?: string;\n },\n): Promise<ISpotOrder | IApiError> =>\n requestPrivate<ISpotOrder | IApiError>(\n credential,\n 'DELETE',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * 用户万向划转(USER_DATA)\n *\n * 用户万向划转\n *\n * 您需要开通api key 允许万向划转权限来调用此接口。\n *\n * 权重: 900\n *\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-universal-transfer\n */\nexport const postAssetTransfer = (\n credential: ICredential,\n params: {\n type: string;\n asset: string;\n amount: number;\n fromSymbol?: string;\n toSymbol?: string;\n },\n): Promise<IAssetTransferResponse | IApiError> =>\n requestPrivate<IAssetTransferResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/asset/transfer',\n params,\n );\n\n/**\n * 统一账户资金归集(TRADE)\n *\n * 资金归集到统一账户钱包\n *\n * 权重: 750\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Fund-Auto-collection\n *\n * ISSUE(2024-07-18): 目前这是唯一能够将资金从原 U 本位合约账户转入统一账户的接口。\n */\nexport const postUnifiedAccountAutoCollection = (credential: ICredential): Promise<{ msg: string }> =>\n requestPrivate<{ msg: string }>(credential, 'POST', 'https://papi.binance.com/papi/v1/auto-collection');\n\n/**\n * 获取充值地址(支持多网络)(USER_DATA)\n *\n * 获取充值地址\n *\n * 权重: 10\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-address\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n coin: string;\n network?: string;\n amount?: number;\n },\n): Promise<IDepositAddress> =>\n requestPrivate<IDepositAddress>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/address',\n params,\n );\n\n/**\n * 查询子账户列表(适用主账户)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/sub_account/account-management/Query-Sub-account-List\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n email?: string;\n isFreeze?: number;\n page?: number;\n limit?: number;\n },\n): Promise<ISubAccountListResponse | IApiError> =>\n requestPrivate<ISubAccountListResponse | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/sub-account/list',\n params,\n );\n\n/**\n * 提币(USER_DATA)\n *\n * 权重: 600\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n coin: string;\n withdrawOrderId?: string;\n network?: string;\n address: string;\n addressTag?: string;\n amount: number;\n transactionFeeFlag?: boolean;\n name?: string;\n walletType?: number;\n },\n): Promise<{ id: string } | IApiError> =>\n requestPrivate<{ id: string } | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/capital/withdraw/apply',\n params,\n );\n\n/**\n * 获取提币历史(支持多网络)(USER_DATA)\n *\n * 获取提币历史 (支持多网络)\n *\n * 请求权重(IP)#\n * 18000 请求限制: 每秒10次\n *\n * 本接口特别采用每秒UID速率限制,用户的总秒级 UID 速率限制为180000/秒。从该接口收到的响应包含key X-SAPI-USED-UID-WEIGHT-1S,该key定义了当前 UID 使用的权重\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw-history\n */\nexport const getWithdrawHistory = (\n credential: ICredential,\n params?: {\n coin?: string;\n withdrawOrderId?: string;\n status?: number;\n offset?: number;\n limit?: number;\n startTime?: number;\n endTime?: number;\n },\n): Promise<IWithdrawRecord[]> =>\n requestPrivate<IWithdrawRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/withdraw/history',\n params,\n );\n\n/**\n * 获取充值历史(支持多网络)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-history\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n includeSource?: boolean;\n coin?: string;\n status?: number;\n startTime?: number;\n endTime?: number;\n offset?: number;\n limit?: number;\n txId?: string;\n },\n): Promise<IDepositRecord[]> =>\n requestPrivate<IDepositRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/hisrec',\n params,\n );\n\n/**\n * UM下单(TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/New-UM-Order\n */\nexport const postUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n positionSide?: string;\n type: string;\n timeInForce?: string;\n quantity: number;\n reduceOnly?: string;\n price?: number;\n newClientOrderId?: string;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n goodTillDate?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\nexport const deleteUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'DELETE',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\n/**\n * 获取UM损益资金流水(USER_DATA)\n *\n * 权重: 30\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Income-History\n */\nexport const getUMIncome = (\n credential: ICredential,\n params?: {\n symbol?: string;\n incomeType?: string;\n startTime?: number;\n endTime?: number;\n recvWindow?: number;\n limit?: number;\n timestamp?: number;\n },\n): Promise<IUMIncomeRecord[]> =>\n requestPrivate<IUMIncomeRecord[]>(credential, 'GET', 'https://api.binance.com/papi/v1/um/income', params);\n\n/**\n * Cancel an Existing Order and Send a New Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E5%B9%B6%E9%87%8D%E6%96%B0%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrderCancelReplace = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n cancelReplaceMode: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n cancelNewClientOrderId?: string;\n cancelOrigClientOrderId?: string;\n cancelOrderId?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order/cancelReplace',\n params,\n );\n\n/**\n * Modify Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Modify-UM-Order\n */\nexport const putUmOrder = (\n credential: ICredential,\n params: {\n orderId?: number;\n origClientOrderId?: string;\n symbol: string;\n side: string;\n quantity?: number;\n price?: number;\n priceMatch?: string;\n recvWindow?: number;\n timestamp?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'PUT',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取所有全仓杠杆交易对(MARKET_DATA)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/market-data/Get-All-Cross-Margin-Pairs\n */\nexport const getMarginAllPairs = (params?: { symbol?: string }): Promise<IMarginPair[]> => {\n const credential = getDefaultCredential();\n return requestPrivate<IMarginPair[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/margin/allPairs',\n params,\n );\n};\n\n/**\n * Get a future hourly interest rate\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Get-a-future-hourly-interest-rate\n */\nexport const getMarginNextHourlyInterestRate = (params: {\n assets: string;\n isIsolated: boolean;\n}): Promise<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/next-hourly-interest-rate', params);\n};\n\n/**\n * Query Margin Interest Rate History\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History\n */\nexport const getMarginInterestRateHistory = (params: {\n asset: string;\n vipLevel?: number;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/interestRateHistory', params);\n};\n\n/**\n *获取用户持仓\n * @param credential\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-assets#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0\n * @param params\n * @returns\n */\nexport const getUserAsset = (\n credential: ICredential,\n params: {\n timestamp: number;\n asset?: string;\n needBtcValuation?: boolean;\n recvWindow?: number;\n },\n) => {\n return requestPrivate<\n | {\n asset: string;\n free: string;\n locked: string;\n freeze: string;\n withdrawing: string;\n ipoable: string;\n btcValuation: string;\n }[]\n | IApiError\n >(credential, 'POST', 'https://api.binance.com/sapi/v3/asset/getUserAsset', params);\n};\n\n/**\n * 查询资金账户\n * @param credential\n * https://developers.binance.com/docs/zh-CN/wallet/asset/funding-wallet?utm_source=chatgpt.com\n * @param params\n * @returns\n */\nexport const getFundingAsset = (\n credential: ICredential,\n params: {\n timestamp: number;\n asset?: string;\n needBtcValuation?: boolean;\n recvWindow?: number;\n },\n) => {\n return requestPrivate<\n | {\n asset: string;\n free: string;\n locked: string;\n freeze: string;\n withdrawing: string;\n ipoable: string;\n btcValuation: string;\n }[]\n | IApiError\n >(credential, 'POST', 'https://api.binance.com/sapi/v1/asset/get-funding-asset', params);\n};\n"]}
@@ -53,4 +53,10 @@ export const getSpotBookTicker = (params) => requestPublic('GET', 'https://api.b
53
53
  * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/general-endpoints#%E4%BA%A4%E6%98%93%E8%A7%84%E8%8C%83%E4%BF%A1%E6%81%AF
54
54
  */
55
55
  export const getSpotExchangeInfo = () => requestPublic('GET', 'https://api.binance.com/api/v3/exchangeInfo');
56
+ /**
57
+ * 获取当前现货报价
58
+ *
59
+ *https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints#%E6%9C%80%E6%96%B0%E4%BB%B7%E6%A0%BC%E6%8E%A5%E5%8F%A3
60
+ */
61
+ export const getSpotTickerPrice = (params) => requestPublic('GET', 'https://api.binance.com/api/v3/ticker/price', params);
56
62
  //# sourceMappingURL=public-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAgGzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAiC,EAAE,CACtE,aAAa,CAAsB,KAAK,EAAE,+CAA+C,CAAC,CAAC;AAE7F;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAKpC,EAAsC,EAAE,CACvC,aAAa,CAA4B,KAAK,EAAE,8CAA8C,EAAE,MAAM,CAAC,CAAC;AAE1G;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAA2B,EAAuC,EAAE,CACxG,aAAa,CAA6B,KAAK,EAAE,+CAA+C,EAAE,MAAM,CAAC,CAAC;AAE5G;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAA4B,EAAqC,EAAE,CACrG,aAAa,CACX,KAAK,EACL,oDAAoD,EACpD,MAAM,CACP,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAA0B,EAAgC,EAAE,CAChG,aAAa,CAAsB,KAAK,EAAE,+CAA+C,EAAE,MAAM,CAAC,CAAC;AASrG;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA4B,EAAmC,EAAE,CACjG,aAAa,CAAyB,KAAK,EAAE,kDAAkD,EAAE,MAAM,CAAC,CAAC;AAwC3G;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAA+B,EAAE,CAClE,aAAa,CAAoB,KAAK,EAAE,6CAA6C,CAAC,CAAC","sourcesContent":["import { requestPublic } from './client';\n\nexport interface IFutureExchangeFilter extends Record<string, string | number | boolean | undefined> {\n filterType: string;\n}\n\nexport interface IFutureExchangeSymbol {\n symbol: string;\n pair: string;\n contractType: string;\n deliveryDate: number;\n onboardDate: number;\n status: string;\n maintMarginPercent: string;\n requiredMarginPercent: string;\n baseAsset: string;\n quoteAsset: string;\n marginAsset: string;\n pricePrecision: number;\n quantityPrecision: number;\n baseAssetPrecision: number;\n quotePrecision: number;\n underlyingType: string;\n underlyingSubType: string[];\n settlePlan: number;\n triggerProtect: string;\n liquidationFee: string;\n marketTakeBound: string;\n maxMoveOrderLimit: number;\n filters: IFutureExchangeFilter[];\n orderTypes: string[];\n timeInForce: string[];\n}\n\nexport interface IFutureExchangeInfo {\n timezone: string;\n serverTime: number;\n futuresType: string;\n rateLimits: {\n rateLimitType: string;\n interval: string;\n intervalNum: number;\n limit: number;\n }[];\n exchangeFilters: unknown[];\n assets: {\n asset: string;\n marginAvailable: boolean;\n autoAssetExchange: string;\n }[];\n symbols: IFutureExchangeSymbol[];\n}\n\nexport interface IFutureFundingRateEntry {\n symbol: string;\n fundingTime: number;\n fundingRate: string;\n markPrice: string;\n}\n\nexport interface IFuturePremiumIndexEntry {\n symbol: string;\n markPrice: string;\n indexPrice: string;\n estimatedSettlePrice: string;\n lastFundingRate: string;\n interestRate: string;\n nextFundingTime: number;\n time: number;\n}\n\nexport interface IFutureBookTickerEntry {\n symbol: string;\n bidPrice: string;\n bidQty: string;\n askPrice: string;\n askQty: string;\n time: number;\n}\n\nexport interface IFutureOpenInterest {\n openInterest: string;\n symbol: string;\n time: number;\n}\n\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取交易规则和交易对\n *\n * https://binance-docs.github.io/apidocs/futures/cn/#0f3f2d5ee7\n */\nexport const getFutureExchangeInfo = (): Promise<IFutureExchangeInfo> =>\n requestPublic<IFutureExchangeInfo>('GET', 'https://fapi.binance.com/fapi/v1/exchangeInfo');\n\n/**\n * 查询资金费率历史\n *\n * https://binance-docs.github.io/apidocs/futures/cn/#31dbeb24c4\n */\nexport const getFutureFundingRate = (params: {\n symbol?: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<IFutureFundingRateEntry[]> =>\n requestPublic<IFutureFundingRateEntry[]>('GET', 'https://fapi.binance.com/fapi/v1/fundingRate', params);\n\n/**\n * 最新标记价格和资金费率\n *\n * 采集各大交易所数据加权平均\n *\n * 权重: 带symbol为1;不带symbol为10\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price\n */\nexport const getFuturePremiumIndex = (params: { symbol?: string }): Promise<IFuturePremiumIndexEntry[]> =>\n requestPublic<IFuturePremiumIndexEntry[]>('GET', 'https://fapi.binance.com/fapi/v1/premiumIndex', params);\n\n/**\n * 当前最优挂单\n *\n * 返回当前最优的挂单(最高买单,最低卖单)\n *\n * 权重: 单交易对2,无交易对5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Symbol-Order-Book-Ticker\n */\nexport const getFutureBookTicker = (params?: { symbol?: string }): Promise<IFutureBookTickerEntry[]> =>\n requestPublic<IFutureBookTickerEntry[]>(\n 'GET',\n 'https://fapi.binance.com/fapi/v1/ticker/bookTicker',\n params,\n );\n\n/**\n * 获取未平仓合约数\n *\n * 权重: 1\n *\n * 更新速率: 3s\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Open-Interest\n */\nexport const getFutureOpenInterest = (params: { symbol: string }): Promise<IFutureOpenInterest> =>\n requestPublic<IFutureOpenInterest>('GET', 'https://fapi.binance.com/fapi/v1/openInterest', params);\nexport interface ISpotBookTickerEntry {\n symbol: string;\n bidPrice: string;\n bidQty: string;\n askPrice: string;\n askQty: string;\n}\n\n/**\n * 当前最优挂单 (Spot)\n *\n * https://binance-docs.github.io/apidocs/spot/cn/#5393cd0851\n */\nexport const getSpotBookTicker = (params?: { symbol?: string }): Promise<ISpotBookTickerEntry[]> =>\n requestPublic<ISpotBookTickerEntry[]>('GET', 'https://api.binance.com/api/v3/ticker/bookTicker', params);\n\nexport interface ISpotExchangeFilter extends Record<string, string | number | boolean | undefined> {\n filterType: string;\n}\n\nexport interface ISpotExchangeSymbol {\n symbol: string;\n status: string;\n baseAsset: string;\n baseAssetPrecision: number;\n quoteAsset: string;\n quotePrecision: number;\n baseCommissionPrecision: number;\n quoteCommissionPrecision: number;\n orderTypes: string[];\n icebergAllowed: boolean;\n ocoAllowed: boolean;\n quoteOrderQtyMarketAllowed: boolean;\n allowTrailingStop: boolean;\n cancelReplaceAllowed: boolean;\n isSpotTradingAllowed: boolean;\n isMarginTradingAllowed: boolean;\n filters: ISpotExchangeFilter[];\n permissions: string[];\n}\n\nexport interface ISpotExchangeInfo {\n timezone: string;\n serverTime: number;\n rateLimits: {\n rateLimitType: string;\n interval: string;\n intervalNum: number;\n limit: number;\n }[];\n exchangeFilters: unknown[];\n symbols: ISpotExchangeSymbol[];\n}\n\n/**\n * 获取现货交易规则和交易对\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/general-endpoints#%E4%BA%A4%E6%98%93%E8%A7%84%E8%8C%83%E4%BF%A1%E6%81%AF\n */\nexport const getSpotExchangeInfo = (): Promise<ISpotExchangeInfo> =>\n requestPublic<ISpotExchangeInfo>('GET', 'https://api.binance.com/api/v3/exchangeInfo');\n"]}
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAgGzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAiC,EAAE,CACtE,aAAa,CAAsB,KAAK,EAAE,+CAA+C,CAAC,CAAC;AAE7F;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAKpC,EAAsC,EAAE,CACvC,aAAa,CAA4B,KAAK,EAAE,8CAA8C,EAAE,MAAM,CAAC,CAAC;AAE1G;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAA2B,EAAuC,EAAE,CACxG,aAAa,CAA6B,KAAK,EAAE,+CAA+C,EAAE,MAAM,CAAC,CAAC;AAE5G;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAA4B,EAAqC,EAAE,CACrG,aAAa,CACX,KAAK,EACL,oDAAoD,EACpD,MAAM,CACP,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAA0B,EAAgC,EAAE,CAChG,aAAa,CAAsB,KAAK,EAAE,+CAA+C,EAAE,MAAM,CAAC,CAAC;AASrG;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA4B,EAAmC,EAAE,CACjG,aAAa,CAAyB,KAAK,EAAE,kDAAkD,EAAE,MAAM,CAAC,CAAC;AAwC3G;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAA+B,EAAE,CAClE,aAAa,CAAoB,KAAK,EAAE,6CAA6C,CAAC,CAAC;AAEzF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAIlC,EASC,EAAE,CACF,aAAa,CASX,KAAK,EAAE,6CAA6C,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import { requestPublic } from './client';\n\nexport interface IFutureExchangeFilter extends Record<string, string | number | boolean | undefined> {\n filterType: string;\n}\n\nexport interface IFutureExchangeSymbol {\n symbol: string;\n pair: string;\n contractType: string;\n deliveryDate: number;\n onboardDate: number;\n status: string;\n maintMarginPercent: string;\n requiredMarginPercent: string;\n baseAsset: string;\n quoteAsset: string;\n marginAsset: string;\n pricePrecision: number;\n quantityPrecision: number;\n baseAssetPrecision: number;\n quotePrecision: number;\n underlyingType: string;\n underlyingSubType: string[];\n settlePlan: number;\n triggerProtect: string;\n liquidationFee: string;\n marketTakeBound: string;\n maxMoveOrderLimit: number;\n filters: IFutureExchangeFilter[];\n orderTypes: string[];\n timeInForce: string[];\n}\n\nexport interface IFutureExchangeInfo {\n timezone: string;\n serverTime: number;\n futuresType: string;\n rateLimits: {\n rateLimitType: string;\n interval: string;\n intervalNum: number;\n limit: number;\n }[];\n exchangeFilters: unknown[];\n assets: {\n asset: string;\n marginAvailable: boolean;\n autoAssetExchange: string;\n }[];\n symbols: IFutureExchangeSymbol[];\n}\n\nexport interface IFutureFundingRateEntry {\n symbol: string;\n fundingTime: number;\n fundingRate: string;\n markPrice: string;\n}\n\nexport interface IFuturePremiumIndexEntry {\n symbol: string;\n markPrice: string;\n indexPrice: string;\n estimatedSettlePrice: string;\n lastFundingRate: string;\n interestRate: string;\n nextFundingTime: number;\n time: number;\n}\n\nexport interface IFutureBookTickerEntry {\n symbol: string;\n bidPrice: string;\n bidQty: string;\n askPrice: string;\n askQty: string;\n time: number;\n}\n\nexport interface IFutureOpenInterest {\n openInterest: string;\n symbol: string;\n time: number;\n}\n\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取交易规则和交易对\n *\n * https://binance-docs.github.io/apidocs/futures/cn/#0f3f2d5ee7\n */\nexport const getFutureExchangeInfo = (): Promise<IFutureExchangeInfo> =>\n requestPublic<IFutureExchangeInfo>('GET', 'https://fapi.binance.com/fapi/v1/exchangeInfo');\n\n/**\n * 查询资金费率历史\n *\n * https://binance-docs.github.io/apidocs/futures/cn/#31dbeb24c4\n */\nexport const getFutureFundingRate = (params: {\n symbol?: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<IFutureFundingRateEntry[]> =>\n requestPublic<IFutureFundingRateEntry[]>('GET', 'https://fapi.binance.com/fapi/v1/fundingRate', params);\n\n/**\n * 最新标记价格和资金费率\n *\n * 采集各大交易所数据加权平均\n *\n * 权重: 带symbol为1;不带symbol为10\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price\n */\nexport const getFuturePremiumIndex = (params: { symbol?: string }): Promise<IFuturePremiumIndexEntry[]> =>\n requestPublic<IFuturePremiumIndexEntry[]>('GET', 'https://fapi.binance.com/fapi/v1/premiumIndex', params);\n\n/**\n * 当前最优挂单\n *\n * 返回当前最优的挂单(最高买单,最低卖单)\n *\n * 权重: 单交易对2,无交易对5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Symbol-Order-Book-Ticker\n */\nexport const getFutureBookTicker = (params?: { symbol?: string }): Promise<IFutureBookTickerEntry[]> =>\n requestPublic<IFutureBookTickerEntry[]>(\n 'GET',\n 'https://fapi.binance.com/fapi/v1/ticker/bookTicker',\n params,\n );\n\n/**\n * 获取未平仓合约数\n *\n * 权重: 1\n *\n * 更新速率: 3s\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Open-Interest\n */\nexport const getFutureOpenInterest = (params: { symbol: string }): Promise<IFutureOpenInterest> =>\n requestPublic<IFutureOpenInterest>('GET', 'https://fapi.binance.com/fapi/v1/openInterest', params);\nexport interface ISpotBookTickerEntry {\n symbol: string;\n bidPrice: string;\n bidQty: string;\n askPrice: string;\n askQty: string;\n}\n\n/**\n * 当前最优挂单 (Spot)\n *\n * https://binance-docs.github.io/apidocs/spot/cn/#5393cd0851\n */\nexport const getSpotBookTicker = (params?: { symbol?: string }): Promise<ISpotBookTickerEntry[]> =>\n requestPublic<ISpotBookTickerEntry[]>('GET', 'https://api.binance.com/api/v3/ticker/bookTicker', params);\n\nexport interface ISpotExchangeFilter extends Record<string, string | number | boolean | undefined> {\n filterType: string;\n}\n\nexport interface ISpotExchangeSymbol {\n symbol: string;\n status: string;\n baseAsset: string;\n baseAssetPrecision: number;\n quoteAsset: string;\n quotePrecision: number;\n baseCommissionPrecision: number;\n quoteCommissionPrecision: number;\n orderTypes: string[];\n icebergAllowed: boolean;\n ocoAllowed: boolean;\n quoteOrderQtyMarketAllowed: boolean;\n allowTrailingStop: boolean;\n cancelReplaceAllowed: boolean;\n isSpotTradingAllowed: boolean;\n isMarginTradingAllowed: boolean;\n filters: ISpotExchangeFilter[];\n permissions: string[];\n}\n\nexport interface ISpotExchangeInfo {\n timezone: string;\n serverTime: number;\n rateLimits: {\n rateLimitType: string;\n interval: string;\n intervalNum: number;\n limit: number;\n }[];\n exchangeFilters: unknown[];\n symbols: ISpotExchangeSymbol[];\n}\n\n/**\n * 获取现货交易规则和交易对\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/general-endpoints#%E4%BA%A4%E6%98%93%E8%A7%84%E8%8C%83%E4%BF%A1%E6%81%AF\n */\nexport const getSpotExchangeInfo = (): Promise<ISpotExchangeInfo> =>\n requestPublic<ISpotExchangeInfo>('GET', 'https://api.binance.com/api/v3/exchangeInfo');\n\n/**\n * 获取当前现货报价\n *\n *https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints#%E6%9C%80%E6%96%B0%E4%BB%B7%E6%A0%BC%E6%8E%A5%E5%8F%A3\n */\nexport const getSpotTickerPrice = (params?: {\n symbol?: string;\n symbols?: string;\n symbolStatus?: 'TRADING' | 'HALT' | 'BREAK';\n}): Promise<\n | {\n symbol: string;\n price: string;\n }\n | {\n symbol: string;\n price: string;\n }[]\n> =>\n requestPublic<\n | {\n symbol: string;\n price: string;\n }\n | {\n symbol: string;\n price: string;\n }[]\n >('GET', 'https://api.binance.com/api/v3/ticker/price', params);\n"]}
@@ -1,24 +1,57 @@
1
1
  import { makeSpotPosition } from '@yuants/data-account';
2
2
  import { encodePath } from '@yuants/utils';
3
3
  import { isApiError } from '../../api/client';
4
- import { getSpotAccountInfo } from '../../api/private-api';
4
+ import { getFundingAsset, getSpotAccountInfo } from '../../api/private-api';
5
+ import { getSpotTickerPrice } from '../../api/public-api';
5
6
  export const getSpotAccountInfoSnapshot = async (credential) => {
6
- const res = await getSpotAccountInfo(credential, { omitZeroBalances: true });
7
+ const [res, fundingAsset] = await Promise.all([
8
+ getSpotAccountInfo(credential, { omitZeroBalances: true }),
9
+ getFundingAsset(credential, {
10
+ timestamp: Date.now(),
11
+ }),
12
+ ]);
7
13
  if (isApiError(res)) {
8
14
  throw new Error(res.msg);
9
15
  }
10
- const positions = res.balances
16
+ if (isApiError(fundingAsset)) {
17
+ throw new Error(fundingAsset.msg);
18
+ }
19
+ const prices = await getSpotTickerPrice({
20
+ symbols: JSON.stringify([
21
+ ...new Set([
22
+ ...res.balances
23
+ .map((balance) => {
24
+ const match = balance.asset.match(/^LD(\w+)$/);
25
+ let symbol = balance.asset;
26
+ if (match) {
27
+ symbol = match[1];
28
+ }
29
+ if (symbol === 'USDT')
30
+ return '';
31
+ return `${symbol}USDT`;
32
+ })
33
+ .filter(Boolean),
34
+ ...fundingAsset.map((item) => `${item.asset}USDT`),
35
+ ]),
36
+ ]),
37
+ });
38
+ const positions = [...res.balances, ...fundingAsset]
11
39
  .map((balance) => {
40
+ var _a, _b;
12
41
  const volume = +balance.free + +balance.locked;
13
42
  if (!volume)
14
43
  return undefined;
15
44
  const position = makeSpotPosition({
16
45
  position_id: `spot/${balance.asset}`,
17
46
  datasource_id: 'BINANCE',
18
- product_id: encodePath('BINANCE', 'SPOT', `${balance.asset}USDT`),
47
+ product_id: encodePath('BINANCE', 'SPOT', `${balance.asset}`),
19
48
  volume,
20
49
  free_volume: +balance.free,
21
- closable_price: 0, // TODO: fetch price later
50
+ closable_price: balance.asset === 'USDT'
51
+ ? 1
52
+ : Array.isArray(prices)
53
+ ? +((_b = (_a = prices.find((item) => item.symbol === `${balance.asset}USDT`)) === null || _a === void 0 ? void 0 : _a.price) !== null && _b !== void 0 ? _b : 0)
54
+ : 0,
22
55
  });
23
56
  return position;
24
57
  })
@@ -1 +1 @@
1
- {"version":3,"file":"spot.js","sourceRoot":"","sources":["../../../src/services/accounts/spot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAe,MAAM,uBAAuB,CAAC;AAExE,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAAE,UAAuB,EAAwB,EAAE;IAChG,MAAM,GAAG,GAAG,MAAM,kBAAkB,CAAC,UAAU,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7E,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KAC1B;IACD,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ;SAC3B,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;QAC/C,IAAI,CAAC,MAAM;YAAE,OAAO,SAAS,CAAC;QAC9B,MAAM,QAAQ,GAAc,gBAAgB,CAAC;YAC3C,WAAW,EAAE,QAAQ,OAAO,CAAC,KAAK,EAAE;YACpC,aAAa,EAAE,SAAS;YACxB,UAAU,EAAE,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,MAAM,CAAC;YACjE,MAAM;YACN,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI;YAC1B,cAAc,EAAE,CAAC,EAAE,0BAA0B;SAC9C,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,QAAQ,EAAyB,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { IPosition, makeSpotPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { isApiError } from '../../api/client';\nimport { getSpotAccountInfo, ICredential } from '../../api/private-api';\n\nexport const getSpotAccountInfoSnapshot = async (credential: ICredential): Promise<IPosition[]> => {\n const res = await getSpotAccountInfo(credential, { omitZeroBalances: true });\n if (isApiError(res)) {\n throw new Error(res.msg);\n }\n const positions = res.balances\n .map((balance) => {\n const volume = +balance.free + +balance.locked;\n if (!volume) return undefined;\n const position: IPosition = makeSpotPosition({\n position_id: `spot/${balance.asset}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'SPOT', `${balance.asset}USDT`),\n volume,\n free_volume: +balance.free,\n closable_price: 0, // TODO: fetch price later\n });\n return position;\n })\n .filter((position): position is IPosition => Boolean(position));\n return positions;\n};\n"]}
1
+ {"version":3,"file":"spot.js","sourceRoot":"","sources":["../../../src/services/accounts/spot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAe,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAAE,UAAuB,EAAwB,EAAE;IAChG,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5C,kBAAkB,CAAC,UAAU,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;QAC1D,eAAe,CAAC,UAAU,EAAE;YAC1B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KAC1B;IACD,I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AAK,EAAE,CAAC;YAC7D,MAAM;YACN,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI;YAC1B,cAAc,EACZ,OAAO,CAAC,KAAK,KAAK,MAAM;gBACtB,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;oBACvB,CAAC,CAAC,CAAC,CAAC,MAAA,MAAA,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,MAAM,CAAC,0CAAE,KAAK,mCAAI,CAAC,CAAC;oBAC9E,CAAC,CAAC,CAAC;SACR,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,QAAQ,EAAyB,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { IPosition, makeSpotPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { isApiError } from '../../api/client';\nimport { getFundingAsset, getSpotAccountInfo, ICredential } from '../../api/private-api';\nimport { getSpotTickerPrice } from '../../api/public-api';\n\nexport const getSpotAccountInfoSnapshot = async (credential: ICredential): Promise<IPosition[]> => {\n const [res, fundingAsset] = await Promise.all([\n getSpotAccountInfo(credential, { omitZeroBalances: true }),\n getFundingAsset(credential, {\n timestamp: Date.now(),\n }),\n ]);\n\n if (isApiError(res)) {\n throw new Error(res.msg);\n }\n if (isApiError(fundingAsset)) {\n throw new Error(fundingAsset.msg);\n }\n\n const prices = await getSpotTickerPrice({\n symbols: JSON.stringify([\n ...new Set([\n ...res.balances\n .map((balance) => {\n const match = balance.asset.match(/^LD(\\w+)$/);\n let symbol = balance.asset;\n if (match) {\n symbol = match[1];\n }\n if (symbol === 'USDT') return '';\n return `${symbol}USDT`;\n })\n .filter(Boolean),\n ...fundingAsset.map((item) => `${item.asset}USDT`),\n ]),\n ]),\n });\n\n const positions = [...res.balances, ...fundingAsset]\n .map((balance) => {\n const volume = +balance.free + +balance.locked;\n if (!volume) return undefined;\n const position: IPosition = makeSpotPosition({\n position_id: `spot/${balance.asset}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'SPOT', `${balance.asset}`),\n volume,\n free_volume: +balance.free,\n closable_price:\n balance.asset === 'USDT'\n ? 1\n : Array.isArray(prices)\n ? +(prices.find((item) => item.symbol === `${balance.asset}USDT`)?.price ?? 0)\n : 0,\n });\n return position;\n })\n .filter((position): position is IPosition => Boolean(position));\n return positions;\n};\n"]}
@@ -1,6 +1,8 @@
1
+ import { makeSpotPosition } from '@yuants/data-account';
1
2
  import { encodePath } from '@yuants/utils';
2
3
  import { isApiError } from '../../api/client';
3
4
  import { getUnifiedAccountBalance, getUnifiedUmAccount } from '../../api/private-api';
5
+ import { getSpotTickerPrice } from '../../api/public-api';
4
6
  export const getUnifiedAccountInfo = async (credential) => {
5
7
  const [balanceRes, umAccountRes] = await Promise.all([
6
8
  getUnifiedAccountBalance(credential),
@@ -34,6 +36,39 @@ export const getUnifiedAccountInfo = async (credential) => {
34
36
  (+position.entryPrice +
35
37
  (+position.positionAmt === 0 ? 0 : +position.unrealizedProfit / +position.positionAmt)),
36
38
  }));
37
- return positions;
39
+ const prices = await getSpotTickerPrice({
40
+ symbols: JSON.stringify([
41
+ ...new Set([
42
+ ...balanceRes
43
+ .map((balance) => {
44
+ const match = balance.asset.match(/^LD(\w+)$/);
45
+ let symbol = balance.asset;
46
+ if (match) {
47
+ symbol = match[1];
48
+ }
49
+ if (symbol === 'USDT')
50
+ return '';
51
+ return `${symbol}USDT`;
52
+ })
53
+ .filter(Boolean),
54
+ ]),
55
+ ]),
56
+ });
57
+ const balancePositions = balanceRes.map((position) => {
58
+ var _a, _b;
59
+ return makeSpotPosition({
60
+ position_id: `UNIFIED-SPOT/${position.asset}`,
61
+ datasource_id: 'BINANCE',
62
+ product_id: encodePath('BINANCE', 'UNIFIED-SPOT', position.asset),
63
+ volume: +position.totalWalletBalance + +position.umUnrealizedPNL,
64
+ free_volume: +position.crossMarginFree,
65
+ closable_price: position.asset === 'USDT'
66
+ ? 1
67
+ : Array.isArray(prices)
68
+ ? +((_b = (_a = prices.find((item) => item.symbol === `${position.asset}USDT`)) === null || _a === void 0 ? void 0 : _a.price) !== null && _b !== void 0 ? _b : 0)
69
+ : 0,
70
+ });
71
+ });
72
+ return [...balancePositions, ...positions];
38
73
  };
39
74
  //# sourceMappingURL=unified.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAe,MAAM,uBAAuB,CAAC;AAEnG,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EAAE,UAAuB,EAAwB,EAAE;IAC3F,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACnD,wBAAwB,CAAC,UAAU,CAAC;QACpC,mBAAmB,CAAC,UAAU,CAAC;KAChC,CAAC,CAAC;IACH,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KACjC;IACD,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;KACnC;IAED,MAAM,SAAS,GAAgB,YAAY,CAAC,SAAS;SAClD,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,KAAK,CAAC,CAAC;SACjD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClB,WAAW,EAAE,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,YAAY,EAAE;QAC1D,aAAa,EAAE,SAAS;QACxB,UAAU,EAAE,UAAU,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC;QACjE,SAAS,EACP,QAAQ,CAAC,YAAY,KAAK,MAAM;YAC9B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,QAAQ,CAAC,YAAY,KAAK,OAAO;gBACnC,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,QAAQ,CAAC,YAAY,KAAK,MAAM;oBAClC,CAAC,CAAC,MAAM;oBACR,CAAC,CAAC,SAAS;QACf,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW;QAC7B,WAAW,EAAE,CAAC,QAAQ,CAAC,WAAW;QAClC,cAAc,EAAE,CAAC,QAAQ,CAAC,UAAU;QACpC,cAAc,EAAE,CAAC,QAAQ,CAAC,UAAU,GAAG,CAAC,QAAQ,CAAC,gBAAgB,GAAG,CAAC,QAAQ,CAAC,WAAW;QACzF,eAAe,EAAE,CAAC,QAAQ,CAAC,gBAAgB;QAC3C,SAAS,EACP,CAAC,QAAQ,CAAC,WAAW;YACrB,CAAC,CAAC,QAAQ,CAAC,UAAU;gBACnB,CAAC,CAAC,QAAQ,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;KAC5F,CAAC,CAAC,CAAC;IAEN,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { IPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { isApiError } from '../../api/client';\nimport { getUnifiedAccountBalance, getUnifiedUmAccount, ICredential } from '../../api/private-api';\n\nexport const getUnifiedAccountInfo = async (credential: ICredential): Promise<IPosition[]> => {\n const [balanceRes, umAccountRes] = await Promise.all([\n getUnifiedAccountBalance(credential),\n getUnifiedUmAccount(credential),\n ]);\n if (isApiError(balanceRes)) {\n throw new Error(balanceRes.msg);\n }\n if (isApiError(umAccountRes)) {\n throw new Error(umAccountRes.msg);\n }\n\n const positions: IPosition[] = umAccountRes.positions\n .filter((position) => +position.positionAmt !== 0)\n .map((position) => ({\n position_id: `${position.symbol}/${position.positionSide}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'USDT-FUTURE', position.symbol),\n direction:\n position.positionSide === 'LONG'\n ? 'LONG'\n : position.positionSide === 'SHORT'\n ? 'SHORT'\n : position.positionSide === 'BOTH'\n ? 'BOTH'\n : 'UNKNOWN',\n volume: +position.positionAmt,\n free_volume: +position.positionAmt,\n position_price: +position.entryPrice,\n closable_price: +position.entryPrice + +position.unrealizedProfit / +position.positionAmt,\n floating_profit: +position.unrealizedProfit,\n valuation:\n +position.positionAmt *\n (+position.entryPrice +\n (+position.positionAmt === 0 ? 0 : +position.unrealizedProfit / +position.positionAmt)),\n }));\n\n return positions;\n};\n"]}
1
+ {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAe,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EAAE,UAAuB,EAAwB,EAAE;IAC3F,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACnD,wBAAwB,CAAC,UAAU,CAAC;QACpC,mBAAmB,CAAC,UAAU,CAAC;KAChC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AAM,CAAC;oBACvB,CAAC,CAAC,CAAC,CAAC,MAAA,MAAA,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,MAAM,CAAC,0CAAE,KAAK,mCAAI,CAAC,CAAC;oBAC/E,CAAC,CAAC,CAAC;SACR,CAAC,CAAA;KAAA,CACH,CAAC;IACF,OAAO,CAAC,GAAG,gBAAgB,EAAE,GAAG,SAAS,CAAC,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["import { IPosition, makeSpotPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { isApiError } from '../../api/client';\nimport { getUnifiedAccountBalance, getUnifiedUmAccount, ICredential } from '../../api/private-api';\nimport { getSpotTickerPrice } from '../../api/public-api';\n\nexport const getUnifiedAccountInfo = async (credential: ICredential): Promise<IPosition[]> => {\n const [balanceRes, umAccountRes] = await Promise.all([\n getUnifiedAccountBalance(credential),\n getUnifiedUmAccount(credential),\n ]);\n if (isApiError(balanceRes)) {\n throw new Error(balanceRes.msg);\n }\n if (isApiError(umAccountRes)) {\n throw new Error(umAccountRes.msg);\n }\n\n const positions: IPosition[] = umAccountRes.positions\n .filter((position) => +position.positionAmt !== 0)\n .map((position) => ({\n position_id: `${position.symbol}/${position.positionSide}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'USDT-FUTURE', position.symbol),\n direction:\n position.positionSide === 'LONG'\n ? 'LONG'\n : position.positionSide === 'SHORT'\n ? 'SHORT'\n : position.positionSide === 'BOTH'\n ? 'BOTH'\n : 'UNKNOWN',\n volume: +position.positionAmt,\n free_volume: +position.positionAmt,\n position_price: +position.entryPrice,\n closable_price: +position.entryPrice + +position.unrealizedProfit / +position.positionAmt,\n floating_profit: +position.unrealizedProfit,\n valuation:\n +position.positionAmt *\n (+position.entryPrice +\n (+position.positionAmt === 0 ? 0 : +position.unrealizedProfit / +position.positionAmt)),\n }));\n\n const prices = await getSpotTickerPrice({\n symbols: JSON.stringify([\n ...new Set([\n ...balanceRes\n .map((balance) => {\n const match = balance.asset.match(/^LD(\\w+)$/);\n let symbol = balance.asset;\n if (match) {\n symbol = match[1];\n }\n if (symbol === 'USDT') return '';\n return `${symbol}USDT`;\n })\n .filter(Boolean),\n ]),\n ]),\n });\n const balancePositions: IPosition[] = balanceRes.map((position) =>\n makeSpotPosition({\n position_id: `UNIFIED-SPOT/${position.asset}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'UNIFIED-SPOT', position.asset),\n volume: +position.totalWalletBalance + +position.umUnrealizedPNL,\n free_volume: +position.crossMarginFree,\n closable_price:\n position.asset === 'USDT'\n ? 1\n : Array.isArray(prices)\n ? +(prices.find((item) => item.symbol === `${position.asset}USDT`)?.price ?? 0)\n : 0,\n }),\n );\n return [...balancePositions, ...positions];\n};\n"]}
@@ -571,4 +571,46 @@ export declare const getMarginInterestRateHistory: (params: {
571
571
  timestamp: number;
572
572
  vipLevel: number;
573
573
  }[]>;
574
+ /**
575
+ *获取用户持仓
576
+ * @param credential
577
+ * https://developers.binance.com/docs/zh-CN/wallet/asset/user-assets#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0
578
+ * @param params
579
+ * @returns
580
+ */
581
+ export declare const getUserAsset: (credential: ICredential, params: {
582
+ timestamp: number;
583
+ asset?: string;
584
+ needBtcValuation?: boolean;
585
+ recvWindow?: number;
586
+ }) => Promise<IApiError | {
587
+ asset: string;
588
+ free: string;
589
+ locked: string;
590
+ freeze: string;
591
+ withdrawing: string;
592
+ ipoable: string;
593
+ btcValuation: string;
594
+ }[]>;
595
+ /**
596
+ * 查询资金账户
597
+ * @param credential
598
+ * https://developers.binance.com/docs/zh-CN/wallet/asset/funding-wallet?utm_source=chatgpt.com
599
+ * @param params
600
+ * @returns
601
+ */
602
+ export declare const getFundingAsset: (credential: ICredential, params: {
603
+ timestamp: number;
604
+ asset?: string;
605
+ needBtcValuation?: boolean;
606
+ recvWindow?: number;
607
+ }) => Promise<IApiError | {
608
+ asset: string;
609
+ free: string;
610
+ locked: string;
611
+ freeze: string;
612
+ withdrawing: string;
613
+ ipoable: string;
614
+ btcValuation: string;
615
+ }[]>;
574
616
  //# sourceMappingURL=private-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"private-api.d.ts","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,SAAS,EAAE,WAAW,EAAkB,MAAM,UAAU,CAAC;AACxF,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,wBAAwB,EAAE,MAAM,CAAC;IACjC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,QAAQ,EAAE,MAAM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MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;WAIY,MAAM;UACP,MAAM;YACJ,MAAM;YACN,MAAM;iBACD,MAAM;aACV,MAAM;kBACD,MAAM;IAI3B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMarginInterestRateHistory = exports.getMarginNextHourlyInterestRate = exports.getMarginAllPairs = exports.putUmOrder = exports.postSpotOrderCancelReplace = exports.getUMIncome = exports.deleteUmOrder = exports.postUmOrder = exports.getDepositHistory = exports.getWithdrawHistory = exports.postWithdraw = exports.getSubAccountList = exports.getDepositAddress = exports.postUnifiedAccountAutoCollection = exports.postAssetTransfer = exports.deleteSpotOrder = exports.postSpotOrder = exports.getSpotOpenOrders = exports.getSpotAccountInfo = exports.getUnifiedAccountBalance = exports.getUnifiedUmOpenOrders = exports.getUnifiedUmAccount = exports.getUnifiedAccountInfo = void 0;
3
+ exports.getFundingAsset = exports.getUserAsset = exports.getMarginInterestRateHistory = exports.getMarginNextHourlyInterestRate = exports.getMarginAllPairs = exports.putUmOrder = exports.postSpotOrderCancelReplace = exports.getUMIncome = exports.deleteUmOrder = exports.postUmOrder = exports.getDepositHistory = exports.getWithdrawHistory = exports.postWithdraw = exports.getSubAccountList = exports.getDepositAddress = exports.postUnifiedAccountAutoCollection = exports.postAssetTransfer = exports.deleteSpotOrder = exports.postSpotOrder = exports.getSpotOpenOrders = exports.getSpotAccountInfo = exports.getUnifiedAccountBalance = exports.getUnifiedUmOpenOrders = exports.getUnifiedUmAccount = exports.getUnifiedAccountInfo = void 0;
4
4
  const client_1 = require("./client");
5
5
  /**
6
6
  * 查询账户信息(USER_DATA)
@@ -230,4 +230,26 @@ const getMarginInterestRateHistory = (params) => {
230
230
  return (0, client_1.requestPrivate)(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/interestRateHistory', params);
231
231
  };
232
232
  exports.getMarginInterestRateHistory = getMarginInterestRateHistory;
233
+ /**
234
+ *获取用户持仓
235
+ * @param credential
236
+ * https://developers.binance.com/docs/zh-CN/wallet/asset/user-assets#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0
237
+ * @param params
238
+ * @returns
239
+ */
240
+ const getUserAsset = (credential, params) => {
241
+ return (0, client_1.requestPrivate)(credential, 'POST', 'https://api.binance.com/sapi/v3/asset/getUserAsset', params);
242
+ };
243
+ exports.getUserAsset = getUserAsset;
244
+ /**
245
+ * 查询资金账户
246
+ * @param credential
247
+ * https://developers.binance.com/docs/zh-CN/wallet/asset/funding-wallet?utm_source=chatgpt.com
248
+ * @param params
249
+ * @returns
250
+ */
251
+ const getFundingAsset = (credential, params) => {
252
+ return (0, client_1.requestPrivate)(credential, 'POST', 'https://api.binance.com/sapi/v1/asset/get-funding-asset', params);
253
+ };
254
+ exports.getFundingAsset = getFundingAsset;
233
255
  //# sourceMappingURL=private-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":";;;AAAA,qCAAwF;AAsOxF;;;;;;;;GAQG;AACI,MAAM,qBAAqB,GAAG,CAAC,UAAuB,EAA4C,EAAE,CACzG,IAAA,uBAAc,EACZ,UAAU,EACV,KAAK,EACL,0CAA0C,CAC3C,CAAC;AALS,QAAA,qBAAqB,yBAK9B;AAEJ;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,CAAC,UAAuB,EAA0C,EAAE,CACrG,IAAA,uBAAc,EACZ,UAAU,EACV,KAAK,EACL,6CAA6C,CAC9C,CAAC;AALS,QAAA,mBAAmB,uBAK5B;AAEJ;;;;;;;;GAQG;AACI,MAAM,sBAAsB,GAAG,CACpC,UAAuB,EACvB,MAEC,EAC+B,EAAE,CAClC,IAAA,uBAAc,EACZ,UAAU,EACV,KAAK,EACL,gDAAgD,EACh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E,kEAAkE,EAAE,MAAM,CAAC,CAAC;AACnG,CAAC,CAAC;AAhBW,QAAA,+BAA+B,mCAgB1C;AAEF;;;;GAIG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAM5C,EAOC,EAAE;IACF,MAAM,UAAU,GAAG,IAAA,6BAAoB,GAAE,CAAC;IAC1C,OAAO,IAAA,uBAAc,EAOnB,UAAU,EAAE,KAAK,EAAE,4DAA4D,EAAE,MAAM,CAAC,CAAC;AAC7F,CAAC,CAAC;AAvBW,QAAA,4BAA4B,gCAuBvC","sourcesContent":["import { getDefaultCredential, IApiError, ICredential, requestPrivate } from './client';\nexport type { ICredential };\n\nexport interface IUnifiedAccountInfo {\n uniMMR: string;\n accountEquity: string;\n actualEquity: string;\n accountInitialMargin: string;\n accountMaintMargin: string;\n accountStatus: string;\n virtualMaxWithdrawAmount: string;\n totalAvailableBalance: string;\n totalMarginOpenLoss: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAsset {\n asset: string;\n crossWalletBalance: string;\n crossUnPnl: string;\n maintMargin: string;\n initialMargin: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmPosition {\n symbol: string;\n initialMargin: string;\n maintMargin: string;\n unrealizedProfit: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n leverage: string;\n entryPrice: string;\n maxNotional: string;\n bidNotional: string;\n askNotional: string;\n positionSide: string;\n positionAmt: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAccount {\n assets: IUnifiedUmAsset[];\n positions: IUnifiedUmPosition[];\n}\n\nexport interface IUnifiedUmOpenOrder {\n avgPrice: string;\n clientOrderId: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n origQty: string;\n origType: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n time: number;\n timeInForce: string;\n type: string;\n updateTime: number;\n selfTradePreventionMode: string;\n goodTillDate: number;\n}\n\nexport interface IUnifiedAccountBalanceEntry {\n asset: string;\n totalWalletBalance: string;\n crossMarginAsset: string;\n crossMarginBorrowed: string;\n crossMarginFree: string;\n crossMarginInterest: string;\n crossMarginLocked: string;\n umWalletBalance: string;\n umUnrealizedPNL: string;\n cmWalletBalance: string;\n cmUnrealizedPNL: string;\n updateTime: number;\n}\n\nexport interface ISpotAccountInfo {\n makerCommission: number;\n takerCommission: number;\n buyerCommission: number;\n sellerCommission: number;\n commissionRates: {\n maker: string;\n taker: string;\n buyer: string;\n seller: string;\n };\n canTrade: boolean;\n canWithdraw: boolean;\n canDeposit: boolean;\n brokered: boolean;\n requireSelfTradePrevention: boolean;\n preventSor: boolean;\n updateTime: number;\n balances: {\n asset: string;\n free: string;\n locked: string;\n }[];\n permissions: string[];\n uid: number;\n}\n\nexport interface ISpotOrder {\n symbol: string;\n orderId: number;\n orderListId: number;\n clientOrderId: string;\n price: string;\n origQty: string;\n executedQty: string;\n origQuoteOrderQty: string;\n cummulativeQuoteQty: string;\n status: string;\n timeInForce: string;\n type: string;\n side: string;\n stopPrice: string;\n icebergQty: string;\n time: number;\n updateTime: number;\n isWorking: boolean;\n}\n\nexport interface ISpotNewOrderResponse {\n symbol: string;\n orderId: number;\n clientOrderId: string;\n transactTime: number;\n}\n\nexport interface IAssetTransferResponse {\n tranId: number;\n}\n\nexport interface IDepositAddress {\n address: string;\n coin: string;\n tag: string;\n url: string;\n}\n\nexport interface ISubAccountSummary {\n email: string;\n isFreeze: boolean;\n createTime: number;\n isManagedSubAccount: boolean;\n isAssetManagementSubAccount: boolean;\n}\n\nexport interface ISubAccountListResponse {\n subAccounts: ISubAccountSummary[];\n}\n\nexport interface IWithdrawRecord {\n id: string;\n amount: string;\n transactionFee: string;\n coin: string;\n status: number;\n address: string;\n txId: string;\n applyTime: Date;\n network: string;\n transferType: number;\n info: string;\n confirmNo: number;\n walletType: number;\n txKey: string;\n completeTime: Date;\n}\n\nexport interface IDepositRecord {\n id: string;\n amount: string;\n coin: string;\n network: string;\n status: number;\n address: string;\n addressTag: string;\n txId: string;\n insertTime: number;\n transferType: number;\n confirmTimes: string;\n unlockConfirm: number;\n walletType: number;\n}\n\nexport interface IUnifiedUmOrderResponse {\n clientOrderId: string;\n cumQty: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n avgPrice: string;\n origQty: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n timeInForce: string;\n type: string;\n selfTradePreventionMode: string;\n goodTillDate: number;\n updateTime: number;\n}\n\nexport interface IUMIncomeRecord {\n symbol: string;\n incomeType: string;\n income: string;\n asset: string;\n info: string;\n time: number;\n tranId: string;\n tradeId: string;\n}\n\n/**\n * 查询账户信息(USER_DATA)\n *\n * 查询账户信息\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Information\n */\nexport const getUnifiedAccountInfo = (credential: ICredential): Promise<IUnifiedAccountInfo | IApiError> =>\n requestPrivate<IUnifiedAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/account',\n );\n\n/**\n * 获取UM账户信息\n *\n * 现有UM账户资产和仓位信息\n *\n * 权重: 5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Account-Detail\n */\nexport const getUnifiedUmAccount = (credential: ICredential): Promise<IUnifiedUmAccount | IApiError> =>\n requestPrivate<IUnifiedUmAccount | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/account',\n );\n\n/**\n * 查看当前全部UM挂单(USER_DATA)\n *\n * 查看当前全部UM挂单,请小心使用不带symbol参数的调用\n *\n * 权重: 带symbol 1 - 不带 40\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders\n */\nexport const getUnifiedUmOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<IUnifiedUmOpenOrder[]> =>\n requestPrivate<IUnifiedUmOpenOrder[]>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/openOrders',\n params,\n );\n\n/**\n * 查询账户余额(USER_DATA)\n *\n * 查询账户余额\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Balance\n */\nexport const getUnifiedAccountBalance = (\n credential: ICredential,\n params?: {\n assets?: string;\n },\n): Promise<IUnifiedAccountBalanceEntry[] | IApiError> =>\n requestPrivate<IUnifiedAccountBalanceEntry[] | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/balance',\n params,\n );\n\n/**\n * 账户信息 (USER_DATA)\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api#%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF-user_data\n */\nexport const getSpotAccountInfo = (\n credential: ICredential,\n params?: {\n omitZeroBalances?: boolean;\n },\n): Promise<ISpotAccountInfo | IApiError> =>\n requestPrivate<ISpotAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/account',\n params,\n );\n\n/**\n * Current open orders (USER_DATA)\n *\n * 权重: 带symbol: 6 不带: 80\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/account-endpoints#%E6%9F%A5%E7%9C%8B%E8%B4%A6%E6%88%B7%E5%BD%93%E5%89%8D%E6%8C%82%E5%8D%95-user_data\n */\nexport const getSpotOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<ISpotOrder[] | IApiError> =>\n requestPrivate<ISpotOrder[] | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/openOrders',\n params,\n );\n\n/**\n * New order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * Cancel order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E8%AE%A2%E5%8D%95-trade\n */\nexport const deleteSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n newClientOrderId?: string;\n cancelRestrictions?: string;\n },\n): Promise<ISpotOrder | IApiError> =>\n requestPrivate<ISpotOrder | IApiError>(\n credential,\n 'DELETE',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * 用户万向划转(USER_DATA)\n *\n * 用户万向划转\n *\n * 您需要开通api key 允许万向划转权限来调用此接口。\n *\n * 权重: 900\n *\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-universal-transfer\n */\nexport const postAssetTransfer = (\n credential: ICredential,\n params: {\n type: string;\n asset: string;\n amount: number;\n fromSymbol?: string;\n toSymbol?: string;\n },\n): Promise<IAssetTransferResponse | IApiError> =>\n requestPrivate<IAssetTransferResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/asset/transfer',\n params,\n );\n\n/**\n * 统一账户资金归集(TRADE)\n *\n * 资金归集到统一账户钱包\n *\n * 权重: 750\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Fund-Auto-collection\n *\n * ISSUE(2024-07-18): 目前这是唯一能够将资金从原 U 本位合约账户转入统一账户的接口。\n */\nexport const postUnifiedAccountAutoCollection = (credential: ICredential): Promise<{ msg: string }> =>\n requestPrivate<{ msg: string }>(credential, 'POST', 'https://papi.binance.com/papi/v1/auto-collection');\n\n/**\n * 获取充值地址(支持多网络)(USER_DATA)\n *\n * 获取充值地址\n *\n * 权重: 10\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-address\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n coin: string;\n network?: string;\n amount?: number;\n },\n): Promise<IDepositAddress> =>\n requestPrivate<IDepositAddress>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/address',\n params,\n );\n\n/**\n * 查询子账户列表(适用主账户)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/sub_account/account-management/Query-Sub-account-List\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n email?: string;\n isFreeze?: number;\n page?: number;\n limit?: number;\n },\n): Promise<ISubAccountListResponse | IApiError> =>\n requestPrivate<ISubAccountListResponse | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/sub-account/list',\n params,\n );\n\n/**\n * 提币(USER_DATA)\n *\n * 权重: 600\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n coin: string;\n withdrawOrderId?: string;\n network?: string;\n address: string;\n addressTag?: string;\n amount: number;\n transactionFeeFlag?: boolean;\n name?: string;\n walletType?: number;\n },\n): Promise<{ id: string } | IApiError> =>\n requestPrivate<{ id: string } | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/capital/withdraw/apply',\n params,\n );\n\n/**\n * 获取提币历史(支持多网络)(USER_DATA)\n *\n * 获取提币历史 (支持多网络)\n *\n * 请求权重(IP)#\n * 18000 请求限制: 每秒10次\n *\n * 本接口特别采用每秒UID速率限制,用户的总秒级 UID 速率限制为180000/秒。从该接口收到的响应包含key X-SAPI-USED-UID-WEIGHT-1S,该key定义了当前 UID 使用的权重\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw-history\n */\nexport const getWithdrawHistory = (\n credential: ICredential,\n params?: {\n coin?: string;\n withdrawOrderId?: string;\n status?: number;\n offset?: number;\n limit?: number;\n startTime?: number;\n endTime?: number;\n },\n): Promise<IWithdrawRecord[]> =>\n requestPrivate<IWithdrawRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/withdraw/history',\n params,\n );\n\n/**\n * 获取充值历史(支持多网络)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-history\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n includeSource?: boolean;\n coin?: string;\n status?: number;\n startTime?: number;\n endTime?: number;\n offset?: number;\n limit?: number;\n txId?: string;\n },\n): Promise<IDepositRecord[]> =>\n requestPrivate<IDepositRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/hisrec',\n params,\n );\n\n/**\n * UM下单(TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/New-UM-Order\n */\nexport const postUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n positionSide?: string;\n type: string;\n timeInForce?: string;\n quantity: number;\n reduceOnly?: string;\n price?: number;\n newClientOrderId?: string;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n goodTillDate?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\nexport const deleteUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'DELETE',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\n/**\n * 获取UM损益资金流水(USER_DATA)\n *\n * 权重: 30\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Income-History\n */\nexport const getUMIncome = (\n credential: ICredential,\n params?: {\n symbol?: string;\n incomeType?: string;\n startTime?: number;\n endTime?: number;\n recvWindow?: number;\n limit?: number;\n timestamp?: number;\n },\n): Promise<IUMIncomeRecord[]> =>\n requestPrivate<IUMIncomeRecord[]>(credential, 'GET', 'https://api.binance.com/papi/v1/um/income', params);\n\n/**\n * Cancel an Existing Order and Send a New Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E5%B9%B6%E9%87%8D%E6%96%B0%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrderCancelReplace = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n cancelReplaceMode: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n cancelNewClientOrderId?: string;\n cancelOrigClientOrderId?: string;\n cancelOrderId?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order/cancelReplace',\n params,\n );\n\n/**\n * Modify Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Modify-UM-Order\n */\nexport const putUmOrder = (\n credential: ICredential,\n params: {\n orderId?: number;\n origClientOrderId?: string;\n symbol: string;\n side: string;\n quantity?: number;\n price?: number;\n priceMatch?: string;\n recvWindow?: number;\n timestamp?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'PUT',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取所有全仓杠杆交易对(MARKET_DATA)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/market-data/Get-All-Cross-Margin-Pairs\n */\nexport const getMarginAllPairs = (params?: { symbol?: string }): Promise<IMarginPair[]> => {\n const credential = getDefaultCredential();\n return requestPrivate<IMarginPair[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/margin/allPairs',\n params,\n );\n};\n\n/**\n * Get a future hourly interest rate\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Get-a-future-hourly-interest-rate\n */\nexport const getMarginNextHourlyInterestRate = (params: {\n assets: string;\n isIsolated: boolean;\n}): Promise<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/next-hourly-interest-rate', params);\n};\n\n/**\n * Query Margin Interest Rate History\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History\n */\nexport const getMarginInterestRateHistory = (params: {\n asset: string;\n vipLevel?: number;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/interestRateHistory', params);\n};\n"]}
1
+ {"version":3,"file":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AM,EAAE,yDAAyD,EAAE,MAAM,CAAC,CAAC;AAC3F,CAAC,CAAC;AArBW,QAAA,eAAe,mBAqB1B","sourcesContent":["import { getDefaultCredential, IApiError, ICredential, requestPrivate } from './client';\nexport type { ICredential };\n\nexport interface IUnifiedAccountInfo {\n uniMMR: string;\n accountEquity: string;\n actualEquity: string;\n accountInitialMargin: string;\n accountMaintMargin: string;\n accountStatus: string;\n virtualMaxWithdrawAmount: string;\n totalAvailableBalance: string;\n totalMarginOpenLoss: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAsset {\n asset: string;\n crossWalletBalance: string;\n crossUnPnl: string;\n maintMargin: string;\n initialMargin: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmPosition {\n symbol: string;\n initialMargin: string;\n maintMargin: string;\n unrealizedProfit: string;\n positionInitialMargin: string;\n openOrderInitialMargin: string;\n leverage: string;\n entryPrice: string;\n maxNotional: string;\n bidNotional: string;\n askNotional: string;\n positionSide: string;\n positionAmt: string;\n updateTime: number;\n}\n\nexport interface IUnifiedUmAccount {\n assets: IUnifiedUmAsset[];\n positions: IUnifiedUmPosition[];\n}\n\nexport interface IUnifiedUmOpenOrder {\n avgPrice: string;\n clientOrderId: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n origQty: string;\n origType: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n time: number;\n timeInForce: string;\n type: string;\n updateTime: number;\n selfTradePreventionMode: string;\n goodTillDate: number;\n}\n\nexport interface IUnifiedAccountBalanceEntry {\n asset: string;\n totalWalletBalance: string;\n crossMarginAsset: string;\n crossMarginBorrowed: string;\n crossMarginFree: string;\n crossMarginInterest: string;\n crossMarginLocked: string;\n umWalletBalance: string;\n umUnrealizedPNL: string;\n cmWalletBalance: string;\n cmUnrealizedPNL: string;\n updateTime: number;\n}\n\nexport interface ISpotAccountInfo {\n makerCommission: number;\n takerCommission: number;\n buyerCommission: number;\n sellerCommission: number;\n commissionRates: {\n maker: string;\n taker: string;\n buyer: string;\n seller: string;\n };\n canTrade: boolean;\n canWithdraw: boolean;\n canDeposit: boolean;\n brokered: boolean;\n requireSelfTradePrevention: boolean;\n preventSor: boolean;\n updateTime: number;\n balances: {\n asset: string;\n free: string;\n locked: string;\n }[];\n permissions: string[];\n uid: number;\n}\n\nexport interface ISpotOrder {\n symbol: string;\n orderId: number;\n orderListId: number;\n clientOrderId: string;\n price: string;\n origQty: string;\n executedQty: string;\n origQuoteOrderQty: string;\n cummulativeQuoteQty: string;\n status: string;\n timeInForce: string;\n type: string;\n side: string;\n stopPrice: string;\n icebergQty: string;\n time: number;\n updateTime: number;\n isWorking: boolean;\n}\n\nexport interface ISpotNewOrderResponse {\n symbol: string;\n orderId: number;\n clientOrderId: string;\n transactTime: number;\n}\n\nexport interface IAssetTransferResponse {\n tranId: number;\n}\n\nexport interface IDepositAddress {\n address: string;\n coin: string;\n tag: string;\n url: string;\n}\n\nexport interface ISubAccountSummary {\n email: string;\n isFreeze: boolean;\n createTime: number;\n isManagedSubAccount: boolean;\n isAssetManagementSubAccount: boolean;\n}\n\nexport interface ISubAccountListResponse {\n subAccounts: ISubAccountSummary[];\n}\n\nexport interface IWithdrawRecord {\n id: string;\n amount: string;\n transactionFee: string;\n coin: string;\n status: number;\n address: string;\n txId: string;\n applyTime: Date;\n network: string;\n transferType: number;\n info: string;\n confirmNo: number;\n walletType: number;\n txKey: string;\n completeTime: Date;\n}\n\nexport interface IDepositRecord {\n id: string;\n amount: string;\n coin: string;\n network: string;\n status: number;\n address: string;\n addressTag: string;\n txId: string;\n insertTime: number;\n transferType: number;\n confirmTimes: string;\n unlockConfirm: number;\n walletType: number;\n}\n\nexport interface IUnifiedUmOrderResponse {\n clientOrderId: string;\n cumQty: string;\n cumQuote: string;\n executedQty: string;\n orderId: number;\n avgPrice: string;\n origQty: string;\n price: string;\n reduceOnly: boolean;\n side: string;\n positionSide: string;\n status: string;\n symbol: string;\n timeInForce: string;\n type: string;\n selfTradePreventionMode: string;\n goodTillDate: number;\n updateTime: number;\n}\n\nexport interface IUMIncomeRecord {\n symbol: string;\n incomeType: string;\n income: string;\n asset: string;\n info: string;\n time: number;\n tranId: string;\n tradeId: string;\n}\n\n/**\n * 查询账户信息(USER_DATA)\n *\n * 查询账户信息\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Information\n */\nexport const getUnifiedAccountInfo = (credential: ICredential): Promise<IUnifiedAccountInfo | IApiError> =>\n requestPrivate<IUnifiedAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/account',\n );\n\n/**\n * 获取UM账户信息\n *\n * 现有UM账户资产和仓位信息\n *\n * 权重: 5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Account-Detail\n */\nexport const getUnifiedUmAccount = (credential: ICredential): Promise<IUnifiedUmAccount | IApiError> =>\n requestPrivate<IUnifiedUmAccount | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/account',\n );\n\n/**\n * 查看当前全部UM挂单(USER_DATA)\n *\n * 查看当前全部UM挂单,请小心使用不带symbol参数的调用\n *\n * 权重: 带symbol 1 - 不带 40\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders\n */\nexport const getUnifiedUmOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<IUnifiedUmOpenOrder[]> =>\n requestPrivate<IUnifiedUmOpenOrder[]>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/um/openOrders',\n params,\n );\n\n/**\n * 查询账户余额(USER_DATA)\n *\n * 查询账户余额\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Account-Balance\n */\nexport const getUnifiedAccountBalance = (\n credential: ICredential,\n params?: {\n assets?: string;\n },\n): Promise<IUnifiedAccountBalanceEntry[] | IApiError> =>\n requestPrivate<IUnifiedAccountBalanceEntry[] | IApiError>(\n credential,\n 'GET',\n 'https://papi.binance.com/papi/v1/balance',\n params,\n );\n\n/**\n * 账户信息 (USER_DATA)\n *\n * 权重: 20\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api#%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF-user_data\n */\nexport const getSpotAccountInfo = (\n credential: ICredential,\n params?: {\n omitZeroBalances?: boolean;\n },\n): Promise<ISpotAccountInfo | IApiError> =>\n requestPrivate<ISpotAccountInfo | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/account',\n params,\n );\n\n/**\n * Current open orders (USER_DATA)\n *\n * 权重: 带symbol: 6 不带: 80\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/account-endpoints#%E6%9F%A5%E7%9C%8B%E8%B4%A6%E6%88%B7%E5%BD%93%E5%89%8D%E6%8C%82%E5%8D%95-user_data\n */\nexport const getSpotOpenOrders = (\n credential: ICredential,\n params?: {\n symbol?: string;\n },\n): Promise<ISpotOrder[] | IApiError> =>\n requestPrivate<ISpotOrder[] | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/api/v3/openOrders',\n params,\n );\n\n/**\n * New order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * Cancel order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E8%AE%A2%E5%8D%95-trade\n */\nexport const deleteSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n newClientOrderId?: string;\n cancelRestrictions?: string;\n },\n): Promise<ISpotOrder | IApiError> =>\n requestPrivate<ISpotOrder | IApiError>(\n credential,\n 'DELETE',\n 'https://api.binance.com/api/v3/order',\n params,\n );\n\n/**\n * 用户万向划转(USER_DATA)\n *\n * 用户万向划转\n *\n * 您需要开通api key 允许万向划转权限来调用此接口。\n *\n * 权重: 900\n *\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-universal-transfer\n */\nexport const postAssetTransfer = (\n credential: ICredential,\n params: {\n type: string;\n asset: string;\n amount: number;\n fromSymbol?: string;\n toSymbol?: string;\n },\n): Promise<IAssetTransferResponse | IApiError> =>\n requestPrivate<IAssetTransferResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/asset/transfer',\n params,\n );\n\n/**\n * 统一账户资金归集(TRADE)\n *\n * 资金归集到统一账户钱包\n *\n * 权重: 750\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Fund-Auto-collection\n *\n * ISSUE(2024-07-18): 目前这是唯一能够将资金从原 U 本位合约账户转入统一账户的接口。\n */\nexport const postUnifiedAccountAutoCollection = (credential: ICredential): Promise<{ msg: string }> =>\n requestPrivate<{ msg: string }>(credential, 'POST', 'https://papi.binance.com/papi/v1/auto-collection');\n\n/**\n * 获取充值地址(支持多网络)(USER_DATA)\n *\n * 获取充值地址\n *\n * 权重: 10\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-address\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n coin: string;\n network?: string;\n amount?: number;\n },\n): Promise<IDepositAddress> =>\n requestPrivate<IDepositAddress>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/address',\n params,\n );\n\n/**\n * 查询子账户列表(适用主账户)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/sub_account/account-management/Query-Sub-account-List\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n email?: string;\n isFreeze?: number;\n page?: number;\n limit?: number;\n },\n): Promise<ISubAccountListResponse | IApiError> =>\n requestPrivate<ISubAccountListResponse | IApiError>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/sub-account/list',\n params,\n );\n\n/**\n * 提币(USER_DATA)\n *\n * 权重: 600\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n coin: string;\n withdrawOrderId?: string;\n network?: string;\n address: string;\n addressTag?: string;\n amount: number;\n transactionFeeFlag?: boolean;\n name?: string;\n walletType?: number;\n },\n): Promise<{ id: string } | IApiError> =>\n requestPrivate<{ id: string } | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/sapi/v1/capital/withdraw/apply',\n params,\n );\n\n/**\n * 获取提币历史(支持多网络)(USER_DATA)\n *\n * 获取提币历史 (支持多网络)\n *\n * 请求权重(IP)#\n * 18000 请求限制: 每秒10次\n *\n * 本接口特别采用每秒UID速率限制,用户的总秒级 UID 速率限制为180000/秒。从该接口收到的响应包含key X-SAPI-USED-UID-WEIGHT-1S,该key定义了当前 UID 使用的权重\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/withdraw-history\n */\nexport const getWithdrawHistory = (\n credential: ICredential,\n params?: {\n coin?: string;\n withdrawOrderId?: string;\n status?: number;\n offset?: number;\n limit?: number;\n startTime?: number;\n endTime?: number;\n },\n): Promise<IWithdrawRecord[]> =>\n requestPrivate<IWithdrawRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/withdraw/history',\n params,\n );\n\n/**\n * 获取充值历史(支持多网络)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/wallet/capital/deposite-history\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n includeSource?: boolean;\n coin?: string;\n status?: number;\n startTime?: number;\n endTime?: number;\n offset?: number;\n limit?: number;\n txId?: string;\n },\n): Promise<IDepositRecord[]> =>\n requestPrivate<IDepositRecord[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/capital/deposit/hisrec',\n params,\n );\n\n/**\n * UM下单(TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/New-UM-Order\n */\nexport const postUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n positionSide?: string;\n type: string;\n timeInForce?: string;\n quantity: number;\n reduceOnly?: string;\n price?: number;\n newClientOrderId?: string;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n goodTillDate?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\nexport const deleteUmOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n orderId?: string | number;\n origClientOrderId?: string;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'DELETE',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\n\n/**\n * 获取UM损益资金流水(USER_DATA)\n *\n * 权重: 30\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/account/Get-UM-Income-History\n */\nexport const getUMIncome = (\n credential: ICredential,\n params?: {\n symbol?: string;\n incomeType?: string;\n startTime?: number;\n endTime?: number;\n recvWindow?: number;\n limit?: number;\n timestamp?: number;\n },\n): Promise<IUMIncomeRecord[]> =>\n requestPrivate<IUMIncomeRecord[]>(credential, 'GET', 'https://api.binance.com/papi/v1/um/income', params);\n\n/**\n * Cancel an Existing Order and Send a New Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/trading-endpoints#%E6%92%A4%E9%94%80%E5%B9%B6%E9%87%8D%E6%96%B0%E4%B8%8B%E5%8D%95-trade\n */\nexport const postSpotOrderCancelReplace = (\n credential: ICredential,\n params: {\n symbol: string;\n side: string;\n type: string;\n cancelReplaceMode: string;\n timeInForce?: string;\n quantity?: number;\n quoteOrderQty?: number;\n price?: number;\n cancelNewClientOrderId?: string;\n cancelOrigClientOrderId?: string;\n cancelOrderId?: number;\n newClientOrderId?: string;\n strategyId?: number;\n strategyType?: number;\n stopPrice?: number;\n trailingDelta?: number;\n icebergQty?: number;\n newOrderRespType?: string;\n selfTradePreventionMode?: string;\n pegPriceType?: string;\n pegOffsetValue?: number;\n pegOffsetType?: string;\n },\n): Promise<ISpotNewOrderResponse | IApiError> =>\n requestPrivate<ISpotNewOrderResponse | IApiError>(\n credential,\n 'POST',\n 'https://api.binance.com/api/v3/order/cancelReplace',\n params,\n );\n\n/**\n * Modify Order (TRADE)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/portfolio-margin/trade/Modify-UM-Order\n */\nexport const putUmOrder = (\n credential: ICredential,\n params: {\n orderId?: number;\n origClientOrderId?: string;\n symbol: string;\n side: string;\n quantity?: number;\n price?: number;\n priceMatch?: string;\n recvWindow?: number;\n timestamp?: number;\n },\n): Promise<IUnifiedUmOrderResponse | IApiError> =>\n requestPrivate<IUnifiedUmOrderResponse | IApiError>(\n credential,\n 'PUT',\n 'https://papi.binance.com/papi/v1/um/order',\n params,\n );\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取所有全仓杠杆交易对(MARKET_DATA)\n *\n * 权重: 1\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/market-data/Get-All-Cross-Margin-Pairs\n */\nexport const getMarginAllPairs = (params?: { symbol?: string }): Promise<IMarginPair[]> => {\n const credential = getDefaultCredential();\n return requestPrivate<IMarginPair[]>(\n credential,\n 'GET',\n 'https://api.binance.com/sapi/v1/margin/allPairs',\n params,\n );\n};\n\n/**\n * Get a future hourly interest rate\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Get-a-future-hourly-interest-rate\n */\nexport const getMarginNextHourlyInterestRate = (params: {\n assets: string;\n isIsolated: boolean;\n}): Promise<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n nextHourlyInterestRate: string;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/next-hourly-interest-rate', params);\n};\n\n/**\n * Query Margin Interest Rate History\n *\n * https://developers.binance.com/docs/zh-CN/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History\n */\nexport const getMarginInterestRateHistory = (params: {\n asset: string;\n vipLevel?: number;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n> => {\n const credential = getDefaultCredential();\n return requestPrivate<\n {\n asset: string;\n dailyInterestRate: string;\n timestamp: number;\n vipLevel: number;\n }[]\n >(credential, 'GET', 'https://api.binance.com/sapi/v1/margin/interestRateHistory', params);\n};\n\n/**\n *获取用户持仓\n * @param credential\n * https://developers.binance.com/docs/zh-CN/wallet/asset/user-assets#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0\n * @param params\n * @returns\n */\nexport const getUserAsset = (\n credential: ICredential,\n params: {\n timestamp: number;\n asset?: string;\n needBtcValuation?: boolean;\n recvWindow?: number;\n },\n) => {\n return requestPrivate<\n | {\n asset: string;\n free: string;\n locked: string;\n freeze: string;\n withdrawing: string;\n ipoable: string;\n btcValuation: string;\n }[]\n | IApiError\n >(credential, 'POST', 'https://api.binance.com/sapi/v3/asset/getUserAsset', params);\n};\n\n/**\n * 查询资金账户\n * @param credential\n * https://developers.binance.com/docs/zh-CN/wallet/asset/funding-wallet?utm_source=chatgpt.com\n * @param params\n * @returns\n */\nexport const getFundingAsset = (\n credential: ICredential,\n params: {\n timestamp: number;\n asset?: string;\n needBtcValuation?: boolean;\n recvWindow?: number;\n },\n) => {\n return requestPrivate<\n | {\n asset: string;\n free: string;\n locked: string;\n freeze: string;\n withdrawing: string;\n ipoable: string;\n btcValuation: string;\n }[]\n | IApiError\n >(credential, 'POST', 'https://api.binance.com/sapi/v1/asset/get-funding-asset', params);\n};\n"]}
@@ -193,4 +193,20 @@ export interface ISpotExchangeInfo {
193
193
  * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/general-endpoints#%E4%BA%A4%E6%98%93%E8%A7%84%E8%8C%83%E4%BF%A1%E6%81%AF
194
194
  */
195
195
  export declare const getSpotExchangeInfo: () => Promise<ISpotExchangeInfo>;
196
+ /**
197
+ * 获取当前现货报价
198
+ *
199
+ *https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints#%E6%9C%80%E6%96%B0%E4%BB%B7%E6%A0%BC%E6%8E%A5%E5%8F%A3
200
+ */
201
+ export declare const getSpotTickerPrice: (params?: {
202
+ symbol?: string;
203
+ symbols?: string;
204
+ symbolStatus?: 'TRADING' | 'HALT' | 'BREAK';
205
+ }) => Promise<{
206
+ symbol: string;
207
+ price: string;
208
+ } | {
209
+ symbol: string;
210
+ price: string;
211
+ }[]>;
196
212
  //# sourceMappingURL=public-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAsB,SAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAA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C;IAC3B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,sBAAsB,EAAE,OAAO,CAAC;IAChC,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAO,QAAQ,iBAAiB,CACwB,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,YAAa;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;CAC7C,KAAG,QACA;IACE,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,EAAE,CAW0D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSpotExchangeInfo = exports.getSpotBookTicker = exports.getFutureOpenInterest = exports.getFutureBookTicker = exports.getFuturePremiumIndex = exports.getFutureFundingRate = exports.getFutureExchangeInfo = void 0;
3
+ exports.getSpotTickerPrice = exports.getSpotExchangeInfo = exports.getSpotBookTicker = exports.getFutureOpenInterest = exports.getFutureBookTicker = exports.getFuturePremiumIndex = exports.getFutureFundingRate = exports.getFutureExchangeInfo = void 0;
4
4
  const client_1 = require("./client");
5
5
  /**
6
6
  * 获取交易规则和交易对
@@ -63,4 +63,11 @@ exports.getSpotBookTicker = getSpotBookTicker;
63
63
  */
64
64
  const getSpotExchangeInfo = () => (0, client_1.requestPublic)('GET', 'https://api.binance.com/api/v3/exchangeInfo');
65
65
  exports.getSpotExchangeInfo = getSpotExchangeInfo;
66
+ /**
67
+ * 获取当前现货报价
68
+ *
69
+ *https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints#%E6%9C%80%E6%96%B0%E4%BB%B7%E6%A0%BC%E6%8E%A5%E5%8F%A3
70
+ */
71
+ const getSpotTickerPrice = (params) => (0, client_1.requestPublic)('GET', 'https://api.binance.com/api/v3/ticker/price', params);
72
+ exports.getSpotTickerPrice = getSpotTickerPrice;
66
73
  //# sourceMappingURL=public-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAgGzC;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,GAAiC,EAAE,CACtE,IAAA,sBAAa,EAAsB,KAAK,EAAE,+CAA+C,CAAC,CAAC;AADhF,QAAA,qBAAqB,yBAC2D;AAE7F;;;;GAIG;AACI,MAAM,oBAAoB,GAAG,CAAC,MAKpC,EAAsC,EAAE,CACvC,IAAA,sBAAa,EAA4B,KAAK,EAAE,8CAA8C,EAAE,MAAM,CAAC,CAAC;AAN7F,QAAA,oBAAoB,wBAMyE;AAE1G;;;;;;;;GAQG;AACI,MAAM,qBAAqB,GAAG,CAAC,MAA2B,EAAuC,EAAE,CACxG,IAAA,sBAAa,EAA6B,KAAK,EAAE,+CAA+C,EAAE,MAAM,CAAC,CAAC;AAD/F,QAAA,qBAAqB,yBAC0E;AAE5G;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,CAAC,MAA4B,EAAqC,EAAE,CACrG,IAAA,sBAAa,EACX,KAAK,EACL,oDAAoD,EACpD,MAAM,CACP,CAAC;AALS,QAAA,mBAAmB,uBAK5B;AAEJ;;;;;;;;GAQG;AACI,MAAM,qBAAqB,GAAG,CAAC,MAA0B,EAAgC,EAAE,CAChG,IAAA,sBAAa,EAAsB,KAAK,EAAE,+CAA+C,EAAE,MAAM,CAAC,CAAC;AADxF,QAAA,qBAAqB,yBACmE;AASrG;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAA4B,EAAmC,EAAE,CACjG,IAAA,sBAAa,EAAyB,KAAK,EAAE,kDAAkD,EAAE,MAAM,CAAC,CAAC;AAD9F,QAAA,iBAAiB,qBAC6E;AAwC3G;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,GAA+B,EAAE,CAClE,IAAA,sBAAa,EAAoB,KAAK,EAAE,6CAA6C,CAAC,CAAC;AAD5E,QAAA,mBAAmB,uBACyD","sourcesContent":["import { requestPublic } from './client';\n\nexport interface IFutureExchangeFilter extends Record<string, string | number | boolean | undefined> {\n filterType: string;\n}\n\nexport interface IFutureExchangeSymbol {\n symbol: string;\n pair: string;\n contractType: string;\n deliveryDate: number;\n onboardDate: number;\n status: string;\n maintMarginPercent: string;\n requiredMarginPercent: string;\n baseAsset: string;\n quoteAsset: string;\n marginAsset: string;\n pricePrecision: number;\n quantityPrecision: number;\n baseAssetPrecision: number;\n quotePrecision: number;\n underlyingType: string;\n underlyingSubType: string[];\n settlePlan: number;\n triggerProtect: string;\n liquidationFee: string;\n marketTakeBound: string;\n maxMoveOrderLimit: number;\n filters: IFutureExchangeFilter[];\n orderTypes: string[];\n timeInForce: string[];\n}\n\nexport interface IFutureExchangeInfo {\n timezone: string;\n serverTime: number;\n futuresType: string;\n rateLimits: {\n rateLimitType: string;\n interval: string;\n intervalNum: number;\n limit: number;\n }[];\n exchangeFilters: unknown[];\n assets: {\n asset: string;\n marginAvailable: boolean;\n autoAssetExchange: string;\n }[];\n symbols: IFutureExchangeSymbol[];\n}\n\nexport interface IFutureFundingRateEntry {\n symbol: string;\n fundingTime: number;\n fundingRate: string;\n markPrice: string;\n}\n\nexport interface IFuturePremiumIndexEntry {\n symbol: string;\n markPrice: string;\n indexPrice: string;\n estimatedSettlePrice: string;\n lastFundingRate: string;\n interestRate: string;\n nextFundingTime: number;\n time: number;\n}\n\nexport interface IFutureBookTickerEntry {\n symbol: string;\n bidPrice: string;\n bidQty: string;\n askPrice: string;\n askQty: string;\n time: number;\n}\n\nexport interface IFutureOpenInterest {\n openInterest: string;\n symbol: string;\n time: number;\n}\n\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取交易规则和交易对\n *\n * https://binance-docs.github.io/apidocs/futures/cn/#0f3f2d5ee7\n */\nexport const getFutureExchangeInfo = (): Promise<IFutureExchangeInfo> =>\n requestPublic<IFutureExchangeInfo>('GET', 'https://fapi.binance.com/fapi/v1/exchangeInfo');\n\n/**\n * 查询资金费率历史\n *\n * https://binance-docs.github.io/apidocs/futures/cn/#31dbeb24c4\n */\nexport const getFutureFundingRate = (params: {\n symbol?: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<IFutureFundingRateEntry[]> =>\n requestPublic<IFutureFundingRateEntry[]>('GET', 'https://fapi.binance.com/fapi/v1/fundingRate', params);\n\n/**\n * 最新标记价格和资金费率\n *\n * 采集各大交易所数据加权平均\n *\n * 权重: 带symbol为1;不带symbol为10\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price\n */\nexport const getFuturePremiumIndex = (params: { symbol?: string }): Promise<IFuturePremiumIndexEntry[]> =>\n requestPublic<IFuturePremiumIndexEntry[]>('GET', 'https://fapi.binance.com/fapi/v1/premiumIndex', params);\n\n/**\n * 当前最优挂单\n *\n * 返回当前最优的挂单(最高买单,最低卖单)\n *\n * 权重: 单交易对2,无交易对5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Symbol-Order-Book-Ticker\n */\nexport const getFutureBookTicker = (params?: { symbol?: string }): Promise<IFutureBookTickerEntry[]> =>\n requestPublic<IFutureBookTickerEntry[]>(\n 'GET',\n 'https://fapi.binance.com/fapi/v1/ticker/bookTicker',\n params,\n );\n\n/**\n * 获取未平仓合约数\n *\n * 权重: 1\n *\n * 更新速率: 3s\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Open-Interest\n */\nexport const getFutureOpenInterest = (params: { symbol: string }): Promise<IFutureOpenInterest> =>\n requestPublic<IFutureOpenInterest>('GET', 'https://fapi.binance.com/fapi/v1/openInterest', params);\nexport interface ISpotBookTickerEntry {\n symbol: string;\n bidPrice: string;\n bidQty: string;\n askPrice: string;\n askQty: string;\n}\n\n/**\n * 当前最优挂单 (Spot)\n *\n * https://binance-docs.github.io/apidocs/spot/cn/#5393cd0851\n */\nexport const getSpotBookTicker = (params?: { symbol?: string }): Promise<ISpotBookTickerEntry[]> =>\n requestPublic<ISpotBookTickerEntry[]>('GET', 'https://api.binance.com/api/v3/ticker/bookTicker', params);\n\nexport interface ISpotExchangeFilter extends Record<string, string | number | boolean | undefined> {\n filterType: string;\n}\n\nexport interface ISpotExchangeSymbol {\n symbol: string;\n status: string;\n baseAsset: string;\n baseAssetPrecision: number;\n quoteAsset: string;\n quotePrecision: number;\n baseCommissionPrecision: number;\n quoteCommissionPrecision: number;\n orderTypes: string[];\n icebergAllowed: boolean;\n ocoAllowed: boolean;\n quoteOrderQtyMarketAllowed: boolean;\n allowTrailingStop: boolean;\n cancelReplaceAllowed: boolean;\n isSpotTradingAllowed: boolean;\n isMarginTradingAllowed: boolean;\n filters: ISpotExchangeFilter[];\n permissions: string[];\n}\n\nexport interface ISpotExchangeInfo {\n timezone: string;\n serverTime: number;\n rateLimits: {\n rateLimitType: string;\n interval: string;\n intervalNum: number;\n limit: number;\n }[];\n exchangeFilters: unknown[];\n symbols: ISpotExchangeSymbol[];\n}\n\n/**\n * 获取现货交易规则和交易对\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/general-endpoints#%E4%BA%A4%E6%98%93%E8%A7%84%E8%8C%83%E4%BF%A1%E6%81%AF\n */\nexport const getSpotExchangeInfo = (): Promise<ISpotExchangeInfo> =>\n requestPublic<ISpotExchangeInfo>('GET', 'https://api.binance.com/api/v3/exchangeInfo');\n"]}
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAgGzC;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,GAAiC,EAAE,CACtE,IAAA,sBAAa,EAAsB,KAAK,EAAE,+CAA+C,CAAC,CAAC;AADhF,QAAA,qBAAqB,yBAC2D;AAE7F;;;;GAIG;AACI,MAAM,oBAAoB,GAAG,CAAC,MAKpC,EAAsC,EAAE,CACvC,IAAA,sBAAa,EAA4B,KAAK,EAAE,8CAA8C,EAAE,MAAM,CAAC,CAAC;AAN7F,QAAA,oBAAoB,wBAMyE;AAE1G;;;;;;;;GAQG;AACI,MAAM,qBAAqB,GAAG,CAAC,MAA2B,EAAuC,EAAE,CACxG,IAAA,sBAAa,EAA6B,KAAK,EAAE,+CAA+C,EAAE,MAAM,CAAC,CAAC;AAD/F,QAAA,qBAAqB,yBAC0E;AAE5G;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,CAAC,MAA4B,EAAqC,EAAE,CACrG,IAAA,sBAAa,EACX,KAAK,EACL,oDAAoD,EACpD,MAAM,CACP,CAAC;AALS,QAAA,mBAAmB,uBAK5B;AAEJ;;;;;;;;GAQG;AACI,MAAM,qBAAqB,GAAG,CAAC,MAA0B,EAAgC,EAAE,CAChG,IAAA,sBAAa,EAAsB,KAAK,EAAE,+CAA+C,EAAE,MAAM,CAAC,CAAC;AADxF,QAAA,qBAAqB,yBACmE;AASrG;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAA4B,EAAmC,EAAE,CACjG,IAAA,sBAAa,EAAyB,KAAK,EAAE,kDAAkD,EAAE,MAAM,CAAC,CAAC;AAD9F,QAAA,iBAAiB,qBAC6E;AAwC3G;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,GAA+B,EAAE,CAClE,IAAA,sBAAa,EAAoB,KAAK,EAAE,6CAA6C,CAAC,CAAC;AAD5E,QAAA,mBAAmB,uBACyD;AAEzF;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,MAIlC,EASC,EAAE,CACF,IAAA,sBAAa,EASX,KAAK,EAAE,6CAA6C,EAAE,MAAM,CAAC,CAAC;AAvBrD,QAAA,kBAAkB,sBAuBmC","sourcesContent":["import { requestPublic } from './client';\n\nexport interface IFutureExchangeFilter extends Record<string, string | number | boolean | undefined> {\n filterType: string;\n}\n\nexport interface IFutureExchangeSymbol {\n symbol: string;\n pair: string;\n contractType: string;\n deliveryDate: number;\n onboardDate: number;\n status: string;\n maintMarginPercent: string;\n requiredMarginPercent: string;\n baseAsset: string;\n quoteAsset: string;\n marginAsset: string;\n pricePrecision: number;\n quantityPrecision: number;\n baseAssetPrecision: number;\n quotePrecision: number;\n underlyingType: string;\n underlyingSubType: string[];\n settlePlan: number;\n triggerProtect: string;\n liquidationFee: string;\n marketTakeBound: string;\n maxMoveOrderLimit: number;\n filters: IFutureExchangeFilter[];\n orderTypes: string[];\n timeInForce: string[];\n}\n\nexport interface IFutureExchangeInfo {\n timezone: string;\n serverTime: number;\n futuresType: string;\n rateLimits: {\n rateLimitType: string;\n interval: string;\n intervalNum: number;\n limit: number;\n }[];\n exchangeFilters: unknown[];\n assets: {\n asset: string;\n marginAvailable: boolean;\n autoAssetExchange: string;\n }[];\n symbols: IFutureExchangeSymbol[];\n}\n\nexport interface IFutureFundingRateEntry {\n symbol: string;\n fundingTime: number;\n fundingRate: string;\n markPrice: string;\n}\n\nexport interface IFuturePremiumIndexEntry {\n symbol: string;\n markPrice: string;\n indexPrice: string;\n estimatedSettlePrice: string;\n lastFundingRate: string;\n interestRate: string;\n nextFundingTime: number;\n time: number;\n}\n\nexport interface IFutureBookTickerEntry {\n symbol: string;\n bidPrice: string;\n bidQty: string;\n askPrice: string;\n askQty: string;\n time: number;\n}\n\nexport interface IFutureOpenInterest {\n openInterest: string;\n symbol: string;\n time: number;\n}\n\nexport interface IMarginPair {\n id: string;\n symbol: string;\n base: string;\n quote: string;\n isMarginTrade: boolean;\n isBuyAllowed: boolean;\n isSellAllowed: boolean;\n}\n\n/**\n * 获取交易规则和交易对\n *\n * https://binance-docs.github.io/apidocs/futures/cn/#0f3f2d5ee7\n */\nexport const getFutureExchangeInfo = (): Promise<IFutureExchangeInfo> =>\n requestPublic<IFutureExchangeInfo>('GET', 'https://fapi.binance.com/fapi/v1/exchangeInfo');\n\n/**\n * 查询资金费率历史\n *\n * https://binance-docs.github.io/apidocs/futures/cn/#31dbeb24c4\n */\nexport const getFutureFundingRate = (params: {\n symbol?: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n}): Promise<IFutureFundingRateEntry[]> =>\n requestPublic<IFutureFundingRateEntry[]>('GET', 'https://fapi.binance.com/fapi/v1/fundingRate', params);\n\n/**\n * 最新标记价格和资金费率\n *\n * 采集各大交易所数据加权平均\n *\n * 权重: 带symbol为1;不带symbol为10\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price\n */\nexport const getFuturePremiumIndex = (params: { symbol?: string }): Promise<IFuturePremiumIndexEntry[]> =>\n requestPublic<IFuturePremiumIndexEntry[]>('GET', 'https://fapi.binance.com/fapi/v1/premiumIndex', params);\n\n/**\n * 当前最优挂单\n *\n * 返回当前最优的挂单(最高买单,最低卖单)\n *\n * 权重: 单交易对2,无交易对5\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Symbol-Order-Book-Ticker\n */\nexport const getFutureBookTicker = (params?: { symbol?: string }): Promise<IFutureBookTickerEntry[]> =>\n requestPublic<IFutureBookTickerEntry[]>(\n 'GET',\n 'https://fapi.binance.com/fapi/v1/ticker/bookTicker',\n params,\n );\n\n/**\n * 获取未平仓合约数\n *\n * 权重: 1\n *\n * 更新速率: 3s\n *\n * https://developers.binance.com/docs/zh-CN/derivatives/usds-margined-futures/market-data/rest-api/Open-Interest\n */\nexport const getFutureOpenInterest = (params: { symbol: string }): Promise<IFutureOpenInterest> =>\n requestPublic<IFutureOpenInterest>('GET', 'https://fapi.binance.com/fapi/v1/openInterest', params);\nexport interface ISpotBookTickerEntry {\n symbol: string;\n bidPrice: string;\n bidQty: string;\n askPrice: string;\n askQty: string;\n}\n\n/**\n * 当前最优挂单 (Spot)\n *\n * https://binance-docs.github.io/apidocs/spot/cn/#5393cd0851\n */\nexport const getSpotBookTicker = (params?: { symbol?: string }): Promise<ISpotBookTickerEntry[]> =>\n requestPublic<ISpotBookTickerEntry[]>('GET', 'https://api.binance.com/api/v3/ticker/bookTicker', params);\n\nexport interface ISpotExchangeFilter extends Record<string, string | number | boolean | undefined> {\n filterType: string;\n}\n\nexport interface ISpotExchangeSymbol {\n symbol: string;\n status: string;\n baseAsset: string;\n baseAssetPrecision: number;\n quoteAsset: string;\n quotePrecision: number;\n baseCommissionPrecision: number;\n quoteCommissionPrecision: number;\n orderTypes: string[];\n icebergAllowed: boolean;\n ocoAllowed: boolean;\n quoteOrderQtyMarketAllowed: boolean;\n allowTrailingStop: boolean;\n cancelReplaceAllowed: boolean;\n isSpotTradingAllowed: boolean;\n isMarginTradingAllowed: boolean;\n filters: ISpotExchangeFilter[];\n permissions: string[];\n}\n\nexport interface ISpotExchangeInfo {\n timezone: string;\n serverTime: number;\n rateLimits: {\n rateLimitType: string;\n interval: string;\n intervalNum: number;\n limit: number;\n }[];\n exchangeFilters: unknown[];\n symbols: ISpotExchangeSymbol[];\n}\n\n/**\n * 获取现货交易规则和交易对\n *\n * https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/general-endpoints#%E4%BA%A4%E6%98%93%E8%A7%84%E8%8C%83%E4%BF%A1%E6%81%AF\n */\nexport const getSpotExchangeInfo = (): Promise<ISpotExchangeInfo> =>\n requestPublic<ISpotExchangeInfo>('GET', 'https://api.binance.com/api/v3/exchangeInfo');\n\n/**\n * 获取当前现货报价\n *\n *https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api/market-data-endpoints#%E6%9C%80%E6%96%B0%E4%BB%B7%E6%A0%BC%E6%8E%A5%E5%8F%A3\n */\nexport const getSpotTickerPrice = (params?: {\n symbol?: string;\n symbols?: string;\n symbolStatus?: 'TRADING' | 'HALT' | 'BREAK';\n}): Promise<\n | {\n symbol: string;\n price: string;\n }\n | {\n symbol: string;\n price: string;\n }[]\n> =>\n requestPublic<\n | {\n symbol: string;\n price: string;\n }\n | {\n symbol: string;\n price: string;\n }[]\n >('GET', 'https://api.binance.com/api/v3/ticker/price', params);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"spot.d.ts","sourceRoot":"","sources":["../../../src/services/accounts/spot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAsB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAExE,eAAO,MAAM,0BAA0B,eAAsB,WAAW,KAAG,QAAQ,SAAS,EAAE,CAqB7F,CAAC"}
1
+ {"version":3,"file":"spot.d.ts","sourceRoot":"","sources":["../../../src/services/accounts/spot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAuC,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzF,eAAO,MAAM,0BAA0B,eAAsB,WAAW,KAAG,QAAQ,SAAS,EAAE,CAuD7F,CAAC"}
@@ -5,23 +5,56 @@ const data_account_1 = require("@yuants/data-account");
5
5
  const utils_1 = require("@yuants/utils");
6
6
  const client_1 = require("../../api/client");
7
7
  const private_api_1 = require("../../api/private-api");
8
+ const public_api_1 = require("../../api/public-api");
8
9
  const getSpotAccountInfoSnapshot = async (credential) => {
9
- const res = await (0, private_api_1.getSpotAccountInfo)(credential, { omitZeroBalances: true });
10
+ const [res, fundingAsset] = await Promise.all([
11
+ (0, private_api_1.getSpotAccountInfo)(credential, { omitZeroBalances: true }),
12
+ (0, private_api_1.getFundingAsset)(credential, {
13
+ timestamp: Date.now(),
14
+ }),
15
+ ]);
10
16
  if ((0, client_1.isApiError)(res)) {
11
17
  throw new Error(res.msg);
12
18
  }
13
- const positions = res.balances
19
+ if ((0, client_1.isApiError)(fundingAsset)) {
20
+ throw new Error(fundingAsset.msg);
21
+ }
22
+ const prices = await (0, public_api_1.getSpotTickerPrice)({
23
+ symbols: JSON.stringify([
24
+ ...new Set([
25
+ ...res.balances
26
+ .map((balance) => {
27
+ const match = balance.asset.match(/^LD(\w+)$/);
28
+ let symbol = balance.asset;
29
+ if (match) {
30
+ symbol = match[1];
31
+ }
32
+ if (symbol === 'USDT')
33
+ return '';
34
+ return `${symbol}USDT`;
35
+ })
36
+ .filter(Boolean),
37
+ ...fundingAsset.map((item) => `${item.asset}USDT`),
38
+ ]),
39
+ ]),
40
+ });
41
+ const positions = [...res.balances, ...fundingAsset]
14
42
  .map((balance) => {
43
+ var _a, _b;
15
44
  const volume = +balance.free + +balance.locked;
16
45
  if (!volume)
17
46
  return undefined;
18
47
  const position = (0, data_account_1.makeSpotPosition)({
19
48
  position_id: `spot/${balance.asset}`,
20
49
  datasource_id: 'BINANCE',
21
- product_id: (0, utils_1.encodePath)('BINANCE', 'SPOT', `${balance.asset}USDT`),
50
+ product_id: (0, utils_1.encodePath)('BINANCE', 'SPOT', `${balance.asset}`),
22
51
  volume,
23
52
  free_volume: +balance.free,
24
- closable_price: 0, // TODO: fetch price later
53
+ closable_price: balance.asset === 'USDT'
54
+ ? 1
55
+ : Array.isArray(prices)
56
+ ? +((_b = (_a = prices.find((item) => item.symbol === `${balance.asset}USDT`)) === null || _a === void 0 ? void 0 : _a.price) !== null && _b !== void 0 ? _b : 0)
57
+ : 0,
25
58
  });
26
59
  return position;
27
60
  })
@@ -1 +1 @@
1
- {"version":3,"file":"spot.js","sourceRoot":"","sources":["../../../src/services/accounts/spot.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AACnE,yCAA2C;AAC3C,6CAA8C;AAC9C,uDAAwE;AAEjE,MAAM,0BAA0B,GAAG,KAAK,EAAE,UAAuB,EAAwB,EAAE;IAChG,MAAM,GAAG,GAAG,MAAM,IAAA,gCAAkB,EAAC,UAAU,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7E,IAAI,IAAA,mBAAU,EAAC,GAAG,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KAC1B;IACD,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ;SAC3B,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;QAC/C,IAAI,CAAC,MAAM;YAAE,OAAO,SAAS,CAAC;QAC9B,MAAM,QAAQ,GAAc,IAAA,+BAAgB,EAAC;YAC3C,WAAW,EAAE,QAAQ,OAAO,CAAC,KAAK,EAAE;YACpC,aAAa,EAAE,SAAS;YACxB,UAAU,EAAE,IAAA,kBAAU,EAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,MAAM,CAAC;YACjE,MAAM;YACN,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI;YAC1B,cAAc,EAAE,CAAC,EAAE,0BAA0B;SAC9C,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,QAAQ,EAAyB,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AArBW,QAAA,0BAA0B,8BAqBrC","sourcesContent":["import { IPosition, makeSpotPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { isApiError } from '../../api/client';\nimport { getSpotAccountInfo, ICredential } from '../../api/private-api';\n\nexport const getSpotAccountInfoSnapshot = async (credential: ICredential): Promise<IPosition[]> => {\n const res = await getSpotAccountInfo(credential, { omitZeroBalances: true });\n if (isApiError(res)) {\n throw new Error(res.msg);\n }\n const positions = res.balances\n .map((balance) => {\n const volume = +balance.free + +balance.locked;\n if (!volume) return undefined;\n const position: IPosition = makeSpotPosition({\n position_id: `spot/${balance.asset}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'SPOT', `${balance.asset}USDT`),\n volume,\n free_volume: +balance.free,\n closable_price: 0, // TODO: fetch price later\n });\n return position;\n })\n .filter((position): position is IPosition => Boolean(position));\n return positions;\n};\n"]}
1
+ {"version":3,"file":"spot.js","sourceRoot":"","sources":["../../../src/services/accounts/spot.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AACnE,yCAA2C;AAC3C,6CAA8C;AAC9C,uDAAyF;AACzF,qDAA0D;AAEnD,MAAM,0BAA0B,GAAG,KAAK,EAAE,UAAuB,EAAwB,EAAE;IAChG,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5C,IAAA,gCAAkB,EAAC,UAAU,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;QAC1D,IAAA,6BAAe,EAAC,UAAU,EAAE;YAC1B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,IAAA,mBAAU,EAAC,GAAG,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KAC1B;IACD,IAAI,IAAA,mBAAU,EAAC,YAAY,CAAC,EAAE;QAC5B,MA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AAM;YACN,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI;YAC1B,cAAc,EACZ,OAAO,CAAC,KAAK,KAAK,MAAM;gBACtB,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;oBACvB,CAAC,CAAC,CAAC,CAAC,MAAA,MAAA,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,MAAM,CAAC,0CAAE,KAAK,mCAAI,CAAC,CAAC;oBAC9E,CAAC,CAAC,CAAC;SACR,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,QAAQ,EAAyB,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAvDW,QAAA,0BAA0B,8BAuDrC","sourcesContent":["import { IPosition, makeSpotPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { isApiError } from '../../api/client';\nimport { getFundingAsset, getSpotAccountInfo, ICredential } from '../../api/private-api';\nimport { getSpotTickerPrice } from '../../api/public-api';\n\nexport const getSpotAccountInfoSnapshot = async (credential: ICredential): Promise<IPosition[]> => {\n const [res, fundingAsset] = await Promise.all([\n getSpotAccountInfo(credential, { omitZeroBalances: true }),\n getFundingAsset(credential, {\n timestamp: Date.now(),\n }),\n ]);\n\n if (isApiError(res)) {\n throw new Error(res.msg);\n }\n if (isApiError(fundingAsset)) {\n throw new Error(fundingAsset.msg);\n }\n\n const prices = await getSpotTickerPrice({\n symbols: JSON.stringify([\n ...new Set([\n ...res.balances\n .map((balance) => {\n const match = balance.asset.match(/^LD(\\w+)$/);\n let symbol = balance.asset;\n if (match) {\n symbol = match[1];\n }\n if (symbol === 'USDT') return '';\n return `${symbol}USDT`;\n })\n .filter(Boolean),\n ...fundingAsset.map((item) => `${item.asset}USDT`),\n ]),\n ]),\n });\n\n const positions = [...res.balances, ...fundingAsset]\n .map((balance) => {\n const volume = +balance.free + +balance.locked;\n if (!volume) return undefined;\n const position: IPosition = makeSpotPosition({\n position_id: `spot/${balance.asset}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'SPOT', `${balance.asset}`),\n volume,\n free_volume: +balance.free,\n closable_price:\n balance.asset === 'USDT'\n ? 1\n : Array.isArray(prices)\n ? +(prices.find((item) => item.symbol === `${balance.asset}USDT`)?.price ?? 0)\n : 0,\n });\n return position;\n })\n .filter((position): position is IPosition => Boolean(position));\n return positions;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAiD,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEnG,eAAO,MAAM,qBAAqB,eAAsB,WAAW,KAAG,QAAQ,SAAS,EAAE,CAsCxF,CAAC"}
1
+ {"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAiD,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGnG,eAAO,MAAM,qBAAqB,eAAsB,WAAW,KAAG,QAAQ,SAAS,EAAE,CAsExF,CAAC"}
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUnifiedAccountInfo = void 0;
4
+ const data_account_1 = require("@yuants/data-account");
4
5
  const utils_1 = require("@yuants/utils");
5
6
  const client_1 = require("../../api/client");
6
7
  const private_api_1 = require("../../api/private-api");
8
+ const public_api_1 = require("../../api/public-api");
7
9
  const getUnifiedAccountInfo = async (credential) => {
8
10
  const [balanceRes, umAccountRes] = await Promise.all([
9
11
  (0, private_api_1.getUnifiedAccountBalance)(credential),
@@ -37,7 +39,40 @@ const getUnifiedAccountInfo = async (credential) => {
37
39
  (+position.entryPrice +
38
40
  (+position.positionAmt === 0 ? 0 : +position.unrealizedProfit / +position.positionAmt)),
39
41
  }));
40
- return positions;
42
+ const prices = await (0, public_api_1.getSpotTickerPrice)({
43
+ symbols: JSON.stringify([
44
+ ...new Set([
45
+ ...balanceRes
46
+ .map((balance) => {
47
+ const match = balance.asset.match(/^LD(\w+)$/);
48
+ let symbol = balance.asset;
49
+ if (match) {
50
+ symbol = match[1];
51
+ }
52
+ if (symbol === 'USDT')
53
+ return '';
54
+ return `${symbol}USDT`;
55
+ })
56
+ .filter(Boolean),
57
+ ]),
58
+ ]),
59
+ });
60
+ const balancePositions = balanceRes.map((position) => {
61
+ var _a, _b;
62
+ return (0, data_account_1.makeSpotPosition)({
63
+ position_id: `UNIFIED-SPOT/${position.asset}`,
64
+ datasource_id: 'BINANCE',
65
+ product_id: (0, utils_1.encodePath)('BINANCE', 'UNIFIED-SPOT', position.asset),
66
+ volume: +position.totalWalletBalance + +position.umUnrealizedPNL,
67
+ free_volume: +position.crossMarginFree,
68
+ closable_price: position.asset === 'USDT'
69
+ ? 1
70
+ : Array.isArray(prices)
71
+ ? +((_b = (_a = prices.find((item) => item.symbol === `${position.asset}USDT`)) === null || _a === void 0 ? void 0 : _a.price) !== null && _b !== void 0 ? _b : 0)
72
+ : 0,
73
+ });
74
+ });
75
+ return [...balancePositions, ...positions];
41
76
  };
42
77
  exports.getUnifiedAccountInfo = getUnifiedAccountInfo;
43
78
  //# sourceMappingURL=unified.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,6CAA8C;AAC9C,uDAAmG;AAE5F,MAAM,qBAAqB,GAAG,KAAK,EAAE,UAAuB,EAAwB,EAAE;IAC3F,MAAM,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,QAAQ,CAAC,WAAW;QACzF,eAAe,EAAE,CAAC,QAAQ,CAAC,gBAAgB;QAC3C,SAAS,EACP,CAAC,QAAQ,CAAC,WAAW;YACrB,CAAC,CAAC,QAAQ,CAAC,UAAU;gBACnB,CAAC,CAAC,QAAQ,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;KAC5F,CAAC,CAAC,CAAC;IAEN,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAtCW,QAAA,qBAAqB,yBAsChC","sourcesContent":["import { IPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { isApiError } from '../../api/client';\nimport { getUnifiedAccountBalance, getUnifiedUmAccount, ICredential } from '../../api/private-api';\n\nexport const getUnifiedAccountInfo = async (credential: ICredential): Promise<IPosition[]> => {\n const [balanceRes, umAccountRes] = await Promise.all([\n getUnifiedAccountBalance(credential),\n getUnifiedUmAccount(credential),\n ]);\n if (isApiError(balanceRes)) {\n throw new Error(balanceRes.msg);\n }\n if (isApiError(umAccountRes)) {\n throw new Error(umAccountRes.msg);\n }\n\n const positions: IPosition[] = umAccountRes.positions\n .filter((position) => +position.positionAmt !== 0)\n .map((position) => ({\n position_id: `${position.symbol}/${position.positionSide}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'USDT-FUTURE', position.symbol),\n direction:\n position.positionSide === 'LONG'\n ? 'LONG'\n : position.positionSide === 'SHORT'\n ? 'SHORT'\n : position.positionSide === 'BOTH'\n ? 'BOTH'\n : 'UNKNOWN',\n volume: +position.positionAmt,\n free_volume: +position.positionAmt,\n position_price: +position.entryPrice,\n closable_price: +position.entryPrice + +position.unrealizedProfit / +position.positionAmt,\n floating_profit: +position.unrealizedProfit,\n valuation:\n +position.positionAmt *\n (+position.entryPrice +\n (+position.positionAmt === 0 ? 0 : +position.unrealizedProfit / +position.positionAmt)),\n }));\n\n return positions;\n};\n"]}
1
+ {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AACnE,yCAA2C;AAC3C,6CAA8C;AAC9C,uDAAmG;AACnG,qDAA0D;AAEnD,MAAM,qBAAqB,GAAG,KAAK,EAAE,UAAuB,EAAwB,EAAE;IAC3F,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACnD,IAAA,sCAAwB,EAAC,UAAU,CAAC;QACpC,IAAA,iCAAmB,EAAC,UAAU,CAAC;KAChC,CAAC,CAAC;IACH,IAAI,IAAA,mBAAU,EAAC,UAAU,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KACjC;IACD,IAAI,IAAA,mBAAU,EAAC,YAAY,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;KACnC;IAED,MAAM,SAAS,GAAgB,YAAY,CAAC,SAAS;SAClD,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,KAAK,CAAC,CAAC;SACjD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClB,WAAW,EAAE,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,YAAY,EAAE;QAC1D,aAAa,EAAE,SAAS;QACxB,UAAU,EAAE,IAAA,kBAAU,EAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC;QACjE,SAAS,EACP,QAAQ,CAAC,YAAY,KAAK,MAAM;YAC9B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,QAAQ,CAAC,YAAY,KAAK,OAAO;gBACnC,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,QAAQ,CAAC,YAAY,KAAK,MAAM;oB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QAAQ,EAAE,EAAE;;QAChE,OAAA,IAAA,+BAAgB,EAAC;YACf,WAAW,EAAE,gBAAgB,QAAQ,CAAC,KAAK,EAAE;YAC7C,aAAa,EAAE,SAAS;YACxB,UAAU,EAAE,IAAA,kBAAU,EAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,CAAC,KAAK,CAAC;YACjE,MAAM,EAAE,CAAC,QAAQ,CAAC,kBAAkB,GAAG,CAAC,QAAQ,CAAC,eAAe;YAChE,WAAW,EAAE,CAAC,QAAQ,CAAC,eAAe;YACtC,cAAc,EACZ,QAAQ,CAAC,KAAK,KAAK,MAAM;gBACvB,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;oBACvB,CAAC,CAAC,CAAC,CAAC,MAAA,MAAA,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,MAAM,CAAC,0CAAE,KAAK,mCAAI,CAAC,CAAC;oBAC/E,CAAC,CAAC,CAAC;SACR,CAAC,CAAA;KAAA,CACH,CAAC;IACF,OAAO,CAAC,GAAG,gBAAgB,EAAE,GAAG,SAAS,CAAC,CAAC;AAC7C,CAAC,CAAC;AAtEW,QAAA,qBAAqB,yBAsEhC","sourcesContent":["import { IPosition, makeSpotPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { isApiError } from '../../api/client';\nimport { getUnifiedAccountBalance, getUnifiedUmAccount, ICredential } from '../../api/private-api';\nimport { getSpotTickerPrice } from '../../api/public-api';\n\nexport const getUnifiedAccountInfo = async (credential: ICredential): Promise<IPosition[]> => {\n const [balanceRes, umAccountRes] = await Promise.all([\n getUnifiedAccountBalance(credential),\n getUnifiedUmAccount(credential),\n ]);\n if (isApiError(balanceRes)) {\n throw new Error(balanceRes.msg);\n }\n if (isApiError(umAccountRes)) {\n throw new Error(umAccountRes.msg);\n }\n\n const positions: IPosition[] = umAccountRes.positions\n .filter((position) => +position.positionAmt !== 0)\n .map((position) => ({\n position_id: `${position.symbol}/${position.positionSide}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'USDT-FUTURE', position.symbol),\n direction:\n position.positionSide === 'LONG'\n ? 'LONG'\n : position.positionSide === 'SHORT'\n ? 'SHORT'\n : position.positionSide === 'BOTH'\n ? 'BOTH'\n : 'UNKNOWN',\n volume: +position.positionAmt,\n free_volume: +position.positionAmt,\n position_price: +position.entryPrice,\n closable_price: +position.entryPrice + +position.unrealizedProfit / +position.positionAmt,\n floating_profit: +position.unrealizedProfit,\n valuation:\n +position.positionAmt *\n (+position.entryPrice +\n (+position.positionAmt === 0 ? 0 : +position.unrealizedProfit / +position.positionAmt)),\n }));\n\n const prices = await getSpotTickerPrice({\n symbols: JSON.stringify([\n ...new Set([\n ...balanceRes\n .map((balance) => {\n const match = balance.asset.match(/^LD(\\w+)$/);\n let symbol = balance.asset;\n if (match) {\n symbol = match[1];\n }\n if (symbol === 'USDT') return '';\n return `${symbol}USDT`;\n })\n .filter(Boolean),\n ]),\n ]),\n });\n const balancePositions: IPosition[] = balanceRes.map((position) =>\n makeSpotPosition({\n position_id: `UNIFIED-SPOT/${position.asset}`,\n datasource_id: 'BINANCE',\n product_id: encodePath('BINANCE', 'UNIFIED-SPOT', position.asset),\n volume: +position.totalWalletBalance + +position.umUnrealizedPNL,\n free_volume: +position.crossMarginFree,\n closable_price:\n position.asset === 'USDT'\n ? 1\n : Array.isArray(prices)\n ? +(prices.find((item) => item.symbol === `${position.asset}USDT`)?.price ?? 0)\n : 0,\n }),\n );\n return [...balancePositions, ...positions];\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuants/vendor-binance",
3
- "version": "0.10.5",
3
+ "version": "0.10.7",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "dist",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "apps/vendor-binance/AGENTS.md": "378369925bffa237cd5e8ef459fe2bc2a141337c",
3
- "apps/vendor-binance/CHANGELOG.json": "9e094ca16a644b4262837ae8b6773c491d544958",
4
- "apps/vendor-binance/CHANGELOG.md": "b2b8da48ff7cb9a96bdeb5fca76123f53b8bafd7",
3
+ "apps/vendor-binance/CHANGELOG.json": "1724ac9c1a90d73259d5c62dc4dc401b11d2cbba",
4
+ "apps/vendor-binance/CHANGELOG.md": "989cf099947a3940d64b59546aa9e7e7f68e30d2",
5
5
  "apps/vendor-binance/README.md": "4ab94c08b3d07398aee74c3264a4f87d554d20fa",
6
6
  "apps/vendor-binance/SESSION_NOTES.md": "323540130bec032bd3e4231c7bbcfc0013a17631",
7
7
  "apps/vendor-binance/api-extractor.json": "62f4fd324425b9a235f0c117975967aab09ced0c",
@@ -9,10 +9,10 @@
9
9
  "apps/vendor-binance/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
10
10
  "apps/vendor-binance/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
11
11
  "apps/vendor-binance/etc/vendor-binance.api.md": "2094b84e9b5e7503f5c42b31fffee8d7db47fe7b",
12
- "apps/vendor-binance/package.json": "9f6eed55d6ce96323481e1bb42b31c237be5f42c",
12
+ "apps/vendor-binance/package.json": "794b2a173f66d3ca5613f42a974b68be8a93b856",
13
13
  "apps/vendor-binance/src/api/client.ts": "4d853dcbc46f08054dfbf6b985f776a3231a8138",
14
- "apps/vendor-binance/src/api/private-api.ts": "e7643bd482e4d8f4eefe39aee578e5ea52094b2b",
15
- "apps/vendor-binance/src/api/public-api.ts": "7ff3b6551cdf1766b4a31cdf76002ce1db11f109",
14
+ "apps/vendor-binance/src/api/private-api.ts": "982c1902b8417aba1f75df5fa63db76dfc416dac",
15
+ "apps/vendor-binance/src/api/public-api.ts": "07546b44b7fc7dec67423cfd73b9175afe828ea0",
16
16
  "apps/vendor-binance/src/index.ts": "285cc4bded3608d415aaa00b9df180fbbdcebac0",
17
17
  "apps/vendor-binance/src/legacy_index.ts": "a2b44c041aa7ef1f4b77249e11f84d97cde5525f",
18
18
  "apps/vendor-binance/src/public-data/interest_rate.ts": "ab9b57f1af6478c61d34db8b51f4fcabac971fd4",
@@ -20,8 +20,8 @@
20
20
  "apps/vendor-binance/src/public-data/product.ts": "8879f59f4b5ee5925c5becef5fce5492e2f30f42",
21
21
  "apps/vendor-binance/src/public-data/quote.ts": "5a034f952736b50ce9d1939c588ba163ac975c38",
22
22
  "apps/vendor-binance/src/services/accounts/profile.ts": "1d23b04d19c078e8c21f41efd6ca3db37b0bd206",
23
- "apps/vendor-binance/src/services/accounts/spot.ts": "144315335e7fa00737cd66402622a649d4bf0cab",
24
- "apps/vendor-binance/src/services/accounts/unified.ts": "1a6aea6b993fbefce9073761b69bb5b92519da36",
23
+ "apps/vendor-binance/src/services/accounts/spot.ts": "7561d3054c967b48711a4dcedf96946eeab9fab4",
24
+ "apps/vendor-binance/src/services/accounts/unified.ts": "4bb4de2908b3dfb4a9ea78610c77a06fb4a46739",
25
25
  "apps/vendor-binance/src/services/exchange.ts": "c989e025b771f5d5c49efcc779ca388dfb1d488d",
26
26
  "apps/vendor-binance/src/services/orders/cancelOrder.ts": "7177ca56fd09b11651edbb38e1962363ac67d4ff",
27
27
  "apps/vendor-binance/src/services/orders/listOrders.ts": "baa21b8e858c1ec593415145cc63fb38a6841d3f",