@yuants/vendor-coinex 0.2.42 → 0.2.43
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/interest_rate.js
CHANGED
|
@@ -23,8 +23,7 @@ createSeriesProvider(terminal, {
|
|
|
23
23
|
serviceOptions: { concurrent: 1 },
|
|
24
24
|
queryFn: function ({ series_id, started_at, ended_at }) {
|
|
25
25
|
return __asyncGenerator(this, arguments, function* () {
|
|
26
|
-
const [
|
|
27
|
-
const [instType, instId] = decodePath(product_id);
|
|
26
|
+
const [, instType, instId] = decodePath(series_id);
|
|
28
27
|
let current_page = 0;
|
|
29
28
|
while (true) {
|
|
30
29
|
const res = yield __await(client.getFuturesFundingRateHistory({
|
|
@@ -41,8 +40,8 @@ createSeriesProvider(terminal, {
|
|
|
41
40
|
break;
|
|
42
41
|
yield yield __await(res.data.map((v) => ({
|
|
43
42
|
series_id,
|
|
44
|
-
datasource_id,
|
|
45
|
-
product_id,
|
|
43
|
+
datasource_id: 'COINEX',
|
|
44
|
+
product_id: series_id,
|
|
46
45
|
created_at: formatTime(+v.funding_time),
|
|
47
46
|
long_rate: `${-v.actual_funding_rate}`,
|
|
48
47
|
short_rate: `${v.actual_funding_rate}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../src/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,cAAc,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,oB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ClB,KAAK,EAAE,GAAG;iBACX,CAAC,CAAA,CAAC;gBACH,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE;oBAClB,MAAM,eAAe,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;iBAChD;gBACD,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;oBAAE,MAAM;gBAEjC,oBAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAChB,CAAC,CAAC,EAAiB,EAAE,CAAC,CAAC;oBACrB,SAAS;oBACT,aAAa,EAAE,QAAQ;oBACvB,UAAU,EAAE,SAAS;oBACrB,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;oBACvC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,mBAAmB,EAAE;oBACtC,UAAU,EAAE,GAAG,CAAC,CAAC,mBAAmB,EAAE;oBACtC,gBAAgB,EAAE,EAAE;iBACrB,CAAC,CACH,CAAA,CAAC;gBACF,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ;oBAAE,MAAM;gBACpC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,YAAY,IAAI,UAAU;oBAAE,MAAM;gBACrE,YAAY,EAAE,CAAC;gBACf,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 { createSeriesProvider } from '@yuants/data-series';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, formatTime } from '@yuants/utils';\nimport { firstValueFrom, timer } from 'rxjs';\nimport { client } from './api';\n\nconst terminal = Terminal.fromNodeEnv();\n\ncreateSeriesProvider<IInterestRate>(terminal, {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['coinex'],\n reversed: true,\n serviceOptions: { concurrent: 1 },\n queryFn: async function* ({ series_id, started_at, ended_at }) {\n const [, instType, instId] = decodePath(series_id);\n let current_page = 0;\n\n while (true) {\n const res = await client.getFuturesFundingRateHistory({\n market: instId,\n start_time: started_at,\n end_time: ended_at,\n page: current_page,\n limit: 100,\n });\n if (res.code !== 0) {\n throw `API failed: ${res.code} ${res.message}`;\n }\n if (res.data.length === 0) break;\n\n yield res.data.map(\n (v): IInterestRate => ({\n series_id,\n datasource_id: 'COINEX',\n product_id: series_id,\n created_at: formatTime(+v.funding_time),\n long_rate: `${-v.actual_funding_rate}`,\n short_rate: `${v.actual_funding_rate}`,\n settlement_price: '',\n }),\n );\n if (!res.pagination.has_next) break;\n if (+res.data[res.data.length - 1].funding_time <= started_at) break;\n current_page++;\n await firstValueFrom(timer(1000));\n }\n },\n});\n"]}
|
package/lib/interest_rate.js
CHANGED
|
@@ -25,8 +25,7 @@ const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
|
25
25
|
serviceOptions: { concurrent: 1 },
|
|
26
26
|
queryFn: function ({ series_id, started_at, ended_at }) {
|
|
27
27
|
return __asyncGenerator(this, arguments, function* () {
|
|
28
|
-
const [
|
|
29
|
-
const [instType, instId] = (0, utils_1.decodePath)(product_id);
|
|
28
|
+
const [, instType, instId] = (0, utils_1.decodePath)(series_id);
|
|
30
29
|
let current_page = 0;
|
|
31
30
|
while (true) {
|
|
32
31
|
const res = yield __await(api_1.client.getFuturesFundingRateHistory({
|
|
@@ -43,8 +42,8 @@ const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
|
43
42
|
break;
|
|
44
43
|
yield yield __await(res.data.map((v) => ({
|
|
45
44
|
series_id,
|
|
46
|
-
datasource_id,
|
|
47
|
-
product_id,
|
|
45
|
+
datasource_id: 'COINEX',
|
|
46
|
+
product_id: series_id,
|
|
48
47
|
created_at: (0, utils_1.formatTime)(+v.funding_time),
|
|
49
48
|
long_rate: `${-v.actual_funding_rate}`,
|
|
50
49
|
short_rate: `${v.actual_funding_rate}`,
|
package/lib/interest_rate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../src/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qDAA2D;AAC3D,+CAA4C;AAC5C,yCAAuD;AACvD,+BAA6C;AAC7C,+BAA+B;AAE/B,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,kCAAoB,EAAgB,QAAQ,EAAE;IAC5C,SAAS,EAAE,eAAe;IAC1B,sBAAsB,EAAE,CAAC,QAAQ,CAAC;IAClC,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;IACjC,OAAO,EAAE,UAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE;;YAC3D,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../src/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qDAA2D;AAC3D,+CAA4C;AAC5C,yCAAuD;AACvD,+BAA6C;AAC7C,+BAA+B;AAE/B,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,kCAAoB,EAAgB,QAAQ,EAAE;IAC5C,SAAS,EAAE,eAAe;IAC1B,sBAAsB,EAAE,CAAC,QAAQ,CAAC;IAClC,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;IACjC,OAAO,EAAE,UAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE;;YAC3D,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAA,kBAAU,EAAC,SAAS,CAAC,CAAC;YACnD,IAAI,YAAY,GAAG,CAAC,CAAC;YAErB,OAAO,IAAI,EAAE;gBACX,MAAM,GAAG,GAAG,cAAM,YAAM,CAAC,4BAA4B,CAAC;oBACpD,MAAM,EAAE,MAAM;oBACd,UAAU,EAAE,UAAU;oBACtB,QAAQ,EAAE,QAAQ;oBAClB,IAAI,EAAE,YAAY;oBAClB,KAAK,EAAE,GAAG;iBACX,CAAC,CAAA,CAAC;gBACH,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE;oBAClB,MAAM,eAAe,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;iBAChD;gBACD,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;oBAAE,MAAM;gBAEjC,oBAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAChB,CAAC,CAAC,EAAiB,EAAE,CAAC,CAAC;oBACrB,SAAS;oBACT,aAAa,EAAE,QAAQ;oBACvB,UAAU,EAAE,SAAS;oBACrB,UAAU,EAAE,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAC,YAAY,CAAC;oBACvC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,mBAAmB,EAAE;oBACtC,UAAU,EAAE,GAAG,CAAC,CAAC,mBAAmB,EAAE;oBACtC,gBAAgB,EAAE,EAAE;iBACrB,CAAC,CACH,CAAA,CAAC;gBACF,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ;oBAAE,MAAM;gBACpC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,YAAY,IAAI,UAAU;oBAAE,MAAM;gBACrE,YAAY,EAAE,CAAC;gBACf,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 { createSeriesProvider } from '@yuants/data-series';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, formatTime } from '@yuants/utils';\nimport { firstValueFrom, timer } from 'rxjs';\nimport { client } from './api';\n\nconst terminal = Terminal.fromNodeEnv();\n\ncreateSeriesProvider<IInterestRate>(terminal, {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['coinex'],\n reversed: true,\n serviceOptions: { concurrent: 1 },\n queryFn: async function* ({ series_id, started_at, ended_at }) {\n const [, instType, instId] = decodePath(series_id);\n let current_page = 0;\n\n while (true) {\n const res = await client.getFuturesFundingRateHistory({\n market: instId,\n start_time: started_at,\n end_time: ended_at,\n page: current_page,\n limit: 100,\n });\n if (res.code !== 0) {\n throw `API failed: ${res.code} ${res.message}`;\n }\n if (res.data.length === 0) break;\n\n yield res.data.map(\n (v): IInterestRate => ({\n series_id,\n datasource_id: 'COINEX',\n product_id: series_id,\n created_at: formatTime(+v.funding_time),\n long_rate: `${-v.actual_funding_rate}`,\n short_rate: `${v.actual_funding_rate}`,\n settlement_price: '',\n }),\n );\n if (!res.pagination.has_next) break;\n if (+res.data[res.data.length - 1].funding_time <= started_at) break;\n current_page++;\n await firstValueFrom(timer(1000));\n }\n },\n});\n"]}
|
package/package.json
CHANGED
package/temp/package-deps.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"apps/vendor-coinex/CHANGELOG.json": "
|
|
3
|
-
"apps/vendor-coinex/CHANGELOG.md": "
|
|
2
|
+
"apps/vendor-coinex/CHANGELOG.json": "a120569068e401fa06d276f4dd11c08ac34987ae",
|
|
3
|
+
"apps/vendor-coinex/CHANGELOG.md": "56005ed7d8083acb1ab088e1558d7dcd7df9bed1",
|
|
4
4
|
"apps/vendor-coinex/api-extractor.json": "62f4fd324425b9a235f0c117975967aab09ced0c",
|
|
5
5
|
"apps/vendor-coinex/config/jest.config.json": "4bb17bde3ee911163a3edb36a6eb71491d80b1bd",
|
|
6
6
|
"apps/vendor-coinex/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
|
|
7
7
|
"apps/vendor-coinex/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
|
|
8
8
|
"apps/vendor-coinex/etc/vendor-coinex.api.md": "33941b70ac7469421ff8fb8c157181014a0ea655",
|
|
9
|
-
"apps/vendor-coinex/package.json": "
|
|
9
|
+
"apps/vendor-coinex/package.json": "ac7eb9bceecdccf5fea9eebbec3c4f849da6d14a",
|
|
10
10
|
"apps/vendor-coinex/src/api.ts": "2c912b4fcb8e849cef573c6cd7c26489a6ab0b70",
|
|
11
11
|
"apps/vendor-coinex/src/index.ts": "1839b7a344b0f693f8e835f048a0bf6a69f5ff60",
|
|
12
|
-
"apps/vendor-coinex/src/interest_rate.ts": "
|
|
12
|
+
"apps/vendor-coinex/src/interest_rate.ts": "ca8d750396697e81e60f609986bc1a676c7aeb41",
|
|
13
13
|
"apps/vendor-coinex/src/product.ts": "c11fafeac162c0037299b79d4ce9594a931d7a96",
|
|
14
14
|
"apps/vendor-coinex/tsconfig.json": "81da8f78196974b5d15da0edb6b2d9f48641063c",
|
|
15
15
|
"apps/vendor-coinex/.rush/temp/shrinkwrap-deps.json": "537a943cdb48a6dab24c8bb450baed0c66b8c244",
|