@yuants/vendor-huobi 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/private-api.js.map +1 -1
- package/dist/order-actions-with-credentials.js +9 -25
- package/dist/order-actions-with-credentials.js.map +1 -1
- package/dist/order-actions.js +3 -15
- package/dist/order-actions.js.map +1 -1
- package/dist/orders/submitOrder.js +13 -2
- package/dist/orders/submitOrder.js.map +1 -1
- package/lib/api/private-api.d.ts +3 -0
- package/lib/api/private-api.d.ts.map +1 -1
- package/lib/api/private-api.js.map +1 -1
- package/lib/order-actions-with-credentials.js +8 -24
- package/lib/order-actions-with-credentials.js.map +1 -1
- package/lib/order-actions.d.ts.map +1 -1
- package/lib/order-actions.js +2 -14
- package/lib/order-actions.js.map +1 -1
- package/lib/orders/submitOrder.d.ts +3 -8
- package/lib/orders/submitOrder.d.ts.map +1 -1
- package/lib/orders/submitOrder.js +13 -3
- package/lib/orders/submitOrder.js.map +1 -1
- package/package.json +3 -3
- package/temp/package-deps.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAgB,EAAE;IACpD,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,UAAW;QACnC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,UAAW;KACpC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,UAAuB,EACvB,MAAc,EACd,IAAY,EACZ,QAAgB,EAChB,MAAY,EACZ,EAAE;IACF,MAAM,aAAa,GAAG,eACpB,UAAU,CAAC,UACb,4DAA4D,kBAAkB,CAC5E,IAAI,IAAI,EAAE,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c,EACd,MAAM,CACP,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,UAAuB,EACvB,MAGC,EAkCA,EAAE;IACH,OAAO,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AAChG,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,UAAuB,EACvB,MASC,EAmBA,EAAE;IACH,OAAO,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AAC3F,CAAC,CAAC","sourcesContent":["import { encodeBase64, formatTime, HmacSHA256 } from '@yuants/utils';\n\nexport interface ICredential {\n access_key: string;\n secret_key: string;\n}\n\nexport const getDefaultCredential = (): ICredential => {\n return {\n access_key: process.env.ACCESS_KEY!,\n secret_key: process.env.SECRET_KEY!,\n };\n};\n\nexport const privateRequest = async (\n credential: ICredential,\n method: string,\n path: string,\n api_root: string,\n params?: any,\n) => {\n const requestParams = `AccessKeyId=${\n credential.access_key\n }&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=${encodeURIComponent(\n new Date().toISOString().split('.')[0],\n )}${\n method === 'GET' && params !== undefined\n ? `&${Object.entries(params)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([k, v]) => `${k}=${v}`)\n .join('&')}`\n : ''\n }`;\n\n const body = method === 'GET' ? '' : JSON.stringify(params);\n\n const requestString = `${method}\\n${api_root}\\n${path}\\n${requestParams}`;\n\n const str = encodeBase64(\n await HmacSHA256(\n new TextEncoder().encode(requestString),\n new TextEncoder().encode(credential.secret_key),\n ),\n );\n\n const url = new URL(`https://${api_root}${path}?${requestParams}&Signature=${encodeURIComponent(str)}`);\n // url.searchParams.sort();\n console.info(formatTime(Date.now()), method, url.href, body);\n const res = await fetch(url.href, {\n method,\n headers: { 'Content-Type': 'application/json' },\n body: body || undefined,\n });\n\n const retStr = await res.text();\n console.info(formatTime(Date.now()), 'PrivateResponse', url.toString(), res.status);\n try {\n return JSON.parse(retStr);\n } catch (e) {\n console.error(formatTime(Date.now()), 'huobiRequestFailed', path, JSON.stringify(params), retStr);\n throw e;\n }\n};\n\n/**\n * 获取账户信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec40743-7773-11ed-9966-0242ac110003\n */\nexport const getAccount = (\n credential: ICredential,\n): Promise<{\n status: string;\n data: {\n id: number;\n type: string;\n state: string;\n subtype: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/account/accounts', 'api.huobi.pro');\n};\n\n/**\n * 获取用户ID\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec491c9-7773-11ed-9966-0242ac110003\n */\nexport const getUid = (credential: ICredential): Promise<{ data: number; code: number }> => {\n return privateRequest(credential, 'GET', '/v2/user/uid', 'api.huobi.pro');\n};\n\n/**\n * 获取统一账户信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000073-77b7-11ed-9966-0242ac110003\n */\nexport const getUnifiedAccountInfo = (\n credential: ICredential,\n): Promise<{\n status: string;\n code: number;\n msg: string;\n data: {\n margin_asset: string;\n margin_balance: number;\n cross_margin_static: number;\n cross_profit_unreal: number;\n withdraw_available: number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/linear-swap-api/v3/unified_account_info', 'api.hbdm.com');\n};\n\n/**\n * 获取合约持仓信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb74963-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapCrossPositionInfo = (\n credential: ICredential,\n params?: {\n contract_code?: string;\n pair?: string;\n contract_type: string;\n },\n): Promise<{\n status: string;\n ts: number;\n data: {\n contract_code: string;\n contract_type: string;\n direction: string;\n margin_mode: string;\n volume: number;\n available: number;\n cost_hold: number;\n last_price: number;\n profit_unreal: number;\n lever_rate: number;\n }[];\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v1/swap_cross_position_info',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * 获取合约挂单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb784d4-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapOpenOrders = (\n credential: ICredential,\n params?: {\n contract_code?: string;\n pair?: string;\n page_index?: number;\n page_size?: number;\n sort_by?: string;\n trade_type?: string;\n },\n): Promise<{\n status: string;\n data: {\n orders: {\n order_id_str: string;\n contract_code: string;\n order_price_type: string;\n direction: string;\n offset: string;\n volume: number;\n created_at: number;\n price: number;\n trade_volume: number;\n }[];\n };\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v1/swap_cross_openorders',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * 获取现货账户余额\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec40922-7773-11ed-9966-0242ac110003\n */\nexport const getSpotAccountBalance = (\n credential: ICredential,\n account_uid: number,\n): Promise<{\n status: string;\n data: {\n list: {\n currency: string;\n balance: string;\n type: string;\n }[];\n };\n}> => {\n return privateRequest(credential, 'GET', `/v1/account/accounts/${account_uid}/balance`, 'api.huobi.pro');\n};\n\n/**\n * 获取杠杆借贷信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41863-7773-11ed-9966-0242ac110003\n */\nexport const getCrossMarginLoanInfo = (\n credential: ICredential,\n): Promise<{\n status: string;\n code: number;\n data: {\n currency: string;\n 'loanable-amt': string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/cross-margin/loan-info', 'api.huobi.pro');\n};\n\n/**\n * 获取现货行情\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec3fc25-7773-11ed-9966-0242ac110003\n */\nexport const getSpotTick = (\n credential: ICredential,\n params: { symbol: string },\n): Promise<{\n status: string;\n tick: {\n close: number;\n };\n}> => {\n return privateRequest(credential, 'GET', `/market/detail/merged`, 'api.huobi.pro', params);\n};\n\n/**\n * 现货下单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000065-77b7-11ed-9966-0242ac110003\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n 'account-id': string;\n amount: string;\n market_amount?: string;\n 'borrow-amount'?: string;\n type: string;\n 'trade-purpose': string;\n price?: string;\n source: string;\n },\n): Promise<{ success: boolean; code: number; message: string }> => {\n return privateRequest(credential, 'POST', `/v1/order/auto/place`, 'api.huobi.pro', params);\n};\n\n/**\n * 合约下单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb77159-77b5-11ed-9966-0242ac110003\n */\nexport const postSwapOrder = (\n credential: ICredential,\n params: {\n contract_code: string;\n contract_type: string;\n price?: number;\n volume: number;\n offset: string;\n direction: string;\n lever_rate: number;\n order_price_type: string;\n },\n): Promise<{ status: string; ts: number; data: { order_id: number; order_id_str: string } }> => {\n return privateRequest(credential, 'POST', '/linear-swap-api/v1/swap_cross_order', 'api.hbdm.com', params);\n};\n\n/**\n * 获取现货存款地址\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec45fb7-7773-11ed-9966-0242ac110003\n */\nexport const getSpotAccountDepositAddresses = (\n credential: ICredential,\n params: { currency: string },\n): Promise<{\n code: number;\n message: string;\n data: {\n currency: string;\n chain: string;\n address: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v2/account/deposit/address`, 'api.huobi.pro', params);\n};\n\n/**\n * 获取账户流水\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec4610b-7773-11ed-9966-0242ac110003\n */\nexport const getAccountLedger = (\n credential: ICredential,\n params: { accountId: string; currency: string },\n): Promise<{\n status: string;\n data: {\n transactTime: number;\n transactAmt: number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v2/account/ledger`, 'api.huobi.pro', params);\n};\n\n/**\n * 超级杠杆转出\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41ff0-7773-11ed-9966-0242ac110003\n */\nexport const postSuperMarginAccountTransferOut = (\n credential: ICredential,\n params: {\n currency: string;\n amount: string;\n },\n): Promise<{ status: string; data: number }> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/transfer-out`, 'api.huobi.pro', params);\n};\n\n/**\n * 超级杠杆转入\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41f0e-7773-11ed-9966-0242ac110003\n */\nexport const postSuperMarginAccountTransferIn = (\n credential: ICredential,\n params: {\n currency: string;\n amount: string;\n },\n): Promise<{ status: string; data: number }> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/transfer-in`, 'api.huobi.pro', params);\n};\n\n/**\n * 现货账户转账\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000095-77b7-11ed-9966-0242ac110003\n */\nexport const postSpotAccountTransfer = (\n credential: ICredential,\n params: {\n from: string;\n to: string;\n currency: string;\n amount: number;\n 'margin-account': string;\n },\n): Promise<{ success: boolean; data: number; code: number; message: string }> => {\n return privateRequest(credential, 'POST', `/v2/account/transfer`, 'api.huobi.pro', params);\n};\n\n/**\n * 借贷\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41b5d-7773-11ed-9966-0242ac110003\n */\nexport const postBorrow = (\n credential: ICredential,\n params: { currency: string; amount: string },\n): Promise<{\n status: string;\n data: number;\n}> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/orders`, 'api.huobi.pro', params);\n};\n\n/**\n * 提现\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec42cfd-7773-11ed-9966-0242ac110003\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n address: string;\n amount: string;\n currency: string;\n fee: string;\n chain: string;\n },\n): Promise<{\n status: string;\n data: number;\n}> => {\n return privateRequest(credential, 'POST', `/v1/dw/withdraw/api/create`, 'api.huobi.pro', params);\n};\n\n/**\n * 获取充提历史\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec44f99-7773-11ed-9966-0242ac110003\n */\nexport const getDepositWithdrawHistory = (\n credential: ICredential,\n params: {\n currency: string;\n type: string;\n from?: string;\n size?: string;\n direct?: string;\n },\n): Promise<{\n status: string;\n 'error-code': string;\n 'error-msg': string;\n data: {\n id: number;\n type: string;\n currency: string;\n 'tx-hash': string;\n chain: string;\n amount: string;\n address: string;\n 'address-tag': string;\n fee: string;\n state: string;\n 'create-at': number;\n 'update-at': number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v1/query/deposit-withdraw`, 'api.huobi.pro', params);\n};\n\n/**\n * 资产划转(母子用户之间)\n *\n * 接口权限: 交易\n *\n * 限频: 2次/2s\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec45d8e-7773-11ed-9966-0242ac110003\n */\nexport const postSubUserTransfer = (\n credential: ICredential,\n params: {\n 'sub-uid': number;\n currency: string;\n amount: number;\n 'client-order-id'?: string;\n type: string;\n },\n): Promise<{\n data: number;\n status: string;\n}> => {\n return privateRequest(credential, 'POST', '/v1/subuser/transfer', 'api.huobi.pro', params);\n};\n\n/**\n * 获取子用户列表\n *\n * 接口权限: 读取\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec48f09-7773-11ed-9966-0242ac110003\n */\nexport const getSubUserList = (\n credential: ICredential,\n params?: { fromId?: number },\n): Promise<{\n code: number;\n message?: string;\n data: {\n uid: number;\n userState: string;\n subUserName: string;\n note: string;\n }[];\n nextId?: number;\n ok: boolean;\n}> => {\n return privateRequest(credential, 'GET', `/v2/sub-user/user-list`, 'api.huobi.pro', params);\n};\n\n/**\n * 账户类型查询\n *\n * 是否验签: 是\n *\n * 接口权限: 读取\n *\n * 限频: 每个UID 3秒最多 144 次请求(交易接口3秒最多 72 次请求,查询接口3秒最多 72 次请求) (该UID的所有币种和不同到期日的合约的所有私有接口共享该限制) 。\n *\n * 接口描述: 此接口用于客户查询的账号类型,当前U本位合约有统一账户和非统一账户(全仓逐仓账户)类型。统一账户类型资产放在USDT一个账户上,全仓逐仓账户类型资产放在不同的币对。\n * 统一账户类型为最新升级的,当前不支持API下单。若需要用用API下单请切换账户类型为非统一账户。\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb71825-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapUnifiedAccountType = (\n credential: ICredential,\n): Promise<{\n code: number;\n msg: string;\n ts: number;\n data: {\n account_type: number;\n };\n}> => {\n return privateRequest(credential, 'GET', '/linear-swap-api/v3/swap_unified_account_type', 'api.hbdm.com');\n};\n\n/**\n * 账户类型更改接口\n *\n * 是否验签: 是\n *\n * 接口权限: 交易\n *\n * 限频: 每个UID 3秒最多 144 次请求(交易接口3秒最多 72 次请求,查询接口3秒最多 72 次请求) (该UID的所有币种和不同到期日的合约的所有私有接口共享该限制) 。\n *\n * 接口描述: 调用该接口前需要保证U本位合约无持仓和挂单,当由非统一账户(全仓逐仓账户)变为统一账户还需将资产从逐仓账户划转到全仓账户。\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb7196b-77b5-11ed-9966-0242ac110003\n */\nexport const postSwapSwitchAccountType = (\n credential: ICredential,\n params: { account_type: number },\n): Promise<{\n code: number;\n msg: string;\n ts: number;\n data: {\n account_type: number;\n };\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v3/swap_switch_account_type',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * APIv2币链参考信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec478f0-7773-11ed-9966-0242ac110003\n */\nexport const getV2ReferenceCurrencies = (\n credential: ICredential,\n params: {\n currency?: string;\n authorizedUser?: string;\n },\n): Promise<{\n code: number;\n data: {\n currency: string;\n assetType: number;\n chains: {\n chain: string;\n displayName: string;\n fullName: string;\n baseChain?: string;\n baseChainProtocol?: string;\n isDynamic?: boolean;\n numOfConfirmations: number;\n numOfFastConfirmations: number;\n depositStatus: string;\n minDepositAmt: string;\n withdrawStatus: string;\n minWithdrawAmt: string;\n withdrawPrecision: number;\n maxWithdrawAmt: string;\n withdrawQuotaPerDay: string;\n withdrawQuotaPerYear: null;\n withdrawQuotaTotal: null;\n withdrawFeeType: string;\n transactFeeWithdraw?: string;\n addrWithTag: boolean;\n addrDepositTag: boolean;\n minTransactFeeWithdraw?: string;\n transactFeeRateWithdraw?: string;\n maxTransactFeeWithdraw?: string;\n }[];\n instStatus: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v2/reference/currencies', 'api.huobi.pro', params);\n};\n\n/**\n * 获取账户历史\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41049-7773-11ed-9966-0242ac110003\n */\nexport const getAccountHistory = (\n credential: ICredential,\n params: {\n 'account-id': string;\n currency?: string;\n 'transact-types'?: number;\n 'start-time'?: number;\n 'end-time'?: number;\n sort?: 'asc' | 'desc';\n size?: number;\n 'from-id'?: number;\n },\n): Promise<{\n // code: number;\n 'transact-amt': string;\n 'avail-balance': string;\n 'acct-balance': string;\n 'transact-time': string;\n 'record-id': string;\n status: string;\n data: {\n 'account-id': string;\n currency: string;\n 'record-id': string;\n 'transact-amt': string;\n 'transact-type': string;\n 'avail-balance': string;\n 'acct-balance': string;\n 'transact-time': string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/account/history', 'api.huobi.pro', params);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAgB,EAAE;IACpD,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,UAAW;QACnC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,UAAW;KACpC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,UAAuB,EACvB,MAAc,EACd,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CAAC,MAAM,yBAAyB,GAAG,CACvC,UAAuB,EACvB,MAAgC,EAQ/B,EAAE;IACH,OAAO,cAAc,CACnB,UAAU,EACV,MAAM,EACN,8CAA8C,EAC9C,cAAc,EACd,MAAM,CACP,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,UAAuB,EACvB,MAGC,EAkCA,EAAE;IACH,OAAO,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AAChG,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,UAAuB,EACvB,MASC,EAmBA,EAAE;IACH,OAAO,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AAC3F,CAAC,CAAC","sourcesContent":["import { encodeBase64, formatTime, HmacSHA256 } from '@yuants/utils';\n\nexport interface ICredential {\n access_key: string;\n secret_key: string;\n}\n\nexport const getDefaultCredential = (): ICredential => {\n return {\n access_key: process.env.ACCESS_KEY!,\n secret_key: process.env.SECRET_KEY!,\n };\n};\n\nexport const privateRequest = async (\n credential: ICredential,\n method: string,\n path: string,\n api_root: string,\n params?: any,\n) => {\n const requestParams = `AccessKeyId=${\n credential.access_key\n }&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=${encodeURIComponent(\n new Date().toISOString().split('.')[0],\n )}${\n method === 'GET' && params !== undefined\n ? `&${Object.entries(params)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([k, v]) => `${k}=${v}`)\n .join('&')}`\n : ''\n }`;\n\n const body = method === 'GET' ? '' : JSON.stringify(params);\n\n const requestString = `${method}\\n${api_root}\\n${path}\\n${requestParams}`;\n\n const str = encodeBase64(\n await HmacSHA256(\n new TextEncoder().encode(requestString),\n new TextEncoder().encode(credential.secret_key),\n ),\n );\n\n const url = new URL(`https://${api_root}${path}?${requestParams}&Signature=${encodeURIComponent(str)}`);\n // url.searchParams.sort();\n console.info(formatTime(Date.now()), method, url.href, body);\n const res = await fetch(url.href, {\n method,\n headers: { 'Content-Type': 'application/json' },\n body: body || undefined,\n });\n\n const retStr = await res.text();\n console.info(formatTime(Date.now()), 'PrivateResponse', url.toString(), res.status);\n try {\n return JSON.parse(retStr);\n } catch (e) {\n console.error(formatTime(Date.now()), 'huobiRequestFailed', path, JSON.stringify(params), retStr);\n throw e;\n }\n};\n\n/**\n * 获取账户信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec40743-7773-11ed-9966-0242ac110003\n */\nexport const getAccount = (\n credential: ICredential,\n): Promise<{\n status: string;\n data: {\n id: number;\n type: string;\n state: string;\n subtype: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/account/accounts', 'api.huobi.pro');\n};\n\n/**\n * 获取用户ID\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec491c9-7773-11ed-9966-0242ac110003\n */\nexport const getUid = (credential: ICredential): Promise<{ data: number; code: number }> => {\n return privateRequest(credential, 'GET', '/v2/user/uid', 'api.huobi.pro');\n};\n\n/**\n * 获取统一账户信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000073-77b7-11ed-9966-0242ac110003\n */\nexport const getUnifiedAccountInfo = (\n credential: ICredential,\n): Promise<{\n status: string;\n code: number;\n msg: string;\n data: {\n margin_asset: string;\n margin_balance: number;\n cross_margin_static: number;\n cross_profit_unreal: number;\n withdraw_available: number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/linear-swap-api/v3/unified_account_info', 'api.hbdm.com');\n};\n\n/**\n * 获取合约持仓信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb74963-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapCrossPositionInfo = (\n credential: ICredential,\n params?: {\n contract_code?: string;\n pair?: string;\n contract_type: string;\n },\n): Promise<{\n status: string;\n ts: number;\n data: {\n contract_code: string;\n contract_type: string;\n direction: string;\n margin_mode: string;\n volume: number;\n available: number;\n cost_hold: number;\n last_price: number;\n profit_unreal: number;\n lever_rate: number;\n }[];\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v1/swap_cross_position_info',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * 获取合约挂单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb784d4-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapOpenOrders = (\n credential: ICredential,\n params?: {\n contract_code?: string;\n pair?: string;\n page_index?: number;\n page_size?: number;\n sort_by?: string;\n trade_type?: string;\n },\n): Promise<{\n status: string;\n data: {\n orders: {\n order_id_str: string;\n contract_code: string;\n order_price_type: string;\n direction: string;\n offset: string;\n volume: number;\n created_at: number;\n price: number;\n trade_volume: number;\n }[];\n };\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v1/swap_cross_openorders',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * 获取现货账户余额\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec40922-7773-11ed-9966-0242ac110003\n */\nexport const getSpotAccountBalance = (\n credential: ICredential,\n account_uid: number,\n): Promise<{\n status: string;\n data: {\n list: {\n currency: string;\n balance: string;\n type: string;\n }[];\n };\n}> => {\n return privateRequest(credential, 'GET', `/v1/account/accounts/${account_uid}/balance`, 'api.huobi.pro');\n};\n\n/**\n * 获取杠杆借贷信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41863-7773-11ed-9966-0242ac110003\n */\nexport const getCrossMarginLoanInfo = (\n credential: ICredential,\n): Promise<{\n status: string;\n code: number;\n data: {\n currency: string;\n 'loanable-amt': string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/cross-margin/loan-info', 'api.huobi.pro');\n};\n\n/**\n * 获取现货行情\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec3fc25-7773-11ed-9966-0242ac110003\n */\nexport const getSpotTick = (\n credential: ICredential,\n params: { symbol: string },\n): Promise<{\n status: string;\n tick: {\n close: number;\n };\n}> => {\n return privateRequest(credential, 'GET', `/market/detail/merged`, 'api.huobi.pro', params);\n};\n\n/**\n * 现货下单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000065-77b7-11ed-9966-0242ac110003\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n 'account-id': string;\n amount: string;\n market_amount?: string;\n 'borrow-amount'?: string;\n type: string;\n 'trade-purpose': string;\n price?: string;\n source: string;\n },\n): Promise<{ success: boolean; code: number; message: string; data: { orderId: number } }> => {\n return privateRequest(credential, 'POST', `/v1/order/auto/place`, 'api.huobi.pro', params);\n};\n\n/**\n * 合约下单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb77159-77b5-11ed-9966-0242ac110003\n */\nexport const postSwapOrder = (\n credential: ICredential,\n params: {\n contract_code: string;\n contract_type: string;\n price?: number;\n volume: number;\n offset: string;\n direction: string;\n lever_rate: number;\n order_price_type: string;\n },\n): Promise<{ status: string; ts: number; data: { order_id: number; order_id_str: string } }> => {\n return privateRequest(credential, 'POST', '/linear-swap-api/v1/swap_cross_order', 'api.hbdm.com', params);\n};\n\n/**\n * 获取现货存款地址\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec45fb7-7773-11ed-9966-0242ac110003\n */\nexport const getSpotAccountDepositAddresses = (\n credential: ICredential,\n params: { currency: string },\n): Promise<{\n code: number;\n message: string;\n data: {\n currency: string;\n chain: string;\n address: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v2/account/deposit/address`, 'api.huobi.pro', params);\n};\n\n/**\n * 获取账户流水\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec4610b-7773-11ed-9966-0242ac110003\n */\nexport const getAccountLedger = (\n credential: ICredential,\n params: { accountId: string; currency: string },\n): Promise<{\n status: string;\n data: {\n transactTime: number;\n transactAmt: number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v2/account/ledger`, 'api.huobi.pro', params);\n};\n\n/**\n * 超级杠杆转出\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41ff0-7773-11ed-9966-0242ac110003\n */\nexport const postSuperMarginAccountTransferOut = (\n credential: ICredential,\n params: {\n currency: string;\n amount: string;\n },\n): Promise<{ status: string; data: number }> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/transfer-out`, 'api.huobi.pro', params);\n};\n\n/**\n * 超级杠杆转入\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41f0e-7773-11ed-9966-0242ac110003\n */\nexport const postSuperMarginAccountTransferIn = (\n credential: ICredential,\n params: {\n currency: string;\n amount: string;\n },\n): Promise<{ status: string; data: number }> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/transfer-in`, 'api.huobi.pro', params);\n};\n\n/**\n * 现货账户转账\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000095-77b7-11ed-9966-0242ac110003\n */\nexport const postSpotAccountTransfer = (\n credential: ICredential,\n params: {\n from: string;\n to: string;\n currency: string;\n amount: number;\n 'margin-account': string;\n },\n): Promise<{ success: boolean; data: number; code: number; message: string }> => {\n return privateRequest(credential, 'POST', `/v2/account/transfer`, 'api.huobi.pro', params);\n};\n\n/**\n * 借贷\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41b5d-7773-11ed-9966-0242ac110003\n */\nexport const postBorrow = (\n credential: ICredential,\n params: { currency: string; amount: string },\n): Promise<{\n status: string;\n data: number;\n}> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/orders`, 'api.huobi.pro', params);\n};\n\n/**\n * 提现\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec42cfd-7773-11ed-9966-0242ac110003\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n address: string;\n amount: string;\n currency: string;\n fee: string;\n chain: string;\n },\n): Promise<{\n status: string;\n data: number;\n}> => {\n return privateRequest(credential, 'POST', `/v1/dw/withdraw/api/create`, 'api.huobi.pro', params);\n};\n\n/**\n * 获取充提历史\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec44f99-7773-11ed-9966-0242ac110003\n */\nexport const getDepositWithdrawHistory = (\n credential: ICredential,\n params: {\n currency: string;\n type: string;\n from?: string;\n size?: string;\n direct?: string;\n },\n): Promise<{\n status: string;\n 'error-code': string;\n 'error-msg': string;\n data: {\n id: number;\n type: string;\n currency: string;\n 'tx-hash': string;\n chain: string;\n amount: string;\n address: string;\n 'address-tag': string;\n fee: string;\n state: string;\n 'create-at': number;\n 'update-at': number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v1/query/deposit-withdraw`, 'api.huobi.pro', params);\n};\n\n/**\n * 资产划转(母子用户之间)\n *\n * 接口权限: 交易\n *\n * 限频: 2次/2s\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec45d8e-7773-11ed-9966-0242ac110003\n */\nexport const postSubUserTransfer = (\n credential: ICredential,\n params: {\n 'sub-uid': number;\n currency: string;\n amount: number;\n 'client-order-id'?: string;\n type: string;\n },\n): Promise<{\n data: number;\n status: string;\n}> => {\n return privateRequest(credential, 'POST', '/v1/subuser/transfer', 'api.huobi.pro', params);\n};\n\n/**\n * 获取子用户列表\n *\n * 接口权限: 读取\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec48f09-7773-11ed-9966-0242ac110003\n */\nexport const getSubUserList = (\n credential: ICredential,\n params?: { fromId?: number },\n): Promise<{\n code: number;\n message?: string;\n data: {\n uid: number;\n userState: string;\n subUserName: string;\n note: string;\n }[];\n nextId?: number;\n ok: boolean;\n}> => {\n return privateRequest(credential, 'GET', `/v2/sub-user/user-list`, 'api.huobi.pro', params);\n};\n\n/**\n * 账户类型查询\n *\n * 是否验签: 是\n *\n * 接口权限: 读取\n *\n * 限频: 每个UID 3秒最多 144 次请求(交易接口3秒最多 72 次请求,查询接口3秒最多 72 次请求) (该UID的所有币种和不同到期日的合约的所有私有接口共享该限制) 。\n *\n * 接口描述: 此接口用于客户查询的账号类型,当前U本位合约有统一账户和非统一账户(全仓逐仓账户)类型。统一账户类型资产放在USDT一个账户上,全仓逐仓账户类型资产放在不同的币对。\n * 统一账户类型为最新升级的,当前不支持API下单。若需要用用API下单请切换账户类型为非统一账户。\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb71825-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapUnifiedAccountType = (\n credential: ICredential,\n): Promise<{\n code: number;\n msg: string;\n ts: number;\n data: {\n account_type: number;\n };\n}> => {\n return privateRequest(credential, 'GET', '/linear-swap-api/v3/swap_unified_account_type', 'api.hbdm.com');\n};\n\n/**\n * 账户类型更改接口\n *\n * 是否验签: 是\n *\n * 接口权限: 交易\n *\n * 限频: 每个UID 3秒最多 144 次请求(交易接口3秒最多 72 次请求,查询接口3秒最多 72 次请求) (该UID的所有币种和不同到期日的合约的所有私有接口共享该限制) 。\n *\n * 接口描述: 调用该接口前需要保证U本位合约无持仓和挂单,当由非统一账户(全仓逐仓账户)变为统一账户还需将资产从逐仓账户划转到全仓账户。\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb7196b-77b5-11ed-9966-0242ac110003\n */\nexport const postSwapSwitchAccountType = (\n credential: ICredential,\n params: { account_type: number },\n): Promise<{\n code: number;\n msg: string;\n ts: number;\n data: {\n account_type: number;\n };\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v3/swap_switch_account_type',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * APIv2币链参考信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec478f0-7773-11ed-9966-0242ac110003\n */\nexport const getV2ReferenceCurrencies = (\n credential: ICredential,\n params: {\n currency?: string;\n authorizedUser?: string;\n },\n): Promise<{\n code: number;\n data: {\n currency: string;\n assetType: number;\n chains: {\n chain: string;\n displayName: string;\n fullName: string;\n baseChain?: string;\n baseChainProtocol?: string;\n isDynamic?: boolean;\n numOfConfirmations: number;\n numOfFastConfirmations: number;\n depositStatus: string;\n minDepositAmt: string;\n withdrawStatus: string;\n minWithdrawAmt: string;\n withdrawPrecision: number;\n maxWithdrawAmt: string;\n withdrawQuotaPerDay: string;\n withdrawQuotaPerYear: null;\n withdrawQuotaTotal: null;\n withdrawFeeType: string;\n transactFeeWithdraw?: string;\n addrWithTag: boolean;\n addrDepositTag: boolean;\n minTransactFeeWithdraw?: string;\n transactFeeRateWithdraw?: string;\n maxTransactFeeWithdraw?: string;\n }[];\n instStatus: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v2/reference/currencies', 'api.huobi.pro', params);\n};\n\n/**\n * 获取账户历史\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41049-7773-11ed-9966-0242ac110003\n */\nexport const getAccountHistory = (\n credential: ICredential,\n params: {\n 'account-id': string;\n currency?: string;\n 'transact-types'?: number;\n 'start-time'?: number;\n 'end-time'?: number;\n sort?: 'asc' | 'desc';\n size?: number;\n 'from-id'?: number;\n },\n): Promise<{\n // code: number;\n 'transact-amt': string;\n 'avail-balance': string;\n 'acct-balance': string;\n 'transact-time': string;\n 'record-id': string;\n status: string;\n data: {\n 'account-id': string;\n currency: string;\n 'record-id': string;\n 'transact-amt': string;\n 'transact-type': string;\n 'avail-balance': string;\n 'acct-balance': string;\n 'transact-time': string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/account/history', 'api.huobi.pro', params);\n};\n"]}
|
|
@@ -1,31 +1,15 @@
|
|
|
1
|
+
import { provideOrderActionsWithCredential } from '@yuants/data-order';
|
|
1
2
|
import { Terminal } from '@yuants/protocol';
|
|
2
|
-
import {
|
|
3
|
+
import { submitOrder } from './orders/submitOrder';
|
|
3
4
|
const terminal = Terminal.fromNodeEnv();
|
|
4
|
-
terminal
|
|
5
|
-
|
|
5
|
+
provideOrderActionsWithCredential(terminal, 'HTX', {
|
|
6
|
+
type: 'object',
|
|
7
|
+
required: ['access_key', 'secret_key'],
|
|
6
8
|
properties: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
pattern: '^huobi/',
|
|
10
|
-
},
|
|
11
|
-
credential: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
required: ['access_key', 'secret_key'],
|
|
14
|
-
properties: {
|
|
15
|
-
access_key: { type: 'string' },
|
|
16
|
-
secret_key: { type: 'string' },
|
|
17
|
-
},
|
|
18
|
-
},
|
|
9
|
+
access_key: { type: 'string' },
|
|
10
|
+
secret_key: { type: 'string' },
|
|
19
11
|
},
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
await handleSwapOrder(msg.req, msg.req.credential);
|
|
23
|
-
}
|
|
24
|
-
else if (/huobi\/(.*)\/super-margin/.test(msg.req.account_id)) {
|
|
25
|
-
await handleSuperMarginOrder(msg.req, msg.req.credential);
|
|
26
|
-
}
|
|
27
|
-
else
|
|
28
|
-
throw new Error(`Unsupported account_id: ${msg.req.account_id}`);
|
|
29
|
-
return { res: { code: 0, message: 'OK' } };
|
|
12
|
+
}, {
|
|
13
|
+
submitOrder,
|
|
30
14
|
});
|
|
31
15
|
//# sourceMappingURL=order-actions-with-credentials.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-actions-with-credentials.js","sourceRoot":"","sources":["../src/order-actions-with-credentials.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"order-actions-with-credentials.js","sourceRoot":"","sources":["../src/order-actions-with-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,iCAAiC,CAC/B,QAAQ,EACR,KAAK,EACL;IACE,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC;IACtC,UAAU,EAAE;QACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC/B;CACF,EACD;IACE,WAAW;CACZ,CACF,CAAC","sourcesContent":["import { provideOrderActionsWithCredential } from '@yuants/data-order';\nimport { Terminal } from '@yuants/protocol';\nimport { submitOrder } from './orders/submitOrder';\n\nconst terminal = Terminal.fromNodeEnv();\n\nprovideOrderActionsWithCredential(\n terminal,\n 'HTX',\n {\n type: 'object',\n required: ['access_key', 'secret_key'],\n properties: {\n access_key: { type: 'string' },\n secret_key: { type: 'string' },\n },\n },\n {\n submitOrder,\n },\n);\n"]}
|
package/dist/order-actions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { submitOrder } from './orders/submitOrder';
|
|
2
2
|
/**
|
|
3
3
|
* 提供订单提交服务
|
|
4
4
|
*/
|
|
@@ -7,23 +7,11 @@ export const provideOrderSubmitService = (terminal, swapAccountId, superMarginAc
|
|
|
7
7
|
required: ['account_id'],
|
|
8
8
|
properties: {
|
|
9
9
|
account_id: {
|
|
10
|
-
|
|
10
|
+
enum: [superMarginAccountId, swapAccountId],
|
|
11
11
|
},
|
|
12
12
|
},
|
|
13
13
|
}, async (msg) => {
|
|
14
|
-
await
|
|
15
|
-
return { res: { code: 0, message: 'OK' } };
|
|
16
|
-
});
|
|
17
|
-
terminal.server.provideService('SubmitOrder', {
|
|
18
|
-
required: ['account_id'],
|
|
19
|
-
properties: {
|
|
20
|
-
account_id: {
|
|
21
|
-
const: swapAccountId,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
}, async (msg) => {
|
|
25
|
-
await handleSwapOrder(msg.req, credential);
|
|
26
|
-
return { res: { code: 0, message: 'OK' } };
|
|
14
|
+
return { res: { code: 0, message: 'OK', data: await submitOrder(credential, msg.req) } };
|
|
27
15
|
});
|
|
28
16
|
};
|
|
29
17
|
//# sourceMappingURL=order-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-actions.js","sourceRoot":"","sources":["../src/order-actions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"order-actions.js","sourceRoot":"","sources":["../src/order-actions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,QAAkB,EAClB,aAAqB,EACrB,oBAA4B,EAC5B,UAAuB,EACvB,EAAE;IACF,QAAQ,CAAC,MAAM,CAAC,cAAc,CAC5B,aAAa,EACb;QACE,QAAQ,EAAE,CAAC,YAAY,CAAC;QACxB,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,CAAC,oBAAoB,EAAE,aAAa,CAAC;aAC5C;SACF;KACF,EACD,KAAK,EAAE,GAAG,EAAE,EAAE;QACZ,OAAO,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IAC3F,CAAC,CACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { IOrder } from '@yuants/data-order';\nimport { Terminal } from '@yuants/protocol';\nimport { ICredential } from './api/private-api';\nimport { submitOrder } from './orders/submitOrder';\n\n/**\n * 提供订单提交服务\n */\nexport const provideOrderSubmitService = (\n terminal: Terminal,\n swapAccountId: string,\n superMarginAccountId: string,\n credential: ICredential,\n) => {\n terminal.server.provideService<IOrder, { order_id: string }>(\n 'SubmitOrder',\n {\n required: ['account_id'],\n properties: {\n account_id: {\n enum: [superMarginAccountId, swapAccountId],\n },\n },\n },\n async (msg) => {\n return { res: { code: 0, message: 'OK', data: await submitOrder(credential, msg.req) } };\n },\n );\n};\n"]}
|
|
@@ -6,7 +6,7 @@ import { superMarginAccountUidCache } from '../uid';
|
|
|
6
6
|
/**
|
|
7
7
|
* 处理 swap 账户订单提交
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
async function handleSwapOrder(order, credential) {
|
|
10
10
|
var _a;
|
|
11
11
|
// 获取仓位信息
|
|
12
12
|
const positionInfo = await getSwapCrossPositionInfo(credential);
|
|
@@ -28,11 +28,12 @@ export async function handleSwapOrder(order, credential) {
|
|
|
28
28
|
if (result.status !== 'ok') {
|
|
29
29
|
throw new Error(`Failed to submit swap order: status=${result.status}`);
|
|
30
30
|
}
|
|
31
|
+
return { order_id: result.data.order_id_str };
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* 处理 super-margin 账户订单提交
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
+
async function handleSuperMarginOrder(order, credential) {
|
|
36
37
|
// 获取可贷款金额
|
|
37
38
|
const superMarginAccountUid = await superMarginAccountUidCache.query(JSON.stringify(credential));
|
|
38
39
|
if (!superMarginAccountUid)
|
|
@@ -78,5 +79,15 @@ export async function handleSuperMarginOrder(order, credential) {
|
|
|
78
79
|
if (result.success === false) {
|
|
79
80
|
throw new Error(`Failed to submit super margin order: code=${result.code} message=${result.message}`);
|
|
80
81
|
}
|
|
82
|
+
return { order_id: result.data.orderId.toString() };
|
|
81
83
|
}
|
|
84
|
+
export const submitOrder = (credential, order) => {
|
|
85
|
+
if (order.account_id.includes('swap')) {
|
|
86
|
+
return handleSwapOrder(order, credential);
|
|
87
|
+
}
|
|
88
|
+
if (order.account_id.includes('super-margin')) {
|
|
89
|
+
return handleSuperMarginOrder(order, credential);
|
|
90
|
+
}
|
|
91
|
+
throw new Error(`Unsupported account_id for order submission: ${order.account_id}`);
|
|
92
|
+
};
|
|
82
93
|
//# sourceMappingURL=submitOrder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submitOrder.js","sourceRoot":"","sources":["../../src/orders/submitOrder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAEL,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,EACX,wBAAwB,EACxB,aAAa,EACb,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC;AAEpD;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"submitOrder.js","sourceRoot":"","sources":["../../src/orders/submitOrder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAEL,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,EACX,wBAAwB,EACxB,aAAa,EACb,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC;AAEpD;;GAEG;AACH,KAAK,UAAU,eAAe,CAAC,KAAa,EAAE,UAAuB;;IACnE,SAAS;IACT,MAAM,YAAY,GAAG,MAAM,wBAAwB,CAAC,UAAU,CAAC,CAAC;IAChE,MAAM,qBAAqB,GAAG,MAAM,CAAC,WAAW,CAC9C,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAC9D,CAAC;IAEF,MAAM,UAAU,GAAG,MAAA,qBAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,mCAA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UAAU,EAAE,MAAM,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAEpG,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,6CAA6C,MAAM,CAAC,IAAI,YAAY,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;KACvG;IAED,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,UAAuB,EAAE,KAAa,EAAiC,EAAE;IACnG,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACrC,OAAO,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;KAC3C;IACD,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;QAC7C,OAAO,sBAAsB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;KAClD;IACD,MAAM,IAAI,KAAK,CAAC,gDAAgD,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;AACtF,CAAC,CAAC","sourcesContent":["import { IOrder } from '@yuants/data-order';\nimport { formatTime, roundToStep } from '@yuants/utils';\nimport { firstValueFrom } from 'rxjs';\nimport {\n ICredential,\n getCrossMarginLoanInfo,\n getSpotAccountBalance,\n getSpotTick,\n getSwapCrossPositionInfo,\n postSpotOrder,\n postSwapOrder,\n} from '../api/private-api';\nimport { spotProductService } from '../product';\nimport { superMarginAccountUidCache } from '../uid';\n\n/**\n * 处理 swap 账户订单提交\n */\nasync function handleSwapOrder(order: IOrder, credential: ICredential): Promise<{ order_id: string }> {\n // 获取仓位信息\n const positionInfo = await getSwapCrossPositionInfo(credential);\n const mapContractCodeToRate = Object.fromEntries(\n positionInfo.data.map((v) => [v.contract_code, v.lever_rate]),\n );\n\n const lever_rate = mapContractCodeToRate[order.product_id] ?? 20;\n const params = {\n contract_code: order.product_id,\n contract_type: 'swap',\n price: order.price,\n volume: order.volume,\n offset:\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'OPEN_SHORT' ? 'open' : 'close',\n direction:\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT' ? 'buy' : 'sell',\n // dynamically adjust the leverage\n lever_rate,\n order_price_type: order.order_type === 'MARKET' ? 'market' : 'limit',\n };\n\n const result = await postSwapOrder(credential, params);\n console.info(formatTime(Date.now()), 'SubmitOrder', JSON.stringify(result), JSON.stringify(params));\n\n if (result.status !== 'ok') {\n throw new Error(`Failed to submit swap order: status=${result.status}`);\n }\n return { order_id: result.data.order_id_str };\n}\n\n/**\n * 处理 super-margin 账户订单提交\n */\nasync function handleSuperMarginOrder(order: IOrder, credential: ICredential): Promise<{ order_id: string }> {\n // 获取可贷款金额\n const superMarginAccountUid = await superMarginAccountUidCache.query(JSON.stringify(credential));\n if (!superMarginAccountUid) throw new Error('Super margin account UID not found');\n const loanInfo = await getCrossMarginLoanInfo(credential);\n const usdtLoanable = loanInfo.data.find((v) => v.currency === 'usdt');\n if (!usdtLoanable) throw new Error('USDT loanable amount not found');\n const loanable = +usdtLoanable['loanable-amt'];\n\n // 获取账户余额, 产品信息和价格\n const [balanceRes, mapProductIdToProduct, priceRes] = await Promise.all([\n getSpotAccountBalance(credential, superMarginAccountUid),\n firstValueFrom(spotProductService.mapProductIdToProduct$),\n getSpotTick(credential, { symbol: order.product_id }),\n ]);\n\n const balance = balanceRes.data.list\n .filter((v) => v.currency === 'usdt' && v.type === 'trade')\n .reduce((acc, cur) => acc + +cur.balance, 0);\n\n if (!mapProductIdToProduct) throw new Error('Product map not found');\n\n const theProduct = mapProductIdToProduct.get(order.product_id);\n const price = priceRes.tick.close;\n const borrow_amount =\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT'\n ? Math.max(Math.min(loanable, order.volume * price - balance), 0)\n : undefined;\n\n const params = {\n symbol: order.product_id,\n 'account-id': '' + superMarginAccountUid,\n amount:\n '' +\n (order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT'\n ? roundToStep(order.volume * price, theProduct?.volume_step!)\n : order.volume),\n 'borrow-amount': '' + borrow_amount,\n type: `${\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT' ? 'buy' : 'sell'\n }-${'LIMIT' === order.order_type ? 'limit' : 'market'}`,\n 'trade-purpose':\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT'\n ? '1' // auto borrow\n : '2', // auto repay\n price: order.order_type === 'MARKET' ? undefined : '' + order.price,\n source: 'super-margin-api',\n };\n\n const result = await postSpotOrder(credential, params);\n console.info(formatTime(Date.now()), 'SubmitOrder', JSON.stringify(result), JSON.stringify(params));\n\n if (result.success === false) {\n throw new Error(`Failed to submit super margin order: code=${result.code} message=${result.message}`);\n }\n\n return { order_id: result.data.orderId.toString() };\n}\n\nexport const submitOrder = (credential: ICredential, order: IOrder): Promise<{ order_id: string }> => {\n if (order.account_id.includes('swap')) {\n return handleSwapOrder(order, credential);\n }\n if (order.account_id.includes('super-margin')) {\n return handleSuperMarginOrder(order, credential);\n }\n throw new Error(`Unsupported account_id for order submission: ${order.account_id}`);\n};\n"]}
|
package/lib/api/private-api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-api.d.ts","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,oBAAoB,QAAO,WAKvC,CAAC;AAEF,eAAO,MAAM,cAAc,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AAEF;;;;;;GAMG;AACI,MAAM,cAAc,GAAG,CAC5B,UAAuB,EACvB,MAA4B,EAY3B,EAAE;IACH,OAAO,IAAA,sBAAc,EAAC,UAAU,EAAE,KAAK,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AAC9F,CAAC,CAAC;AAhBW,QAAA,cAAc,kBAgBzB;AAEF;;;;;;;;;;;;;GAaG;AACI,MAAM,yBAAyB,GAAG,CACvC,UAAuB,EAQtB,EAAE;IACH,OAAO,IAAA,sBAAc,EAAC,UAAU,EAAE,KAAK,EAAE,+CAA+C,EAAE,cAAc,CAAC,CAAC;AAC5G,CAAC,CAAC;AAXW,QAAA,yBAAyB,6BAWpC;AAEF;;;;;;;;;;;;GAYG;AACI,MAAM,yBAAyB,GAAG,CACvC,UAAuB,EACvB,MAAgC,EAQ/B,EAAE;IACH,OAAO,IAAA,sBAAc,EACnB,UAAU,EACV,MAAM,EACN,8CAA8C,EAC9C,cAAc,EACd,MAAM,CACP,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,yBAAyB,6BAkBpC;AAEF;;;;GAIG;AACI,MAAM,wBAAwB,GAAG,CACtC,UAAuB,EACvB,MAGC,EAkCA,EAAE;IACH,OAAO,IAAA,sBAAc,EAAC,UAAU,EAAE,KAAK,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AAChG,CAAC,CAAC;AAzCW,QAAA,wBAAwB,4BAyCnC;AAEF;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAC/B,UAAuB,EACvB,MASC,EAmBA,EAAE;IACH,OAAO,IAAA,sBAAc,EAAC,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AAC3F,CAAC,CAAC;AAhCW,QAAA,iBAAiB,qBAgC5B","sourcesContent":["import { encodeBase64, formatTime, HmacSHA256 } from '@yuants/utils';\n\nexport interface ICredential {\n access_key: string;\n secret_key: string;\n}\n\nexport const getDefaultCredential = (): ICredential => {\n return {\n access_key: process.env.ACCESS_KEY!,\n secret_key: process.env.SECRET_KEY!,\n };\n};\n\nexport const privateRequest = async (\n credential: ICredential,\n method: string,\n path: string,\n api_root: string,\n params?: any,\n) => {\n const requestParams = `AccessKeyId=${\n credential.access_key\n }&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=${encodeURIComponent(\n new Date().toISOString().split('.')[0],\n )}${\n method === 'GET' && params !== undefined\n ? `&${Object.entries(params)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([k, v]) => `${k}=${v}`)\n .join('&')}`\n : ''\n }`;\n\n const body = method === 'GET' ? '' : JSON.stringify(params);\n\n const requestString = `${method}\\n${api_root}\\n${path}\\n${requestParams}`;\n\n const str = encodeBase64(\n await HmacSHA256(\n new TextEncoder().encode(requestString),\n new TextEncoder().encode(credential.secret_key),\n ),\n );\n\n const url = new URL(`https://${api_root}${path}?${requestParams}&Signature=${encodeURIComponent(str)}`);\n // url.searchParams.sort();\n console.info(formatTime(Date.now()), method, url.href, body);\n const res = await fetch(url.href, {\n method,\n headers: { 'Content-Type': 'application/json' },\n body: body || undefined,\n });\n\n const retStr = await res.text();\n console.info(formatTime(Date.now()), 'PrivateResponse', url.toString(), res.status);\n try {\n return JSON.parse(retStr);\n } catch (e) {\n console.error(formatTime(Date.now()), 'huobiRequestFailed', path, JSON.stringify(params), retStr);\n throw e;\n }\n};\n\n/**\n * 获取账户信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec40743-7773-11ed-9966-0242ac110003\n */\nexport const getAccount = (\n credential: ICredential,\n): Promise<{\n status: string;\n data: {\n id: number;\n type: string;\n state: string;\n subtype: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/account/accounts', 'api.huobi.pro');\n};\n\n/**\n * 获取用户ID\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec491c9-7773-11ed-9966-0242ac110003\n */\nexport const getUid = (credential: ICredential): Promise<{ data: number; code: number }> => {\n return privateRequest(credential, 'GET', '/v2/user/uid', 'api.huobi.pro');\n};\n\n/**\n * 获取统一账户信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000073-77b7-11ed-9966-0242ac110003\n */\nexport const getUnifiedAccountInfo = (\n credential: ICredential,\n): Promise<{\n status: string;\n code: number;\n msg: string;\n data: {\n margin_asset: string;\n margin_balance: number;\n cross_margin_static: number;\n cross_profit_unreal: number;\n withdraw_available: number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/linear-swap-api/v3/unified_account_info', 'api.hbdm.com');\n};\n\n/**\n * 获取合约持仓信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb74963-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapCrossPositionInfo = (\n credential: ICredential,\n params?: {\n contract_code?: string;\n pair?: string;\n contract_type: string;\n },\n): Promise<{\n status: string;\n ts: number;\n data: {\n contract_code: string;\n contract_type: string;\n direction: string;\n margin_mode: string;\n volume: number;\n available: number;\n cost_hold: number;\n last_price: number;\n profit_unreal: number;\n lever_rate: number;\n }[];\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v1/swap_cross_position_info',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * 获取合约挂单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb784d4-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapOpenOrders = (\n credential: ICredential,\n params?: {\n contract_code?: string;\n pair?: string;\n page_index?: number;\n page_size?: number;\n sort_by?: string;\n trade_type?: string;\n },\n): Promise<{\n status: string;\n data: {\n orders: {\n order_id_str: string;\n contract_code: string;\n order_price_type: string;\n direction: string;\n offset: string;\n volume: number;\n created_at: number;\n price: number;\n trade_volume: number;\n }[];\n };\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v1/swap_cross_openorders',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * 获取现货账户余额\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec40922-7773-11ed-9966-0242ac110003\n */\nexport const getSpotAccountBalance = (\n credential: ICredential,\n account_uid: number,\n): Promise<{\n status: string;\n data: {\n list: {\n currency: string;\n balance: string;\n type: string;\n }[];\n };\n}> => {\n return privateRequest(credential, 'GET', `/v1/account/accounts/${account_uid}/balance`, 'api.huobi.pro');\n};\n\n/**\n * 获取杠杆借贷信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41863-7773-11ed-9966-0242ac110003\n */\nexport const getCrossMarginLoanInfo = (\n credential: ICredential,\n): Promise<{\n status: string;\n code: number;\n data: {\n currency: string;\n 'loanable-amt': string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/cross-margin/loan-info', 'api.huobi.pro');\n};\n\n/**\n * 获取现货行情\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec3fc25-7773-11ed-9966-0242ac110003\n */\nexport const getSpotTick = (\n credential: ICredential,\n params: { symbol: string },\n): Promise<{\n status: string;\n tick: {\n close: number;\n };\n}> => {\n return privateRequest(credential, 'GET', `/market/detail/merged`, 'api.huobi.pro', params);\n};\n\n/**\n * 现货下单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000065-77b7-11ed-9966-0242ac110003\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n 'account-id': string;\n amount: string;\n market_amount?: string;\n 'borrow-amount'?: string;\n type: string;\n 'trade-purpose': string;\n price?: string;\n source: string;\n },\n): Promise<{ success: boolean; code: number; message: string }> => {\n return privateRequest(credential, 'POST', `/v1/order/auto/place`, 'api.huobi.pro', params);\n};\n\n/**\n * 合约下单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb77159-77b5-11ed-9966-0242ac110003\n */\nexport const postSwapOrder = (\n credential: ICredential,\n params: {\n contract_code: string;\n contract_type: string;\n price?: number;\n volume: number;\n offset: string;\n direction: string;\n lever_rate: number;\n order_price_type: string;\n },\n): Promise<{ status: string; ts: number; data: { order_id: number; order_id_str: string } }> => {\n return privateRequest(credential, 'POST', '/linear-swap-api/v1/swap_cross_order', 'api.hbdm.com', params);\n};\n\n/**\n * 获取现货存款地址\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec45fb7-7773-11ed-9966-0242ac110003\n */\nexport const getSpotAccountDepositAddresses = (\n credential: ICredential,\n params: { currency: string },\n): Promise<{\n code: number;\n message: string;\n data: {\n currency: string;\n chain: string;\n address: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v2/account/deposit/address`, 'api.huobi.pro', params);\n};\n\n/**\n * 获取账户流水\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec4610b-7773-11ed-9966-0242ac110003\n */\nexport const getAccountLedger = (\n credential: ICredential,\n params: { accountId: string; currency: string },\n): Promise<{\n status: string;\n data: {\n transactTime: number;\n transactAmt: number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v2/account/ledger`, 'api.huobi.pro', params);\n};\n\n/**\n * 超级杠杆转出\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41ff0-7773-11ed-9966-0242ac110003\n */\nexport const postSuperMarginAccountTransferOut = (\n credential: ICredential,\n params: {\n currency: string;\n amount: string;\n },\n): Promise<{ status: string; data: number }> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/transfer-out`, 'api.huobi.pro', params);\n};\n\n/**\n * 超级杠杆转入\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41f0e-7773-11ed-9966-0242ac110003\n */\nexport const postSuperMarginAccountTransferIn = (\n credential: ICredential,\n params: {\n currency: string;\n amount: string;\n },\n): Promise<{ status: string; data: number }> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/transfer-in`, 'api.huobi.pro', params);\n};\n\n/**\n * 现货账户转账\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000095-77b7-11ed-9966-0242ac110003\n */\nexport const postSpotAccountTransfer = (\n credential: ICredential,\n params: {\n from: string;\n to: string;\n currency: string;\n amount: number;\n 'margin-account': string;\n },\n): Promise<{ success: boolean; data: number; code: number; message: string }> => {\n return privateRequest(credential, 'POST', `/v2/account/transfer`, 'api.huobi.pro', params);\n};\n\n/**\n * 借贷\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41b5d-7773-11ed-9966-0242ac110003\n */\nexport const postBorrow = (\n credential: ICredential,\n params: { currency: string; amount: string },\n): Promise<{\n status: string;\n data: number;\n}> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/orders`, 'api.huobi.pro', params);\n};\n\n/**\n * 提现\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec42cfd-7773-11ed-9966-0242ac110003\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n address: string;\n amount: string;\n currency: string;\n fee: string;\n chain: string;\n },\n): Promise<{\n status: string;\n data: number;\n}> => {\n return privateRequest(credential, 'POST', `/v1/dw/withdraw/api/create`, 'api.huobi.pro', params);\n};\n\n/**\n * 获取充提历史\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec44f99-7773-11ed-9966-0242ac110003\n */\nexport const getDepositWithdrawHistory = (\n credential: ICredential,\n params: {\n currency: string;\n type: string;\n from?: string;\n size?: string;\n direct?: string;\n },\n): Promise<{\n status: string;\n 'error-code': string;\n 'error-msg': string;\n data: {\n id: number;\n type: string;\n currency: string;\n 'tx-hash': string;\n chain: string;\n amount: string;\n address: string;\n 'address-tag': string;\n fee: string;\n state: string;\n 'create-at': number;\n 'update-at': number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v1/query/deposit-withdraw`, 'api.huobi.pro', params);\n};\n\n/**\n * 资产划转(母子用户之间)\n *\n * 接口权限: 交易\n *\n * 限频: 2次/2s\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec45d8e-7773-11ed-9966-0242ac110003\n */\nexport const postSubUserTransfer = (\n credential: ICredential,\n params: {\n 'sub-uid': number;\n currency: string;\n amount: number;\n 'client-order-id'?: string;\n type: string;\n },\n): Promise<{\n data: number;\n status: string;\n}> => {\n return privateRequest(credential, 'POST', '/v1/subuser/transfer', 'api.huobi.pro', params);\n};\n\n/**\n * 获取子用户列表\n *\n * 接口权限: 读取\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec48f09-7773-11ed-9966-0242ac110003\n */\nexport const getSubUserList = (\n credential: ICredential,\n params?: { fromId?: number },\n): Promise<{\n code: number;\n message?: string;\n data: {\n uid: number;\n userState: string;\n subUserName: string;\n note: string;\n }[];\n nextId?: number;\n ok: boolean;\n}> => {\n return privateRequest(credential, 'GET', `/v2/sub-user/user-list`, 'api.huobi.pro', params);\n};\n\n/**\n * 账户类型查询\n *\n * 是否验签: 是\n *\n * 接口权限: 读取\n *\n * 限频: 每个UID 3秒最多 144 次请求(交易接口3秒最多 72 次请求,查询接口3秒最多 72 次请求) (该UID的所有币种和不同到期日的合约的所有私有接口共享该限制) 。\n *\n * 接口描述: 此接口用于客户查询的账号类型,当前U本位合约有统一账户和非统一账户(全仓逐仓账户)类型。统一账户类型资产放在USDT一个账户上,全仓逐仓账户类型资产放在不同的币对。\n * 统一账户类型为最新升级的,当前不支持API下单。若需要用用API下单请切换账户类型为非统一账户。\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb71825-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapUnifiedAccountType = (\n credential: ICredential,\n): Promise<{\n code: number;\n msg: string;\n ts: number;\n data: {\n account_type: number;\n };\n}> => {\n return privateRequest(credential, 'GET', '/linear-swap-api/v3/swap_unified_account_type', 'api.hbdm.com');\n};\n\n/**\n * 账户类型更改接口\n *\n * 是否验签: 是\n *\n * 接口权限: 交易\n *\n * 限频: 每个UID 3秒最多 144 次请求(交易接口3秒最多 72 次请求,查询接口3秒最多 72 次请求) (该UID的所有币种和不同到期日的合约的所有私有接口共享该限制) 。\n *\n * 接口描述: 调用该接口前需要保证U本位合约无持仓和挂单,当由非统一账户(全仓逐仓账户)变为统一账户还需将资产从逐仓账户划转到全仓账户。\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb7196b-77b5-11ed-9966-0242ac110003\n */\nexport const postSwapSwitchAccountType = (\n credential: ICredential,\n params: { account_type: number },\n): Promise<{\n code: number;\n msg: string;\n ts: number;\n data: {\n account_type: number;\n };\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v3/swap_switch_account_type',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * APIv2币链参考信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec478f0-7773-11ed-9966-0242ac110003\n */\nexport const getV2ReferenceCurrencies = (\n credential: ICredential,\n params: {\n currency?: string;\n authorizedUser?: string;\n },\n): Promise<{\n code: number;\n data: {\n currency: string;\n assetType: number;\n chains: {\n chain: string;\n displayName: string;\n fullName: string;\n baseChain?: string;\n baseChainProtocol?: string;\n isDynamic?: boolean;\n numOfConfirmations: number;\n numOfFastConfirmations: number;\n depositStatus: string;\n minDepositAmt: string;\n withdrawStatus: string;\n minWithdrawAmt: string;\n withdrawPrecision: number;\n maxWithdrawAmt: string;\n withdrawQuotaPerDay: string;\n withdrawQuotaPerYear: null;\n withdrawQuotaTotal: null;\n withdrawFeeType: string;\n transactFeeWithdraw?: string;\n addrWithTag: boolean;\n addrDepositTag: boolean;\n minTransactFeeWithdraw?: string;\n transactFeeRateWithdraw?: string;\n maxTransactFeeWithdraw?: string;\n }[];\n instStatus: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v2/reference/currencies', 'api.huobi.pro', params);\n};\n\n/**\n * 获取账户历史\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41049-7773-11ed-9966-0242ac110003\n */\nexport const getAccountHistory = (\n credential: ICredential,\n params: {\n 'account-id': string;\n currency?: string;\n 'transact-types'?: number;\n 'start-time'?: number;\n 'end-time'?: number;\n sort?: 'asc' | 'desc';\n size?: number;\n 'from-id'?: number;\n },\n): Promise<{\n // code: number;\n 'transact-amt': string;\n 'avail-balance': string;\n 'acct-balance': string;\n 'transact-time': string;\n 'record-id': string;\n status: string;\n data: {\n 'account-id': string;\n currency: string;\n 'record-id': string;\n 'transact-amt': string;\n 'transact-type': string;\n 'avail-balance': string;\n 'acct-balance': string;\n 'transact-time': string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/account/history', 'api.huobi.pro', params);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":";;;AAAA,yCAAqE;AAO9D,MAAM,oBAAoB,GAAG,GAAgB,EAAE;IACpD,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,UAAW;QACnC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,UAAW;KACpC,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,oBAAoB,wBAK/B;AAEK,MAAM,cAAc,GAAG,KAAK,EACjC,UAAuB,EACvB,MAAc,EACd,IAAY,EACZ,QAAgB,EAChB,MAAY,EACZ,EAAE;IACF,MAAM,aAAa,GAAG,eACpB,UAAU,CAAC,UACb,4DAA4D,kBAAkB,CAC5E,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACvC,GACC,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,SAAS;QACtC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;aACvB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;aACtC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;aAC5B,IAAI,CAAC,GAAG,CAAC,EAAE;QAChB,CAAC,C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/B,EAAE;IACH,OAAO,IAAA,sBAAc,EACnB,UAAU,EACV,MAAM,EACN,8CAA8C,EAC9C,cAAc,EACd,MAAM,CACP,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,yBAAyB,6BAkBpC;AAEF;;;;GAIG;AACI,MAAM,wBAAwB,GAAG,CACtC,UAAuB,EACvB,MAGC,EAkCA,EAAE;IACH,OAAO,IAAA,sBAAc,EAAC,UAAU,EAAE,KAAK,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AAChG,CAAC,CAAC;AAzCW,QAAA,wBAAwB,4BAyCnC;AAEF;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAC/B,UAAuB,EACvB,MASC,EAmBA,EAAE;IACH,OAAO,IAAA,sBAAc,EAAC,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;AAC3F,CAAC,CAAC;AAhCW,QAAA,iBAAiB,qBAgC5B","sourcesContent":["import { encodeBase64, formatTime, HmacSHA256 } from '@yuants/utils';\n\nexport interface ICredential {\n access_key: string;\n secret_key: string;\n}\n\nexport const getDefaultCredential = (): ICredential => {\n return {\n access_key: process.env.ACCESS_KEY!,\n secret_key: process.env.SECRET_KEY!,\n };\n};\n\nexport const privateRequest = async (\n credential: ICredential,\n method: string,\n path: string,\n api_root: string,\n params?: any,\n) => {\n const requestParams = `AccessKeyId=${\n credential.access_key\n }&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=${encodeURIComponent(\n new Date().toISOString().split('.')[0],\n )}${\n method === 'GET' && params !== undefined\n ? `&${Object.entries(params)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([k, v]) => `${k}=${v}`)\n .join('&')}`\n : ''\n }`;\n\n const body = method === 'GET' ? '' : JSON.stringify(params);\n\n const requestString = `${method}\\n${api_root}\\n${path}\\n${requestParams}`;\n\n const str = encodeBase64(\n await HmacSHA256(\n new TextEncoder().encode(requestString),\n new TextEncoder().encode(credential.secret_key),\n ),\n );\n\n const url = new URL(`https://${api_root}${path}?${requestParams}&Signature=${encodeURIComponent(str)}`);\n // url.searchParams.sort();\n console.info(formatTime(Date.now()), method, url.href, body);\n const res = await fetch(url.href, {\n method,\n headers: { 'Content-Type': 'application/json' },\n body: body || undefined,\n });\n\n const retStr = await res.text();\n console.info(formatTime(Date.now()), 'PrivateResponse', url.toString(), res.status);\n try {\n return JSON.parse(retStr);\n } catch (e) {\n console.error(formatTime(Date.now()), 'huobiRequestFailed', path, JSON.stringify(params), retStr);\n throw e;\n }\n};\n\n/**\n * 获取账户信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec40743-7773-11ed-9966-0242ac110003\n */\nexport const getAccount = (\n credential: ICredential,\n): Promise<{\n status: string;\n data: {\n id: number;\n type: string;\n state: string;\n subtype: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/account/accounts', 'api.huobi.pro');\n};\n\n/**\n * 获取用户ID\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec491c9-7773-11ed-9966-0242ac110003\n */\nexport const getUid = (credential: ICredential): Promise<{ data: number; code: number }> => {\n return privateRequest(credential, 'GET', '/v2/user/uid', 'api.huobi.pro');\n};\n\n/**\n * 获取统一账户信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000073-77b7-11ed-9966-0242ac110003\n */\nexport const getUnifiedAccountInfo = (\n credential: ICredential,\n): Promise<{\n status: string;\n code: number;\n msg: string;\n data: {\n margin_asset: string;\n margin_balance: number;\n cross_margin_static: number;\n cross_profit_unreal: number;\n withdraw_available: number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/linear-swap-api/v3/unified_account_info', 'api.hbdm.com');\n};\n\n/**\n * 获取合约持仓信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb74963-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapCrossPositionInfo = (\n credential: ICredential,\n params?: {\n contract_code?: string;\n pair?: string;\n contract_type: string;\n },\n): Promise<{\n status: string;\n ts: number;\n data: {\n contract_code: string;\n contract_type: string;\n direction: string;\n margin_mode: string;\n volume: number;\n available: number;\n cost_hold: number;\n last_price: number;\n profit_unreal: number;\n lever_rate: number;\n }[];\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v1/swap_cross_position_info',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * 获取合约挂单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb784d4-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapOpenOrders = (\n credential: ICredential,\n params?: {\n contract_code?: string;\n pair?: string;\n page_index?: number;\n page_size?: number;\n sort_by?: string;\n trade_type?: string;\n },\n): Promise<{\n status: string;\n data: {\n orders: {\n order_id_str: string;\n contract_code: string;\n order_price_type: string;\n direction: string;\n offset: string;\n volume: number;\n created_at: number;\n price: number;\n trade_volume: number;\n }[];\n };\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v1/swap_cross_openorders',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * 获取现货账户余额\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec40922-7773-11ed-9966-0242ac110003\n */\nexport const getSpotAccountBalance = (\n credential: ICredential,\n account_uid: number,\n): Promise<{\n status: string;\n data: {\n list: {\n currency: string;\n balance: string;\n type: string;\n }[];\n };\n}> => {\n return privateRequest(credential, 'GET', `/v1/account/accounts/${account_uid}/balance`, 'api.huobi.pro');\n};\n\n/**\n * 获取杠杆借贷信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41863-7773-11ed-9966-0242ac110003\n */\nexport const getCrossMarginLoanInfo = (\n credential: ICredential,\n): Promise<{\n status: string;\n code: number;\n data: {\n currency: string;\n 'loanable-amt': string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/cross-margin/loan-info', 'api.huobi.pro');\n};\n\n/**\n * 获取现货行情\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec3fc25-7773-11ed-9966-0242ac110003\n */\nexport const getSpotTick = (\n credential: ICredential,\n params: { symbol: string },\n): Promise<{\n status: string;\n tick: {\n close: number;\n };\n}> => {\n return privateRequest(credential, 'GET', `/market/detail/merged`, 'api.huobi.pro', params);\n};\n\n/**\n * 现货下单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000065-77b7-11ed-9966-0242ac110003\n */\nexport const postSpotOrder = (\n credential: ICredential,\n params: {\n symbol: string;\n 'account-id': string;\n amount: string;\n market_amount?: string;\n 'borrow-amount'?: string;\n type: string;\n 'trade-purpose': string;\n price?: string;\n source: string;\n },\n): Promise<{ success: boolean; code: number; message: string; data: { orderId: number } }> => {\n return privateRequest(credential, 'POST', `/v1/order/auto/place`, 'api.huobi.pro', params);\n};\n\n/**\n * 合约下单\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb77159-77b5-11ed-9966-0242ac110003\n */\nexport const postSwapOrder = (\n credential: ICredential,\n params: {\n contract_code: string;\n contract_type: string;\n price?: number;\n volume: number;\n offset: string;\n direction: string;\n lever_rate: number;\n order_price_type: string;\n },\n): Promise<{ status: string; ts: number; data: { order_id: number; order_id_str: string } }> => {\n return privateRequest(credential, 'POST', '/linear-swap-api/v1/swap_cross_order', 'api.hbdm.com', params);\n};\n\n/**\n * 获取现货存款地址\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec45fb7-7773-11ed-9966-0242ac110003\n */\nexport const getSpotAccountDepositAddresses = (\n credential: ICredential,\n params: { currency: string },\n): Promise<{\n code: number;\n message: string;\n data: {\n currency: string;\n chain: string;\n address: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v2/account/deposit/address`, 'api.huobi.pro', params);\n};\n\n/**\n * 获取账户流水\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec4610b-7773-11ed-9966-0242ac110003\n */\nexport const getAccountLedger = (\n credential: ICredential,\n params: { accountId: string; currency: string },\n): Promise<{\n status: string;\n data: {\n transactTime: number;\n transactAmt: number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v2/account/ledger`, 'api.huobi.pro', params);\n};\n\n/**\n * 超级杠杆转出\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41ff0-7773-11ed-9966-0242ac110003\n */\nexport const postSuperMarginAccountTransferOut = (\n credential: ICredential,\n params: {\n currency: string;\n amount: string;\n },\n): Promise<{ status: string; data: number }> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/transfer-out`, 'api.huobi.pro', params);\n};\n\n/**\n * 超级杠杆转入\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41f0e-7773-11ed-9966-0242ac110003\n */\nexport const postSuperMarginAccountTransferIn = (\n credential: ICredential,\n params: {\n currency: string;\n amount: string;\n },\n): Promise<{ status: string; data: number }> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/transfer-in`, 'api.huobi.pro', params);\n};\n\n/**\n * 现货账户转账\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=10000095-77b7-11ed-9966-0242ac110003\n */\nexport const postSpotAccountTransfer = (\n credential: ICredential,\n params: {\n from: string;\n to: string;\n currency: string;\n amount: number;\n 'margin-account': string;\n },\n): Promise<{ success: boolean; data: number; code: number; message: string }> => {\n return privateRequest(credential, 'POST', `/v2/account/transfer`, 'api.huobi.pro', params);\n};\n\n/**\n * 借贷\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41b5d-7773-11ed-9966-0242ac110003\n */\nexport const postBorrow = (\n credential: ICredential,\n params: { currency: string; amount: string },\n): Promise<{\n status: string;\n data: number;\n}> => {\n return privateRequest(credential, 'POST', `/v1/cross-margin/orders`, 'api.huobi.pro', params);\n};\n\n/**\n * 提现\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec42cfd-7773-11ed-9966-0242ac110003\n */\nexport const postWithdraw = (\n credential: ICredential,\n params: {\n address: string;\n amount: string;\n currency: string;\n fee: string;\n chain: string;\n },\n): Promise<{\n status: string;\n data: number;\n}> => {\n return privateRequest(credential, 'POST', `/v1/dw/withdraw/api/create`, 'api.huobi.pro', params);\n};\n\n/**\n * 获取充提历史\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec44f99-7773-11ed-9966-0242ac110003\n */\nexport const getDepositWithdrawHistory = (\n credential: ICredential,\n params: {\n currency: string;\n type: string;\n from?: string;\n size?: string;\n direct?: string;\n },\n): Promise<{\n status: string;\n 'error-code': string;\n 'error-msg': string;\n data: {\n id: number;\n type: string;\n currency: string;\n 'tx-hash': string;\n chain: string;\n amount: string;\n address: string;\n 'address-tag': string;\n fee: string;\n state: string;\n 'create-at': number;\n 'update-at': number;\n }[];\n}> => {\n return privateRequest(credential, 'GET', `/v1/query/deposit-withdraw`, 'api.huobi.pro', params);\n};\n\n/**\n * 资产划转(母子用户之间)\n *\n * 接口权限: 交易\n *\n * 限频: 2次/2s\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec45d8e-7773-11ed-9966-0242ac110003\n */\nexport const postSubUserTransfer = (\n credential: ICredential,\n params: {\n 'sub-uid': number;\n currency: string;\n amount: number;\n 'client-order-id'?: string;\n type: string;\n },\n): Promise<{\n data: number;\n status: string;\n}> => {\n return privateRequest(credential, 'POST', '/v1/subuser/transfer', 'api.huobi.pro', params);\n};\n\n/**\n * 获取子用户列表\n *\n * 接口权限: 读取\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec48f09-7773-11ed-9966-0242ac110003\n */\nexport const getSubUserList = (\n credential: ICredential,\n params?: { fromId?: number },\n): Promise<{\n code: number;\n message?: string;\n data: {\n uid: number;\n userState: string;\n subUserName: string;\n note: string;\n }[];\n nextId?: number;\n ok: boolean;\n}> => {\n return privateRequest(credential, 'GET', `/v2/sub-user/user-list`, 'api.huobi.pro', params);\n};\n\n/**\n * 账户类型查询\n *\n * 是否验签: 是\n *\n * 接口权限: 读取\n *\n * 限频: 每个UID 3秒最多 144 次请求(交易接口3秒最多 72 次请求,查询接口3秒最多 72 次请求) (该UID的所有币种和不同到期日的合约的所有私有接口共享该限制) 。\n *\n * 接口描述: 此接口用于客户查询的账号类型,当前U本位合约有统一账户和非统一账户(全仓逐仓账户)类型。统一账户类型资产放在USDT一个账户上,全仓逐仓账户类型资产放在不同的币对。\n * 统一账户类型为最新升级的,当前不支持API下单。若需要用用API下单请切换账户类型为非统一账户。\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb71825-77b5-11ed-9966-0242ac110003\n */\nexport const getSwapUnifiedAccountType = (\n credential: ICredential,\n): Promise<{\n code: number;\n msg: string;\n ts: number;\n data: {\n account_type: number;\n };\n}> => {\n return privateRequest(credential, 'GET', '/linear-swap-api/v3/swap_unified_account_type', 'api.hbdm.com');\n};\n\n/**\n * 账户类型更改接口\n *\n * 是否验签: 是\n *\n * 接口权限: 交易\n *\n * 限频: 每个UID 3秒最多 144 次请求(交易接口3秒最多 72 次请求,查询接口3秒最多 72 次请求) (该UID的所有币种和不同到期日的合约的所有私有接口共享该限制) 。\n *\n * 接口描述: 调用该接口前需要保证U本位合约无持仓和挂单,当由非统一账户(全仓逐仓账户)变为统一账户还需将资产从逐仓账户划转到全仓账户。\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=8cb7196b-77b5-11ed-9966-0242ac110003\n */\nexport const postSwapSwitchAccountType = (\n credential: ICredential,\n params: { account_type: number },\n): Promise<{\n code: number;\n msg: string;\n ts: number;\n data: {\n account_type: number;\n };\n}> => {\n return privateRequest(\n credential,\n 'POST',\n '/linear-swap-api/v3/swap_switch_account_type',\n 'api.hbdm.com',\n params,\n );\n};\n\n/**\n * APIv2币链参考信息\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec478f0-7773-11ed-9966-0242ac110003\n */\nexport const getV2ReferenceCurrencies = (\n credential: ICredential,\n params: {\n currency?: string;\n authorizedUser?: string;\n },\n): Promise<{\n code: number;\n data: {\n currency: string;\n assetType: number;\n chains: {\n chain: string;\n displayName: string;\n fullName: string;\n baseChain?: string;\n baseChainProtocol?: string;\n isDynamic?: boolean;\n numOfConfirmations: number;\n numOfFastConfirmations: number;\n depositStatus: string;\n minDepositAmt: string;\n withdrawStatus: string;\n minWithdrawAmt: string;\n withdrawPrecision: number;\n maxWithdrawAmt: string;\n withdrawQuotaPerDay: string;\n withdrawQuotaPerYear: null;\n withdrawQuotaTotal: null;\n withdrawFeeType: string;\n transactFeeWithdraw?: string;\n addrWithTag: boolean;\n addrDepositTag: boolean;\n minTransactFeeWithdraw?: string;\n transactFeeRateWithdraw?: string;\n maxTransactFeeWithdraw?: string;\n }[];\n instStatus: string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v2/reference/currencies', 'api.huobi.pro', params);\n};\n\n/**\n * 获取账户历史\n *\n * https://www.htx.com/zh-cn/opend/newApiPages/?id=7ec41049-7773-11ed-9966-0242ac110003\n */\nexport const getAccountHistory = (\n credential: ICredential,\n params: {\n 'account-id': string;\n currency?: string;\n 'transact-types'?: number;\n 'start-time'?: number;\n 'end-time'?: number;\n sort?: 'asc' | 'desc';\n size?: number;\n 'from-id'?: number;\n },\n): Promise<{\n // code: number;\n 'transact-amt': string;\n 'avail-balance': string;\n 'acct-balance': string;\n 'transact-time': string;\n 'record-id': string;\n status: string;\n data: {\n 'account-id': string;\n currency: string;\n 'record-id': string;\n 'transact-amt': string;\n 'transact-type': string;\n 'avail-balance': string;\n 'acct-balance': string;\n 'transact-time': string;\n }[];\n}> => {\n return privateRequest(credential, 'GET', '/v1/account/history', 'api.huobi.pro', params);\n};\n"]}
|
|
@@ -1,33 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const data_order_1 = require("@yuants/data-order");
|
|
3
4
|
const protocol_1 = require("@yuants/protocol");
|
|
4
5
|
const submitOrder_1 = require("./orders/submitOrder");
|
|
5
6
|
const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
(0, data_order_1.provideOrderActionsWithCredential)(terminal, 'HTX', {
|
|
8
|
+
type: 'object',
|
|
9
|
+
required: ['access_key', 'secret_key'],
|
|
8
10
|
properties: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
pattern: '^huobi/',
|
|
12
|
-
},
|
|
13
|
-
credential: {
|
|
14
|
-
type: 'object',
|
|
15
|
-
required: ['access_key', 'secret_key'],
|
|
16
|
-
properties: {
|
|
17
|
-
access_key: { type: 'string' },
|
|
18
|
-
secret_key: { type: 'string' },
|
|
19
|
-
},
|
|
20
|
-
},
|
|
11
|
+
access_key: { type: 'string' },
|
|
12
|
+
secret_key: { type: 'string' },
|
|
21
13
|
},
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
await (0, submitOrder_1.handleSwapOrder)(msg.req, msg.req.credential);
|
|
25
|
-
}
|
|
26
|
-
else if (/huobi\/(.*)\/super-margin/.test(msg.req.account_id)) {
|
|
27
|
-
await (0, submitOrder_1.handleSuperMarginOrder)(msg.req, msg.req.credential);
|
|
28
|
-
}
|
|
29
|
-
else
|
|
30
|
-
throw new Error(`Unsupported account_id: ${msg.req.account_id}`);
|
|
31
|
-
return { res: { code: 0, message: 'OK' } };
|
|
14
|
+
}, {
|
|
15
|
+
submitOrder: submitOrder_1.submitOrder,
|
|
32
16
|
});
|
|
33
17
|
//# sourceMappingURL=order-actions-with-credentials.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-actions-with-credentials.js","sourceRoot":"","sources":["../src/order-actions-with-credentials.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"order-actions-with-credentials.js","sourceRoot":"","sources":["../src/order-actions-with-credentials.ts"],"names":[],"mappings":";;AAAA,mDAAuE;AACvE,+CAA4C;AAC5C,sDAAmD;AAEnD,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,8CAAiC,EAC/B,QAAQ,EACR,KAAK,EACL;IACE,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC;IACtC,UAAU,EAAE;QACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC/B;CACF,EACD;IACE,WAAW,EAAX,yBAAW;CACZ,CACF,CAAC","sourcesContent":["import { provideOrderActionsWithCredential } from '@yuants/data-order';\nimport { Terminal } from '@yuants/protocol';\nimport { submitOrder } from './orders/submitOrder';\n\nconst terminal = Terminal.fromNodeEnv();\n\nprovideOrderActionsWithCredential(\n terminal,\n 'HTX',\n {\n type: 'object',\n required: ['access_key', 'secret_key'],\n properties: {\n access_key: { type: 'string' },\n secret_key: { type: 'string' },\n },\n },\n {\n submitOrder,\n },\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-actions.d.ts","sourceRoot":"","sources":["../src/order-actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;GAEG;AACH,eAAO,MAAM,yBAAyB,aAC1B,QAAQ,iBACH,MAAM,wBACC,MAAM,cAChB,WAAW,
|
|
1
|
+
{"version":3,"file":"order-actions.d.ts","sourceRoot":"","sources":["../src/order-actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;GAEG;AACH,eAAO,MAAM,yBAAyB,aAC1B,QAAQ,iBACH,MAAM,wBACC,MAAM,cAChB,WAAW,SAgBxB,CAAC"}
|
package/lib/order-actions.js
CHANGED
|
@@ -10,23 +10,11 @@ const provideOrderSubmitService = (terminal, swapAccountId, superMarginAccountId
|
|
|
10
10
|
required: ['account_id'],
|
|
11
11
|
properties: {
|
|
12
12
|
account_id: {
|
|
13
|
-
|
|
13
|
+
enum: [superMarginAccountId, swapAccountId],
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
}, async (msg) => {
|
|
17
|
-
await (0, submitOrder_1.
|
|
18
|
-
return { res: { code: 0, message: 'OK' } };
|
|
19
|
-
});
|
|
20
|
-
terminal.server.provideService('SubmitOrder', {
|
|
21
|
-
required: ['account_id'],
|
|
22
|
-
properties: {
|
|
23
|
-
account_id: {
|
|
24
|
-
const: swapAccountId,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
}, async (msg) => {
|
|
28
|
-
await (0, submitOrder_1.handleSwapOrder)(msg.req, credential);
|
|
29
|
-
return { res: { code: 0, message: 'OK' } };
|
|
17
|
+
return { res: { code: 0, message: 'OK', data: await (0, submitOrder_1.submitOrder)(credential, msg.req) } };
|
|
30
18
|
});
|
|
31
19
|
};
|
|
32
20
|
exports.provideOrderSubmitService = provideOrderSubmitService;
|
package/lib/order-actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-actions.js","sourceRoot":"","sources":["../src/order-actions.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"order-actions.js","sourceRoot":"","sources":["../src/order-actions.ts"],"names":[],"mappings":";;;AAGA,sDAAmD;AAEnD;;GAEG;AACI,MAAM,yBAAyB,GAAG,CACvC,QAAkB,EAClB,aAAqB,EACrB,oBAA4B,EAC5B,UAAuB,EACvB,EAAE;IACF,QAAQ,CAAC,MAAM,CAAC,cAAc,CAC5B,aAAa,EACb;QACE,QAAQ,EAAE,CAAC,YAAY,CAAC;QACxB,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,CAAC,oBAAoB,EAAE,aAAa,CAAC;aAC5C;SACF;KACF,EACD,KAAK,EAAE,GAAG,EAAE,EAAE;QACZ,OAAO,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,IAAA,yBAAW,EAAC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IAC3F,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,yBAAyB,6BAoBpC","sourcesContent":["import { IOrder } from '@yuants/data-order';\nimport { Terminal } from '@yuants/protocol';\nimport { ICredential } from './api/private-api';\nimport { submitOrder } from './orders/submitOrder';\n\n/**\n * 提供订单提交服务\n */\nexport const provideOrderSubmitService = (\n terminal: Terminal,\n swapAccountId: string,\n superMarginAccountId: string,\n credential: ICredential,\n) => {\n terminal.server.provideService<IOrder, { order_id: string }>(\n 'SubmitOrder',\n {\n required: ['account_id'],\n properties: {\n account_id: {\n enum: [superMarginAccountId, swapAccountId],\n },\n },\n },\n async (msg) => {\n return { res: { code: 0, message: 'OK', data: await submitOrder(credential, msg.req) } };\n },\n );\n};\n"]}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { IOrder } from '@yuants/data-order';
|
|
2
2
|
import { ICredential } from '../api/private-api';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare function handleSwapOrder(order: IOrder, credential: ICredential): Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* 处理 super-margin 账户订单提交
|
|
9
|
-
*/
|
|
10
|
-
export declare function handleSuperMarginOrder(order: IOrder, credential: ICredential): Promise<void>;
|
|
3
|
+
export declare const submitOrder: (credential: ICredential, order: IOrder) => Promise<{
|
|
4
|
+
order_id: string;
|
|
5
|
+
}>;
|
|
11
6
|
//# sourceMappingURL=submitOrder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submitOrder.d.ts","sourceRoot":"","sources":["../../src/orders/submitOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EACL,WAAW,EAOZ,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"submitOrder.d.ts","sourceRoot":"","sources":["../../src/orders/submitOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EACL,WAAW,EAOZ,MAAM,oBAAoB,CAAC;AAoG5B,eAAO,MAAM,WAAW,eAAgB,WAAW,SAAS,MAAM,KAAG,QAAQ;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAQhG,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.submitOrder = void 0;
|
|
4
4
|
const utils_1 = require("@yuants/utils");
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
6
|
const private_api_1 = require("../api/private-api");
|
|
@@ -31,8 +31,8 @@ async function handleSwapOrder(order, credential) {
|
|
|
31
31
|
if (result.status !== 'ok') {
|
|
32
32
|
throw new Error(`Failed to submit swap order: status=${result.status}`);
|
|
33
33
|
}
|
|
34
|
+
return { order_id: result.data.order_id_str };
|
|
34
35
|
}
|
|
35
|
-
exports.handleSwapOrder = handleSwapOrder;
|
|
36
36
|
/**
|
|
37
37
|
* 处理 super-margin 账户订单提交
|
|
38
38
|
*/
|
|
@@ -82,6 +82,16 @@ async function handleSuperMarginOrder(order, credential) {
|
|
|
82
82
|
if (result.success === false) {
|
|
83
83
|
throw new Error(`Failed to submit super margin order: code=${result.code} message=${result.message}`);
|
|
84
84
|
}
|
|
85
|
+
return { order_id: result.data.orderId.toString() };
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
+
const submitOrder = (credential, order) => {
|
|
88
|
+
if (order.account_id.includes('swap')) {
|
|
89
|
+
return handleSwapOrder(order, credential);
|
|
90
|
+
}
|
|
91
|
+
if (order.account_id.includes('super-margin')) {
|
|
92
|
+
return handleSuperMarginOrder(order, credential);
|
|
93
|
+
}
|
|
94
|
+
throw new Error(`Unsupported account_id for order submission: ${order.account_id}`);
|
|
95
|
+
};
|
|
96
|
+
exports.submitOrder = submitOrder;
|
|
87
97
|
//# sourceMappingURL=submitOrder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submitOrder.js","sourceRoot":"","sources":["../../src/orders/submitOrder.ts"],"names":[],"mappings":";;;AACA,yCAAwD;AACxD,+BAAsC;AACtC,oDAQ4B;AAC5B,wCAAgD;AAChD,gCAAoD;AAEpD;;GAEG;
|
|
1
|
+
{"version":3,"file":"submitOrder.js","sourceRoot":"","sources":["../../src/orders/submitOrder.ts"],"names":[],"mappings":";;;AACA,yCAAwD;AACxD,+BAAsC;AACtC,oDAQ4B;AAC5B,wCAAgD;AAChD,gCAAoD;AAEpD;;GAEG;AACH,KAAK,UAAU,eAAe,CAAC,KAAa,EAAE,UAAuB;;IACnE,SAAS;IACT,MAAM,YAAY,GAAG,MAAM,IAAA,sCAAwB,EAAC,UAAU,CAAC,CAAC;IAChE,MAAM,qBAAqB,GAAG,MAAM,CAAC,WAAW,CAC9C,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAC9D,CAAC;IAEF,MAAM,UAAU,GAAG,MAAA,qBAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,mCAAI,EAAE,CAAC;IACjE,MAAM,MAAM,GAAG;QACb,aAAa,EAAE,KAAK,CAAC,UAAU;QAC/B,aAAa,EAAE,MAAM;QACrB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EACJ,KAAK,CAAC,eAAe,KAAK,WAAW,IAAI,KAAK,CAAC,eAAe,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;QACpG,SAAS,EAC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AAE;QAC5B,MAAM,IAAI,KAAK,CAAC,6CAA6C,MAAM,CAAC,IAAI,YAAY,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;KACvG;IAED,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;AACtD,CAAC;AAEM,MAAM,WAAW,GAAG,CAAC,UAAuB,EAAE,KAAa,EAAiC,EAAE;IACnG,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACrC,OAAO,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;KAC3C;IACD,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;QAC7C,OAAO,sBAAsB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;KAClD;IACD,MAAM,IAAI,KAAK,CAAC,gDAAgD,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;AACtF,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB","sourcesContent":["import { IOrder } from '@yuants/data-order';\nimport { formatTime, roundToStep } from '@yuants/utils';\nimport { firstValueFrom } from 'rxjs';\nimport {\n ICredential,\n getCrossMarginLoanInfo,\n getSpotAccountBalance,\n getSpotTick,\n getSwapCrossPositionInfo,\n postSpotOrder,\n postSwapOrder,\n} from '../api/private-api';\nimport { spotProductService } from '../product';\nimport { superMarginAccountUidCache } from '../uid';\n\n/**\n * 处理 swap 账户订单提交\n */\nasync function handleSwapOrder(order: IOrder, credential: ICredential): Promise<{ order_id: string }> {\n // 获取仓位信息\n const positionInfo = await getSwapCrossPositionInfo(credential);\n const mapContractCodeToRate = Object.fromEntries(\n positionInfo.data.map((v) => [v.contract_code, v.lever_rate]),\n );\n\n const lever_rate = mapContractCodeToRate[order.product_id] ?? 20;\n const params = {\n contract_code: order.product_id,\n contract_type: 'swap',\n price: order.price,\n volume: order.volume,\n offset:\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'OPEN_SHORT' ? 'open' : 'close',\n direction:\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT' ? 'buy' : 'sell',\n // dynamically adjust the leverage\n lever_rate,\n order_price_type: order.order_type === 'MARKET' ? 'market' : 'limit',\n };\n\n const result = await postSwapOrder(credential, params);\n console.info(formatTime(Date.now()), 'SubmitOrder', JSON.stringify(result), JSON.stringify(params));\n\n if (result.status !== 'ok') {\n throw new Error(`Failed to submit swap order: status=${result.status}`);\n }\n return { order_id: result.data.order_id_str };\n}\n\n/**\n * 处理 super-margin 账户订单提交\n */\nasync function handleSuperMarginOrder(order: IOrder, credential: ICredential): Promise<{ order_id: string }> {\n // 获取可贷款金额\n const superMarginAccountUid = await superMarginAccountUidCache.query(JSON.stringify(credential));\n if (!superMarginAccountUid) throw new Error('Super margin account UID not found');\n const loanInfo = await getCrossMarginLoanInfo(credential);\n const usdtLoanable = loanInfo.data.find((v) => v.currency === 'usdt');\n if (!usdtLoanable) throw new Error('USDT loanable amount not found');\n const loanable = +usdtLoanable['loanable-amt'];\n\n // 获取账户余额, 产品信息和价格\n const [balanceRes, mapProductIdToProduct, priceRes] = await Promise.all([\n getSpotAccountBalance(credential, superMarginAccountUid),\n firstValueFrom(spotProductService.mapProductIdToProduct$),\n getSpotTick(credential, { symbol: order.product_id }),\n ]);\n\n const balance = balanceRes.data.list\n .filter((v) => v.currency === 'usdt' && v.type === 'trade')\n .reduce((acc, cur) => acc + +cur.balance, 0);\n\n if (!mapProductIdToProduct) throw new Error('Product map not found');\n\n const theProduct = mapProductIdToProduct.get(order.product_id);\n const price = priceRes.tick.close;\n const borrow_amount =\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT'\n ? Math.max(Math.min(loanable, order.volume * price - balance), 0)\n : undefined;\n\n const params = {\n symbol: order.product_id,\n 'account-id': '' + superMarginAccountUid,\n amount:\n '' +\n (order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT'\n ? roundToStep(order.volume * price, theProduct?.volume_step!)\n : order.volume),\n 'borrow-amount': '' + borrow_amount,\n type: `${\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT' ? 'buy' : 'sell'\n }-${'LIMIT' === order.order_type ? 'limit' : 'market'}`,\n 'trade-purpose':\n order.order_direction === 'OPEN_LONG' || order.order_direction === 'CLOSE_SHORT'\n ? '1' // auto borrow\n : '2', // auto repay\n price: order.order_type === 'MARKET' ? undefined : '' + order.price,\n source: 'super-margin-api',\n };\n\n const result = await postSpotOrder(credential, params);\n console.info(formatTime(Date.now()), 'SubmitOrder', JSON.stringify(result), JSON.stringify(params));\n\n if (result.success === false) {\n throw new Error(`Failed to submit super margin order: code=${result.code} message=${result.message}`);\n }\n\n return { order_id: result.data.orderId.toString() };\n}\n\nexport const submitOrder = (credential: ICredential, order: IOrder): Promise<{ order_id: string }> => {\n if (order.account_id.includes('swap')) {\n return handleSwapOrder(order, credential);\n }\n if (order.account_id.includes('super-margin')) {\n return handleSuperMarginOrder(order, credential);\n }\n throw new Error(`Unsupported account_id for order submission: ${order.account_id}`);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuants/vendor-huobi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"bin": "lib/cli.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@yuants/protocol": "0.50.4",
|
|
13
|
-
"@yuants/data-account": "0.6.
|
|
14
|
-
"@yuants/data-order": "0.
|
|
13
|
+
"@yuants/data-account": "0.6.16",
|
|
14
|
+
"@yuants/data-order": "0.5.0",
|
|
15
15
|
"@yuants/transfer": "0.2.33",
|
|
16
16
|
"@yuants/utils": "0.11.0",
|
|
17
17
|
"@yuants/cache": "0.3.0",
|
package/temp/package-deps.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"apps/vendor-huobi/CHANGELOG.json": "
|
|
3
|
-
"apps/vendor-huobi/CHANGELOG.md": "
|
|
2
|
+
"apps/vendor-huobi/CHANGELOG.json": "bef8820770e0c446789ed8b767aa229153a32df2",
|
|
3
|
+
"apps/vendor-huobi/CHANGELOG.md": "12baced88ce0c9cfd240b60676d45037f72291fc",
|
|
4
4
|
"apps/vendor-huobi/README.md": "d7bf0149513114eab5500a6b5c9e7cba10565572",
|
|
5
5
|
"apps/vendor-huobi/api-extractor.json": "62f4fd324425b9a235f0c117975967aab09ced0c",
|
|
6
6
|
"apps/vendor-huobi/config/jest.config.json": "4bb17bde3ee911163a3edb36a6eb71491d80b1bd",
|
|
7
7
|
"apps/vendor-huobi/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
|
|
8
8
|
"apps/vendor-huobi/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
|
|
9
9
|
"apps/vendor-huobi/etc/vendor-huobi.api.md": "dc8cbf2a044a227b30a4ee9701b0c97328244724",
|
|
10
|
-
"apps/vendor-huobi/package.json": "
|
|
10
|
+
"apps/vendor-huobi/package.json": "6e931fa9e7759ea7030c430ef3a112e9e33dc4da",
|
|
11
11
|
"apps/vendor-huobi/src/account-info.ts": "78d866fab248c78f6aaf5623f21e9013debab25c",
|
|
12
12
|
"apps/vendor-huobi/src/api.ts": "061c8644a01c6e0b4964e4be6f4588e16abd8869",
|
|
13
|
-
"apps/vendor-huobi/src/api/private-api.ts": "
|
|
13
|
+
"apps/vendor-huobi/src/api/private-api.ts": "e093cd61bb5e69eaf2ba42a7393fddf10d221552",
|
|
14
14
|
"apps/vendor-huobi/src/api/public-api.ts": "03a1468bea318d5fcb8c0c9d45666ffbee4346f0",
|
|
15
15
|
"apps/vendor-huobi/src/cli.ts": "9bf6b5559a6c6f33da20e74cc6c5d702c60ec891",
|
|
16
16
|
"apps/vendor-huobi/src/index.ts": "9733795740b8df5e1d9fe96a25257d080c35b983",
|
|
17
17
|
"apps/vendor-huobi/src/interest_rate.ts": "2ba38d2c97b91f1b2f9979647dab5d516f6bfa4f",
|
|
18
|
-
"apps/vendor-huobi/src/order-actions-with-credentials.ts": "
|
|
19
|
-
"apps/vendor-huobi/src/order-actions.ts": "
|
|
20
|
-
"apps/vendor-huobi/src/orders/submitOrder.ts": "
|
|
18
|
+
"apps/vendor-huobi/src/order-actions-with-credentials.ts": "32322c28a4c52b936c98ee51d09905178815cb5e",
|
|
19
|
+
"apps/vendor-huobi/src/order-actions.ts": "93a5d294f6674ba433d892d6be2ae6aa5d059420",
|
|
20
|
+
"apps/vendor-huobi/src/orders/submitOrder.ts": "37d6886dc81bde92b20f31031a9df2a1ef9963c4",
|
|
21
21
|
"apps/vendor-huobi/src/product.ts": "973c81048708f265ce86fad37d06e4a4044a11b9",
|
|
22
22
|
"apps/vendor-huobi/src/quote.ts": "52922569315ce9f72aef8ed5d65157c8800e943d",
|
|
23
23
|
"apps/vendor-huobi/src/transfer.ts": "0da0957b0acf820bbc26bfd74776305167f28d35",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"apps/vendor-huobi/tsconfig.json": "81da8f78196974b5d15da0edb6b2d9f48641063c",
|
|
26
26
|
"apps/vendor-huobi/.rush/temp/shrinkwrap-deps.json": "9cfeff02d2b4838478ed6afd825f89806d4c2b57",
|
|
27
27
|
"libraries/protocol/temp/package-deps.json": "35bc77333a1c85db1cd130579963e8cefa00f56c",
|
|
28
|
-
"libraries/data-account/temp/package-deps.json": "
|
|
29
|
-
"libraries/data-order/temp/package-deps.json": "
|
|
28
|
+
"libraries/data-account/temp/package-deps.json": "f10239e42ff14419c0d9eaf09424fdf68297e724",
|
|
29
|
+
"libraries/data-order/temp/package-deps.json": "921c6745e9a502669524f7a7d276bff69c25491c",
|
|
30
30
|
"libraries/transfer/temp/package-deps.json": "708a4caf79d042cad56a39f0b00d399bca04af40",
|
|
31
31
|
"libraries/utils/temp/package-deps.json": "c58f1ca8f498315d9a0219ca8c498299a41d297b",
|
|
32
32
|
"libraries/cache/temp/package-deps.json": "49789a92426969daa31f0c956bb56bd783929765",
|