@yuants/vendor-gate 0.7.0 → 0.7.2
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 +6 -0
- package/dist/api/private-api.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/services/interest-ledger-service.js +25 -21
- package/dist/services/interest-ledger-service.js.map +1 -1
- package/dist/services/trade-history-service.js +62 -0
- package/dist/services/trade-history-service.js.map +1 -0
- package/lib/api/private-api.d.ts +26 -0
- package/lib/api/private-api.d.ts.map +1 -1
- package/lib/api/private-api.js +8 -1
- package/lib/api/private-api.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/services/interest-ledger-service.js +25 -21
- package/lib/services/interest-ledger-service.js.map +1 -1
- package/lib/services/trade-history-service.d.ts +2 -0
- package/lib/services/trade-history-service.d.ts.map +1 -0
- package/lib/services/trade-history-service.js +64 -0
- package/lib/services/trade-history-service.js.map +1 -0
- package/package.json +9 -8
- package/temp/build/typescript/ts_Eujh_fX2.json +1 -1
- package/temp/package-deps.json +10 -8
- package/temp/test/jest/haste-map-ac984f375ffe2771b37aa116ca7fe6f5-87fb4bb14df3d29fb61369ce8cbe1fe1-6499ab22de0ac9ce813ded0e96430273 +0 -0
package/dist/api/private-api.js
CHANGED
|
@@ -116,4 +116,10 @@ export const getUnifiedTransferable = (credential, params) => callPrivate(creden
|
|
|
116
116
|
* https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E5%90%88%E7%BA%A6%E8%B4%A6%E6%88%B7%E5%8F%98%E6%9B%B4%E5%8E%86%E5%8F%B2
|
|
117
117
|
*/
|
|
118
118
|
export const getFutureAccountsBook = (credential, params) => callPrivate(credential, 'GET', `/futures/${params.settle}/account_book`, params);
|
|
119
|
+
/**
|
|
120
|
+
* 查询个人成交记录(时间区间)
|
|
121
|
+
*
|
|
122
|
+
* https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E4%B8%AA%E4%BA%BA%E6%88%90%E4%BA%A4%E8%AE%B0%E5%BD%95-%E6%97%B6%E9%97%B4%E5%8C%BA%E9%97%B4
|
|
123
|
+
*/
|
|
124
|
+
export const getFutureAccountsTrades = (credential, params) => callPrivate(credential, 'GET', `/futures/${params.settle}/my_trades_timerange`, params);
|
|
119
125
|
//# sourceMappingURL=private-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,WAAW,GAAG,CAClB,UAAuB,EACvB,MAAkB,EAClB,IAAY,EACZ,MAAmB,EACnB,EAAE,CAAC,cAAc,CAAY,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,UAAuB,EAStB,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAExD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,MAA8B,EAoC7B,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,cAAsB,EACtB,MAA+D,EAmB/D,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,cAAc,YAAY,EAAE,MAAM,CAAC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,UAAuB,EACvB,MAAc,EACd,MAMC,EAc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,EAcD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,UAAuB,EACvB,MAMC,EAcD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,UAAuB,EACvB,MAEC,EAQD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,MAOC,EAGA,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,UAAuB,EACvB,MAEC,EAIA,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,CAAC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,UAAuB,EACvB,MAQC,EAYD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,MAAM,CAAC,MAAM,eAAe,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import type { GateParams, HttpMethod, IGateCredential } from './http-client';\nimport { requestPrivate } from './http-client';\n\nexport type ICredential = IGateCredential;\n\nconst callPrivate = <TResponse>(\n credential: ICredential,\n method: HttpMethod,\n path: string,\n params?: GateParams,\n) => requestPrivate<TResponse>(credential, method, path, params);\n\n/**\n * 获取用户账户信息\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF\n */\nexport const getAccountDetail = (\n credential: ICredential,\n): Promise<{\n user_id: number;\n ip_whitelist: string[];\n currency_pairs: string[];\n key: {\n mode: number;\n };\n tier: number;\n}> => callPrivate(credential, 'GET', '/account/detail');\n\n/**\n * 获取统一账户信息\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%BB%9F%E4%B8%80%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF\n */\nexport const getUnifiedAccounts = (\n credential: ICredential,\n params?: { currency?: string },\n): Promise<{\n user_id: string;\n refresh_time: number;\n locket: boolean;\n balances: Record<\n string,\n {\n available: string;\n freeze: string;\n borrowed: string;\n negative_liab: string;\n futures_pos_liab: string;\n equity: string;\n total_freeze: string;\n total_liab: string;\n spot_in_use: string;\n cross_balance: string;\n iso_balance: string;\n funding: string;\n }\n >;\n total: string;\n borrowed: string;\n total_initial_margin: string;\n total_margin_balance: string;\n total_maintenance_margin: string;\n total_initial_margin_rate: string;\n total_maintenance_margin_rate: string;\n total_avail_margin: string;\n unified_account_total: string;\n unified_account_total_liab: string;\n unified_account_total_equity: string;\n leverage: string;\n spot_order_loss: string;\n spot_hedge: boolean;\n}> => callPrivate(credential, 'GET', '/unified/accounts', params);\n\n/**\n * 获取用户仓位列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E4%BB%93%E4%BD%8D%E5%88%97%E8%A1%A8\n */\nexport const getFuturePositions = (\n credential: ICredential,\n quote_currency: string,\n params?: { holding?: boolean; limit?: number; offset?: number },\n): Promise<\n {\n user: number;\n contract: string;\n size: number;\n leverage: string;\n risk_limit: string;\n leverage_max: string;\n maintenance_rate: string;\n value: string;\n margin: string;\n entry_price: string;\n mark_price: string;\n unrealised_pnl: string;\n realised_pnl: string;\n mode: string;\n liq_price: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${quote_currency}/positions`, params);\n\n/**\n * 查询合约订单列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E5%90%88%E7%BA%A6%E8%AE%A2%E5%8D%95%E5%88%97%E8%A1%A8\n */\nexport const getFuturesOrders = (\n credential: ICredential,\n settle: string,\n params: {\n contract?: string;\n status: string;\n limit?: number;\n offset?: number;\n last_id?: number;\n },\n): Promise<\n {\n id: string;\n contract: string;\n create_time: number;\n size: number;\n price: string;\n is_close: boolean;\n fill_price: string;\n left?: number;\n status?: string;\n text: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${settle}/orders`, params);\n\n/**\n * 获取合约账号\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%90%88%E7%BA%A6%E8%B4%A6%E5%8F%B7\n */\nexport const getFuturesAccounts = (\n credential: ICredential,\n settle: string,\n): Promise<{\n user: number;\n currency: string;\n total: string;\n unrealised_pnl: string;\n position_margin: string;\n order_margin: string;\n available: string;\n point: string;\n bonus: string;\n in_dual_mode: boolean;\n enable_evolved_classic: boolean;\n history: {\n dnw: string;\n pnl: string;\n fee: string;\n refr: string;\n fund: string;\n point_dnw: string;\n point_fee: string;\n point_refr: string;\n bonus_dnw: string;\n bonus_offset: string;\n };\n}> => callPrivate(credential, 'GET', `/futures/${settle}/accounts`);\n\n/**\n * 合约交易下单\n *\n * 下单时指定的是合约张数 size ,而非币的数量,每一张合约对应的币的数量是合约详情接口里返回的 quanto_multiplier\n *\n * 0 成交的订单在撤单 10 分钟之后无法再获取到,会提到订单不存在\n *\n * 设置 reduce_only 为 true 可以防止在减仓的时候穿仓\n *\n * 单仓模式下,如果需要平仓,需要设置 size 为 0 ,close 为 true\n *\n * 双仓模式下,平仓需要使用 auto_size 来设置平仓方向,并同时设置 reduce_only 为 true,size 为 0\n *\n * 设置 stp_act 决定使用限制用户自成交的策略,详细用法参考body参数stp_act\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E5%90%88%E7%BA%A6%E4%BA%A4%E6%98%93%E4%B8%8B%E5%8D%95\n */\nexport const postFutureOrders = (\n credential: ICredential,\n settle: string,\n params: {\n contract: string;\n size: number;\n iceberg?: number;\n price?: string;\n close?: boolean;\n reduce_only?: boolean;\n tif?: string;\n text?: string;\n auto_size?: string;\n stp_act?: string;\n },\n): Promise<{\n label?: string;\n message?: string;\n detail?: string;\n id: number;\n user: number;\n contract: string;\n create_time: number;\n size: number;\n iceberg: number;\n left: number;\n price: string;\n fill_price: string;\n mkfr: string;\n tkfr: string;\n tif: string;\n refu: number;\n is_reduce_only: boolean;\n is_close: boolean;\n is_liq: boolean;\n text: string;\n status: string;\n finish_time: number;\n finish_as: string;\n stp_id: number;\n stp_act: string;\n amend_text: string;\n}> => callPrivate(credential, 'POST', `/futures/${settle}/orders`, params);\n\n/**\n * 撤销单个订单\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%92%A4%E9%94%80%E5%8D%95%E4%B8%AA%E8%AE%A2%E5%8D%95-2\n */\nexport const deleteFutureOrders = (credential: ICredential, settle: string, order_id: string): Promise<{}> =>\n callPrivate(credential, 'DELETE', `/futures/${settle}/orders/${order_id}`);\n\n/**\n * 提现\n *\n * POST /withdrawals\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%8F%90%E7%8E%B0\n */\nexport const postWithdrawals = (\n credential: ICredential,\n params: {\n withdraw_order_id?: string;\n amount: string;\n currency: string;\n address?: string;\n memo?: string;\n chain: string;\n },\n): Promise<{\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n}> => callPrivate(credential, 'POST', '/withdrawals', params);\n\n/**\n * 获取币种充值地址\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%B8%81%E7%A7%8D%E5%85%85%E5%80%BC%E5%9C%B0%E5%9D%80\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n currency: string;\n },\n): Promise<{\n currency: string;\n address: string;\n multichain_addresses: {\n chain: string;\n address: string;\n payment_id: string;\n payment_name: string;\n obtain_failed: boolean;\n }[];\n}> => callPrivate(credential, 'GET', '/wallet/deposit_address', params);\n\n/**\n * 创建新的子账户\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E5%88%9B%E5%BB%BA%E6%96%B0%E7%9A%84%E5%AD%90%E8%B4%A6%E6%88%B7\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n type?: string;\n },\n): Promise<\n {\n remark: string;\n login_name: string;\n password: string;\n email: string;\n state: number;\n type: number;\n user_id: number;\n create_time: number;\n }[]\n> => callPrivate(credential, 'GET', '/sub_accounts', params);\n\n/**\n * 获取充值记录\n *\n * 记录查询时间范围不允许超过 30 天\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%85%85%E5%80%BC%E8%AE%B0%E5%BD%95\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n currency?: string;\n from?: number;\n to?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<\n {\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n }[]\n> => callPrivate(credential, 'GET', '/wallet/deposits', params);\n\n/**\n * 获取提现记录\n *\n * 记录查询时间范围不允许超过 30 天\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%B8%81%E7%A7%8D%E5%85%85%E5%80%BC%E5%9C%B0%E5%9D%80\n */\nexport const getWithdrawalHistory = (\n credential: ICredential,\n params?: {\n currency?: string;\n from?: number;\n to?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<\n {\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n }[]\n> => callPrivate(credential, 'GET', '/wallet/withdrawals', params);\n\n/**\n * 获取现货交易账户列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%8E%B0%E8%B4%A7%E4%BA%A4%E6%98%93%E8%B4%A6%E6%88%B7%E5%88%97%E8%A1%A8\n */\nexport const getSpotAccounts = (\n credential: ICredential,\n params?: {\n currency?: string;\n },\n): Promise<\n {\n currency: string;\n available: string;\n locked: string;\n update_id: string;\n }[]\n> => callPrivate(credential, 'GET', '/spot/accounts', params);\n\n/**\n * 交易账户互转\n *\n * POST /wallet/transfers\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E4%BA%A4%E6%98%93%E8%B4%A6%E6%88%B7%E4%BA%92%E8%BD%AC\n */\nexport const postWalletTransfer = (\n credential: ICredential,\n params: {\n currency: string;\n from: string;\n to: string;\n amount: string;\n currency_pair?: string;\n settle?: string;\n },\n): Promise<{\n tx_id: string;\n}> => callPrivate(credential, 'POST', '/wallet/transfers', params);\n\n/**\n * 获取统一账户最多可转出\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E7%BB%9F%E4%B8%80%E8%B4%A6%E6%88%B7%E6%9C%80%E5%A4%9A%E5%8F%AF%E8%BD%AC%E5%87%BA\n */\nexport const getUnifiedTransferable = (\n credential: ICredential,\n params: {\n currency: string;\n },\n): Promise<{\n currency: string;\n amount: string;\n}> => callPrivate(credential, 'GET', `/unified/transferable`, params);\n\n/**\n * 查询合约账户变更历史\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E5%90%88%E7%BA%A6%E8%B4%A6%E6%88%B7%E5%8F%98%E6%9B%B4%E5%8E%86%E5%8F%B2\n */\nexport const getFutureAccountsBook = (\n credential: ICredential,\n params: {\n settle: string;\n contract?: string;\n limit?: number;\n offset?: number;\n from?: number;\n to?: number;\n type?: string; // | 'dnw' | 'pnl' | 'fee' | 'refr' | 'fund' | 'point_dnw' | 'point_fee' | 'point_refr' | 'bonus_offset'\n },\n): Promise<\n {\n time: number;\n change: string;\n balance: string;\n text: string;\n type: string;\n contract: string;\n trade_id: string;\n id: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${params.settle}/account_book`, params);\n"]}
|
|
1
|
+
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,WAAW,GAAG,CAClB,UAAuB,EACvB,MAAkB,EAClB,IAAY,EACZ,MAAmB,EACnB,EAAE,CAAC,cAAc,CAAY,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,UAAuB,EAStB,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAExD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,MAA8B,EAoC7B,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,cAAsB,EACtB,MAA+D,EAmB/D,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,cAAc,YAAY,EAAE,MAAM,CAAC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,UAAuB,EACvB,MAAc,EACd,MAMC,EAcD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,MAAM,SAAS,EAAE,MAAM,CAAC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,UAAuB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ACvB,MAMC,EAcD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,UAAuB,EACvB,MAEC,EAQD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,MAOC,EAGA,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,UAAuB,EACvB,MAEC,EAIA,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,CAAC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,UAAuB,EACvB,MAQC,EAYD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,MAAM,CAAC,MAAM,eAAe,EAAE,MAAM,CAAC,CAAC;AAEtF;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,UAAuB,EACvB,MAQC,EAeD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,MAAM,CAAC,MAAM,sBAAsB,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import type { GateParams, HttpMethod, IGateCredential } from './http-client';\nimport { requestPrivate } from './http-client';\n\nexport type ICredential = IGateCredential;\n\nconst callPrivate = <TResponse>(\n credential: ICredential,\n method: HttpMethod,\n path: string,\n params?: GateParams,\n) => requestPrivate<TResponse>(credential, method, path, params);\n\n/**\n * 获取用户账户信息\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF\n */\nexport const getAccountDetail = (\n credential: ICredential,\n): Promise<{\n user_id: number;\n ip_whitelist: string[];\n currency_pairs: string[];\n key: {\n mode: number;\n };\n tier: number;\n}> => callPrivate(credential, 'GET', '/account/detail');\n\n/**\n * 获取统一账户信息\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%BB%9F%E4%B8%80%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF\n */\nexport const getUnifiedAccounts = (\n credential: ICredential,\n params?: { currency?: string },\n): Promise<{\n user_id: string;\n refresh_time: number;\n locket: boolean;\n balances: Record<\n string,\n {\n available: string;\n freeze: string;\n borrowed: string;\n negative_liab: string;\n futures_pos_liab: string;\n equity: string;\n total_freeze: string;\n total_liab: string;\n spot_in_use: string;\n cross_balance: string;\n iso_balance: string;\n funding: string;\n }\n >;\n total: string;\n borrowed: string;\n total_initial_margin: string;\n total_margin_balance: string;\n total_maintenance_margin: string;\n total_initial_margin_rate: string;\n total_maintenance_margin_rate: string;\n total_avail_margin: string;\n unified_account_total: string;\n unified_account_total_liab: string;\n unified_account_total_equity: string;\n leverage: string;\n spot_order_loss: string;\n spot_hedge: boolean;\n}> => callPrivate(credential, 'GET', '/unified/accounts', params);\n\n/**\n * 获取用户仓位列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E4%BB%93%E4%BD%8D%E5%88%97%E8%A1%A8\n */\nexport const getFuturePositions = (\n credential: ICredential,\n quote_currency: string,\n params?: { holding?: boolean; limit?: number; offset?: number },\n): Promise<\n {\n user: number;\n contract: string;\n size: number;\n leverage: string;\n risk_limit: string;\n leverage_max: string;\n maintenance_rate: string;\n value: string;\n margin: string;\n entry_price: string;\n mark_price: string;\n unrealised_pnl: string;\n realised_pnl: string;\n mode: string;\n liq_price: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${quote_currency}/positions`, params);\n\n/**\n * 查询合约订单列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E5%90%88%E7%BA%A6%E8%AE%A2%E5%8D%95%E5%88%97%E8%A1%A8\n */\nexport const getFuturesOrders = (\n credential: ICredential,\n settle: string,\n params: {\n contract?: string;\n status: string;\n limit?: number;\n offset?: number;\n last_id?: number;\n },\n): Promise<\n {\n id: string;\n contract: string;\n create_time: number;\n size: number;\n price: string;\n is_close: boolean;\n fill_price: string;\n left?: number;\n status?: string;\n text: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${settle}/orders`, params);\n\n/**\n * 获取合约账号\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%90%88%E7%BA%A6%E8%B4%A6%E5%8F%B7\n */\nexport const getFuturesAccounts = (\n credential: ICredential,\n settle: string,\n): Promise<{\n user: number;\n currency: string;\n total: string;\n unrealised_pnl: string;\n position_margin: string;\n order_margin: string;\n available: string;\n point: string;\n bonus: string;\n in_dual_mode: boolean;\n enable_evolved_classic: boolean;\n history: {\n dnw: string;\n pnl: string;\n fee: string;\n refr: string;\n fund: string;\n point_dnw: string;\n point_fee: string;\n point_refr: string;\n bonus_dnw: string;\n bonus_offset: string;\n };\n}> => callPrivate(credential, 'GET', `/futures/${settle}/accounts`);\n\n/**\n * 合约交易下单\n *\n * 下单时指定的是合约张数 size ,而非币的数量,每一张合约对应的币的数量是合约详情接口里返回的 quanto_multiplier\n *\n * 0 成交的订单在撤单 10 分钟之后无法再获取到,会提到订单不存在\n *\n * 设置 reduce_only 为 true 可以防止在减仓的时候穿仓\n *\n * 单仓模式下,如果需要平仓,需要设置 size 为 0 ,close 为 true\n *\n * 双仓模式下,平仓需要使用 auto_size 来设置平仓方向,并同时设置 reduce_only 为 true,size 为 0\n *\n * 设置 stp_act 决定使用限制用户自成交的策略,详细用法参考body参数stp_act\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E5%90%88%E7%BA%A6%E4%BA%A4%E6%98%93%E4%B8%8B%E5%8D%95\n */\nexport const postFutureOrders = (\n credential: ICredential,\n settle: string,\n params: {\n contract: string;\n size: number;\n iceberg?: number;\n price?: string;\n close?: boolean;\n reduce_only?: boolean;\n tif?: string;\n text?: string;\n auto_size?: string;\n stp_act?: string;\n },\n): Promise<{\n label?: string;\n message?: string;\n detail?: string;\n id: number;\n user: number;\n contract: string;\n create_time: number;\n size: number;\n iceberg: number;\n left: number;\n price: string;\n fill_price: string;\n mkfr: string;\n tkfr: string;\n tif: string;\n refu: number;\n is_reduce_only: boolean;\n is_close: boolean;\n is_liq: boolean;\n text: string;\n status: string;\n finish_time: number;\n finish_as: string;\n stp_id: number;\n stp_act: string;\n amend_text: string;\n}> => callPrivate(credential, 'POST', `/futures/${settle}/orders`, params);\n\n/**\n * 撤销单个订单\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%92%A4%E9%94%80%E5%8D%95%E4%B8%AA%E8%AE%A2%E5%8D%95-2\n */\nexport const deleteFutureOrders = (credential: ICredential, settle: string, order_id: string): Promise<{}> =>\n callPrivate(credential, 'DELETE', `/futures/${settle}/orders/${order_id}`);\n\n/**\n * 提现\n *\n * POST /withdrawals\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%8F%90%E7%8E%B0\n */\nexport const postWithdrawals = (\n credential: ICredential,\n params: {\n withdraw_order_id?: string;\n amount: string;\n currency: string;\n address?: string;\n memo?: string;\n chain: string;\n },\n): Promise<{\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n}> => callPrivate(credential, 'POST', '/withdrawals', params);\n\n/**\n * 获取币种充值地址\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%B8%81%E7%A7%8D%E5%85%85%E5%80%BC%E5%9C%B0%E5%9D%80\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n currency: string;\n },\n): Promise<{\n currency: string;\n address: string;\n multichain_addresses: {\n chain: string;\n address: string;\n payment_id: string;\n payment_name: string;\n obtain_failed: boolean;\n }[];\n}> => callPrivate(credential, 'GET', '/wallet/deposit_address', params);\n\n/**\n * 创建新的子账户\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E5%88%9B%E5%BB%BA%E6%96%B0%E7%9A%84%E5%AD%90%E8%B4%A6%E6%88%B7\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n type?: string;\n },\n): Promise<\n {\n remark: string;\n login_name: string;\n password: string;\n email: string;\n state: number;\n type: number;\n user_id: number;\n create_time: number;\n }[]\n> => callPrivate(credential, 'GET', '/sub_accounts', params);\n\n/**\n * 获取充值记录\n *\n * 记录查询时间范围不允许超过 30 天\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%85%85%E5%80%BC%E8%AE%B0%E5%BD%95\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n currency?: string;\n from?: number;\n to?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<\n {\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n }[]\n> => callPrivate(credential, 'GET', '/wallet/deposits', params);\n\n/**\n * 获取提现记录\n *\n * 记录查询时间范围不允许超过 30 天\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%B8%81%E7%A7%8D%E5%85%85%E5%80%BC%E5%9C%B0%E5%9D%80\n */\nexport const getWithdrawalHistory = (\n credential: ICredential,\n params?: {\n currency?: string;\n from?: number;\n to?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<\n {\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n }[]\n> => callPrivate(credential, 'GET', '/wallet/withdrawals', params);\n\n/**\n * 获取现货交易账户列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%8E%B0%E8%B4%A7%E4%BA%A4%E6%98%93%E8%B4%A6%E6%88%B7%E5%88%97%E8%A1%A8\n */\nexport const getSpotAccounts = (\n credential: ICredential,\n params?: {\n currency?: string;\n },\n): Promise<\n {\n currency: string;\n available: string;\n locked: string;\n update_id: string;\n }[]\n> => callPrivate(credential, 'GET', '/spot/accounts', params);\n\n/**\n * 交易账户互转\n *\n * POST /wallet/transfers\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E4%BA%A4%E6%98%93%E8%B4%A6%E6%88%B7%E4%BA%92%E8%BD%AC\n */\nexport const postWalletTransfer = (\n credential: ICredential,\n params: {\n currency: string;\n from: string;\n to: string;\n amount: string;\n currency_pair?: string;\n settle?: string;\n },\n): Promise<{\n tx_id: string;\n}> => callPrivate(credential, 'POST', '/wallet/transfers', params);\n\n/**\n * 获取统一账户最多可转出\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E7%BB%9F%E4%B8%80%E8%B4%A6%E6%88%B7%E6%9C%80%E5%A4%9A%E5%8F%AF%E8%BD%AC%E5%87%BA\n */\nexport const getUnifiedTransferable = (\n credential: ICredential,\n params: {\n currency: string;\n },\n): Promise<{\n currency: string;\n amount: string;\n}> => callPrivate(credential, 'GET', `/unified/transferable`, params);\n\n/**\n * 查询合约账户变更历史\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E5%90%88%E7%BA%A6%E8%B4%A6%E6%88%B7%E5%8F%98%E6%9B%B4%E5%8E%86%E5%8F%B2\n */\nexport const getFutureAccountsBook = (\n credential: ICredential,\n params: {\n settle: string;\n contract?: string;\n limit?: number;\n offset?: number;\n from?: number;\n to?: number;\n type?: string; // | 'dnw' | 'pnl' | 'fee' | 'refr' | 'fund' | 'point_dnw' | 'point_fee' | 'point_refr' | 'bonus_offset'\n },\n): Promise<\n {\n time: number;\n change: string;\n balance: string;\n text: string;\n type: string;\n contract: string;\n trade_id: string;\n id: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${params.settle}/account_book`, params);\n\n/**\n * 查询个人成交记录(时间区间)\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E4%B8%AA%E4%BA%BA%E6%88%90%E4%BA%A4%E8%AE%B0%E5%BD%95-%E6%97%B6%E9%97%B4%E5%8C%BA%E9%97%B4\n */\nexport const getFutureAccountsTrades = (\n credential: ICredential,\n params: {\n settle: string;\n contract?: string;\n limit?: number;\n offset?: number;\n from?: number;\n to?: number;\n role?: string;\n },\n): Promise<\n {\n trade_id: string;\n create_time: number;\n contract: string;\n order_id: string;\n size: string;\n price: string;\n text: string;\n fee: string;\n point_fee: string;\n role: string;\n close_size: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${params.settle}/my_trades_timerange`, params);\n"]}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC","sourcesContent":["import './services/exchange';\nimport './services/markets/product';\nimport './services/markets/quote';\nimport './services/quotes';\nimport './services/transfer';\nimport './services/ohlc-service';\nimport './services/interest-rate-service';\nimport './services/interest-ledger-service';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC","sourcesContent":["import './services/exchange';\nimport './services/markets/product';\nimport './services/markets/quote';\nimport './services/quotes';\nimport './services/transfer';\nimport './services/ohlc-service';\nimport './services/interest-rate-service';\nimport './services/interest-ledger-service';\nimport './services/trade-history-service';\n"]}
|
|
@@ -3,32 +3,36 @@ import { encodePath, formatTime } from '@yuants/utils';
|
|
|
3
3
|
import { provideInterestLedgerService } from '@yuants/exchange';
|
|
4
4
|
import { getFutureAccountsBook } from '../api/private-api';
|
|
5
5
|
const terminal = Terminal.fromNodeEnv();
|
|
6
|
-
const WINDOW_MS =
|
|
6
|
+
const WINDOW_MS = 2 * 24 * 3600000;
|
|
7
7
|
const fetchInterestRateLedgerBackward = async (req) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const res = await getFutureAccountsBook(req.credential.payload, params);
|
|
16
|
-
return (res !== null && res !== void 0 ? res : [])
|
|
17
|
-
.map((v) => {
|
|
18
|
-
const ms = Number(v.time * 1000);
|
|
19
|
-
return {
|
|
20
|
-
id: v.id,
|
|
21
|
-
product_id: encodePath('GATE', 'FUTURE', v.contract),
|
|
22
|
-
amount: v.change,
|
|
23
|
-
account_id: req.account_id,
|
|
24
|
-
currency: 'USDT',
|
|
25
|
-
created_at: formatTime(ms),
|
|
8
|
+
if (req.ledger_type === 'FUNDING_FEE') {
|
|
9
|
+
const params = {
|
|
10
|
+
settle: 'usdt',
|
|
11
|
+
to: ~~(req.time / 1000),
|
|
12
|
+
from: ~~((req.time - WINDOW_MS) / 1000),
|
|
13
|
+
limit: 100,
|
|
14
|
+
type: 'fund',
|
|
26
15
|
};
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
const res = await getFutureAccountsBook(req.credential.payload, params);
|
|
17
|
+
return (res !== null && res !== void 0 ? res : [])
|
|
18
|
+
.map((v) => {
|
|
19
|
+
const ms = Number(v.time * 1000);
|
|
20
|
+
return {
|
|
21
|
+
id: v.id,
|
|
22
|
+
product_id: encodePath('GATE', 'FUTURE', v.contract),
|
|
23
|
+
amount: v.change,
|
|
24
|
+
account_id: req.account_id,
|
|
25
|
+
currency: 'USDT',
|
|
26
|
+
created_at: formatTime(ms),
|
|
27
|
+
};
|
|
28
|
+
})
|
|
29
|
+
.filter((x) => Date.parse(x.created_at) <= req.time);
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
29
32
|
};
|
|
30
33
|
provideInterestLedgerService(terminal, {
|
|
31
34
|
direction: 'backward',
|
|
32
35
|
type: 'GATE',
|
|
36
|
+
ledger_type: ['FUNDING_FEE'],
|
|
33
37
|
}, fetchInterestRateLedgerBackward);
|
|
34
38
|
//# sourceMappingURL=interest-ledger-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest-ledger-service.js","sourceRoot":"","sources":["../../src/services/interest-ledger-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAO3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,MAAM,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"interest-ledger-service.js","sourceRoot":"","sources":["../../src/services/interest-ledger-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,E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,UAAU,CAAC,EAAE,CAAC;aACR,CAAC;QACvB,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAW,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,4BAA4B,CAC1B,QAAQ,EACR;IACE,SAAS,EAAE,UAAU;IACrB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,CAAC,aAAa,CAAC;CAC7B,EACD,+BAA+B,CAChC,CAAC","sourcesContent":["import { IInterestLedger } from '@yuants/data-interest-rate';\nimport { Terminal } from '@yuants/protocol';\nimport { encodePath, formatTime } from '@yuants/utils';\nimport { provideInterestLedgerService } from '@yuants/exchange';\nimport { getFutureAccountsBook } from '../api/private-api';\n\ninterface IExchangeCredential {\n type: string;\n payload: any;\n}\n\nconst terminal = Terminal.fromNodeEnv();\n\nconst WINDOW_MS = 2 * 24 * 3600_000;\nconst fetchInterestRateLedgerBackward = async (req: {\n credential: IExchangeCredential;\n account_id: string;\n time: number;\n ledger_type: string;\n}): Promise<IInterestLedger[]> => {\n if (req.ledger_type === 'FUNDING_FEE') {\n const params = {\n settle: 'usdt',\n to: ~~(req.time / 1000),\n from: ~~((req.time - WINDOW_MS) / 1000),\n limit: 100,\n type: 'fund',\n };\n const res = await getFutureAccountsBook(req.credential.payload, params);\n return (res ?? [])\n .map((v): IInterestLedger => {\n const ms = Number(v.time * 1000);\n return {\n id: v.id,\n product_id: encodePath('GATE', 'FUTURE', v.contract),\n amount: v.change,\n account_id: req.account_id,\n currency: 'USDT',\n created_at: formatTime(ms),\n } as IInterestLedger;\n })\n .filter((x) => Date.parse(x.created_at!) <= req.time);\n }\n return [];\n};\n\nprovideInterestLedgerService(\n terminal,\n {\n direction: 'backward',\n type: 'GATE',\n ledger_type: ['FUNDING_FEE'],\n },\n fetchInterestRateLedgerBackward,\n);\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Terminal } from '@yuants/protocol';
|
|
2
|
+
import { encodePath, formatTime } from '@yuants/utils';
|
|
3
|
+
import { provideTradeHistoryService } from '@yuants/exchange';
|
|
4
|
+
import { getFutureAccountsTrades } from '../api/private-api';
|
|
5
|
+
import { createClientProductCache } from '@yuants/data-product';
|
|
6
|
+
const terminal = Terminal.fromNodeEnv();
|
|
7
|
+
const productsCache = createClientProductCache(terminal, { expire: 7200000 });
|
|
8
|
+
const WINDOW_MS = 1 * 24 * 3600000;
|
|
9
|
+
const fetchTradeHistoryBackward = async (req) => {
|
|
10
|
+
if (req.trade_type === 'USDT_SWAP') {
|
|
11
|
+
const params = {
|
|
12
|
+
settle: 'usdt',
|
|
13
|
+
to: ~~(req.time / 1000),
|
|
14
|
+
from: ~~((req.time - WINDOW_MS) / 1000),
|
|
15
|
+
limit: 100,
|
|
16
|
+
};
|
|
17
|
+
const res = await getFutureAccountsTrades(req.credential.payload, params);
|
|
18
|
+
return (await Promise.all((res !== null && res !== void 0 ? res : []).map(async (v) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const product_id = encodePath('GATE', 'FUTURE', v.contract);
|
|
21
|
+
const product = await productsCache.query(product_id);
|
|
22
|
+
if (!product)
|
|
23
|
+
return;
|
|
24
|
+
const ms = Number(v.create_time) * 1000;
|
|
25
|
+
let direction = 'OPEN_LONG';
|
|
26
|
+
const numberSize = +v.size;
|
|
27
|
+
const numberCloseSize = +v.close_size;
|
|
28
|
+
if (numberCloseSize === 0) {
|
|
29
|
+
if (numberSize > 0) {
|
|
30
|
+
direction = 'OPEN_LONG';
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
direction = 'OPEN_SHORT';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (numberCloseSize > 0 && numberSize > 0) {
|
|
37
|
+
direction = 'CLOSE_SHORT';
|
|
38
|
+
}
|
|
39
|
+
if (numberCloseSize < 0 && numberSize < 0) {
|
|
40
|
+
direction = 'CLOSE_LONG';
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
id: v.trade_id,
|
|
44
|
+
product_id,
|
|
45
|
+
size: Math.abs(numberSize * ((_a = product.value_scale) !== null && _a !== void 0 ? _a : 1)).toString(),
|
|
46
|
+
account_id: req.account_id,
|
|
47
|
+
direction,
|
|
48
|
+
price: v.price,
|
|
49
|
+
fee: v.fee,
|
|
50
|
+
fee_currency: 'USDT',
|
|
51
|
+
created_at: formatTime(ms),
|
|
52
|
+
};
|
|
53
|
+
}))).filter((x) => !!x && Date.parse(x.created_at) <= ~~(req.time / 1000) * 1000);
|
|
54
|
+
}
|
|
55
|
+
return [];
|
|
56
|
+
};
|
|
57
|
+
provideTradeHistoryService(terminal, {
|
|
58
|
+
direction: 'backward',
|
|
59
|
+
type: 'GATE',
|
|
60
|
+
trade_type: ['USDT_SWAP'],
|
|
61
|
+
}, fetchTradeHistoryBackward);
|
|
62
|
+
//# sourceMappingURL=trade-history-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade-history-service.js","sourceRoot":"","sources":["../../src/services/trade-history-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAMhE,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AACxC,MAAM,aAAa,GAAG,wBAAwB,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAQ,EAAE,CAAC,CAAC;AAE/E,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,OAAQ,CA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AC;YACH,CAAC;YACD,IAAI,eAAe,GAAG,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;gBAC1C,SAAS,GAAG,aAAa,CAAC;YAC5B,CAAC;YACD,IAAI,eAAe,GAAG,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;gBAC1C,SAAS,GAAG,YAAY,CAAC;YAC3B,CAAC;YAED,OAAO;gBACL,EAAE,EAAE,CAAC,CAAC,QAAQ;gBACd,UAAU;gBACV,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;gBAClE,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,SAAS;gBACT,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,GAAG,EAAE,CAAC,CAAC,GAAG;gBACV,YAAY,EAAE,MAAM;gBACpB,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;aACV,CAAC;QACrB,CAAC,CAAC,CACH,CACF,CAAC,MAAM,CACN,CAAC,CAAC,EAAqC,EAAE,CACvC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAW,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,CACjE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,0BAA0B,CACxB,QAAQ,EACR;IACE,SAAS,EAAE,UAAU;IACrB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,CAAC,WAAW,CAAC;CAC1B,EACD,yBAAyB,CAC1B,CAAC","sourcesContent":["import { Terminal } from '@yuants/protocol';\nimport { encodePath, formatTime } from '@yuants/utils';\nimport { provideTradeHistoryService } from '@yuants/exchange';\nimport { getFutureAccountsTrades } from '../api/private-api';\nimport { ITradeHistory } from '@yuants/data-trade';\nimport { createClientProductCache } from '@yuants/data-product';\ninterface IExchangeCredential {\n type: string;\n payload: any;\n}\n\nconst terminal = Terminal.fromNodeEnv();\nconst productsCache = createClientProductCache(terminal, { expire: 7200_000 });\n\nconst WINDOW_MS = 1 * 24 * 3600_000;\nconst fetchTradeHistoryBackward = async (req: {\n credential: IExchangeCredential;\n account_id: string;\n time: number;\n trade_type: string;\n}): Promise<ITradeHistory[]> => {\n if (req.trade_type === 'USDT_SWAP') {\n const params = {\n settle: 'usdt',\n to: ~~(req.time / 1000),\n from: ~~((req.time - WINDOW_MS) / 1000),\n limit: 100,\n };\n const res = await getFutureAccountsTrades(req.credential.payload, params);\n return (\n await Promise.all(\n (res ?? []).map(async (v): Promise<ITradeHistory | undefined> => {\n const product_id = encodePath('GATE', 'FUTURE', v.contract);\n const product = await productsCache.query(product_id);\n if (!product) return;\n const ms = Number(v.create_time) * 1000;\n let direction = 'OPEN_LONG';\n const numberSize = +v.size;\n const numberCloseSize = +v.close_size;\n if (numberCloseSize === 0) {\n if (numberSize > 0) {\n direction = 'OPEN_LONG';\n } else {\n direction = 'OPEN_SHORT';\n }\n }\n if (numberCloseSize > 0 && numberSize > 0) {\n direction = 'CLOSE_SHORT';\n }\n if (numberCloseSize < 0 && numberSize < 0) {\n direction = 'CLOSE_LONG';\n }\n\n return {\n id: v.trade_id,\n product_id,\n size: Math.abs(numberSize * (product.value_scale ?? 1)).toString(),\n account_id: req.account_id,\n direction,\n price: v.price,\n fee: v.fee,\n fee_currency: 'USDT',\n created_at: formatTime(ms),\n } as ITradeHistory;\n }),\n )\n ).filter(\n (x): x is Exclude<typeof x, undefined> =>\n !!x && Date.parse(x.created_at!) <= ~~(req.time / 1000) * 1000,\n );\n }\n return [];\n};\n\nprovideTradeHistoryService(\n terminal,\n {\n direction: 'backward',\n type: 'GATE',\n trade_type: ['USDT_SWAP'],\n },\n fetchTradeHistoryBackward,\n);\n"]}
|
package/lib/api/private-api.d.ts
CHANGED
|
@@ -370,4 +370,30 @@ export declare const getFutureAccountsBook: (credential: ICredential, params: {
|
|
|
370
370
|
trade_id: string;
|
|
371
371
|
id: string;
|
|
372
372
|
}[]>;
|
|
373
|
+
/**
|
|
374
|
+
* 查询个人成交记录(时间区间)
|
|
375
|
+
*
|
|
376
|
+
* https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E4%B8%AA%E4%BA%BA%E6%88%90%E4%BA%A4%E8%AE%B0%E5%BD%95-%E6%97%B6%E9%97%B4%E5%8C%BA%E9%97%B4
|
|
377
|
+
*/
|
|
378
|
+
export declare const getFutureAccountsTrades: (credential: ICredential, params: {
|
|
379
|
+
settle: string;
|
|
380
|
+
contract?: string;
|
|
381
|
+
limit?: number;
|
|
382
|
+
offset?: number;
|
|
383
|
+
from?: number;
|
|
384
|
+
to?: number;
|
|
385
|
+
role?: string;
|
|
386
|
+
}) => Promise<{
|
|
387
|
+
trade_id: string;
|
|
388
|
+
create_time: number;
|
|
389
|
+
contract: string;
|
|
390
|
+
order_id: string;
|
|
391
|
+
size: string;
|
|
392
|
+
price: string;
|
|
393
|
+
text: string;
|
|
394
|
+
fee: string;
|
|
395
|
+
point_fee: string;
|
|
396
|
+
role: string;
|
|
397
|
+
close_size: string;
|
|
398
|
+
}[]>;
|
|
373
399
|
//# sourceMappingURL=private-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-api.d.ts","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,eAAe,EAAE,MAAM,eAAe,CAAC;AAG7E,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAS1C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAC3B,YAAY,WAAW,KACtB,OAAO,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,GAAG,EAAE;QACH,IAAI,EAAE,MA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|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFutureAccountsBook = exports.getUnifiedTransferable = exports.postWalletTransfer = exports.getSpotAccounts = exports.getWithdrawalHistory = exports.getDepositHistory = exports.getSubAccountList = exports.getDepositAddress = exports.postWithdrawals = exports.deleteFutureOrders = exports.postFutureOrders = exports.getFuturesAccounts = exports.getFuturesOrders = exports.getFuturePositions = exports.getUnifiedAccounts = exports.getAccountDetail = void 0;
|
|
3
|
+
exports.getFutureAccountsTrades = exports.getFutureAccountsBook = exports.getUnifiedTransferable = exports.postWalletTransfer = exports.getSpotAccounts = exports.getWithdrawalHistory = exports.getDepositHistory = exports.getSubAccountList = exports.getDepositAddress = exports.postWithdrawals = exports.deleteFutureOrders = exports.postFutureOrders = exports.getFuturesAccounts = exports.getFuturesOrders = exports.getFuturePositions = exports.getUnifiedAccounts = exports.getAccountDetail = void 0;
|
|
4
4
|
const http_client_1 = require("./http-client");
|
|
5
5
|
const callPrivate = (credential, method, path, params) => (0, http_client_1.requestPrivate)(credential, method, path, params);
|
|
6
6
|
/**
|
|
@@ -135,4 +135,11 @@ exports.getUnifiedTransferable = getUnifiedTransferable;
|
|
|
135
135
|
*/
|
|
136
136
|
const getFutureAccountsBook = (credential, params) => callPrivate(credential, 'GET', `/futures/${params.settle}/account_book`, params);
|
|
137
137
|
exports.getFutureAccountsBook = getFutureAccountsBook;
|
|
138
|
+
/**
|
|
139
|
+
* 查询个人成交记录(时间区间)
|
|
140
|
+
*
|
|
141
|
+
* https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E4%B8%AA%E4%BA%BA%E6%88%90%E4%BA%A4%E8%AE%B0%E5%BD%95-%E6%97%B6%E9%97%B4%E5%8C%BA%E9%97%B4
|
|
142
|
+
*/
|
|
143
|
+
const getFutureAccountsTrades = (credential, params) => callPrivate(credential, 'GET', `/futures/${params.settle}/my_trades_timerange`, params);
|
|
144
|
+
exports.getFutureAccountsTrades = getFutureAccountsTrades;
|
|
138
145
|
//# sourceMappingURL=private-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":";;;AACA,+CAA+C;AAI/C,MAAM,WAAW,GAAG,CAClB,UAAuB,EACvB,MAAkB,EAClB,IAAY,EACZ,MAAmB,EACnB,EAAE,CAAC,IAAA,4BAAc,EAAY,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEjE;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAC9B,UAAuB,EAStB,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAV3C,QAAA,gBAAgB,oBAU2B;AAExD;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,MAA8B,EAoC7B,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAtCrD,QAAA,kBAAkB,sBAsCmC;AAElE;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,cAAsB,EACtB,MAA+D,EAmB/D,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,cAAc,YAAY,EAAE,MAAM,CAAC,CAAC;AAtBvE,QAAA,kBAAkB,sBAsBqD;AAEpF;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAC9B,UAAuB,EACvB,MAAc,EACd,MAMC,EAcD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,MAAM,SAAS,EAAE,MAAM,CAAC,CAAC;AAvB5D,QAAA,gBAAgB,oBAuB4C;AAEzE;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,MAAc,EAyBb,EAAE,CAAC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AAC,CAAC;AAtBnD,QAAA,iBAAiB,qBAsBkC;AAEhE;;;;;;GAMG;AACI,MAAM,oBAAoB,GAAG,CAClC,UAAuB,EACvB,MAMC,EAcD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAtBtD,QAAA,oBAAoB,wBAsBkC;AAEnE;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAC7B,UAAuB,EACvB,MAEC,EAQD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAZjD,QAAA,eAAe,mBAYkC;AAE9D;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,MAOC,EAGA,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAZtD,QAAA,kBAAkB,sBAYoC;AAEnE;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CACpC,UAAuB,EACvB,MAEC,EAIA,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,CAAC,CAAC;AARzD,QAAA,sBAAsB,0BAQmC;AAEtE;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CACnC,UAAuB,EACvB,MAQC,EAYD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,MAAM,CAAC,MAAM,eAAe,EAAE,MAAM,CAAC,CAAC;AAtBzE,QAAA,qBAAqB,yBAsBoD","sourcesContent":["import type { GateParams, HttpMethod, IGateCredential } from './http-client';\nimport { requestPrivate } from './http-client';\n\nexport type ICredential = IGateCredential;\n\nconst callPrivate = <TResponse>(\n credential: ICredential,\n method: HttpMethod,\n path: string,\n params?: GateParams,\n) => requestPrivate<TResponse>(credential, method, path, params);\n\n/**\n * 获取用户账户信息\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF\n */\nexport const getAccountDetail = (\n credential: ICredential,\n): Promise<{\n user_id: number;\n ip_whitelist: string[];\n currency_pairs: string[];\n key: {\n mode: number;\n };\n tier: number;\n}> => callPrivate(credential, 'GET', '/account/detail');\n\n/**\n * 获取统一账户信息\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%BB%9F%E4%B8%80%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF\n */\nexport const getUnifiedAccounts = (\n credential: ICredential,\n params?: { currency?: string },\n): Promise<{\n user_id: string;\n refresh_time: number;\n locket: boolean;\n balances: Record<\n string,\n {\n available: string;\n freeze: string;\n borrowed: string;\n negative_liab: string;\n futures_pos_liab: string;\n equity: string;\n total_freeze: string;\n total_liab: string;\n spot_in_use: string;\n cross_balance: string;\n iso_balance: string;\n funding: string;\n }\n >;\n total: string;\n borrowed: string;\n total_initial_margin: string;\n total_margin_balance: string;\n total_maintenance_margin: string;\n total_initial_margin_rate: string;\n total_maintenance_margin_rate: string;\n total_avail_margin: string;\n unified_account_total: string;\n unified_account_total_liab: string;\n unified_account_total_equity: string;\n leverage: string;\n spot_order_loss: string;\n spot_hedge: boolean;\n}> => callPrivate(credential, 'GET', '/unified/accounts', params);\n\n/**\n * 获取用户仓位列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E4%BB%93%E4%BD%8D%E5%88%97%E8%A1%A8\n */\nexport const getFuturePositions = (\n credential: ICredential,\n quote_currency: string,\n params?: { holding?: boolean; limit?: number; offset?: number },\n): Promise<\n {\n user: number;\n contract: string;\n size: number;\n leverage: string;\n risk_limit: string;\n leverage_max: string;\n maintenance_rate: string;\n value: string;\n margin: string;\n entry_price: string;\n mark_price: string;\n unrealised_pnl: string;\n realised_pnl: string;\n mode: string;\n liq_price: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${quote_currency}/positions`, params);\n\n/**\n * 查询合约订单列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E5%90%88%E7%BA%A6%E8%AE%A2%E5%8D%95%E5%88%97%E8%A1%A8\n */\nexport const getFuturesOrders = (\n credential: ICredential,\n settle: string,\n params: {\n contract?: string;\n status: string;\n limit?: number;\n offset?: number;\n last_id?: number;\n },\n): Promise<\n {\n id: string;\n contract: string;\n create_time: number;\n size: number;\n price: string;\n is_close: boolean;\n fill_price: string;\n left?: number;\n status?: string;\n text: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${settle}/orders`, params);\n\n/**\n * 获取合约账号\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%90%88%E7%BA%A6%E8%B4%A6%E5%8F%B7\n */\nexport const getFuturesAccounts = (\n credential: ICredential,\n settle: string,\n): Promise<{\n user: number;\n currency: string;\n total: string;\n unrealised_pnl: string;\n position_margin: string;\n order_margin: string;\n available: string;\n point: string;\n bonus: string;\n in_dual_mode: boolean;\n enable_evolved_classic: boolean;\n history: {\n dnw: string;\n pnl: string;\n fee: string;\n refr: string;\n fund: string;\n point_dnw: string;\n point_fee: string;\n point_refr: string;\n bonus_dnw: string;\n bonus_offset: string;\n };\n}> => callPrivate(credential, 'GET', `/futures/${settle}/accounts`);\n\n/**\n * 合约交易下单\n *\n * 下单时指定的是合约张数 size ,而非币的数量,每一张合约对应的币的数量是合约详情接口里返回的 quanto_multiplier\n *\n * 0 成交的订单在撤单 10 分钟之后无法再获取到,会提到订单不存在\n *\n * 设置 reduce_only 为 true 可以防止在减仓的时候穿仓\n *\n * 单仓模式下,如果需要平仓,需要设置 size 为 0 ,close 为 true\n *\n * 双仓模式下,平仓需要使用 auto_size 来设置平仓方向,并同时设置 reduce_only 为 true,size 为 0\n *\n * 设置 stp_act 决定使用限制用户自成交的策略,详细用法参考body参数stp_act\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E5%90%88%E7%BA%A6%E4%BA%A4%E6%98%93%E4%B8%8B%E5%8D%95\n */\nexport const postFutureOrders = (\n credential: ICredential,\n settle: string,\n params: {\n contract: string;\n size: number;\n iceberg?: number;\n price?: string;\n close?: boolean;\n reduce_only?: boolean;\n tif?: string;\n text?: string;\n auto_size?: string;\n stp_act?: string;\n },\n): Promise<{\n label?: string;\n message?: string;\n detail?: string;\n id: number;\n user: number;\n contract: string;\n create_time: number;\n size: number;\n iceberg: number;\n left: number;\n price: string;\n fill_price: string;\n mkfr: string;\n tkfr: string;\n tif: string;\n refu: number;\n is_reduce_only: boolean;\n is_close: boolean;\n is_liq: boolean;\n text: string;\n status: string;\n finish_time: number;\n finish_as: string;\n stp_id: number;\n stp_act: string;\n amend_text: string;\n}> => callPrivate(credential, 'POST', `/futures/${settle}/orders`, params);\n\n/**\n * 撤销单个订单\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%92%A4%E9%94%80%E5%8D%95%E4%B8%AA%E8%AE%A2%E5%8D%95-2\n */\nexport const deleteFutureOrders = (credential: ICredential, settle: string, order_id: string): Promise<{}> =>\n callPrivate(credential, 'DELETE', `/futures/${settle}/orders/${order_id}`);\n\n/**\n * 提现\n *\n * POST /withdrawals\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%8F%90%E7%8E%B0\n */\nexport const postWithdrawals = (\n credential: ICredential,\n params: {\n withdraw_order_id?: string;\n amount: string;\n currency: string;\n address?: string;\n memo?: string;\n chain: string;\n },\n): Promise<{\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n}> => callPrivate(credential, 'POST', '/withdrawals', params);\n\n/**\n * 获取币种充值地址\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%B8%81%E7%A7%8D%E5%85%85%E5%80%BC%E5%9C%B0%E5%9D%80\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n currency: string;\n },\n): Promise<{\n currency: string;\n address: string;\n multichain_addresses: {\n chain: string;\n address: string;\n payment_id: string;\n payment_name: string;\n obtain_failed: boolean;\n }[];\n}> => callPrivate(credential, 'GET', '/wallet/deposit_address', params);\n\n/**\n * 创建新的子账户\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E5%88%9B%E5%BB%BA%E6%96%B0%E7%9A%84%E5%AD%90%E8%B4%A6%E6%88%B7\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n type?: string;\n },\n): Promise<\n {\n remark: string;\n login_name: string;\n password: string;\n email: string;\n state: number;\n type: number;\n user_id: number;\n create_time: number;\n }[]\n> => callPrivate(credential, 'GET', '/sub_accounts', params);\n\n/**\n * 获取充值记录\n *\n * 记录查询时间范围不允许超过 30 天\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%85%85%E5%80%BC%E8%AE%B0%E5%BD%95\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n currency?: string;\n from?: number;\n to?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<\n {\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n }[]\n> => callPrivate(credential, 'GET', '/wallet/deposits', params);\n\n/**\n * 获取提现记录\n *\n * 记录查询时间范围不允许超过 30 天\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%B8%81%E7%A7%8D%E5%85%85%E5%80%BC%E5%9C%B0%E5%9D%80\n */\nexport const getWithdrawalHistory = (\n credential: ICredential,\n params?: {\n currency?: string;\n from?: number;\n to?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<\n {\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n }[]\n> => callPrivate(credential, 'GET', '/wallet/withdrawals', params);\n\n/**\n * 获取现货交易账户列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%8E%B0%E8%B4%A7%E4%BA%A4%E6%98%93%E8%B4%A6%E6%88%B7%E5%88%97%E8%A1%A8\n */\nexport const getSpotAccounts = (\n credential: ICredential,\n params?: {\n currency?: string;\n },\n): Promise<\n {\n currency: string;\n available: string;\n locked: string;\n update_id: string;\n }[]\n> => callPrivate(credential, 'GET', '/spot/accounts', params);\n\n/**\n * 交易账户互转\n *\n * POST /wallet/transfers\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E4%BA%A4%E6%98%93%E8%B4%A6%E6%88%B7%E4%BA%92%E8%BD%AC\n */\nexport const postWalletTransfer = (\n credential: ICredential,\n params: {\n currency: string;\n from: string;\n to: string;\n amount: string;\n currency_pair?: string;\n settle?: string;\n },\n): Promise<{\n tx_id: string;\n}> => callPrivate(credential, 'POST', '/wallet/transfers', params);\n\n/**\n * 获取统一账户最多可转出\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E7%BB%9F%E4%B8%80%E8%B4%A6%E6%88%B7%E6%9C%80%E5%A4%9A%E5%8F%AF%E8%BD%AC%E5%87%BA\n */\nexport const getUnifiedTransferable = (\n credential: ICredential,\n params: {\n currency: string;\n },\n): Promise<{\n currency: string;\n amount: string;\n}> => callPrivate(credential, 'GET', `/unified/transferable`, params);\n\n/**\n * 查询合约账户变更历史\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E5%90%88%E7%BA%A6%E8%B4%A6%E6%88%B7%E5%8F%98%E6%9B%B4%E5%8E%86%E5%8F%B2\n */\nexport const getFutureAccountsBook = (\n credential: ICredential,\n params: {\n settle: string;\n contract?: string;\n limit?: number;\n offset?: number;\n from?: number;\n to?: number;\n type?: string; // | 'dnw' | 'pnl' | 'fee' | 'refr' | 'fund' | 'point_dnw' | 'point_fee' | 'point_refr' | 'bonus_offset'\n },\n): Promise<\n {\n time: number;\n change: string;\n balance: string;\n text: string;\n type: string;\n contract: string;\n trade_id: string;\n id: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${params.settle}/account_book`, params);\n"]}
|
|
1
|
+
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],"mappings":";;;AACA,+CAA+C;AAI/C,MAAM,WAAW,GAAG,CAClB,UAAuB,EACvB,MAAkB,EAClB,IAAY,EACZ,MAAmB,EACnB,EAAE,CAAC,IAAA,4BAAc,EAAY,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEjE;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAC9B,UAAuB,EAStB,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAV3C,QAAA,gBAAgB,oBAU2B;AAExD;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,MAA8B,EAoC7B,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAtCrD,QAAA,kBAAkB,sBAsCmC;AAElE;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,cAAsB,EACtB,MAA+D,EAmB/D,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,cAAc,YAAY,EAAE,MAAM,CAAC,CAAC;AAtBvE,QAAA,kBAAkB,sBAsBqD;AAEpF;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAC9B,UAAuB,EACvB,MAAc,EACd,MAMC,EAcD,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,MAAM,SAAS,EAAE,MAAM,CAAC,CA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,YAAY,MAAM,CAAC,MAAM,sBAAsB,EAAE,MAAM,CAAC,CAAC;AAzBhF,QAAA,uBAAuB,2BAyByD","sourcesContent":["import type { GateParams, HttpMethod, IGateCredential } from './http-client';\nimport { requestPrivate } from './http-client';\n\nexport type ICredential = IGateCredential;\n\nconst callPrivate = <TResponse>(\n credential: ICredential,\n method: HttpMethod,\n path: string,\n params?: GateParams,\n) => requestPrivate<TResponse>(credential, method, path, params);\n\n/**\n * 获取用户账户信息\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF\n */\nexport const getAccountDetail = (\n credential: ICredential,\n): Promise<{\n user_id: number;\n ip_whitelist: string[];\n currency_pairs: string[];\n key: {\n mode: number;\n };\n tier: number;\n}> => callPrivate(credential, 'GET', '/account/detail');\n\n/**\n * 获取统一账户信息\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%BB%9F%E4%B8%80%E8%B4%A6%E6%88%B7%E4%BF%A1%E6%81%AF\n */\nexport const getUnifiedAccounts = (\n credential: ICredential,\n params?: { currency?: string },\n): Promise<{\n user_id: string;\n refresh_time: number;\n locket: boolean;\n balances: Record<\n string,\n {\n available: string;\n freeze: string;\n borrowed: string;\n negative_liab: string;\n futures_pos_liab: string;\n equity: string;\n total_freeze: string;\n total_liab: string;\n spot_in_use: string;\n cross_balance: string;\n iso_balance: string;\n funding: string;\n }\n >;\n total: string;\n borrowed: string;\n total_initial_margin: string;\n total_margin_balance: string;\n total_maintenance_margin: string;\n total_initial_margin_rate: string;\n total_maintenance_margin_rate: string;\n total_avail_margin: string;\n unified_account_total: string;\n unified_account_total_liab: string;\n unified_account_total_equity: string;\n leverage: string;\n spot_order_loss: string;\n spot_hedge: boolean;\n}> => callPrivate(credential, 'GET', '/unified/accounts', params);\n\n/**\n * 获取用户仓位列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E4%BB%93%E4%BD%8D%E5%88%97%E8%A1%A8\n */\nexport const getFuturePositions = (\n credential: ICredential,\n quote_currency: string,\n params?: { holding?: boolean; limit?: number; offset?: number },\n): Promise<\n {\n user: number;\n contract: string;\n size: number;\n leverage: string;\n risk_limit: string;\n leverage_max: string;\n maintenance_rate: string;\n value: string;\n margin: string;\n entry_price: string;\n mark_price: string;\n unrealised_pnl: string;\n realised_pnl: string;\n mode: string;\n liq_price: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${quote_currency}/positions`, params);\n\n/**\n * 查询合约订单列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E5%90%88%E7%BA%A6%E8%AE%A2%E5%8D%95%E5%88%97%E8%A1%A8\n */\nexport const getFuturesOrders = (\n credential: ICredential,\n settle: string,\n params: {\n contract?: string;\n status: string;\n limit?: number;\n offset?: number;\n last_id?: number;\n },\n): Promise<\n {\n id: string;\n contract: string;\n create_time: number;\n size: number;\n price: string;\n is_close: boolean;\n fill_price: string;\n left?: number;\n status?: string;\n text: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${settle}/orders`, params);\n\n/**\n * 获取合约账号\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%90%88%E7%BA%A6%E8%B4%A6%E5%8F%B7\n */\nexport const getFuturesAccounts = (\n credential: ICredential,\n settle: string,\n): Promise<{\n user: number;\n currency: string;\n total: string;\n unrealised_pnl: string;\n position_margin: string;\n order_margin: string;\n available: string;\n point: string;\n bonus: string;\n in_dual_mode: boolean;\n enable_evolved_classic: boolean;\n history: {\n dnw: string;\n pnl: string;\n fee: string;\n refr: string;\n fund: string;\n point_dnw: string;\n point_fee: string;\n point_refr: string;\n bonus_dnw: string;\n bonus_offset: string;\n };\n}> => callPrivate(credential, 'GET', `/futures/${settle}/accounts`);\n\n/**\n * 合约交易下单\n *\n * 下单时指定的是合约张数 size ,而非币的数量,每一张合约对应的币的数量是合约详情接口里返回的 quanto_multiplier\n *\n * 0 成交的订单在撤单 10 分钟之后无法再获取到,会提到订单不存在\n *\n * 设置 reduce_only 为 true 可以防止在减仓的时候穿仓\n *\n * 单仓模式下,如果需要平仓,需要设置 size 为 0 ,close 为 true\n *\n * 双仓模式下,平仓需要使用 auto_size 来设置平仓方向,并同时设置 reduce_only 为 true,size 为 0\n *\n * 设置 stp_act 决定使用限制用户自成交的策略,详细用法参考body参数stp_act\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E5%90%88%E7%BA%A6%E4%BA%A4%E6%98%93%E4%B8%8B%E5%8D%95\n */\nexport const postFutureOrders = (\n credential: ICredential,\n settle: string,\n params: {\n contract: string;\n size: number;\n iceberg?: number;\n price?: string;\n close?: boolean;\n reduce_only?: boolean;\n tif?: string;\n text?: string;\n auto_size?: string;\n stp_act?: string;\n },\n): Promise<{\n label?: string;\n message?: string;\n detail?: string;\n id: number;\n user: number;\n contract: string;\n create_time: number;\n size: number;\n iceberg: number;\n left: number;\n price: string;\n fill_price: string;\n mkfr: string;\n tkfr: string;\n tif: string;\n refu: number;\n is_reduce_only: boolean;\n is_close: boolean;\n is_liq: boolean;\n text: string;\n status: string;\n finish_time: number;\n finish_as: string;\n stp_id: number;\n stp_act: string;\n amend_text: string;\n}> => callPrivate(credential, 'POST', `/futures/${settle}/orders`, params);\n\n/**\n * 撤销单个订单\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%92%A4%E9%94%80%E5%8D%95%E4%B8%AA%E8%AE%A2%E5%8D%95-2\n */\nexport const deleteFutureOrders = (credential: ICredential, settle: string, order_id: string): Promise<{}> =>\n callPrivate(credential, 'DELETE', `/futures/${settle}/orders/${order_id}`);\n\n/**\n * 提现\n *\n * POST /withdrawals\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%8F%90%E7%8E%B0\n */\nexport const postWithdrawals = (\n credential: ICredential,\n params: {\n withdraw_order_id?: string;\n amount: string;\n currency: string;\n address?: string;\n memo?: string;\n chain: string;\n },\n): Promise<{\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n}> => callPrivate(credential, 'POST', '/withdrawals', params);\n\n/**\n * 获取币种充值地址\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%B8%81%E7%A7%8D%E5%85%85%E5%80%BC%E5%9C%B0%E5%9D%80\n */\nexport const getDepositAddress = (\n credential: ICredential,\n params: {\n currency: string;\n },\n): Promise<{\n currency: string;\n address: string;\n multichain_addresses: {\n chain: string;\n address: string;\n payment_id: string;\n payment_name: string;\n obtain_failed: boolean;\n }[];\n}> => callPrivate(credential, 'GET', '/wallet/deposit_address', params);\n\n/**\n * 创建新的子账户\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E5%88%9B%E5%BB%BA%E6%96%B0%E7%9A%84%E5%AD%90%E8%B4%A6%E6%88%B7\n */\nexport const getSubAccountList = (\n credential: ICredential,\n params?: {\n type?: string;\n },\n): Promise<\n {\n remark: string;\n login_name: string;\n password: string;\n email: string;\n state: number;\n type: number;\n user_id: number;\n create_time: number;\n }[]\n> => callPrivate(credential, 'GET', '/sub_accounts', params);\n\n/**\n * 获取充值记录\n *\n * 记录查询时间范围不允许超过 30 天\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%85%85%E5%80%BC%E8%AE%B0%E5%BD%95\n */\nexport const getDepositHistory = (\n credential: ICredential,\n params?: {\n currency?: string;\n from?: number;\n to?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<\n {\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n }[]\n> => callPrivate(credential, 'GET', '/wallet/deposits', params);\n\n/**\n * 获取提现记录\n *\n * 记录查询时间范围不允许超过 30 天\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E5%B8%81%E7%A7%8D%E5%85%85%E5%80%BC%E5%9C%B0%E5%9D%80\n */\nexport const getWithdrawalHistory = (\n credential: ICredential,\n params?: {\n currency?: string;\n from?: number;\n to?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<\n {\n id: string;\n txid: string;\n withdraw_order_id: string;\n timestamp: number;\n amount: string;\n currency: string;\n address: string;\n memo: string;\n status: string;\n chain: string;\n }[]\n> => callPrivate(credential, 'GET', '/wallet/withdrawals', params);\n\n/**\n * 获取现货交易账户列表\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E8%8E%B7%E5%8F%96%E7%8E%B0%E8%B4%A7%E4%BA%A4%E6%98%93%E8%B4%A6%E6%88%B7%E5%88%97%E8%A1%A8\n */\nexport const getSpotAccounts = (\n credential: ICredential,\n params?: {\n currency?: string;\n },\n): Promise<\n {\n currency: string;\n available: string;\n locked: string;\n update_id: string;\n }[]\n> => callPrivate(credential, 'GET', '/spot/accounts', params);\n\n/**\n * 交易账户互转\n *\n * POST /wallet/transfers\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E4%BA%A4%E6%98%93%E8%B4%A6%E6%88%B7%E4%BA%92%E8%BD%AC\n */\nexport const postWalletTransfer = (\n credential: ICredential,\n params: {\n currency: string;\n from: string;\n to: string;\n amount: string;\n currency_pair?: string;\n settle?: string;\n },\n): Promise<{\n tx_id: string;\n}> => callPrivate(credential, 'POST', '/wallet/transfers', params);\n\n/**\n * 获取统一账户最多可转出\n *\n * https://www.gate.io/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E7%BB%9F%E4%B8%80%E8%B4%A6%E6%88%B7%E6%9C%80%E5%A4%9A%E5%8F%AF%E8%BD%AC%E5%87%BA\n */\nexport const getUnifiedTransferable = (\n credential: ICredential,\n params: {\n currency: string;\n },\n): Promise<{\n currency: string;\n amount: string;\n}> => callPrivate(credential, 'GET', `/unified/transferable`, params);\n\n/**\n * 查询合约账户变更历史\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E5%90%88%E7%BA%A6%E8%B4%A6%E6%88%B7%E5%8F%98%E6%9B%B4%E5%8E%86%E5%8F%B2\n */\nexport const getFutureAccountsBook = (\n credential: ICredential,\n params: {\n settle: string;\n contract?: string;\n limit?: number;\n offset?: number;\n from?: number;\n to?: number;\n type?: string; // | 'dnw' | 'pnl' | 'fee' | 'refr' | 'fund' | 'point_dnw' | 'point_fee' | 'point_refr' | 'bonus_offset'\n },\n): Promise<\n {\n time: number;\n change: string;\n balance: string;\n text: string;\n type: string;\n contract: string;\n trade_id: string;\n id: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${params.settle}/account_book`, params);\n\n/**\n * 查询个人成交记录(时间区间)\n *\n * https://www.gate.com/docs/developers/apiv4/zh_CN/#%E6%9F%A5%E8%AF%A2%E4%B8%AA%E4%BA%BA%E6%88%90%E4%BA%A4%E8%AE%B0%E5%BD%95-%E6%97%B6%E9%97%B4%E5%8C%BA%E9%97%B4\n */\nexport const getFutureAccountsTrades = (\n credential: ICredential,\n params: {\n settle: string;\n contract?: string;\n limit?: number;\n offset?: number;\n from?: number;\n to?: number;\n role?: string;\n },\n): Promise<\n {\n trade_id: string;\n create_time: number;\n contract: string;\n order_id: string;\n size: string;\n price: string;\n text: string;\n fee: string;\n point_fee: string;\n role: string;\n close_size: string;\n }[]\n> => callPrivate(credential, 'GET', `/futures/${params.settle}/my_trades_timerange`, params);\n"]}
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,+BAA6B;AAC7B,sCAAoC;AACpC,oCAAkC;AAClC,6BAA2B;AAC3B,+BAA6B;AAC7B,mCAAiC;AACjC,4CAA0C;AAC1C,8CAA4C","sourcesContent":["import './services/exchange';\nimport './services/markets/product';\nimport './services/markets/quote';\nimport './services/quotes';\nimport './services/transfer';\nimport './services/ohlc-service';\nimport './services/interest-rate-service';\nimport './services/interest-ledger-service';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,+BAA6B;AAC7B,sCAAoC;AACpC,oCAAkC;AAClC,6BAA2B;AAC3B,+BAA6B;AAC7B,mCAAiC;AACjC,4CAA0C;AAC1C,8CAA4C;AAC5C,4CAA0C","sourcesContent":["import './services/exchange';\nimport './services/markets/product';\nimport './services/markets/quote';\nimport './services/quotes';\nimport './services/transfer';\nimport './services/ohlc-service';\nimport './services/interest-rate-service';\nimport './services/interest-ledger-service';\nimport './services/trade-history-service';\n"]}
|
|
@@ -5,32 +5,36 @@ const utils_1 = require("@yuants/utils");
|
|
|
5
5
|
const exchange_1 = require("@yuants/exchange");
|
|
6
6
|
const private_api_1 = require("../api/private-api");
|
|
7
7
|
const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
8
|
-
const WINDOW_MS =
|
|
8
|
+
const WINDOW_MS = 2 * 24 * 3600000;
|
|
9
9
|
const fetchInterestRateLedgerBackward = async (req) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const res = await (0, private_api_1.getFutureAccountsBook)(req.credential.payload, params);
|
|
18
|
-
return (res !== null && res !== void 0 ? res : [])
|
|
19
|
-
.map((v) => {
|
|
20
|
-
const ms = Number(v.time * 1000);
|
|
21
|
-
return {
|
|
22
|
-
id: v.id,
|
|
23
|
-
product_id: (0, utils_1.encodePath)('GATE', 'FUTURE', v.contract),
|
|
24
|
-
amount: v.change,
|
|
25
|
-
account_id: req.account_id,
|
|
26
|
-
currency: 'USDT',
|
|
27
|
-
created_at: (0, utils_1.formatTime)(ms),
|
|
10
|
+
if (req.ledger_type === 'FUNDING_FEE') {
|
|
11
|
+
const params = {
|
|
12
|
+
settle: 'usdt',
|
|
13
|
+
to: ~~(req.time / 1000),
|
|
14
|
+
from: ~~((req.time - WINDOW_MS) / 1000),
|
|
15
|
+
limit: 100,
|
|
16
|
+
type: 'fund',
|
|
28
17
|
};
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
const res = await (0, private_api_1.getFutureAccountsBook)(req.credential.payload, params);
|
|
19
|
+
return (res !== null && res !== void 0 ? res : [])
|
|
20
|
+
.map((v) => {
|
|
21
|
+
const ms = Number(v.time * 1000);
|
|
22
|
+
return {
|
|
23
|
+
id: v.id,
|
|
24
|
+
product_id: (0, utils_1.encodePath)('GATE', 'FUTURE', v.contract),
|
|
25
|
+
amount: v.change,
|
|
26
|
+
account_id: req.account_id,
|
|
27
|
+
currency: 'USDT',
|
|
28
|
+
created_at: (0, utils_1.formatTime)(ms),
|
|
29
|
+
};
|
|
30
|
+
})
|
|
31
|
+
.filter((x) => Date.parse(x.created_at) <= req.time);
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
31
34
|
};
|
|
32
35
|
(0, exchange_1.provideInterestLedgerService)(terminal, {
|
|
33
36
|
direction: 'backward',
|
|
34
37
|
type: 'GATE',
|
|
38
|
+
ledger_type: ['FUNDING_FEE'],
|
|
35
39
|
}, fetchInterestRateLedgerBackward);
|
|
36
40
|
//# sourceMappingURL=interest-ledger-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest-ledger-service.js","sourceRoot":"","sources":["../../src/services/interest-ledger-service.ts"],"names":[],"mappings":";;AACA,+CAA4C;AAC5C,yCAAuD;AACvD,+CAAgE;AAChE,oDAA2D;AAO3D,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,MAAM,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"interest-ledger-service.js","sourceRoot":"","sources":["../../src/services/interest-ledger-service.ts"],"names":[],"mappings":";;AACA,+CAA4C;AAC5C,yCAAuD;AACvD,+CAAgE;AAChE,oDAA2D;AAO3D,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,OAAQ,CAAC;AACpC,MAAM,+BAA+B,GAAG,KAAK,EAAE,GAK9C,EAA8B,EAAE;IAC/B,IAAI,GAAG,CAAC,WAAW,KAAK,aAAa,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG;YACb,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;YACvB,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC;YACvC,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,MAAM;SACb,CAAC;QACF,MAAM,GAAG,GAAG,MAAM,IAAA,mCAAqB,EAAC,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACxE,OAAO,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAAC;aACf,GAAG,CAAC,CAAC,CAAC,EAAmB,EAAE;YAC1B,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;YACjC,OAAO;gBACL,EAAE,EAAE,CAAC,CAAC,EAAE;gBACR,UAAU,EAAE,IAAA,kBAAU,EAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC;gBACpD,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,QAAQ,EAAE,MAAM;gBAChB,UAAU,EAAE,IAAA,kBAAU,EAAC,EAAE,CAAC;aACR,CAAC;QACvB,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAW,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,IAAA,uCAA4B,EAC1B,QAAQ,EACR;IACE,SAAS,EAAE,UAAU;IACrB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,CAAC,aAAa,CAAC;CAC7B,EACD,+BAA+B,CAChC,CAAC","sourcesContent":["import { IInterestLedger } from '@yuants/data-interest-rate';\nimport { Terminal } from '@yuants/protocol';\nimport { encodePath, formatTime } from '@yuants/utils';\nimport { provideInterestLedgerService } from '@yuants/exchange';\nimport { getFutureAccountsBook } from '../api/private-api';\n\ninterface IExchangeCredential {\n type: string;\n payload: any;\n}\n\nconst terminal = Terminal.fromNodeEnv();\n\nconst WINDOW_MS = 2 * 24 * 3600_000;\nconst fetchInterestRateLedgerBackward = async (req: {\n credential: IExchangeCredential;\n account_id: string;\n time: number;\n ledger_type: string;\n}): Promise<IInterestLedger[]> => {\n if (req.ledger_type === 'FUNDING_FEE') {\n const params = {\n settle: 'usdt',\n to: ~~(req.time / 1000),\n from: ~~((req.time - WINDOW_MS) / 1000),\n limit: 100,\n type: 'fund',\n };\n const res = await getFutureAccountsBook(req.credential.payload, params);\n return (res ?? [])\n .map((v): IInterestLedger => {\n const ms = Number(v.time * 1000);\n return {\n id: v.id,\n product_id: encodePath('GATE', 'FUTURE', v.contract),\n amount: v.change,\n account_id: req.account_id,\n currency: 'USDT',\n created_at: formatTime(ms),\n } as IInterestLedger;\n })\n .filter((x) => Date.parse(x.created_at!) <= req.time);\n }\n return [];\n};\n\nprovideInterestLedgerService(\n terminal,\n {\n direction: 'backward',\n type: 'GATE',\n ledger_type: ['FUNDING_FEE'],\n },\n fetchInterestRateLedgerBackward,\n);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade-history-service.d.ts","sourceRoot":"","sources":["../../src/services/trade-history-service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const protocol_1 = require("@yuants/protocol");
|
|
4
|
+
const utils_1 = require("@yuants/utils");
|
|
5
|
+
const exchange_1 = require("@yuants/exchange");
|
|
6
|
+
const private_api_1 = require("../api/private-api");
|
|
7
|
+
const data_product_1 = require("@yuants/data-product");
|
|
8
|
+
const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
9
|
+
const productsCache = (0, data_product_1.createClientProductCache)(terminal, { expire: 7200000 });
|
|
10
|
+
const WINDOW_MS = 1 * 24 * 3600000;
|
|
11
|
+
const fetchTradeHistoryBackward = async (req) => {
|
|
12
|
+
if (req.trade_type === 'USDT_SWAP') {
|
|
13
|
+
const params = {
|
|
14
|
+
settle: 'usdt',
|
|
15
|
+
to: ~~(req.time / 1000),
|
|
16
|
+
from: ~~((req.time - WINDOW_MS) / 1000),
|
|
17
|
+
limit: 100,
|
|
18
|
+
};
|
|
19
|
+
const res = await (0, private_api_1.getFutureAccountsTrades)(req.credential.payload, params);
|
|
20
|
+
return (await Promise.all((res !== null && res !== void 0 ? res : []).map(async (v) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const product_id = (0, utils_1.encodePath)('GATE', 'FUTURE', v.contract);
|
|
23
|
+
const product = await productsCache.query(product_id);
|
|
24
|
+
if (!product)
|
|
25
|
+
return;
|
|
26
|
+
const ms = Number(v.create_time) * 1000;
|
|
27
|
+
let direction = 'OPEN_LONG';
|
|
28
|
+
const numberSize = +v.size;
|
|
29
|
+
const numberCloseSize = +v.close_size;
|
|
30
|
+
if (numberCloseSize === 0) {
|
|
31
|
+
if (numberSize > 0) {
|
|
32
|
+
direction = 'OPEN_LONG';
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
direction = 'OPEN_SHORT';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (numberCloseSize > 0 && numberSize > 0) {
|
|
39
|
+
direction = 'CLOSE_SHORT';
|
|
40
|
+
}
|
|
41
|
+
if (numberCloseSize < 0 && numberSize < 0) {
|
|
42
|
+
direction = 'CLOSE_LONG';
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
id: v.trade_id,
|
|
46
|
+
product_id,
|
|
47
|
+
size: Math.abs(numberSize * ((_a = product.value_scale) !== null && _a !== void 0 ? _a : 1)).toString(),
|
|
48
|
+
account_id: req.account_id,
|
|
49
|
+
direction,
|
|
50
|
+
price: v.price,
|
|
51
|
+
fee: v.fee,
|
|
52
|
+
fee_currency: 'USDT',
|
|
53
|
+
created_at: (0, utils_1.formatTime)(ms),
|
|
54
|
+
};
|
|
55
|
+
}))).filter((x) => !!x && Date.parse(x.created_at) <= ~~(req.time / 1000) * 1000);
|
|
56
|
+
}
|
|
57
|
+
return [];
|
|
58
|
+
};
|
|
59
|
+
(0, exchange_1.provideTradeHistoryService)(terminal, {
|
|
60
|
+
direction: 'backward',
|
|
61
|
+
type: 'GATE',
|
|
62
|
+
trade_type: ['USDT_SWAP'],
|
|
63
|
+
}, fetchTradeHistoryBackward);
|
|
64
|
+
//# sourceMappingURL=trade-history-service.js.map
|