@yuants/vendor-aster 0.7.9 → 0.7.10
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.
|
@@ -13,14 +13,14 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
13
13
|
import { createSeriesProvider } from '@yuants/data-series';
|
|
14
14
|
import { Terminal } from '@yuants/protocol';
|
|
15
15
|
import { createSQLWriter } from '@yuants/sql';
|
|
16
|
-
import { decodePath,
|
|
16
|
+
import { decodePath, formatTime } from '@yuants/utils';
|
|
17
17
|
import { firstValueFrom, map, mergeAll, timer } from 'rxjs';
|
|
18
18
|
import { getFApiV1FundingRate } from '../../api/public-api';
|
|
19
19
|
import { productService } from './product';
|
|
20
20
|
const terminal = Terminal.fromNodeEnv();
|
|
21
21
|
createSQLWriter(terminal, {
|
|
22
22
|
data$: productService.products$.pipe(map((products) => products.filter((product) => product.no_interest_rate === false)), mergeAll(), map((product) => ({
|
|
23
|
-
series_id:
|
|
23
|
+
series_id: product.product_id,
|
|
24
24
|
table_name: 'interest_rate',
|
|
25
25
|
cron_pattern: '0 * * * *',
|
|
26
26
|
cron_timezone: 'UTC',
|
|
@@ -40,8 +40,7 @@ createSeriesProvider(terminal, {
|
|
|
40
40
|
return __asyncGenerator(this, arguments, function* () {
|
|
41
41
|
const start = started_at !== null && started_at !== void 0 ? started_at : 0;
|
|
42
42
|
const end = ended_at !== null && ended_at !== void 0 ? ended_at : Date.now();
|
|
43
|
-
const [
|
|
44
|
-
const [instType, instId] = decodePath(product_id);
|
|
43
|
+
const [, instType, instId] = decodePath(series_id);
|
|
45
44
|
if (instType !== 'PERP') {
|
|
46
45
|
return yield __await(void 0);
|
|
47
46
|
}
|
|
@@ -71,8 +70,8 @@ createSeriesProvider(terminal, {
|
|
|
71
70
|
const rate = Number(item.fundingRate);
|
|
72
71
|
return {
|
|
73
72
|
series_id,
|
|
74
|
-
product_id,
|
|
75
|
-
datasource_id,
|
|
73
|
+
product_id: series_id,
|
|
74
|
+
datasource_id: 'ASTER',
|
|
76
75
|
created_at: formatTime(item.fundingTime),
|
|
77
76
|
long_rate: `${-rate}`,
|
|
78
77
|
short_rate: `${rate}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,oBAAoB,EAAyB,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,oBAAoB,EAAyB,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,eAAe,CAAwB,QAAQ,EAAE;IAC/C,KAAK,EAAE,cAAc,CAAC,SAAS,CAAC,IAAI,CAClC,GAAG,CAAC,CAAC,QAAoB,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAA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;gBAE5B,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE;oBACrB,MAAM;iBACP;gBAED,cAAM,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA,CAAC;aACnC;QACH,CAAC;KAAA;CACF,CAAC,CAAC","sourcesContent":["import { IInterestRate } from '@yuants/data-interest-rate';\nimport { IProduct } from '@yuants/data-product';\nimport { createSeriesProvider, ISeriesCollectingTask } from '@yuants/data-series';\nimport { Terminal } from '@yuants/protocol';\nimport { createSQLWriter } from '@yuants/sql';\nimport { decodePath, encodePath, formatTime } from '@yuants/utils';\nimport { firstValueFrom, map, mergeAll, timer } from 'rxjs';\nimport { getFApiV1FundingRate } from '../../api/public-api';\nimport { productService } from './product';\n\nconst terminal = Terminal.fromNodeEnv();\n\ncreateSQLWriter<ISeriesCollectingTask>(terminal, {\n data$: productService.products$.pipe(\n map((products: IProduct[]) => products.filter((product) => product.no_interest_rate === false)),\n mergeAll(),\n map(\n (product: IProduct): ISeriesCollectingTask => ({\n series_id: product.product_id,\n table_name: 'interest_rate',\n cron_pattern: '0 * * * *',\n cron_timezone: 'UTC',\n disabled: false,\n replay_count: 0,\n }),\n ),\n ),\n tableName: 'series_collecting_task',\n writeInterval: 1000,\n conflictKeys: ['series_id', 'table_name'],\n});\n\ncreateSeriesProvider<IInterestRate>(terminal, {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['ASTER'],\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 [, instType, instId] = decodePath(series_id);\n\n if (instType !== 'PERP') {\n return;\n }\n\n let currentStart = start;\n\n while (currentStart <= end) {\n const res = await getFApiV1FundingRate({\n symbol: instId,\n startTime: currentStart,\n endTime: end,\n limit: 1000,\n });\n\n if (!Array.isArray(res) || res.length === 0) {\n break;\n }\n\n const filtered = res.filter((item) => item.fundingTime >= currentStart && item.fundingTime <= end);\n\n if (filtered.length === 0) {\n const lastRecord = res[res.length - 1];\n const nextStart = lastRecord.fundingTime + 1;\n if (nextStart <= currentStart) {\n break;\n }\n currentStart = nextStart;\n await firstValueFrom(timer(1000));\n continue;\n }\n\n const data = filtered.map((item): IInterestRate => {\n const rate = Number(item.fundingRate);\n return {\n series_id,\n product_id: series_id,\n datasource_id: 'ASTER',\n created_at: formatTime(item.fundingTime),\n long_rate: `${-rate}`,\n short_rate: `${rate}`,\n settlement_price: '',\n };\n });\n\n yield data;\n\n const lastTime = filtered[filtered.length - 1].fundingTime;\n if (lastTime >= end) {\n break;\n }\n\n currentStart = lastTime + 1;\n\n if (res.length < 1000) {\n break;\n }\n\n await firstValueFrom(timer(1000));\n }\n },\n});\n"]}
|
|
@@ -22,7 +22,7 @@ const product_1 = require("./product");
|
|
|
22
22
|
const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
23
23
|
(0, sql_1.createSQLWriter)(terminal, {
|
|
24
24
|
data$: product_1.productService.products$.pipe((0, rxjs_1.map)((products) => products.filter((product) => product.no_interest_rate === false)), (0, rxjs_1.mergeAll)(), (0, rxjs_1.map)((product) => ({
|
|
25
|
-
series_id:
|
|
25
|
+
series_id: product.product_id,
|
|
26
26
|
table_name: 'interest_rate',
|
|
27
27
|
cron_pattern: '0 * * * *',
|
|
28
28
|
cron_timezone: 'UTC',
|
|
@@ -42,8 +42,7 @@ const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
|
42
42
|
return __asyncGenerator(this, arguments, function* () {
|
|
43
43
|
const start = started_at !== null && started_at !== void 0 ? started_at : 0;
|
|
44
44
|
const end = ended_at !== null && ended_at !== void 0 ? ended_at : Date.now();
|
|
45
|
-
const [
|
|
46
|
-
const [instType, instId] = (0, utils_1.decodePath)(product_id);
|
|
45
|
+
const [, instType, instId] = (0, utils_1.decodePath)(series_id);
|
|
47
46
|
if (instType !== 'PERP') {
|
|
48
47
|
return yield __await(void 0);
|
|
49
48
|
}
|
|
@@ -73,8 +72,8 @@ const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
|
73
72
|
const rate = Number(item.fundingRate);
|
|
74
73
|
return {
|
|
75
74
|
series_id,
|
|
76
|
-
product_id,
|
|
77
|
-
datasource_id,
|
|
75
|
+
product_id: series_id,
|
|
76
|
+
datasource_id: 'ASTER',
|
|
78
77
|
created_at: (0, utils_1.formatTime)(item.fundingTime),
|
|
79
78
|
long_rate: `${-rate}`,
|
|
80
79
|
short_rate: `${rate}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,qDAAkF;AAClF,+CAA4C;AAC5C,qCAA8C;AAC9C,yCAAmE;AACnE,+BAA4D;AAC5D,qDAA4D;AAC5D,uCAA2C;AAE3C,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,qBAAe,EAAwB,QAAQ,EAAE;IAC/C,KAAK,EAAE,wBAAc,CAAC,SAAS,CAAC,IAAI,CAClC,IAAA,UAAG,EAAC,CAAC,QAAoB,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAAC,EAC/F,IAAA,eAAQ,GAAE,EACV,IAAA,UAAG,EACD,CAAC,OAAiB,EAAyB,EAAE,CAAC,CAAC;QAC7C,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,qDAAkF;AAClF,+CAA4C;AAC5C,qCAA8C;AAC9C,yCAAmE;AACnE,+BAA4D;AAC5D,qDAA4D;AAC5D,uCAA2C;AAE3C,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,qBAAe,EAAwB,QAAQ,EA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AAC;gBACJ,CAAC,CAAC,CAAC;gBAEH,oBAAM,IAAI,CAAA,CAAC;gBAEX,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC;gBAC3D,IAAI,QAAQ,IAAI,GAAG,EAAE;oBACnB,MAAM;iBACP;gBAED,YAAY,GAAG,QAAQ,GAAG,CAAC,CAAC;gBAE5B,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE;oBACrB,MAAM;iBACP;gBAED,cAAM,IAAA,qBAAc,EAAC,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC,CAAA,CAAC;aACnC;QACH,CAAC;KAAA;CACF,CAAC,CAAC","sourcesContent":["import { IInterestRate } from '@yuants/data-interest-rate';\nimport { IProduct } from '@yuants/data-product';\nimport { createSeriesProvider, ISeriesCollectingTask } from '@yuants/data-series';\nimport { Terminal } from '@yuants/protocol';\nimport { createSQLWriter } from '@yuants/sql';\nimport { decodePath, encodePath, formatTime } from '@yuants/utils';\nimport { firstValueFrom, map, mergeAll, timer } from 'rxjs';\nimport { getFApiV1FundingRate } from '../../api/public-api';\nimport { productService } from './product';\n\nconst terminal = Terminal.fromNodeEnv();\n\ncreateSQLWriter<ISeriesCollectingTask>(terminal, {\n data$: productService.products$.pipe(\n map((products: IProduct[]) => products.filter((product) => product.no_interest_rate === false)),\n mergeAll(),\n map(\n (product: IProduct): ISeriesCollectingTask => ({\n series_id: product.product_id,\n table_name: 'interest_rate',\n cron_pattern: '0 * * * *',\n cron_timezone: 'UTC',\n disabled: false,\n replay_count: 0,\n }),\n ),\n ),\n tableName: 'series_collecting_task',\n writeInterval: 1000,\n conflictKeys: ['series_id', 'table_name'],\n});\n\ncreateSeriesProvider<IInterestRate>(terminal, {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['ASTER'],\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 [, instType, instId] = decodePath(series_id);\n\n if (instType !== 'PERP') {\n return;\n }\n\n let currentStart = start;\n\n while (currentStart <= end) {\n const res = await getFApiV1FundingRate({\n symbol: instId,\n startTime: currentStart,\n endTime: end,\n limit: 1000,\n });\n\n if (!Array.isArray(res) || res.length === 0) {\n break;\n }\n\n const filtered = res.filter((item) => item.fundingTime >= currentStart && item.fundingTime <= end);\n\n if (filtered.length === 0) {\n const lastRecord = res[res.length - 1];\n const nextStart = lastRecord.fundingTime + 1;\n if (nextStart <= currentStart) {\n break;\n }\n currentStart = nextStart;\n await firstValueFrom(timer(1000));\n continue;\n }\n\n const data = filtered.map((item): IInterestRate => {\n const rate = Number(item.fundingRate);\n return {\n series_id,\n product_id: series_id,\n datasource_id: 'ASTER',\n created_at: formatTime(item.fundingTime),\n long_rate: `${-rate}`,\n short_rate: `${rate}`,\n settlement_price: '',\n };\n });\n\n yield data;\n\n const lastTime = filtered[filtered.length - 1].fundingTime;\n if (lastTime >= end) {\n break;\n }\n\n currentStart = lastTime + 1;\n\n if (res.length < 1000) {\n break;\n }\n\n await firstValueFrom(timer(1000));\n }\n },\n});\n"]}
|
package/package.json
CHANGED
package/temp/package-deps.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apps/vendor-aster/AGENTS.md": "dcd006d19a5c3b73081525d7c0afea68cd6d058b",
|
|
3
|
-
"apps/vendor-aster/CHANGELOG.json": "
|
|
4
|
-
"apps/vendor-aster/CHANGELOG.md": "
|
|
3
|
+
"apps/vendor-aster/CHANGELOG.json": "7f8f2987528230b9a39f6279bd9799564df1942e",
|
|
4
|
+
"apps/vendor-aster/CHANGELOG.md": "247bbb753dccd8fe86c700c9f1738447958d7e2c",
|
|
5
5
|
"apps/vendor-aster/SESSION_NOTES.md": "f54c13cf4182d8a5e720f6db5d3acc323655ea49",
|
|
6
6
|
"apps/vendor-aster/config/jest.config.json": "4bb17bde3ee911163a3edb36a6eb71491d80b1bd",
|
|
7
7
|
"apps/vendor-aster/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
|
|
8
8
|
"apps/vendor-aster/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
|
|
9
|
-
"apps/vendor-aster/package.json": "
|
|
9
|
+
"apps/vendor-aster/package.json": "b59c72d6a5ee4aec5e3be465176f9c5d41f4b220",
|
|
10
10
|
"apps/vendor-aster/src/api/private-api.ts": "2987cb0d1d0f6aac6ec8257696da1e755f15bc3b",
|
|
11
11
|
"apps/vendor-aster/src/api/public-api.ts": "bfc642fff0ae31319c23e198f365a4a3372d4b10",
|
|
12
12
|
"apps/vendor-aster/src/index.ts": "509ef4c18ec2deb8a6e11ed5682334433cb2bcb2",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"apps/vendor-aster/src/services/accounts/profile.ts": "01cbb2cd8a913bb6471208eb96fb0613fbcd8f10",
|
|
15
15
|
"apps/vendor-aster/src/services/accounts/spot.ts": "d612814726080714af3cbe3deeaa3f57e109aaf9",
|
|
16
16
|
"apps/vendor-aster/src/services/exchange.ts": "4cdd15bfff1d1e4b1aceda287af6b280d088ccee",
|
|
17
|
-
"apps/vendor-aster/src/services/markets/interest_rate.ts": "
|
|
17
|
+
"apps/vendor-aster/src/services/markets/interest_rate.ts": "b8a43085be3632fe0afe00502c509b5984ab9cd3",
|
|
18
18
|
"apps/vendor-aster/src/services/markets/product.ts": "a0e5c02e9f99682cd2f4cb0a9e7a01747e540b4e",
|
|
19
19
|
"apps/vendor-aster/src/services/markets/quote.ts": "a5a828de8c5b43963459461d057825d977304233",
|
|
20
20
|
"apps/vendor-aster/src/services/orders/cancelOrder.ts": "09a6d3b10a218ad226346dd68d0ff0207083a7f1",
|