@yuants/vendor-gate 0.4.25 → 0.4.27
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 +5 -0
- package/dist/api/private-api.js.map +1 -1
- package/dist/services/accounts/unified.js +6 -5
- package/dist/services/accounts/unified.js.map +1 -1
- package/dist/services/markets/quote.js +4 -3
- package/dist/services/markets/quote.js.map +1 -1
- package/lib/api/private-api.d.ts +8 -0
- package/lib/api/private-api.d.ts.map +1 -1
- package/lib/api/private-api.js +5 -0
- package/lib/api/private-api.js.map +1 -1
- package/lib/services/accounts/unified.d.ts.map +1 -1
- package/lib/services/accounts/unified.js +5 -4
- package/lib/services/accounts/unified.js.map +1 -1
- package/lib/services/markets/quote.js +2 -1
- package/lib/services/markets/quote.js.map +1 -1
- package/package.json +3 -3
- package/temp/package-deps.json +8 -8
package/dist/api/private-api.js
CHANGED
|
@@ -6,6 +6,11 @@ const callPrivate = (credential, method, path, params) => requestPrivate(credent
|
|
|
6
6
|
* 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
|
|
7
7
|
*/
|
|
8
8
|
export const getAccountDetail = (credential) => callPrivate(credential, 'GET', '/account/detail');
|
|
9
|
+
/**
|
|
10
|
+
* 获取统一账户信息
|
|
11
|
+
*
|
|
12
|
+
* 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
|
|
13
|
+
*/
|
|
9
14
|
export const getUnifiedAccounts = (credential, params) => callPrivate(credential, 'GET', '/unified/accounts', params);
|
|
10
15
|
/**
|
|
11
16
|
* 获取用户仓位列表
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-api.js","sourceRoot":"","sources":["../../src/api/private-api.ts"],"names":[],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;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","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\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 }\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"]}
|
|
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,EACvB,MAAc,EAyBb,EAAE,CAAC,WAAW,CAAC,UAA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AAE,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","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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createCache } from '@yuants/cache';
|
|
2
2
|
import { encodePath } from '@yuants/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { getFuturePositions, getUnifiedAccounts } from '../../api/private-api';
|
|
4
4
|
import { getSpotTickers } from '../../api/public-api';
|
|
5
5
|
import { listProducts } from '../markets/product';
|
|
6
6
|
const spotProductMapCache = createCache(async () => {
|
|
@@ -59,7 +59,7 @@ export const getUnifiedAccountInfo = async (credential) => {
|
|
|
59
59
|
const spotTickerList = Array.isArray(spotTickers) ? spotTickers : [];
|
|
60
60
|
const spotPositions = Object.keys(balances)
|
|
61
61
|
.map((currency) => {
|
|
62
|
-
var _a, _b, _c;
|
|
62
|
+
var _a, _b, _c, _d;
|
|
63
63
|
let currency_pair = `${currency}_USDT`;
|
|
64
64
|
if (currency === 'SOL2') {
|
|
65
65
|
currency_pair = 'SOL_USDT';
|
|
@@ -70,16 +70,17 @@ export const getUnifiedAccountInfo = async (credential) => {
|
|
|
70
70
|
const closable_price = currency === 'USDT'
|
|
71
71
|
? 1
|
|
72
72
|
: Number(((_a = spotTickerList.find((ticker) => ticker.currency_pair === currency_pair)) === null || _a === void 0 ? void 0 : _a.last) || 0);
|
|
73
|
-
const volume = Number(((_b = balances[currency]) === null || _b === void 0 ? void 0 : _b.
|
|
73
|
+
const volume = Number(((_b = balances[currency]) === null || _b === void 0 ? void 0 : _b.cross_balance) || 0);
|
|
74
|
+
const free_volume = Number(((_c = balances[currency]) === null || _c === void 0 ? void 0 : _c.available) || 0);
|
|
74
75
|
if (Math.abs(volume) === 0)
|
|
75
76
|
return undefined;
|
|
76
77
|
return {
|
|
77
78
|
datasource_id: 'GATE',
|
|
78
79
|
position_id: currency,
|
|
79
|
-
product_id: (
|
|
80
|
+
product_id: (_d = resolvedSpotProductMap.get(currency)) !== null && _d !== void 0 ? _d : encodePath('GATE', 'SPOT', currency),
|
|
80
81
|
direction: 'LONG',
|
|
81
82
|
volume,
|
|
82
|
-
free_volume
|
|
83
|
+
free_volume,
|
|
83
84
|
closable_price,
|
|
84
85
|
position_price: closable_price,
|
|
85
86
|
floating_profit: closable_price * volume,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified.js","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAe,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,mBAAmB,GAAG,WAAW,CACrC,KAAK,IAAI,EAAE;IACT,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC;IACtC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,KAAK,MAAM,OAAO,IAAI,QAAQ,aAAR,QAAQ,cAAR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AE/C,OAAO,CAAC,GAAG,eAAe,EAAE,GAAG,aAAa,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { createCache } from '@yuants/cache';\nimport type { IPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { getFuturePositions, getUnifiedAccounts, ICredential } from '../../api/private-api';\nimport { getSpotTickers } from '../../api/public-api';\nimport { listProducts } from '../markets/product';\n\nconst spotProductMapCache = createCache(\n async () => {\n const products = await listProducts();\n const map = new Map<string, string>();\n for (const product of products ?? []) {\n const [, instType] = product.product_id.split('/');\n if (instType === 'SPOT') {\n map.set(product.base_currency, product.product_id);\n }\n }\n return map;\n },\n { expire: 86_400_000 },\n);\n\nconst loadFuturePositions = async (credential: ICredential): Promise<IPosition[]> => {\n const positions: IPosition[] = [];\n const positionsRes = await getFuturePositions(credential, 'usdt');\n\n for (const position of Array.isArray(positionsRes) ? positionsRes : []) {\n if (!(Math.abs(position.size) > 0)) continue;\n\n const product_id = encodePath('GATE', 'FUTURE', position.contract);\n const volume = Math.abs(position.size);\n const closable_price = Number(position.mark_price);\n const valuation = volume * closable_price;\n positions.push({\n datasource_id: 'GATE',\n position_id: `${position.contract}-${position.leverage}-${position.mode}`,\n product_id,\n direction:\n position.mode === 'dual_long'\n ? 'LONG'\n : position.mode === 'dual_short'\n ? 'SHORT'\n : position.size > 0\n ? 'LONG'\n : 'SHORT',\n volume,\n free_volume: Math.abs(position.size),\n position_price: Number(position.entry_price),\n closable_price,\n floating_profit: Number(position.unrealised_pnl),\n liquidation_price: position.liq_price,\n valuation,\n });\n }\n\n return positions;\n};\n\nexport const getUnifiedAccountInfo = async (credential: ICredential) => {\n const [futurePositions, unifiedAccount, spotTickers, spotProductMap] = await Promise.all([\n loadFuturePositions(credential),\n getUnifiedAccounts(credential, {}),\n getSpotTickers({}),\n spotProductMapCache.query('').catch(() => undefined),\n ]);\n\n const resolvedSpotProductMap = spotProductMap ?? new Map<string, string>();\n const balances = unifiedAccount?.balances ?? {};\n const spotTickerList = Array.isArray(spotTickers) ? spotTickers : [];\n const spotPositions: IPosition[] = Object.keys(balances)\n .map((currency) => {\n let currency_pair = `${currency}_USDT`;\n if (currency === 'SOL2') {\n currency_pair = 'SOL_USDT';\n }\n if (currency === 'GTSOL') {\n currency_pair = 'SOL_USDT';\n }\n const closable_price =\n currency === 'USDT'\n ? 1\n : Number(spotTickerList.find((ticker) => ticker.currency_pair === currency_pair)?.last || 0);\n const volume = Number(balances[currency]?.cross_balance || 0);\n const free_volume = Number(balances[currency]?.available || 0);\n if (Math.abs(volume) === 0) return undefined;\n return {\n datasource_id: 'GATE',\n position_id: currency,\n product_id: resolvedSpotProductMap.get(currency) ?? encodePath('GATE', 'SPOT', currency),\n direction: 'LONG',\n volume,\n free_volume,\n closable_price,\n position_price: closable_price,\n floating_profit: closable_price * volume,\n valuation: closable_price * volume,\n } as IPosition;\n })\n .filter((item): item is IPosition => !!item);\n\n return [...futurePositions, ...spotPositions];\n};\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { setMetricsQuoteState } from '@yuants/data-quote';
|
|
1
2
|
import { Terminal } from '@yuants/protocol';
|
|
2
3
|
import { writeToSQL } from '@yuants/sql';
|
|
3
4
|
import { decodePath, encodePath } from '@yuants/utils';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { catchError, defer, EMPTY, filter, groupBy, map, merge, mergeMap, repeat, retry, scan, share, shareReplay, } from 'rxjs';
|
|
6
|
+
import { getFuturesContracts, getFuturesTickers, getSpotTickers } from '../../api/public-api';
|
|
6
7
|
const terminal = Terminal.fromNodeEnv();
|
|
7
8
|
// 获取所有USDT永续合约
|
|
8
9
|
const usdtFutureContracts$ = defer(() => getFuturesContracts('usdt', {})).pipe(repeat({ delay: 3600000 }), retry({ delay: 60000 }), shareReplay(1));
|
|
@@ -59,7 +60,7 @@ if (process.env.WRITE_QUOTE_TO_SQL === 'true') {
|
|
|
59
60
|
return quote$.pipe(filter((x) => x.product_id === product_id));
|
|
60
61
|
});
|
|
61
62
|
quote$
|
|
62
|
-
.pipe(writeToSQL({
|
|
63
|
+
.pipe(setMetricsQuoteState(terminal.terminal_id), writeToSQL({
|
|
63
64
|
terminal,
|
|
64
65
|
writeInterval: 1000,
|
|
65
66
|
tableName: 'quote',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../../src/services/markets/quote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../../src/services/markets/quote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAA4B,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,GAAG,EACH,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,IAAI,EACJ,KAAK,EACL,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE9F,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,eAAe;AACf,MAAM,oBAAoB,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAC5E,MAAM,CAAC,EAAE,KAAK,EAAE,OAAQ,EAAE,CAAC,EAC3B,KAAK,CAAC,EAAE,KAAK,EAAE,KAAM,EAAE,CAAC,EACxB,WAAW,CAAC,CAAC,CAAC,CACf,CAAC;AAEF,qBAAqB;AACrB,MAAM,iBAAiB,GAAG,KAAK,CAAC,GAAG,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E,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,UAAU,EAAE,EAAE;QAC7E,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,EAAE;YAClB,MAAM,2BAA2B,CAAC;SACnC;QACD,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,wBAAwB,CAAC;SAChC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IACH,MAAM;SACH,IAAI,CACH,oBAAoB,CAAC,QAAQ,CAAC,WAAW,CAAC,EAC1C,UAAU,CAAC;QACT,QAAQ;QACR,aAAa,EAAE,IAAI;QACnB,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC;KAC9C,CAAC,CACH;SACA,SAAS,EAAE,CAAC;CAChB","sourcesContent":["import { IQuote, setMetricsQuoteState } from '@yuants/data-quote';\nimport { GlobalPrometheusRegistry, Terminal } from '@yuants/protocol';\nimport { writeToSQL } from '@yuants/sql';\nimport { decodePath, encodePath } from '@yuants/utils';\nimport {\n catchError,\n defer,\n EMPTY,\n filter,\n groupBy,\n map,\n merge,\n mergeMap,\n repeat,\n retry,\n scan,\n share,\n shareReplay,\n} from 'rxjs';\nimport { getFuturesContracts, getFuturesTickers, getSpotTickers } from '../../api/public-api';\n\nconst terminal = Terminal.fromNodeEnv();\n\n// 获取所有USDT永续合约\nconst usdtFutureContracts$ = defer(() => getFuturesContracts('usdt', {})).pipe(\n repeat({ delay: 3600_000 }),\n retry({ delay: 60_000 }),\n shareReplay(1),\n);\n\n// 从tickers获取价格和交易量数据\nconst quoteFromTickers$ = defer(() => getFuturesTickers('usdt', {})).pipe(\n mergeMap((tickers) => tickers),\n map(\n (ticker): Partial<IQuote> => ({\n datasource_id: 'GATE',\n product_id: encodePath('GATE', 'FUTURE', ticker.contract),\n last_price: ticker.last,\n ask_price: ticker.lowest_ask,\n bid_price: ticker.highest_bid,\n // GATE API doesn't provide bid/ask volumes in tickers endpoint\n // We'll need to use order book for that if required\n ask_volume: '0',\n bid_volume: '0',\n // total_size is the open interest\n open_interest: ticker.total_size,\n // funding_rate is the current funding rate\n interest_rate_long: ticker.funding_rate ? `${-parseFloat(ticker.funding_rate)}` : undefined,\n interest_rate_short: ticker.funding_rate,\n }),\n ),\n repeat({ delay: 5000 }),\n retry({ delay: 1000 }),\n);\n\n// 从现货tickers获取价格和交易量数据\nconst quoteFromSpotTickers$ = defer(() => getSpotTickers({})).pipe(\n mergeMap((tickers) => tickers),\n map(\n (ticker): Partial<IQuote> => ({\n datasource_id: 'GATE',\n product_id: encodePath('GATE', 'SPOT', ticker.currency_pair),\n last_price: ticker.last,\n ask_price: ticker.lowest_ask,\n bid_price: ticker.highest_bid,\n ask_volume: ticker.lowest_size ?? '0',\n bid_volume: ticker.highest_size ?? '0',\n // 现货没有持仓量的概念,设置为0\n open_interest: '0',\n }),\n ),\n repeat({ delay: 5000 }),\n retry({ delay: 1000 }),\n);\n\nconst quoteSources$ = [quoteFromTickers$, quoteFromSpotTickers$];\n\nconst quote$ = defer(() =>\n merge(\n ...quoteSources$.map((x$) =>\n defer(() => x$).pipe(\n // 防止单个流关闭导致整体关闭\n catchError(() => EMPTY),\n ),\n ),\n ),\n).pipe(\n groupBy((x) => encodePath(x.datasource_id, x.product_id)),\n mergeMap((group$) => {\n return group$.pipe(\n //\n scan((acc, cur) => Object.assign(acc, cur), {} as Partial<IQuote>),\n );\n }),\n share(),\n);\n\n// 写入数据库\nif (process.env.WRITE_QUOTE_TO_SQL === 'true') {\n terminal.channel.publishChannel('quote', { pattern: `^GATE/` }, (channel_id) => {\n const [datasource_id, product_id] = decodePath(channel_id);\n if (!datasource_id) {\n throw 'datasource_id is required';\n }\n if (!product_id) {\n throw 'product_id is required';\n }\n return quote$.pipe(filter((x) => x.product_id === product_id));\n });\n quote$\n .pipe(\n setMetricsQuoteState(terminal.terminal_id),\n writeToSQL({\n terminal,\n writeInterval: 1000,\n tableName: 'quote',\n conflictKeys: ['datasource_id', 'product_id'],\n }),\n )\n .subscribe();\n}\n"]}
|
package/lib/api/private-api.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export declare const getAccountDetail: (credential: ICredential) => Promise<{
|
|
|
14
14
|
};
|
|
15
15
|
tier: number;
|
|
16
16
|
}>;
|
|
17
|
+
/**
|
|
18
|
+
* 获取统一账户信息
|
|
19
|
+
*
|
|
20
|
+
* 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
|
|
21
|
+
*/
|
|
17
22
|
export declare const getUnifiedAccounts: (credential: ICredential, params?: {
|
|
18
23
|
currency?: string;
|
|
19
24
|
}) => Promise<{
|
|
@@ -30,6 +35,9 @@ export declare const getUnifiedAccounts: (credential: ICredential, params?: {
|
|
|
30
35
|
total_freeze: string;
|
|
31
36
|
total_liab: string;
|
|
32
37
|
spot_in_use: string;
|
|
38
|
+
cross_balance: string;
|
|
39
|
+
iso_balance: string;
|
|
40
|
+
funding: string;
|
|
33
41
|
}>;
|
|
34
42
|
total: string;
|
|
35
43
|
borrowed: string;
|
|
@@ -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,oBAAY,WAAW,GAAG,eAAe,CAAC;AAS1C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,eACf,WAAW,KACtB,QAAQ;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB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AQ;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAoE,CAAC"}
|
package/lib/api/private-api.js
CHANGED
|
@@ -10,6 +10,11 @@ const callPrivate = (credential, method, path, params) => (0, http_client_1.requ
|
|
|
10
10
|
*/
|
|
11
11
|
const getAccountDetail = (credential) => callPrivate(credential, 'GET', '/account/detail');
|
|
12
12
|
exports.getAccountDetail = getAccountDetail;
|
|
13
|
+
/**
|
|
14
|
+
* 获取统一账户信息
|
|
15
|
+
*
|
|
16
|
+
* 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
|
|
17
|
+
*/
|
|
13
18
|
const getUnifiedAccounts = (credential, params) => callPrivate(credential, 'GET', '/unified/accounts', params);
|
|
14
19
|
exports.getUnifiedAccounts = getUnifiedAccounts;
|
|
15
20
|
/**
|
|
@@ -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;AAEjD,MAAM,kBAAkB,GAAG,CAChC,UAAuB,EACvB,MAA8B,EAiC7B,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAnCrD,QAAA,kBAAkB,sBAmCmC;AAElE;;;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MAAM,CAAC,CAAC;AARzD,QAAA,sBAAsB,0BAQmC","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\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 }\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"]}
|
|
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,EAC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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","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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAA0C,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAuD5F,eAAO,MAAM,qBAAqB,eAAsB,WAAW,
|
|
1
|
+
{"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAA0C,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAuD5F,eAAO,MAAM,qBAAqB,eAAsB,WAAW,yBA2ClE,CAAC"}
|
|
@@ -62,7 +62,7 @@ const getUnifiedAccountInfo = async (credential) => {
|
|
|
62
62
|
const spotTickerList = Array.isArray(spotTickers) ? spotTickers : [];
|
|
63
63
|
const spotPositions = Object.keys(balances)
|
|
64
64
|
.map((currency) => {
|
|
65
|
-
var _a, _b, _c;
|
|
65
|
+
var _a, _b, _c, _d;
|
|
66
66
|
let currency_pair = `${currency}_USDT`;
|
|
67
67
|
if (currency === 'SOL2') {
|
|
68
68
|
currency_pair = 'SOL_USDT';
|
|
@@ -73,16 +73,17 @@ const getUnifiedAccountInfo = async (credential) => {
|
|
|
73
73
|
const closable_price = currency === 'USDT'
|
|
74
74
|
? 1
|
|
75
75
|
: Number(((_a = spotTickerList.find((ticker) => ticker.currency_pair === currency_pair)) === null || _a === void 0 ? void 0 : _a.last) || 0);
|
|
76
|
-
const volume = Number(((_b = balances[currency]) === null || _b === void 0 ? void 0 : _b.
|
|
76
|
+
const volume = Number(((_b = balances[currency]) === null || _b === void 0 ? void 0 : _b.cross_balance) || 0);
|
|
77
|
+
const free_volume = Number(((_c = balances[currency]) === null || _c === void 0 ? void 0 : _c.available) || 0);
|
|
77
78
|
if (Math.abs(volume) === 0)
|
|
78
79
|
return undefined;
|
|
79
80
|
return {
|
|
80
81
|
datasource_id: 'GATE',
|
|
81
82
|
position_id: currency,
|
|
82
|
-
product_id: (
|
|
83
|
+
product_id: (_d = resolvedSpotProductMap.get(currency)) !== null && _d !== void 0 ? _d : (0, utils_1.encodePath)('GATE', 'SPOT', currency),
|
|
83
84
|
direction: 'LONG',
|
|
84
85
|
volume,
|
|
85
|
-
free_volume
|
|
86
|
+
free_volume,
|
|
86
87
|
closable_price,
|
|
87
88
|
position_price: closable_price,
|
|
88
89
|
floating_profit: closable_price * volume,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified.js","sourceRoot":"","sources":["../../../src/services/accounts/unified.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAE5C,yCAA2C;AAC3C,uDAA4F;AAC5F,qDAAsD;AACtD,gDAAkD;AAElD,MAAM,mBAAmB,GAAG,IAAA,mBAAW,EACrC,KAAK,IAAI,EAAE;IACT,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAY,GAAE,CAAC;IACtC,MAAM,GAAG,GAAG,IAAI,GAAG,EAA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AC;AA3CW,QAAA,qBAAqB,yBA2ChC","sourcesContent":["import { createCache } from '@yuants/cache';\nimport type { IPosition } from '@yuants/data-account';\nimport { encodePath } from '@yuants/utils';\nimport { getFuturePositions, getUnifiedAccounts, ICredential } from '../../api/private-api';\nimport { getSpotTickers } from '../../api/public-api';\nimport { listProducts } from '../markets/product';\n\nconst spotProductMapCache = createCache(\n async () => {\n const products = await listProducts();\n const map = new Map<string, string>();\n for (const product of products ?? []) {\n const [, instType] = product.product_id.split('/');\n if (instType === 'SPOT') {\n map.set(product.base_currency, product.product_id);\n }\n }\n return map;\n },\n { expire: 86_400_000 },\n);\n\nconst loadFuturePositions = async (credential: ICredential): Promise<IPosition[]> => {\n const positions: IPosition[] = [];\n const positionsRes = await getFuturePositions(credential, 'usdt');\n\n for (const position of Array.isArray(positionsRes) ? positionsRes : []) {\n if (!(Math.abs(position.size) > 0)) continue;\n\n const product_id = encodePath('GATE', 'FUTURE', position.contract);\n const volume = Math.abs(position.size);\n const closable_price = Number(position.mark_price);\n const valuation = volume * closable_price;\n positions.push({\n datasource_id: 'GATE',\n position_id: `${position.contract}-${position.leverage}-${position.mode}`,\n product_id,\n direction:\n position.mode === 'dual_long'\n ? 'LONG'\n : position.mode === 'dual_short'\n ? 'SHORT'\n : position.size > 0\n ? 'LONG'\n : 'SHORT',\n volume,\n free_volume: Math.abs(position.size),\n position_price: Number(position.entry_price),\n closable_price,\n floating_profit: Number(position.unrealised_pnl),\n liquidation_price: position.liq_price,\n valuation,\n });\n }\n\n return positions;\n};\n\nexport const getUnifiedAccountInfo = async (credential: ICredential) => {\n const [futurePositions, unifiedAccount, spotTickers, spotProductMap] = await Promise.all([\n loadFuturePositions(credential),\n getUnifiedAccounts(credential, {}),\n getSpotTickers({}),\n spotProductMapCache.query('').catch(() => undefined),\n ]);\n\n const resolvedSpotProductMap = spotProductMap ?? new Map<string, string>();\n const balances = unifiedAccount?.balances ?? {};\n const spotTickerList = Array.isArray(spotTickers) ? spotTickers : [];\n const spotPositions: IPosition[] = Object.keys(balances)\n .map((currency) => {\n let currency_pair = `${currency}_USDT`;\n if (currency === 'SOL2') {\n currency_pair = 'SOL_USDT';\n }\n if (currency === 'GTSOL') {\n currency_pair = 'SOL_USDT';\n }\n const closable_price =\n currency === 'USDT'\n ? 1\n : Number(spotTickerList.find((ticker) => ticker.currency_pair === currency_pair)?.last || 0);\n const volume = Number(balances[currency]?.cross_balance || 0);\n const free_volume = Number(balances[currency]?.available || 0);\n if (Math.abs(volume) === 0) return undefined;\n return {\n datasource_id: 'GATE',\n position_id: currency,\n product_id: resolvedSpotProductMap.get(currency) ?? encodePath('GATE', 'SPOT', currency),\n direction: 'LONG',\n volume,\n free_volume,\n closable_price,\n position_price: closable_price,\n floating_profit: closable_price * volume,\n valuation: closable_price * volume,\n } as IPosition;\n })\n .filter((item): item is IPosition => !!item);\n\n return [...futurePositions, ...spotPositions];\n};\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const data_quote_1 = require("@yuants/data-quote");
|
|
3
4
|
const protocol_1 = require("@yuants/protocol");
|
|
4
5
|
const sql_1 = require("@yuants/sql");
|
|
5
6
|
const utils_1 = require("@yuants/utils");
|
|
@@ -61,7 +62,7 @@ if (process.env.WRITE_QUOTE_TO_SQL === 'true') {
|
|
|
61
62
|
return quote$.pipe((0, rxjs_1.filter)((x) => x.product_id === product_id));
|
|
62
63
|
});
|
|
63
64
|
quote$
|
|
64
|
-
.pipe((0, sql_1.writeToSQL)({
|
|
65
|
+
.pipe((0, data_quote_1.setMetricsQuoteState)(terminal.terminal_id), (0, sql_1.writeToSQL)({
|
|
65
66
|
terminal,
|
|
66
67
|
writeInterval: 1000,
|
|
67
68
|
tableName: 'quote',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../../src/services/markets/quote.ts"],"names":[],"mappings":";;
|
|
1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IAAA,gBAAU,EAAC;QACT,QAAQ;QACR,aAAa,EAAE,IAAI;QACnB,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC;KAC9C,CAAC,CACH;SACA,SAAS,EAAE,CAAC;CAChB","sourcesContent":["import { IQuote, setMetricsQuoteState } from '@yuants/data-quote';\nimport { GlobalPrometheusRegistry, Terminal } from '@yuants/protocol';\nimport { writeToSQL } from '@yuants/sql';\nimport { decodePath, encodePath } from '@yuants/utils';\nimport {\n catchError,\n defer,\n EMPTY,\n filter,\n groupBy,\n map,\n merge,\n mergeMap,\n repeat,\n retry,\n scan,\n share,\n shareReplay,\n} from 'rxjs';\nimport { getFuturesContracts, getFuturesTickers, getSpotTickers } from '../../api/public-api';\n\nconst terminal = Terminal.fromNodeEnv();\n\n// 获取所有USDT永续合约\nconst usdtFutureContracts$ = defer(() => getFuturesContracts('usdt', {})).pipe(\n repeat({ delay: 3600_000 }),\n retry({ delay: 60_000 }),\n shareReplay(1),\n);\n\n// 从tickers获取价格和交易量数据\nconst quoteFromTickers$ = defer(() => getFuturesTickers('usdt', {})).pipe(\n mergeMap((tickers) => tickers),\n map(\n (ticker): Partial<IQuote> => ({\n datasource_id: 'GATE',\n product_id: encodePath('GATE', 'FUTURE', ticker.contract),\n last_price: ticker.last,\n ask_price: ticker.lowest_ask,\n bid_price: ticker.highest_bid,\n // GATE API doesn't provide bid/ask volumes in tickers endpoint\n // We'll need to use order book for that if required\n ask_volume: '0',\n bid_volume: '0',\n // total_size is the open interest\n open_interest: ticker.total_size,\n // funding_rate is the current funding rate\n interest_rate_long: ticker.funding_rate ? `${-parseFloat(ticker.funding_rate)}` : undefined,\n interest_rate_short: ticker.funding_rate,\n }),\n ),\n repeat({ delay: 5000 }),\n retry({ delay: 1000 }),\n);\n\n// 从现货tickers获取价格和交易量数据\nconst quoteFromSpotTickers$ = defer(() => getSpotTickers({})).pipe(\n mergeMap((tickers) => tickers),\n map(\n (ticker): Partial<IQuote> => ({\n datasource_id: 'GATE',\n product_id: encodePath('GATE', 'SPOT', ticker.currency_pair),\n last_price: ticker.last,\n ask_price: ticker.lowest_ask,\n bid_price: ticker.highest_bid,\n ask_volume: ticker.lowest_size ?? '0',\n bid_volume: ticker.highest_size ?? '0',\n // 现货没有持仓量的概念,设置为0\n open_interest: '0',\n }),\n ),\n repeat({ delay: 5000 }),\n retry({ delay: 1000 }),\n);\n\nconst quoteSources$ = [quoteFromTickers$, quoteFromSpotTickers$];\n\nconst quote$ = defer(() =>\n merge(\n ...quoteSources$.map((x$) =>\n defer(() => x$).pipe(\n // 防止单个流关闭导致整体关闭\n catchError(() => EMPTY),\n ),\n ),\n ),\n).pipe(\n groupBy((x) => encodePath(x.datasource_id, x.product_id)),\n mergeMap((group$) => {\n return group$.pipe(\n //\n scan((acc, cur) => Object.assign(acc, cur), {} as Partial<IQuote>),\n );\n }),\n share(),\n);\n\n// 写入数据库\nif (process.env.WRITE_QUOTE_TO_SQL === 'true') {\n terminal.channel.publishChannel('quote', { pattern: `^GATE/` }, (channel_id) => {\n const [datasource_id, product_id] = decodePath(channel_id);\n if (!datasource_id) {\n throw 'datasource_id is required';\n }\n if (!product_id) {\n throw 'product_id is required';\n }\n return quote$.pipe(filter((x) => x.product_id === product_id));\n });\n quote$\n .pipe(\n setMetricsQuoteState(terminal.terminal_id),\n writeToSQL({\n terminal,\n writeInterval: 1000,\n tableName: 'quote',\n conflictKeys: ['datasource_id', 'product_id'],\n }),\n )\n .subscribe();\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuants/vendor-gate",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.27",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"@yuants/utils": "0.14.0",
|
|
19
19
|
"@yuants/data-series": "0.3.52",
|
|
20
20
|
"@yuants/data-interest-rate": "0.1.48",
|
|
21
|
-
"@yuants/exchange": "0.5.
|
|
22
|
-
"@yuants/data-quote": "0.
|
|
21
|
+
"@yuants/exchange": "0.5.2",
|
|
22
|
+
"@yuants/data-quote": "0.3.0",
|
|
23
23
|
"rxjs": "~7.5.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
package/temp/package-deps.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apps/vendor-gate/AGENTS.md": "59be8d734f8a91ae5f7377e7c688f1fccb8641b7",
|
|
3
|
-
"apps/vendor-gate/CHANGELOG.json": "
|
|
4
|
-
"apps/vendor-gate/CHANGELOG.md": "
|
|
3
|
+
"apps/vendor-gate/CHANGELOG.json": "32a662012d7e93acd56b5ace9f6eec5860d80684",
|
|
4
|
+
"apps/vendor-gate/CHANGELOG.md": "4ecdc572dcc7cd0806588d70ee7af406357ee11c",
|
|
5
5
|
"apps/vendor-gate/README.md": "ea5ee3a61cd87d9104d729902dfaccac9b9913e0",
|
|
6
6
|
"apps/vendor-gate/SESSION_NOTES.md": "eefeaa9e02b039bde7180b6a479fc3fa0e72321c",
|
|
7
7
|
"apps/vendor-gate/api-extractor.json": "62f4fd324425b9a235f0c117975967aab09ced0c",
|
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
"apps/vendor-gate/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
|
|
10
10
|
"apps/vendor-gate/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
|
|
11
11
|
"apps/vendor-gate/etc/vendor-gate.api.md": "970682cd589432de553cc5cee2a0abe73814a515",
|
|
12
|
-
"apps/vendor-gate/package.json": "
|
|
12
|
+
"apps/vendor-gate/package.json": "76e3df7e2f77b2cd6e4ad36829f0c6d5f32b2906",
|
|
13
13
|
"apps/vendor-gate/src/api/http-client.ts": "97e0e70454c6072f388f90442ec4afabe6feb93b",
|
|
14
|
-
"apps/vendor-gate/src/api/private-api.ts": "
|
|
14
|
+
"apps/vendor-gate/src/api/private-api.ts": "7a3e2f74881651ee940d23d34025deab07abe3f0",
|
|
15
15
|
"apps/vendor-gate/src/api/public-api.ts": "ee1a246a8833a7d9bb06e829b09a3bd80e0d86bf",
|
|
16
16
|
"apps/vendor-gate/src/api/rate-limiter.ts": "047c51029ffcaf98190cfd04d96816bbced5fa7c",
|
|
17
17
|
"apps/vendor-gate/src/index.ts": "31888627bccab532d55bd91833d80c72a4afae9b",
|
|
18
18
|
"apps/vendor-gate/src/services/accounts/profile.ts": "4132c7c3d9760b9a6694d5b3eae7e8b2847fe6c1",
|
|
19
|
-
"apps/vendor-gate/src/services/accounts/unified.ts": "
|
|
19
|
+
"apps/vendor-gate/src/services/accounts/unified.ts": "80e1bf413a70b01a5e48552f8307ca31952320f3",
|
|
20
20
|
"apps/vendor-gate/src/services/default-credential.ts": "b9ffa157b818148450bfaaf4851597e91901190c",
|
|
21
21
|
"apps/vendor-gate/src/services/exchange.ts": "3a8fbaecaf7ea0c5a03f3a61f21fb8d2d4588394",
|
|
22
22
|
"apps/vendor-gate/src/services/markets/interest-rate.ts": "e669eb1d664448f309bb062907b273157d1c111e",
|
|
23
23
|
"apps/vendor-gate/src/services/markets/product.ts": "217bf64b307adca4c251333462b75f73d0d85e83",
|
|
24
|
-
"apps/vendor-gate/src/services/markets/quote.ts": "
|
|
24
|
+
"apps/vendor-gate/src/services/markets/quote.ts": "f9e220cabe62c15550a3d2ffc02f64b81c9e9ae5",
|
|
25
25
|
"apps/vendor-gate/src/services/orders/cancelOrder.ts": "7dfdd30eaac89742f1050bf0fb47d8053ccecb28",
|
|
26
26
|
"apps/vendor-gate/src/services/orders/listOrders.ts": "cc59845c6ab9acb6b0513866aff56031a68328c2",
|
|
27
27
|
"apps/vendor-gate/src/services/orders/submitOrder.ts": "321398ad18bb4012d2a40e4f704bc827ccfaff93",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"libraries/utils/temp/package-deps.json": "6d58e9b325e8d16de8a878c32010f626b12a01da",
|
|
39
39
|
"libraries/data-series/temp/package-deps.json": "e12b4c97d2b8c8b21d1a033cdd3683e01f81401a",
|
|
40
40
|
"libraries/data-interest-rate/temp/package-deps.json": "cef1e1cb0116ad593c24635684e0cbf03488d67c",
|
|
41
|
-
"libraries/exchange/temp/package-deps.json": "
|
|
42
|
-
"libraries/data-quote/temp/package-deps.json": "
|
|
41
|
+
"libraries/exchange/temp/package-deps.json": "35e755087dec12d39822dda2dccf2f9d895eefad",
|
|
42
|
+
"libraries/data-quote/temp/package-deps.json": "d5fd89abda84b46f6c14925eda0c381c36b94dfe",
|
|
43
43
|
"libraries/extension/temp/package-deps.json": "9569c553c2f9a7d50b70d8f101fc2d3825aaccb9",
|
|
44
44
|
"tools/toolkit/temp/package-deps.json": "23e053490eb8feade23e4d45de4e54883e322711"
|
|
45
45
|
}
|