@yuants/vendor-gate 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/services/interest-ledger-service.js +25 -21
- package/dist/services/interest-ledger-service.js.map +1 -1
- package/lib/services/interest-ledger-service.js +25 -21
- package/lib/services/interest-ledger-service.js.map +1 -1
- package/package.json +8 -8
- package/temp/build/typescript/ts_Eujh_fX2.json +1 -1
- package/temp/package-deps.json +5 -5
- package/temp/test/jest/haste-map-ac984f375ffe2771b37aa116ca7fe6f5-87fb4bb14df3d29fb61369ce8cbe1fe1-6499ab22de0ac9ce813ded0e96430273 +0 -0
|
@@ -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,EA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,UAAU,EAAE,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"]}
|
|
@@ -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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuants/vendor-gate",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"rxjs": "~7.5.6",
|
|
12
12
|
"@yuants/cache": "0.3.12",
|
|
13
|
-
"@yuants/protocol": "0.54.1",
|
|
14
13
|
"@yuants/transfer": "0.2.48",
|
|
14
|
+
"@yuants/protocol": "0.54.1",
|
|
15
15
|
"@yuants/data-account": "0.11.8",
|
|
16
16
|
"@yuants/data-order": "0.7.9",
|
|
17
17
|
"@yuants/data-ohlc": "0.6.4",
|
|
18
|
+
"@yuants/sql": "0.9.39",
|
|
18
19
|
"@yuants/data-product": "0.5.9",
|
|
19
20
|
"@yuants/utils": "0.19.4",
|
|
21
|
+
"@yuants/data-series": "0.3.61",
|
|
20
22
|
"@yuants/data-interest-rate": "0.2.8",
|
|
21
|
-
"@yuants/
|
|
22
|
-
"@yuants/
|
|
23
|
-
"@yuants/data-quote": "0.4.8",
|
|
24
|
-
"@yuants/data-series": "0.3.61"
|
|
23
|
+
"@yuants/exchange": "0.8.12",
|
|
24
|
+
"@yuants/data-quote": "0.4.8"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@microsoft/api-extractor": "~7.55.2",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@types/heft-jest": "1.0.6",
|
|
32
32
|
"@types/node": "24",
|
|
33
33
|
"typescript": "~5.9.3",
|
|
34
|
-
"@yuants/
|
|
35
|
-
"@yuants/
|
|
34
|
+
"@yuants/tool-kit": "0.2.2",
|
|
35
|
+
"@yuants/extension": "0.2.40"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"registry": "https://registry.npmjs.org",
|