@yuants/vendor-huobi 0.15.2 → 0.15.3
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.
|
@@ -22,15 +22,14 @@ createSeriesProvider(Terminal.fromNodeEnv(), {
|
|
|
22
22
|
serviceOptions: { concurrent: 10 },
|
|
23
23
|
queryFn: function ({ series_id, started_at }) {
|
|
24
24
|
return __asyncGenerator(this, arguments, function* () {
|
|
25
|
-
const [
|
|
26
|
-
const [, instType] = decodePath(product_id);
|
|
25
|
+
const [, instType, contract_code] = decodePath(series_id);
|
|
27
26
|
if (instType === 'SWAP') {
|
|
28
27
|
let current_page = 0;
|
|
29
28
|
let total_page = 1;
|
|
30
29
|
while (true) {
|
|
31
30
|
// 向前翻页,时间降序
|
|
32
31
|
const res = yield __await(getSwapHistoricalFundingRate({
|
|
33
|
-
contract_code:
|
|
32
|
+
contract_code: contract_code,
|
|
34
33
|
page_index: current_page,
|
|
35
34
|
}));
|
|
36
35
|
if (res.status !== 'ok') {
|
|
@@ -40,8 +39,8 @@ createSeriesProvider(Terminal.fromNodeEnv(), {
|
|
|
40
39
|
break;
|
|
41
40
|
yield yield __await(res.data.data.map((v) => ({
|
|
42
41
|
series_id,
|
|
43
|
-
datasource_id,
|
|
44
|
-
product_id,
|
|
42
|
+
datasource_id: 'HTX',
|
|
43
|
+
product_id: series_id,
|
|
45
44
|
created_at: formatTime(+v.funding_time),
|
|
46
45
|
long_rate: `${-v.funding_rate}`,
|
|
47
46
|
short_rate: `${v.funding_rate}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/market-data/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,QA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estRate } from '@yuants/data-interest-rate';\nimport { createSeriesProvider } from '@yuants/data-series';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, formatTime, newError } from '@yuants/utils';\nimport { firstValueFrom, timer } from 'rxjs';\nimport { getSwapHistoricalFundingRate } from '../../api/public-api';\n\ncreateSeriesProvider<IInterestRate>(Terminal.fromNodeEnv(), {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['HTX'],\n reversed: true,\n serviceOptions: { concurrent: 10 },\n queryFn: async function* ({ series_id, started_at }) {\n const [, instType, contract_code] = decodePath(series_id);\n\n if (instType === 'SWAP') {\n let current_page = 0;\n let total_page = 1;\n while (true) {\n // 向前翻页,时间降序\n const res = await getSwapHistoricalFundingRate({\n contract_code: contract_code,\n page_index: current_page,\n });\n if (res.status !== 'ok') {\n throw `API failed: ${res.status}`;\n }\n if (res.data.data.length === 0) break;\n yield res.data.data.map(\n (v): IInterestRate => ({\n series_id,\n datasource_id: 'HTX',\n product_id: series_id,\n created_at: formatTime(+v.funding_time),\n long_rate: `${-v.funding_rate}`,\n short_rate: `${v.funding_rate}`,\n settlement_price: '',\n }),\n );\n total_page = res.data.total_page;\n current_page++;\n if (current_page >= total_page) break;\n if (+res.data.data[res.data.data.length - 1].funding_time <= started_at) break;\n await firstValueFrom(timer(1000));\n }\n }\n throw newError('UNSUPPORTED_INST_TYPE', { instType });\n },\n});\n"]}
|
|
@@ -24,15 +24,14 @@ const public_api_1 = require("../../api/public-api");
|
|
|
24
24
|
serviceOptions: { concurrent: 10 },
|
|
25
25
|
queryFn: function ({ series_id, started_at }) {
|
|
26
26
|
return __asyncGenerator(this, arguments, function* () {
|
|
27
|
-
const [
|
|
28
|
-
const [, instType] = (0, utils_1.decodePath)(product_id);
|
|
27
|
+
const [, instType, contract_code] = (0, utils_1.decodePath)(series_id);
|
|
29
28
|
if (instType === 'SWAP') {
|
|
30
29
|
let current_page = 0;
|
|
31
30
|
let total_page = 1;
|
|
32
31
|
while (true) {
|
|
33
32
|
// 向前翻页,时间降序
|
|
34
33
|
const res = yield __await((0, public_api_1.getSwapHistoricalFundingRate)({
|
|
35
|
-
contract_code:
|
|
34
|
+
contract_code: contract_code,
|
|
36
35
|
page_index: current_page,
|
|
37
36
|
}));
|
|
38
37
|
if (res.status !== 'ok') {
|
|
@@ -42,8 +41,8 @@ const public_api_1 = require("../../api/public-api");
|
|
|
42
41
|
break;
|
|
43
42
|
yield yield __await(res.data.data.map((v) => ({
|
|
44
43
|
series_id,
|
|
45
|
-
datasource_id,
|
|
46
|
-
product_id,
|
|
44
|
+
datasource_id: 'HTX',
|
|
45
|
+
product_id: series_id,
|
|
47
46
|
created_at: (0, utils_1.formatTime)(+v.funding_time),
|
|
48
47
|
long_rate: `${-v.funding_rate}`,
|
|
49
48
|
short_rate: `${v.funding_rate}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/market-data/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qDAA2D;AAC3D,+CAA4C;AAC5C,yCAAiE;AACjE,+BAA6C;AAC7C,qDAAoE;AAEpE,IAAA,kCAAoB,EAAgB,mBAAQ,CAAC,WAAW,EAAE,EAAE;IAC1D,SAAS,EAAE,eAAe;IAC1B,sBAAsB,EAAE,CAAC,KAAK,CAAC;IAC/B,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;IAClC,OAAO,EAAE,UAAiB,EAAE,SAAS,EAAE,UAAU,EAAE;;YACjD,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/market-data/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qDAA2D;AAC3D,+CAA4C;AAC5C,yCAAiE;AACjE,+BAA6C;AAC7C,qDAAoE;AAEpE,IAAA,kCAAoB,EAAgB,mBAAQ,CAAC,WAAW,EAAE,EAAE;IAC1D,SAAS,EAAE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,UAAU;wBAAE,MAAM;oBACtC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,YAAY,IAAI,UAAU;wBAAE,MAAM;oBAC/E,cAAM,IAAA,qBAAc,EAAC,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC,CAAA,CAAC;iBACnC;aACF;YACD,MAAM,IAAA,gBAAQ,EAAC,uBAAuB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACxD,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, newError } from '@yuants/utils';\nimport { firstValueFrom, timer } from 'rxjs';\nimport { getSwapHistoricalFundingRate } from '../../api/public-api';\n\ncreateSeriesProvider<IInterestRate>(Terminal.fromNodeEnv(), {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['HTX'],\n reversed: true,\n serviceOptions: { concurrent: 10 },\n queryFn: async function* ({ series_id, started_at }) {\n const [, instType, contract_code] = decodePath(series_id);\n\n if (instType === 'SWAP') {\n let current_page = 0;\n let total_page = 1;\n while (true) {\n // 向前翻页,时间降序\n const res = await getSwapHistoricalFundingRate({\n contract_code: contract_code,\n page_index: current_page,\n });\n if (res.status !== 'ok') {\n throw `API failed: ${res.status}`;\n }\n if (res.data.data.length === 0) break;\n yield res.data.data.map(\n (v): IInterestRate => ({\n series_id,\n datasource_id: 'HTX',\n product_id: series_id,\n created_at: formatTime(+v.funding_time),\n long_rate: `${-v.funding_rate}`,\n short_rate: `${v.funding_rate}`,\n settlement_price: '',\n }),\n );\n total_page = res.data.total_page;\n current_page++;\n if (current_page >= total_page) break;\n if (+res.data.data[res.data.data.length - 1].funding_time <= started_at) break;\n await firstValueFrom(timer(1000));\n }\n }\n throw newError('UNSUPPORTED_INST_TYPE', { instType });\n },\n});\n"]}
|
package/package.json
CHANGED
package/temp/package-deps.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"apps/vendor-huobi/CHANGELOG.json": "
|
|
3
|
-
"apps/vendor-huobi/CHANGELOG.md": "
|
|
2
|
+
"apps/vendor-huobi/CHANGELOG.json": "62f13640a80624162246d8d02f1f42f381feede8",
|
|
3
|
+
"apps/vendor-huobi/CHANGELOG.md": "bc69e0f7772cc3dddc4052e92ecf211c99ecfa8f",
|
|
4
4
|
"apps/vendor-huobi/README.md": "d7bf0149513114eab5500a6b5c9e7cba10565572",
|
|
5
5
|
"apps/vendor-huobi/api-extractor.json": "62f4fd324425b9a235f0c117975967aab09ced0c",
|
|
6
6
|
"apps/vendor-huobi/config/jest.config.json": "4bb17bde3ee911163a3edb36a6eb71491d80b1bd",
|
|
7
7
|
"apps/vendor-huobi/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
|
|
8
8
|
"apps/vendor-huobi/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
|
|
9
9
|
"apps/vendor-huobi/etc/vendor-huobi.api.md": "dc8cbf2a044a227b30a4ee9701b0c97328244724",
|
|
10
|
-
"apps/vendor-huobi/package.json": "
|
|
10
|
+
"apps/vendor-huobi/package.json": "d8d561f0368cbd4a1c09a990ac4ac4ec5999ff80",
|
|
11
11
|
"apps/vendor-huobi/src/__archived/account-info.ts": "5c325d3bb8839476c11f25693326ce05f3321ebd",
|
|
12
12
|
"apps/vendor-huobi/src/__archived/api.ts": "8366151dc881b177d0478fb328a601a11e33cd35",
|
|
13
13
|
"apps/vendor-huobi/src/__archived/transfer.ts": "fd299ad82ff31344460967f2a938b8f36c879259",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"apps/vendor-huobi/src/services/accounts/super-margin.ts": "b4fbe80f4d1419a211a03461bbe7c96ad52aa594",
|
|
19
19
|
"apps/vendor-huobi/src/services/accounts/swap.ts": "4da1dbf2cc3554a9943df419c5a11330130a5f3d",
|
|
20
20
|
"apps/vendor-huobi/src/services/exchange.ts": "6fed94206a22c43d3c6890cf52ff054a24d98d82",
|
|
21
|
-
"apps/vendor-huobi/src/services/market-data/interest_rate.ts": "
|
|
21
|
+
"apps/vendor-huobi/src/services/market-data/interest_rate.ts": "79aa362f9fa90e612f9813d0b45d357b96189f3e",
|
|
22
22
|
"apps/vendor-huobi/src/services/market-data/quote.ts": "d11620707dd195403df11320cccff7f481b4ae9c",
|
|
23
23
|
"apps/vendor-huobi/src/services/orders/listOrders.ts": "1cf4621727fb290f8e5fd1439765fd73387bda7a",
|
|
24
24
|
"apps/vendor-huobi/src/services/orders/submitOrder.ts": "e79925ede5f4a7dc856f5662ebe9dfb3b9dc8a01",
|