@yuants/vendor-coinex 0.2.5 → 0.2.7

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/product.js CHANGED
@@ -47,7 +47,6 @@ createSQLWriter(terminal, {
47
47
  tableName: 'product',
48
48
  data$: product$,
49
49
  writeInterval: 1000,
50
- keyFn: (x) => encodePath(x.datasource_id, x.product_id),
51
50
  conflictKeys: ['datasource_id', 'product_id'],
52
51
  });
53
52
  futuresProducts$.subscribe();
@@ -1 +1 @@
1
- {"version":3,"file":"product.js","sourceRoot":"","sources":["../src/product.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE;IACjD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC5C,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,EAAE,KAAK,EAAE,IAAK,EAAE,CAAC,EACxB,KAAK,CAAC,EAAE,KAAK,EAAE,KAAM,EAAE,CAAC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,CAAC,IAAI,CACL,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;IACX,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC,EACF,GAAG,CAAC;IACF,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF,CAAC,EACF,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EACtB,MAAM,CAAC,EAAE,KAAK,EAAE,QAAS,EAAE,CAAC,EAC5B,WAAW,CAAC,CAAC,CAAC,CACf,CAAC;AAEF,eAAe,CAAW,QAAQ,EAAE;IAClC,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,QAAQ;IACf,aAAa,EAAE,IAAI;IACnB,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,UAAU,CAAC;IACvD,YAAY,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC;CAC9C,CAAC,CAAC;AAEH,gBAAgB,CAAC,SAAS,EAAE,CAAC;AAE7B,MAAM,6BAA6B,GAAG,gBAAgB,CAAC,IAAI;AACzD,EAAE;AACF,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAClE,WAAW,CAAC,CAAC,CAAC,CACf,CAAC","sourcesContent":["import { IProduct } from '@yuants/data-product';\nimport { createSQLWriter } from '@yuants/sql';\nimport { encodePath, formatTime } from '@yuants/utils';\nimport { defer, from, map, mergeMap, repeat, retry, shareReplay, Subject, tap, toArray } from 'rxjs';\nimport { client } from './api';\nimport { terminal } from './terminal';\n\nconst product$ = new Subject<IProduct>();\n\nexport const mapSymbolToMarket$ = defer(async () => {\n const res = await client.getFuturesMarket();\n if (res.code !== 0) {\n throw new Error(res.message);\n }\n return res.data;\n}).pipe(\n repeat({ delay: 1_000 }),\n retry({ delay: 30_000 }),\n mergeMap((x) =>\n from(x).pipe(\n map((v) => [v.market, v] as const),\n toArray(),\n map((v) => new Map(v)),\n ),\n ),\n shareReplay(1),\n);\n\nconst futuresProducts$ = defer(async () => {\n const res = await client.getFuturesMarket();\n if (res.code !== 0) {\n throw new Error(res.message);\n }\n\n const futures = res.data.map(\n (item): IProduct => ({\n datasource_id: 'COINEX',\n product_id: encodePath('SWAP', item.market),\n quote_currency: item.quote_ccy,\n base_currency: item.base_ccy,\n price_step: Number(item.quote_ccy_precision),\n // FIXME: volume_step, value_scale\n volume_step: 1,\n value_scale: 1,\n name: '',\n value_scale_unit: '',\n margin_rate: 0,\n value_based_cost: 0,\n volume_based_cost: 0,\n max_position: 0,\n max_volume: 0,\n allow_long: true,\n allow_short: true,\n }),\n );\n return futures;\n}).pipe(\n tap((list) => {\n list.forEach((v) => product$.next(v));\n }),\n tap({\n error: (e) => {\n console.error(formatTime(Date.now()), 'FuturesProducts', e);\n },\n }),\n retry({ delay: 5000 }),\n repeat({ delay: 86400_000 }),\n shareReplay(1),\n);\n\ncreateSQLWriter<IProduct>(terminal, {\n tableName: 'product',\n data$: product$,\n writeInterval: 1000,\n keyFn: (x) => encodePath(x.datasource_id, x.product_id),\n conflictKeys: ['datasource_id', 'product_id'],\n});\n\nfuturesProducts$.subscribe();\n\nconst mapProductIdToFuturesProduct$ = futuresProducts$.pipe(\n //\n map((products) => new Map(products.map((v) => [v.product_id, v]))),\n shareReplay(1),\n);\n"]}
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../src/product.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,E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AC,EACtB,MAAM,CAAC,EAAE,KAAK,EAAE,QAAS,EAAE,CAAC,EAC5B,WAAW,CAAC,CAAC,CAAC,CACf,CAAC;AAEF,eAAe,CAAW,QAAQ,EAAE;IAClC,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,QAAQ;IACf,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC;CAC9C,CAAC,CAAC;AAEH,gBAAgB,CAAC,SAAS,EAAE,CAAC;AAE7B,MAAM,6BAA6B,GAAG,gBAAgB,CAAC,IAAI;AACzD,EAAE;AACF,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAClE,WAAW,CAAC,CAAC,CAAC,CACf,CAAC","sourcesContent":["import { IProduct } from '@yuants/data-product';\nimport { createSQLWriter } from '@yuants/sql';\nimport { encodePath, formatTime } from '@yuants/utils';\nimport { defer, from, map, mergeMap, repeat, retry, shareReplay, Subject, tap, toArray } from 'rxjs';\nimport { client } from './api';\nimport { terminal } from './terminal';\n\nconst product$ = new Subject<IProduct>();\n\nexport const mapSymbolToMarket$ = defer(async () => {\n const res = await client.getFuturesMarket();\n if (res.code !== 0) {\n throw new Error(res.message);\n }\n return res.data;\n}).pipe(\n repeat({ delay: 1_000 }),\n retry({ delay: 30_000 }),\n mergeMap((x) =>\n from(x).pipe(\n map((v) => [v.market, v] as const),\n toArray(),\n map((v) => new Map(v)),\n ),\n ),\n shareReplay(1),\n);\n\nconst futuresProducts$ = defer(async () => {\n const res = await client.getFuturesMarket();\n if (res.code !== 0) {\n throw new Error(res.message);\n }\n\n const futures = res.data.map(\n (item): IProduct => ({\n datasource_id: 'COINEX',\n product_id: encodePath('SWAP', item.market),\n quote_currency: item.quote_ccy,\n base_currency: item.base_ccy,\n price_step: Number(item.quote_ccy_precision),\n // FIXME: volume_step, value_scale\n volume_step: 1,\n value_scale: 1,\n name: '',\n value_scale_unit: '',\n margin_rate: 0,\n value_based_cost: 0,\n volume_based_cost: 0,\n max_position: 0,\n max_volume: 0,\n allow_long: true,\n allow_short: true,\n }),\n );\n return futures;\n}).pipe(\n tap((list) => {\n list.forEach((v) => product$.next(v));\n }),\n tap({\n error: (e) => {\n console.error(formatTime(Date.now()), 'FuturesProducts', e);\n },\n }),\n retry({ delay: 5000 }),\n repeat({ delay: 86400_000 }),\n shareReplay(1),\n);\n\ncreateSQLWriter<IProduct>(terminal, {\n tableName: 'product',\n data$: product$,\n writeInterval: 1000,\n conflictKeys: ['datasource_id', 'product_id'],\n});\n\nfuturesProducts$.subscribe();\n\nconst mapProductIdToFuturesProduct$ = futuresProducts$.pipe(\n //\n map((products) => new Map(products.map((v) => [v.product_id, v]))),\n shareReplay(1),\n);\n"]}
package/lib/product.js CHANGED
@@ -50,7 +50,6 @@ const futuresProducts$ = (0, rxjs_1.defer)(async () => {
50
50
  tableName: 'product',
51
51
  data$: product$,
52
52
  writeInterval: 1000,
53
- keyFn: (x) => (0, utils_1.encodePath)(x.datasource_id, x.product_id),
54
53
  conflictKeys: ['datasource_id', 'product_id'],
55
54
  });
56
55
  futuresProducts$.subscribe();
@@ -1 +1 @@
1
- {"version":3,"file":"product.js","sourceRoot":"","sources":["../src/product.ts"],"names":[],"mappings":";;;AACA,qCAA8C;AAC9C,yCAAuD;AACvD,+BAAqG;AACrG,+BAA+B;AAC/B,yCAAsC;AAEtC,MAAM,QAAQ,GAAG,IAAI,cAAO,EAAY,CAAC;AAE5B,QAAA,kBAAkB,GAAG,IAAA,YAAK,EAAC,KAAK,IAAI,EAAE;IACjD,MAAM,GAAG,GAAG,MAAM,YAAM,CAAC,gBAAgB,EAAE,CAAC;IAC5C,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,GAAG,CA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EAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAClE,IAAA,kBAAW,EAAC,CAAC,CAAC,CACf,CAAC","sourcesContent":["import { IProduct } from '@yuants/data-product';\nimport { createSQLWriter } from '@yuants/sql';\nimport { encodePath, formatTime } from '@yuants/utils';\nimport { defer, from, map, mergeMap, repeat, retry, shareReplay, Subject, tap, toArray } from 'rxjs';\nimport { client } from './api';\nimport { terminal } from './terminal';\n\nconst product$ = new Subject<IProduct>();\n\nexport const mapSymbolToMarket$ = defer(async () => {\n const res = await client.getFuturesMarket();\n if (res.code !== 0) {\n throw new Error(res.message);\n }\n return res.data;\n}).pipe(\n repeat({ delay: 1_000 }),\n retry({ delay: 30_000 }),\n mergeMap((x) =>\n from(x).pipe(\n map((v) => [v.market, v] as const),\n toArray(),\n map((v) => new Map(v)),\n ),\n ),\n shareReplay(1),\n);\n\nconst futuresProducts$ = defer(async () => {\n const res = await client.getFuturesMarket();\n if (res.code !== 0) {\n throw new Error(res.message);\n }\n\n const futures = res.data.map(\n (item): IProduct => ({\n datasource_id: 'COINEX',\n product_id: encodePath('SWAP', item.market),\n quote_currency: item.quote_ccy,\n base_currency: item.base_ccy,\n price_step: Number(item.quote_ccy_precision),\n // FIXME: volume_step, value_scale\n volume_step: 1,\n value_scale: 1,\n name: '',\n value_scale_unit: '',\n margin_rate: 0,\n value_based_cost: 0,\n volume_based_cost: 0,\n max_position: 0,\n max_volume: 0,\n allow_long: true,\n allow_short: true,\n }),\n );\n return futures;\n}).pipe(\n tap((list) => {\n list.forEach((v) => product$.next(v));\n }),\n tap({\n error: (e) => {\n console.error(formatTime(Date.now()), 'FuturesProducts', e);\n },\n }),\n retry({ delay: 5000 }),\n repeat({ delay: 86400_000 }),\n shareReplay(1),\n);\n\ncreateSQLWriter<IProduct>(terminal, {\n tableName: 'product',\n data$: product$,\n writeInterval: 1000,\n keyFn: (x) => encodePath(x.datasource_id, x.product_id),\n conflictKeys: ['datasource_id', 'product_id'],\n});\n\nfuturesProducts$.subscribe();\n\nconst mapProductIdToFuturesProduct$ = futuresProducts$.pipe(\n //\n map((products) => new Map(products.map((v) => [v.product_id, v]))),\n shareReplay(1),\n);\n"]}
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../src/product.ts"],"names":[],"mappings":";;;AACA,qCAA8C;AAC9C,yCAAuD;AACvD,+BAAqG;AACrG,+BAA+B;AAC/B,yCAAsC;AAEtC,MAAM,QAAQ,GAAG,IAAI,cAAO,EAAY,CAAC;AAE5B,QAAA,kBAAkB,GAAG,IAAA,YAAK,EAAC,KAAK,IAAI,EAAE;IACjD,MAAM,GAAG,GAAG,MAAM,YAAM,CAAC,gBAAgB,EAAE,CAAC;IAC5C,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC,CAAC,CAAC,IAAI,CACL,IAAA,aAAM,EAAC,EAAE,KAAK,EAAE,IAAK,EAAE,CAAC,EACxB,IAAA,YAAK,EAAC,EAAE,KAAK,EAAE,KAAM,EAAE,CAAC,EACxB,IAAA,eAAQ,EAAC,CAAC,CAAC,EAAE,EAAE,CACb,IAAA,WAAI,EAAC,CAAC,CAAC,CAAC,IAAI,CACV,IAAA,UAAG,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAU,CAAC,EAClC,IAAA,cAAO,GAAE,EACT,IAAA,UAAG,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CACvB,CACF,EACD,IAAA,kBAAW,EAAC,CAAC,CAAC,CACf,CAAC;AAEF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AAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF,CAAC,EACF,IAAA,YAAK,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EACtB,IAAA,aAAM,EAAC,EAAE,KAAK,EAAE,QAAS,EAAE,CAAC,EAC5B,IAAA,kBAAW,EAAC,CAAC,CAAC,CACf,CAAC;AAEF,IAAA,qBAAe,EAAW,mBAAQ,EAAE;IAClC,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,QAAQ;IACf,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC;CAC9C,CAAC,CAAC;AAEH,gBAAgB,CAAC,SAAS,EAAE,CAAC;AAE7B,MAAM,6BAA6B,GAAG,gBAAgB,CAAC,IAAI;AACzD,EAAE;AACF,IAAA,UAAG,EAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAClE,IAAA,kBAAW,EAAC,CAAC,CAAC,CACf,CAAC","sourcesContent":["import { IProduct } from '@yuants/data-product';\nimport { createSQLWriter } from '@yuants/sql';\nimport { encodePath, formatTime } from '@yuants/utils';\nimport { defer, from, map, mergeMap, repeat, retry, shareReplay, Subject, tap, toArray } from 'rxjs';\nimport { client } from './api';\nimport { terminal } from './terminal';\n\nconst product$ = new Subject<IProduct>();\n\nexport const mapSymbolToMarket$ = defer(async () => {\n const res = await client.getFuturesMarket();\n if (res.code !== 0) {\n throw new Error(res.message);\n }\n return res.data;\n}).pipe(\n repeat({ delay: 1_000 }),\n retry({ delay: 30_000 }),\n mergeMap((x) =>\n from(x).pipe(\n map((v) => [v.market, v] as const),\n toArray(),\n map((v) => new Map(v)),\n ),\n ),\n shareReplay(1),\n);\n\nconst futuresProducts$ = defer(async () => {\n const res = await client.getFuturesMarket();\n if (res.code !== 0) {\n throw new Error(res.message);\n }\n\n const futures = res.data.map(\n (item): IProduct => ({\n datasource_id: 'COINEX',\n product_id: encodePath('SWAP', item.market),\n quote_currency: item.quote_ccy,\n base_currency: item.base_ccy,\n price_step: Number(item.quote_ccy_precision),\n // FIXME: volume_step, value_scale\n volume_step: 1,\n value_scale: 1,\n name: '',\n value_scale_unit: '',\n margin_rate: 0,\n value_based_cost: 0,\n volume_based_cost: 0,\n max_position: 0,\n max_volume: 0,\n allow_long: true,\n allow_short: true,\n }),\n );\n return futures;\n}).pipe(\n tap((list) => {\n list.forEach((v) => product$.next(v));\n }),\n tap({\n error: (e) => {\n console.error(formatTime(Date.now()), 'FuturesProducts', e);\n },\n }),\n retry({ delay: 5000 }),\n repeat({ delay: 86400_000 }),\n shareReplay(1),\n);\n\ncreateSQLWriter<IProduct>(terminal, {\n tableName: 'product',\n data$: product$,\n writeInterval: 1000,\n conflictKeys: ['datasource_id', 'product_id'],\n});\n\nfuturesProducts$.subscribe();\n\nconst mapProductIdToFuturesProduct$ = futuresProducts$.pipe(\n //\n map((products) => new Map(products.map((v) => [v.product_id, v]))),\n shareReplay(1),\n);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuants/vendor-coinex",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "main": "lib/index.js",
5
5
  "bin": "lib/cli.js",
6
6
  "module": "dist/index.js",
@@ -10,13 +10,13 @@
10
10
  "temp"
11
11
  ],
12
12
  "dependencies": {
13
- "@yuants/protocol": "0.39.1",
14
- "@yuants/transfer": "0.2.8",
13
+ "@yuants/protocol": "0.40.0",
14
+ "@yuants/transfer": "0.2.10",
15
15
  "@yuants/utils": "0.7.1",
16
- "@yuants/sql": "0.8.7",
17
- "@yuants/data-series": "0.3.20",
18
- "@yuants/data-product": "0.2.9",
19
- "@yuants/data-interest-rate": "0.1.17",
16
+ "@yuants/sql": "0.9.1",
17
+ "@yuants/data-series": "0.3.22",
18
+ "@yuants/data-product": "0.2.11",
19
+ "@yuants/data-interest-rate": "0.1.19",
20
20
  "rxjs": "~7.5.6",
21
21
  "crypto-js": "^4.2.0"
22
22
  },
package/temp/image-tag CHANGED
@@ -1 +1 @@
1
- sha-b2fa75fd4792736785002b93bf677498dbff391c
1
+ sha-9ea54d4ceb2d34e73bd4aa22361452336a3b355c
@@ -1,29 +1,29 @@
1
1
  {
2
- "apps/vendor-coinex/CHANGELOG.json": "eff603be4cb630c39daf61ea1753f0c9037077ac",
3
- "apps/vendor-coinex/CHANGELOG.md": "33905ab0939a20dbe696d4a625a4840cafb3e301",
2
+ "apps/vendor-coinex/CHANGELOG.json": "008ed358a65eaba57b97e0463f261d040d68d310",
3
+ "apps/vendor-coinex/CHANGELOG.md": "fd60b747616813d97a243afec409e45393b760cf",
4
4
  "apps/vendor-coinex/api-extractor.json": "62f4fd324425b9a235f0c117975967aab09ced0c",
5
5
  "apps/vendor-coinex/build/Dockerfile": "8337903e3366ea6c13f1396269c082b8cb5dd96b",
6
6
  "apps/vendor-coinex/config/jest.config.json": "4bb17bde3ee911163a3edb36a6eb71491d80b1bd",
7
7
  "apps/vendor-coinex/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
8
8
  "apps/vendor-coinex/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
9
9
  "apps/vendor-coinex/etc/vendor-coinex.api.md": "33941b70ac7469421ff8fb8c157181014a0ea655",
10
- "apps/vendor-coinex/package.json": "0cf94de5597a0a6a97bcd4be1210c11239178658",
10
+ "apps/vendor-coinex/package.json": "c1d335e9d836d2153fbc64f70783236d7f8bc27f",
11
11
  "apps/vendor-coinex/src/api.ts": "5dc2027855a6f71ff98f88ad2329abeef40593fb",
12
12
  "apps/vendor-coinex/src/cli.ts": "9bf6b5559a6c6f33da20e74cc6c5d702c60ec891",
13
13
  "apps/vendor-coinex/src/extension.ts": "0a560546d341acebb59b1703be89c19fc2111a8b",
14
14
  "apps/vendor-coinex/src/index.ts": "1839b7a344b0f693f8e835f048a0bf6a69f5ff60",
15
15
  "apps/vendor-coinex/src/interest_rate.ts": "e085bb282420c139fd541f7fa8fb9a676121382f",
16
- "apps/vendor-coinex/src/product.ts": "415c59cf5fa9f56fae7b75978eb6b5b35e21748f",
16
+ "apps/vendor-coinex/src/product.ts": "220942cd49f2ca1846edab7708dc089d443591b1",
17
17
  "apps/vendor-coinex/src/terminal.ts": "04776a178d253a2e53f9c84c802e80f67aa9179b",
18
18
  "apps/vendor-coinex/tsconfig.json": "81da8f78196974b5d15da0edb6b2d9f48641063c",
19
19
  "apps/vendor-coinex/.rush/temp/shrinkwrap-deps.json": "65091c107a6149901dadc3fa1a7717446ce94f99",
20
- "libraries/protocol/temp/package-deps.json": "9dd08f362a18e682103da293f1644d0be511dccb",
21
- "libraries/transfer/temp/package-deps.json": "a81e87872e38481e5212939ab0efde33b7fc5ac2",
20
+ "libraries/protocol/temp/package-deps.json": "6b919a484f6489b76ff4a4ffdf17194656d51277",
21
+ "libraries/transfer/temp/package-deps.json": "c35fca5d448618f494529a9d41d880dd8bdd352b",
22
22
  "libraries/utils/temp/package-deps.json": "a8bc223d16ba49e526dfa5dff4b12043b9d69797",
23
- "libraries/sql/temp/package-deps.json": "f48e0ab5231bd2b5cb46f1ea81127b9f52bce805",
24
- "libraries/data-series/temp/package-deps.json": "119eb9cf5b6f73069f0dd51407b2d11d71d5c1df",
25
- "libraries/data-product/temp/package-deps.json": "88aa98e55a065c53676aeb4a3c7fde8b818027a3",
26
- "libraries/data-interest-rate/temp/package-deps.json": "43b8aedd1f0b1e9d21a506acc63c62e9aeb7cf4b",
23
+ "libraries/sql/temp/package-deps.json": "25fea7d3e4db08ddd368e1f74bc90a5c4fc94ef2",
24
+ "libraries/data-series/temp/package-deps.json": "575976ec47f2a71b3dd16ec6699e9883e3fa5430",
25
+ "libraries/data-product/temp/package-deps.json": "45406853ecaabc65c242e5fcfefb006189dd5f79",
26
+ "libraries/data-interest-rate/temp/package-deps.json": "9d7e1c3c9e2c094a945a2da46965318e85d4a24d",
27
27
  "libraries/extension/temp/package-deps.json": "ab7027477e102e1ee21a68d54473d801d4430c98",
28
28
  "tools/toolkit/temp/package-deps.json": "3bef053db16659f0cdaceea64c8a8580c0131633"
29
29
  }