@yuants/vendor-gate 0.7.3 → 0.7.4
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 +8 -5
- package/dist/services/interest-ledger-service.js.map +1 -1
- package/lib/services/interest-ledger-service.js +8 -5
- 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,17 +3,20 @@ 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 = 2 * 24 *
|
|
6
|
+
// const WINDOW_MS = 2 * 24 * 3600_000;
|
|
7
7
|
const fetchInterestRateLedgerBackward = async (req) => {
|
|
8
8
|
if (req.ledger_type === 'FUNDING_FEE') {
|
|
9
|
+
const time = Math.max(req.time, Date.now() - 3600000 * 24 * 365);
|
|
9
10
|
const params = {
|
|
10
11
|
settle: 'usdt',
|
|
11
|
-
to: ~~(
|
|
12
|
-
|
|
13
|
-
limit: 100,
|
|
12
|
+
to: ~~(time / 1000) + 100,
|
|
13
|
+
limit: 500,
|
|
14
14
|
type: 'fund',
|
|
15
15
|
};
|
|
16
16
|
const res = await getFutureAccountsBook(req.credential.payload, params);
|
|
17
|
+
if (!Array.isArray(res)) {
|
|
18
|
+
throw new Error('getAccountIncome failed');
|
|
19
|
+
}
|
|
17
20
|
return (res !== null && res !== void 0 ? res : [])
|
|
18
21
|
.map((v) => {
|
|
19
22
|
const ms = Number(v.time * 1000);
|
|
@@ -26,7 +29,7 @@ const fetchInterestRateLedgerBackward = async (req) => {
|
|
|
26
29
|
created_at: formatTime(ms),
|
|
27
30
|
};
|
|
28
31
|
})
|
|
29
|
-
.filter((x) => Date.parse(x.created_at) <=
|
|
32
|
+
.filter((x) => Date.parse(x.created_at) <= ~~(time / 1000) * 1000);
|
|
30
33
|
}
|
|
31
34
|
return [];
|
|
32
35
|
};
|
|
@@ -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,
|
|
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,uCAAuC;AACvC,MAAM,+BAA+B,GAAG,KAAK,EAAE,GAK9C,EAA8B,EAAE;IAC/B,IAAI,GAAG,CAAC,WAAW,KAAK,aAAa,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAQ,GAAG,EAAE,GAAG,GA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,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\n// const 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 time = Math.max(req.time, Date.now() - 3600_000 * 24 * 365);\n const params = {\n settle: 'usdt',\n to: ~~(time / 1000) + 100,\n limit: 500,\n type: 'fund',\n };\n const res = await getFutureAccountsBook(req.credential.payload, params);\n if (!Array.isArray(res)) {\n throw new Error('getAccountIncome failed');\n }\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!) <= ~~(time / 1000) * 1000);\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,17 +5,20 @@ 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 = 2 * 24 *
|
|
8
|
+
// const WINDOW_MS = 2 * 24 * 3600_000;
|
|
9
9
|
const fetchInterestRateLedgerBackward = async (req) => {
|
|
10
10
|
if (req.ledger_type === 'FUNDING_FEE') {
|
|
11
|
+
const time = Math.max(req.time, Date.now() - 3600000 * 24 * 365);
|
|
11
12
|
const params = {
|
|
12
13
|
settle: 'usdt',
|
|
13
|
-
to: ~~(
|
|
14
|
-
|
|
15
|
-
limit: 100,
|
|
14
|
+
to: ~~(time / 1000) + 100,
|
|
15
|
+
limit: 500,
|
|
16
16
|
type: 'fund',
|
|
17
17
|
};
|
|
18
18
|
const res = await (0, private_api_1.getFutureAccountsBook)(req.credential.payload, params);
|
|
19
|
+
if (!Array.isArray(res)) {
|
|
20
|
+
throw new Error('getAccountIncome failed');
|
|
21
|
+
}
|
|
19
22
|
return (res !== null && res !== void 0 ? res : [])
|
|
20
23
|
.map((v) => {
|
|
21
24
|
const ms = Number(v.time * 1000);
|
|
@@ -28,7 +31,7 @@ const fetchInterestRateLedgerBackward = async (req) => {
|
|
|
28
31
|
created_at: (0, utils_1.formatTime)(ms),
|
|
29
32
|
};
|
|
30
33
|
})
|
|
31
|
-
.filter((x) => Date.parse(x.created_at) <=
|
|
34
|
+
.filter((x) => Date.parse(x.created_at) <= ~~(time / 1000) * 1000);
|
|
32
35
|
}
|
|
33
36
|
return [];
|
|
34
37
|
};
|
|
@@ -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,
|
|
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,uCAA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AC,KAAK,CAAC,CAAC,CAAC,UAAW,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACxE,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\n// const 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 time = Math.max(req.time, Date.now() - 3600_000 * 24 * 365);\n const params = {\n settle: 'usdt',\n to: ~~(time / 1000) + 100,\n limit: 500,\n type: 'fund',\n };\n const res = await getFutureAccountsBook(req.credential.payload, params);\n if (!Array.isArray(res)) {\n throw new Error('getAccountIncome failed');\n }\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!) <= ~~(time / 1000) * 1000);\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.4",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"rxjs": "~7.5.6",
|
|
12
|
-
"@yuants/protocol": "0.54.1",
|
|
13
12
|
"@yuants/cache": "0.3.12",
|
|
13
|
+
"@yuants/protocol": "0.54.1",
|
|
14
14
|
"@yuants/transfer": "0.2.48",
|
|
15
|
-
"@yuants/data-order": "0.7.9",
|
|
16
15
|
"@yuants/data-account": "0.11.8",
|
|
16
|
+
"@yuants/data-order": "0.7.9",
|
|
17
17
|
"@yuants/data-ohlc": "0.6.4",
|
|
18
18
|
"@yuants/data-trade": "0.1.31",
|
|
19
|
+
"@yuants/sql": "0.9.39",
|
|
19
20
|
"@yuants/data-product": "0.5.9",
|
|
20
21
|
"@yuants/utils": "0.19.4",
|
|
21
|
-
"@yuants/sql": "0.9.39",
|
|
22
22
|
"@yuants/data-series": "0.3.61",
|
|
23
23
|
"@yuants/data-interest-rate": "0.2.9",
|
|
24
|
-
"@yuants/
|
|
25
|
-
"@yuants/
|
|
24
|
+
"@yuants/exchange": "0.8.15",
|
|
25
|
+
"@yuants/data-quote": "0.4.8"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@microsoft/api-extractor": "~7.55.2",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@types/heft-jest": "1.0.6",
|
|
33
33
|
"@types/node": "24",
|
|
34
34
|
"typescript": "~5.9.3",
|
|
35
|
-
"@yuants/
|
|
36
|
-
"@yuants/
|
|
35
|
+
"@yuants/tool-kit": "0.2.2",
|
|
36
|
+
"@yuants/extension": "0.2.40"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"registry": "https://registry.npmjs.org",
|