@yuants/vendor-hyperliquid 0.7.7 → 0.7.8
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.
|
@@ -12,32 +12,9 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
12
12
|
};
|
|
13
13
|
import { createSeriesProvider } from '@yuants/data-series';
|
|
14
14
|
import { Terminal } from '@yuants/protocol';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { defer, map, mergeAll, repeat, retry, shareReplay, tap } from 'rxjs';
|
|
18
|
-
import { getHistoricalFundingRates, getPerpetualsMetaData } from '../../api/public-api';
|
|
15
|
+
import { decodePath, formatTime } from '@yuants/utils';
|
|
16
|
+
import { getHistoricalFundingRates } from '../../api/public-api';
|
|
19
17
|
const terminal = Terminal.fromNodeEnv();
|
|
20
|
-
const perpetualProducts$ = defer(async () => {
|
|
21
|
-
const meta = await getPerpetualsMetaData();
|
|
22
|
-
return meta.universe.map((product) => ({
|
|
23
|
-
product_id: encodePath('HYPERLIQUID', 'PERPETUAL', `${product.name}-USD`),
|
|
24
|
-
datasource_id: 'HYPERLIQUID',
|
|
25
|
-
no_interest_rate: false,
|
|
26
|
-
}));
|
|
27
|
-
}).pipe(tap({ error: (err) => console.error(formatTime(Date.now()), 'PerpetualProductFetchFailed', err) }), retry({ delay: 10000 }), repeat({ delay: 3600000 }), shareReplay({ bufferSize: 1, refCount: true }));
|
|
28
|
-
createSQLWriter(terminal, {
|
|
29
|
-
data$: perpetualProducts$.pipe(map((products) => products.filter((product) => product.no_interest_rate === false)), mergeAll(), map((product) => ({
|
|
30
|
-
series_id: product.product_id,
|
|
31
|
-
table_name: 'interest_rate',
|
|
32
|
-
cron_pattern: '0 * * * *',
|
|
33
|
-
cron_timezone: 'UTC',
|
|
34
|
-
disabled: false,
|
|
35
|
-
replay_count: 0,
|
|
36
|
-
}))),
|
|
37
|
-
tableName: 'series_collecting_task',
|
|
38
|
-
writeInterval: 1000,
|
|
39
|
-
conflictKeys: ['series_id', 'table_name'],
|
|
40
|
-
});
|
|
41
18
|
createSeriesProvider(terminal, {
|
|
42
19
|
tableName: 'interest_rate',
|
|
43
20
|
series_id_prefix_parts: ['HYPERLIQUID', 'PERPETUAL'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest-rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"interest-rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,oBAAoB,CAAgB,QAAQ,EAAE;IAC5C,SAAS,EAAE,eAAe;IAC1B,sBAAsB,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC;IACpD,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;IACjC,OAAO,EAAE,UAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE;;;YAC3D,MAAM,KAAK,GAAG,UAAU,IAAI,CAAC,CAAC;YAC9B,MAAM,GAAG,GAAG,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACnC,MAAM,CAAC,EAAE,AAAD,EAAG,MAAM,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;YAC3C,MAAM,IAAI,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,K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sourcesContent":["import { IInterestRate } from '@yuants/data-interest-rate';\nimport { createSeriesProvider } from '@yuants/data-series';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, formatTime } from '@yuants/utils';\nimport { getHistoricalFundingRates } from '../../api/public-api';\n\nconst terminal = Terminal.fromNodeEnv();\n\ncreateSeriesProvider<IInterestRate>(terminal, {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['HYPERLIQUID', 'PERPETUAL'],\n reversed: true,\n serviceOptions: { concurrent: 1 },\n queryFn: async function* ({ series_id, started_at, ended_at }) {\n const start = started_at || 0;\n const end = ended_at || Date.now();\n const [, , instId] = decodePath(series_id);\n const coin = instId?.split('-')?.[0];\n if (!coin) {\n throw new Error(`Invalid product in series_id: ${series_id}`);\n }\n let current = start;\n while (current <= end) {\n const res = await getHistoricalFundingRates({ coin, startTime: current, endTime: end });\n if (!res || res.length === 0) {\n break;\n }\n const filtered = res.filter((v) => v.time >= current && v.time <= end);\n if (!filtered.length) {\n break;\n }\n yield filtered.map(\n (v): IInterestRate => ({\n series_id,\n product_id: series_id,\n datasource_id: 'HYPERLIQUID',\n created_at: formatTime(v.time),\n long_rate: `${-parseFloat(v.fundingRate)}`,\n short_rate: `${v.fundingRate}`,\n settlement_price: '',\n }),\n );\n if (res.length < 500) {\n break;\n }\n current = filtered[filtered.length - 1].time + 1;\n }\n },\n});\n"]}
|
|
@@ -14,32 +14,9 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const data_series_1 = require("@yuants/data-series");
|
|
16
16
|
const protocol_1 = require("@yuants/protocol");
|
|
17
|
-
const sql_1 = require("@yuants/sql");
|
|
18
17
|
const utils_1 = require("@yuants/utils");
|
|
19
|
-
const rxjs_1 = require("rxjs");
|
|
20
18
|
const public_api_1 = require("../../api/public-api");
|
|
21
19
|
const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
22
|
-
const perpetualProducts$ = (0, rxjs_1.defer)(async () => {
|
|
23
|
-
const meta = await (0, public_api_1.getPerpetualsMetaData)();
|
|
24
|
-
return meta.universe.map((product) => ({
|
|
25
|
-
product_id: (0, utils_1.encodePath)('HYPERLIQUID', 'PERPETUAL', `${product.name}-USD`),
|
|
26
|
-
datasource_id: 'HYPERLIQUID',
|
|
27
|
-
no_interest_rate: false,
|
|
28
|
-
}));
|
|
29
|
-
}).pipe((0, rxjs_1.tap)({ error: (err) => console.error((0, utils_1.formatTime)(Date.now()), 'PerpetualProductFetchFailed', err) }), (0, rxjs_1.retry)({ delay: 10000 }), (0, rxjs_1.repeat)({ delay: 3600000 }), (0, rxjs_1.shareReplay)({ bufferSize: 1, refCount: true }));
|
|
30
|
-
(0, sql_1.createSQLWriter)(terminal, {
|
|
31
|
-
data$: perpetualProducts$.pipe((0, rxjs_1.map)((products) => products.filter((product) => product.no_interest_rate === false)), (0, rxjs_1.mergeAll)(), (0, rxjs_1.map)((product) => ({
|
|
32
|
-
series_id: product.product_id,
|
|
33
|
-
table_name: 'interest_rate',
|
|
34
|
-
cron_pattern: '0 * * * *',
|
|
35
|
-
cron_timezone: 'UTC',
|
|
36
|
-
disabled: false,
|
|
37
|
-
replay_count: 0,
|
|
38
|
-
}))),
|
|
39
|
-
tableName: 'series_collecting_task',
|
|
40
|
-
writeInterval: 1000,
|
|
41
|
-
conflictKeys: ['series_id', 'table_name'],
|
|
42
|
-
});
|
|
43
20
|
(0, data_series_1.createSeriesProvider)(terminal, {
|
|
44
21
|
tableName: 'interest_rate',
|
|
45
22
|
series_id_prefix_parts: ['HYPERLIQUID', 'PERPETUAL'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest-rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"interest-rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest-rate.ts"],"names":[],"mappings":";;;;;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,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;gBACvE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;oBACpB,MAAM;iBACP;gBACD,oBAAM,QAAQ,CAAC,GAAG,CAChB,CAAC,CAAC,EAAiB,EAAE,CAAC,CAAC;oBACrB,SAAS;oBACT,UAAU,EAAE,SAAS;oBACrB,aAAa,EAAE,aAAa;oBAC5B,UAAU,EAAE,IAAA,kBAAU,EAAC,CAAC,CAAC,IAAI,CAAC;oBAC9B,SAAS,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE;oBAC1C,UAAU,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE;oBAC9B,gBAAgB,EAAE,EAAE;iBACrB,CAAC,CACH,CAAA,CAAC;gBACF,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE;oBACpB,MAAM;iBACP;gBACD,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;aAClD;;KACF;CACF,CAAC,CAAC","sourcesContent":["import { IInterestRate } from '@yuants/data-interest-rate';\nimport { createSeriesProvider } from '@yuants/data-series';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, formatTime } from '@yuants/utils';\nimport { getHistoricalFundingRates } from '../../api/public-api';\n\nconst terminal = Terminal.fromNodeEnv();\n\ncreateSeriesProvider<IInterestRate>(terminal, {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['HYPERLIQUID', 'PERPETUAL'],\n reversed: true,\n serviceOptions: { concurrent: 1 },\n queryFn: async function* ({ series_id, started_at, ended_at }) {\n const start = started_at || 0;\n const end = ended_at || Date.now();\n const [, , instId] = decodePath(series_id);\n const coin = instId?.split('-')?.[0];\n if (!coin) {\n throw new Error(`Invalid product in series_id: ${series_id}`);\n }\n let current = start;\n while (current <= end) {\n const res = await getHistoricalFundingRates({ coin, startTime: current, endTime: end });\n if (!res || res.length === 0) {\n break;\n }\n const filtered = res.filter((v) => v.time >= current && v.time <= end);\n if (!filtered.length) {\n break;\n }\n yield filtered.map(\n (v): IInterestRate => ({\n series_id,\n product_id: series_id,\n datasource_id: 'HYPERLIQUID',\n created_at: formatTime(v.time),\n long_rate: `${-parseFloat(v.fundingRate)}`,\n short_rate: `${v.fundingRate}`,\n settlement_price: '',\n }),\n );\n if (res.length < 500) {\n break;\n }\n current = filtered[filtered.length - 1].time + 1;\n }\n },\n});\n"]}
|
package/package.json
CHANGED
package/temp/package-deps.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apps/vendor-hyperliquid/AGENTS.md": "f0f3df594ce55fbaf78fb040f2850d1abee3449a",
|
|
3
|
-
"apps/vendor-hyperliquid/CHANGELOG.json": "
|
|
4
|
-
"apps/vendor-hyperliquid/CHANGELOG.md": "
|
|
3
|
+
"apps/vendor-hyperliquid/CHANGELOG.json": "3de161f60161b8354c4bd6f58ef375fbe9812b03",
|
|
4
|
+
"apps/vendor-hyperliquid/CHANGELOG.md": "5c3abad78f8c63005e48422dfc9522763f671294",
|
|
5
5
|
"apps/vendor-hyperliquid/SESSION_NOTES.md": "41a8a3b98f99d30fece2e510934c35e2e30ffa28",
|
|
6
6
|
"apps/vendor-hyperliquid/api-extractor.json": "62f4fd324425b9a235f0c117975967aab09ced0c",
|
|
7
7
|
"apps/vendor-hyperliquid/config/jest.config.json": "4bb17bde3ee911163a3edb36a6eb71491d80b1bd",
|
|
8
8
|
"apps/vendor-hyperliquid/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
|
|
9
9
|
"apps/vendor-hyperliquid/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
|
|
10
10
|
"apps/vendor-hyperliquid/etc/vendor-hyperliquid.api.md": "66675bd88afa1fe945f0d4023984c1c9c3e60a34",
|
|
11
|
-
"apps/vendor-hyperliquid/package.json": "
|
|
11
|
+
"apps/vendor-hyperliquid/package.json": "267ed686709fcdc08ec7b0992d075d87b7a2a088",
|
|
12
12
|
"apps/vendor-hyperliquid/src/api/client.ts": "90eb3b63394c9729cc442e0ee5482bfd494aafdd",
|
|
13
13
|
"apps/vendor-hyperliquid/src/api/private-api.ts": "8fd176063af8f345aeab94444850e82979cef680",
|
|
14
14
|
"apps/vendor-hyperliquid/src/api/public-api.ts": "fbbb982308eea89a51b93cc21442de6ba45cfd60",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"apps/vendor-hyperliquid/src/services/accounts/perp.ts": "2be6376deabbe7f5b6416219de46400309e1c4f9",
|
|
20
20
|
"apps/vendor-hyperliquid/src/services/accounts/spot.ts": "cee336c2e27d97ce8386f873c0a721cce9163ea0",
|
|
21
21
|
"apps/vendor-hyperliquid/src/services/exchange.ts": "e36dcefff1e239e6b44c7ea1aa0632f59cbce653",
|
|
22
|
-
"apps/vendor-hyperliquid/src/services/markets/interest-rate.ts": "
|
|
22
|
+
"apps/vendor-hyperliquid/src/services/markets/interest-rate.ts": "a93246729016cbe8486bc45b5a00aff57fab07ec",
|
|
23
23
|
"apps/vendor-hyperliquid/src/services/markets/ohlc.ts": "6cea84e64ff68ef3a760b35d2e637b66a1ca1615",
|
|
24
24
|
"apps/vendor-hyperliquid/src/services/markets/product.ts": "05e6136a62c09d3756e0288c1a7c8b05b0fe0774",
|
|
25
25
|
"apps/vendor-hyperliquid/src/services/markets/quote.ts": "25f8886667e36aa5e5676618a016f464c667c51b",
|