@yuants/vendor-aster 0.8.4 → 0.9.0
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/api/public-api.js +19 -3
- package/dist/api/public-api.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/services/interest-rate-service.js +37 -0
- package/dist/services/interest-rate-service.js.map +1 -0
- package/dist/services/ohlc-service.js +103 -0
- package/dist/services/ohlc-service.js.map +1 -0
- package/lib/api/public-api.d.ts +45 -4
- package/lib/api/public-api.d.ts.map +1 -1
- package/lib/api/public-api.js +20 -4
- package/lib/api/public-api.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/services/interest-rate-service.d.ts +2 -0
- package/lib/services/interest-rate-service.d.ts.map +1 -0
- package/lib/services/interest-rate-service.js +39 -0
- package/lib/services/interest-rate-service.js.map +1 -0
- package/lib/services/ohlc-service.d.ts +2 -0
- package/lib/services/ohlc-service.d.ts.map +1 -0
- package/lib/services/ohlc-service.js +105 -0
- package/lib/services/ohlc-service.js.map +1 -0
- package/package.json +2 -2
- package/temp/package-deps.json +8 -6
package/dist/api/public-api.js
CHANGED
|
@@ -11,10 +11,11 @@ const request = async (method, baseUrl, endpoint, params = {}) => {
|
|
|
11
11
|
}
|
|
12
12
|
console.info(url.toString());
|
|
13
13
|
MetricsAsterApiCallCounter.labels({ path: url.pathname, terminal_id: terminal.terminal_id }).inc();
|
|
14
|
-
const res = await fetch(url.toString(), {
|
|
14
|
+
const res = (await fetch(url.toString(), {
|
|
15
15
|
method,
|
|
16
|
-
}).then((response) => response.json());
|
|
17
|
-
|
|
16
|
+
}).then((response) => response.json()));
|
|
17
|
+
const maybeError = res;
|
|
18
|
+
if (typeof maybeError.code === 'number' && maybeError.code !== 0) {
|
|
18
19
|
throw JSON.stringify(res);
|
|
19
20
|
}
|
|
20
21
|
return res;
|
|
@@ -57,4 +58,19 @@ export const getFApiV1TickerPrice = createFutureApi('GET', '/fapi/v1/ticker/pric
|
|
|
57
58
|
* https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md
|
|
58
59
|
*/
|
|
59
60
|
export const getFApiV1PremiumIndex = createFutureApi('GET', '/fapi/v1/premiumIndex');
|
|
61
|
+
/**
|
|
62
|
+
* 获取 K 线
|
|
63
|
+
*
|
|
64
|
+
* 参考 Binance 风格接口:/fapi/v1/klines
|
|
65
|
+
* https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#k%E7%BA%BF%E6%95%B0%E6%8D%AE
|
|
66
|
+
*/
|
|
67
|
+
export const getFApiV1Klines = createFutureApi('GET', '/fapi/v1/klines');
|
|
68
|
+
/**
|
|
69
|
+
* 获取现货 K 线
|
|
70
|
+
*
|
|
71
|
+
* 参考 Binance 风格接口:/api/v1/klines
|
|
72
|
+
*
|
|
73
|
+
* https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api_CN.md
|
|
74
|
+
*/
|
|
75
|
+
export const getApiV1Klines = createSpotApi('GET', '/api/v1/klines');
|
|
60
76
|
//# sourceMappingURL=public-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEtE,MAAM,0BAA0B,GAAG,wBAAwB,CAAC,OAAO,CACjE,gBAAgB,EAChB,0BAA0B,CAC3B,CAAC;AACF,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AACxC,MAAM,OAAO,GAAG,KAAK,EACnB,MAAc,EACd,OAAe,EACf,QAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,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AAC;AAClB,CAAC,CAAC;AAEF,MAAM,SAAS,GACb,CAAC,OAAe,EAAE,EAAE,CACpB,CAA6C,MAAc,EAAE,QAAgB,EAAE,EAAE,CACjF,CAAC,MAAY,EAAE,EAAE,CACf,OAAO,CAAO,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAErD,MAAM,eAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC,CAAC;AAC/D,MAAM,aAAa,GAAG,SAAS,CAAC,2BAA2B,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAYjD,KAAK,EAAE,sBAAsB,CAAC,CAAC;AA2BjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAClD,KAAK,EACL,uBAAuB,CACxB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC/C,KAAK,EACL,sBAAsB,CACvB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CASlD,KAAK,EAAE,uBAAuB,CAAC,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAOjD,KAAK,EAAE,uBAAuB,CAAC,CAAC;AAElC;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAwBlD,KAAK,EAAE,uBAAuB,CAAC,CAAC;AAiBlC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAS5C,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAE5B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CASzC,KAAK,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { GlobalPrometheusRegistry, Terminal } from '@yuants/protocol';\n\nconst MetricsAsterApiCallCounter = GlobalPrometheusRegistry.counter(\n 'aster_api_call',\n 'Number of aster api call',\n);\nconst terminal = Terminal.fromNodeEnv();\nconst request = async <T>(\n method: string,\n baseUrl: string,\n endpoint: string,\n params: Record<string, unknown> = {},\n): Promise<T> => {\n const url = new URL(baseUrl);\n url.pathname = endpoint;\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n url.searchParams.set(key, `${value}`);\n }\n\n console.info(url.toString());\n MetricsAsterApiCallCounter.labels({ path: url.pathname, terminal_id: terminal.terminal_id }).inc();\n const res = (await fetch(url.toString(), {\n method,\n }).then((response) => response.json())) as unknown;\n\n const maybeError = res as { code?: number };\n if (typeof maybeError.code === 'number' && maybeError.code !== 0) {\n throw JSON.stringify(res);\n }\n return res as T;\n};\n\nconst createApi =\n (baseUrl: string) =>\n <TReq extends Record<string, unknown>, TRes>(method: string, endpoint: string) =>\n (params: TReq) =>\n request<TRes>(method, baseUrl, endpoint, params);\n\nconst createFutureApi = createApi('https://fapi.asterdex.com');\nconst createSpotApi = createApi('https://sapi.asterdex.com');\n\n/**\n * 获取资金费率历史\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#%E6%9F%A5%E8%AF%A2%E8%B5%84%E9%87%91%E8%B4%B9%E7%8E%87%E5%8E%86%E5%8F%B2\n */\nexport const getFApiV1FundingRate = createFutureApi<\n {\n symbol?: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n },\n {\n symbol: string;\n fundingRate: string;\n fundingTime: number;\n }[]\n>('GET', '/fapi/v1/fundingRate');\n\nexport interface IAsterRateLimit {\n rateLimitType?: string;\n interval?: string;\n intervalNum?: number;\n limit?: number;\n}\n\nexport interface IAsterExchangeInfo {\n symbols: {\n symbol: string;\n status: 'TRADING' | 'BREAK' | 'HALT';\n baseAsset: string;\n quoteAsset: string;\n pricePrecision: number;\n quantityPrecision: number;\n baseAssetPrecision: number;\n quotePrecision: number;\n filters: {\n filterType: string;\n [key: string]: unknown;\n }[];\n }[];\n rateLimits?: IAsterRateLimit[];\n}\n\n/**\n * 获取交易对信息\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#%E4%BA%A4%E6%98%93%E5%AF%B9%E4%BF%A1%E6%81%AF\n */\nexport const getFApiV1ExchangeInfo = createFutureApi<Record<string, never>, IAsterExchangeInfo>(\n 'GET',\n '/fapi/v1/exchangeInfo',\n);\n\n/**\n * 获取现货交易对信息\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api_CN.md#L1080-L1145\n */\nexport const getApiV1ExchangeInfo = createSpotApi<Record<string, never>, IAsterExchangeInfo>(\n 'GET',\n '/api/v1/exchangeInfo',\n);\n\n/**\n * 获取未平仓合约数量\n *\n * 无 API 文档 (weird)\n */\nexport const getFApiV1OpenInterest = createFutureApi<\n {\n symbol: string;\n },\n {\n symbol: string;\n openInterest: string;\n time: number;\n }\n>('GET', '/fapi/v1/openInterest');\n\n/**\n * 获取最新价格\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#%E6%9C%80%E6%96%B0%E4%BB%B7%E6%A0%BC\n */\nexport const getFApiV1TickerPrice = createFutureApi<\n Record<string, never>,\n {\n symbol: string;\n price: string;\n time?: number;\n }[]\n>('GET', '/fapi/v1/ticker/price');\n\n/**\n * 获取资金费率\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md\n */\nexport const getFApiV1PremiumIndex = createFutureApi<\n {\n symbol?: string;\n },\n | {\n symbol: string; // 交易对\n markPrice: string; // 标记价格\n indexPrice: string; // 指数价格\n estimatedSettlePrice: string; // 预估结算价,仅在交割开始前最后一小时有意义\n lastFundingRate: string; // 最近更新的资金费率\n nextFundingTime: number; // 下次资金费时间\n interestRate: string; // 标的资产基础利率\n time: number; // 更新时间\n }\n | {\n symbol: string; // 交易对\n markPrice: string; // 标记价格\n indexPrice: string; // 指数价格\n estimatedSettlePrice: string; // 预估结算价,仅在交割开始前最后一小时有意义\n lastFundingRate: string; // 最近更新的资金费率\n nextFundingTime: number; // 下次资金费时间\n interestRate: string; // 标的资产基础利率\n time: number; // 更新时间\n }[]\n>('GET', '/fapi/v1/premiumIndex');\n\nexport interface IAsterKline extends Array<string | number> {\n 0: number; // Open time\n 1: string; // Open\n 2: string; // High\n 3: string; // Low\n 4: string; // Close\n 5: string; // Volume\n 6: number; // Close time\n 7: string; // Quote asset volume\n 8: number; // Number of trades\n 9: string; // Taker buy base asset volume\n 10: string; // Taker buy quote asset volume\n 11: string; // Ignore\n}\n\n/**\n * 获取 K 线\n *\n * 参考 Binance 风格接口:/fapi/v1/klines\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#k%E7%BA%BF%E6%95%B0%E6%8D%AE\n */\nexport const getFApiV1Klines = createFutureApi<\n {\n symbol: string;\n interval: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n },\n IAsterKline[]\n>('GET', '/fapi/v1/klines');\n\n/**\n * 获取现货 K 线\n *\n * 参考 Binance 风格接口:/api/v1/klines\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api_CN.md\n */\nexport const getApiV1Klines = createSpotApi<\n {\n symbol: string;\n interval: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n },\n IAsterKline[]\n>('GET', '/api/v1/klines');\n"]}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC","sourcesContent":["import './services/markets/interest_rate';\nimport './services/markets/product';\nimport './services/markets/quote';\nimport './services/exchange';\nimport './services/quotes';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kCAAkC,CAAC","sourcesContent":["import './services/markets/interest_rate';\nimport './services/markets/product';\nimport './services/markets/quote';\nimport './services/exchange';\nimport './services/quotes';\nimport './services/ohlc-service';\nimport './services/interest-rate-service';\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { provideInterestRateService } from '@yuants/exchange';
|
|
2
|
+
import { Terminal } from '@yuants/protocol';
|
|
3
|
+
import { decodePath, formatTime } from '@yuants/utils';
|
|
4
|
+
import { getFApiV1FundingRate } from '../api/public-api';
|
|
5
|
+
const terminal = Terminal.fromNodeEnv();
|
|
6
|
+
const WINDOW_MS = 365 * 24 * 3600000;
|
|
7
|
+
const fetchFundingRateForward = async (req) => {
|
|
8
|
+
const [, instType, symbol] = decodePath(req.product_id);
|
|
9
|
+
if (instType !== 'PERP' || !symbol)
|
|
10
|
+
throw new Error(`Unsupported product_id: ${req.product_id}`);
|
|
11
|
+
const startTime = req.time;
|
|
12
|
+
const res = await getFApiV1FundingRate({
|
|
13
|
+
symbol,
|
|
14
|
+
startTime,
|
|
15
|
+
endTime: startTime + WINDOW_MS,
|
|
16
|
+
limit: 1000,
|
|
17
|
+
});
|
|
18
|
+
return (res !== null && res !== void 0 ? res : [])
|
|
19
|
+
.map((item) => {
|
|
20
|
+
const rate = Number(item.fundingRate);
|
|
21
|
+
return {
|
|
22
|
+
series_id: req.series_id,
|
|
23
|
+
product_id: req.product_id,
|
|
24
|
+
datasource_id: 'ASTER',
|
|
25
|
+
created_at: formatTime(item.fundingTime),
|
|
26
|
+
long_rate: `${-rate}`,
|
|
27
|
+
short_rate: `${rate}`,
|
|
28
|
+
settlement_price: '',
|
|
29
|
+
};
|
|
30
|
+
})
|
|
31
|
+
.filter((x) => Date.parse(x.created_at) >= startTime);
|
|
32
|
+
};
|
|
33
|
+
provideInterestRateService(terminal, {
|
|
34
|
+
product_id_prefix: 'ASTER/PERP/',
|
|
35
|
+
direction: 'forward',
|
|
36
|
+
}, fetchFundingRateForward);
|
|
37
|
+
//# sourceMappingURL=interest-rate-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interest-rate-service.js","sourceRoot":"","sources":["../../src/services/interest-rate-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,MAAM,SAAS,GAAG,GAAG,GAAG,EAAE,GAAG,OAAQ,CAAC;AAEtC,MAAM,uBAAuB,GAAG,KAAK,EAAE,GAItC,EAA4B,EAAE;IAC7B,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxD,IAAI,QAAQ,KAAK,MAAM,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IAEjG,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC;QACrC,MAAM;QACN,SAAS;QACT,OAAO,EAAE,SAAS,GAAG,SAAS;QAC9B,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAiB,EAAE;QAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACtC,OAAO;YACL,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,aAAa,EAAE,OAAO;YACtB,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC;YACxC,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE;YACrB,UAAU,EAAE,GAAG,IAAI,EAAE;YACrB,gBAAgB,EAAE,EAAE;SACrB,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,0BAA0B,CACxB,QAAQ,EACR;IACE,iBAAiB,EAAE,aAAa;IAChC,SAAS,EAAE,SAAS;CACrB,EACD,uBAAuB,CACxB,CAAC","sourcesContent":["import { provideInterestRateService } from '@yuants/exchange';\nimport { IInterestRate } from '@yuants/data-interest-rate';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, formatTime } from '@yuants/utils';\nimport { getFApiV1FundingRate } from '../api/public-api';\n\nconst terminal = Terminal.fromNodeEnv();\n\nconst WINDOW_MS = 365 * 24 * 3600_000;\n\nconst fetchFundingRateForward = async (req: {\n product_id: string;\n time: number;\n series_id: string;\n}): Promise<IInterestRate[]> => {\n const [, instType, symbol] = decodePath(req.product_id);\n if (instType !== 'PERP' || !symbol) throw new Error(`Unsupported product_id: ${req.product_id}`);\n\n const startTime = req.time;\n const res = await getFApiV1FundingRate({\n symbol,\n startTime,\n endTime: startTime + WINDOW_MS,\n limit: 1000,\n });\n\n return (res ?? [])\n .map((item): IInterestRate => {\n const rate = Number(item.fundingRate);\n return {\n series_id: req.series_id,\n product_id: req.product_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 .filter((x) => Date.parse(x.created_at) >= startTime);\n};\n\nprovideInterestRateService(\n terminal,\n {\n product_id_prefix: 'ASTER/PERP/',\n direction: 'forward',\n },\n fetchFundingRateForward,\n);\n"]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { provideOHLCService } from '@yuants/exchange';
|
|
2
|
+
import { Terminal } from '@yuants/protocol';
|
|
3
|
+
import { convertDurationToOffset, decodePath, formatTime } from '@yuants/utils';
|
|
4
|
+
import { getApiV1Klines, getFApiV1Klines } from '../api/public-api';
|
|
5
|
+
const terminal = Terminal.fromNodeEnv();
|
|
6
|
+
const DURATION_TO_INTERVAL = {
|
|
7
|
+
PT1M: '1m',
|
|
8
|
+
PT3M: '3m',
|
|
9
|
+
PT5M: '5m',
|
|
10
|
+
PT15M: '15m',
|
|
11
|
+
PT30M: '30m',
|
|
12
|
+
PT1H: '1h',
|
|
13
|
+
PT2H: '2h',
|
|
14
|
+
PT4H: '4h',
|
|
15
|
+
PT6H: '6h',
|
|
16
|
+
PT8H: '8h',
|
|
17
|
+
PT12H: '12h',
|
|
18
|
+
P1D: '1d',
|
|
19
|
+
P3D: '3d',
|
|
20
|
+
P1W: '1w',
|
|
21
|
+
P1M: '1M',
|
|
22
|
+
};
|
|
23
|
+
const fetchOHLCPageBackward = async (req) => {
|
|
24
|
+
const [, instType, symbol] = decodePath(req.product_id);
|
|
25
|
+
if (instType !== 'PERP' || !symbol)
|
|
26
|
+
throw new Error(`Unsupported product_id: ${req.product_id}`);
|
|
27
|
+
const interval = DURATION_TO_INTERVAL[req.duration];
|
|
28
|
+
if (!interval)
|
|
29
|
+
throw new Error(`Unsupported duration: ${req.duration}`);
|
|
30
|
+
const endedAtMs = req.time;
|
|
31
|
+
const offset = convertDurationToOffset(req.duration);
|
|
32
|
+
const res = await getFApiV1Klines({
|
|
33
|
+
symbol,
|
|
34
|
+
interval,
|
|
35
|
+
endTime: endedAtMs,
|
|
36
|
+
limit: 1000,
|
|
37
|
+
});
|
|
38
|
+
return (res !== null && res !== void 0 ? res : [])
|
|
39
|
+
.map((k) => {
|
|
40
|
+
const openTimeMs = Number(k[0]);
|
|
41
|
+
return {
|
|
42
|
+
series_id: req.series_id,
|
|
43
|
+
datasource_id: 'ASTER',
|
|
44
|
+
product_id: req.product_id,
|
|
45
|
+
duration: req.duration,
|
|
46
|
+
created_at: formatTime(openTimeMs),
|
|
47
|
+
closed_at: formatTime(openTimeMs + offset),
|
|
48
|
+
open: `${k[1]}`,
|
|
49
|
+
high: `${k[2]}`,
|
|
50
|
+
low: `${k[3]}`,
|
|
51
|
+
close: `${k[4]}`,
|
|
52
|
+
volume: `${k[5]}`,
|
|
53
|
+
open_interest: '0',
|
|
54
|
+
};
|
|
55
|
+
})
|
|
56
|
+
.filter((x) => Date.parse(x.created_at) < endedAtMs);
|
|
57
|
+
};
|
|
58
|
+
const fetchSpotOHLCPageBackward = async (req) => {
|
|
59
|
+
const [, instType, symbol] = decodePath(req.product_id);
|
|
60
|
+
if (instType !== 'SPOT' || !symbol)
|
|
61
|
+
throw new Error(`Unsupported product_id: ${req.product_id}`);
|
|
62
|
+
const interval = DURATION_TO_INTERVAL[req.duration];
|
|
63
|
+
if (!interval)
|
|
64
|
+
throw new Error(`Unsupported duration: ${req.duration}`);
|
|
65
|
+
const endedAtMs = req.time;
|
|
66
|
+
const offset = convertDurationToOffset(req.duration);
|
|
67
|
+
const res = await getApiV1Klines({
|
|
68
|
+
symbol,
|
|
69
|
+
interval,
|
|
70
|
+
endTime: endedAtMs,
|
|
71
|
+
limit: 1000,
|
|
72
|
+
});
|
|
73
|
+
return (res !== null && res !== void 0 ? res : [])
|
|
74
|
+
.map((k) => {
|
|
75
|
+
const openTimeMs = Number(k[0]);
|
|
76
|
+
return {
|
|
77
|
+
series_id: req.series_id,
|
|
78
|
+
datasource_id: 'ASTER',
|
|
79
|
+
product_id: req.product_id,
|
|
80
|
+
duration: req.duration,
|
|
81
|
+
created_at: formatTime(openTimeMs),
|
|
82
|
+
closed_at: formatTime(openTimeMs + offset),
|
|
83
|
+
open: `${k[1]}`,
|
|
84
|
+
high: `${k[2]}`,
|
|
85
|
+
low: `${k[3]}`,
|
|
86
|
+
close: `${k[4]}`,
|
|
87
|
+
volume: `${k[5]}`,
|
|
88
|
+
open_interest: '0',
|
|
89
|
+
};
|
|
90
|
+
})
|
|
91
|
+
.filter((x) => Date.parse(x.created_at) < endedAtMs);
|
|
92
|
+
};
|
|
93
|
+
provideOHLCService(terminal, {
|
|
94
|
+
product_id_prefix: 'ASTER/PERP/',
|
|
95
|
+
duration_list: Object.keys(DURATION_TO_INTERVAL),
|
|
96
|
+
direction: 'backward',
|
|
97
|
+
}, fetchOHLCPageBackward);
|
|
98
|
+
provideOHLCService(terminal, {
|
|
99
|
+
product_id_prefix: 'ASTER/SPOT/',
|
|
100
|
+
duration_list: Object.keys(DURATION_TO_INTERVAL),
|
|
101
|
+
direction: 'backward',
|
|
102
|
+
}, fetchSpotOHLCPageBackward);
|
|
103
|
+
//# sourceMappingURL=ohlc-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ohlc-service.js","sourceRoot":"","sources":["../../src/services/ohlc-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpE,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,MAAM,oBAAoB,GAA2B;IACnD,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,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AyB,CAC1B,CAAC","sourcesContent":["import { provideOHLCService } from '@yuants/exchange';\nimport { IOHLC } from '@yuants/data-ohlc';\nimport { Terminal } from '@yuants/protocol';\nimport { convertDurationToOffset, decodePath, formatTime } from '@yuants/utils';\nimport { getApiV1Klines, getFApiV1Klines } from '../api/public-api';\n\nconst terminal = Terminal.fromNodeEnv();\n\nconst DURATION_TO_INTERVAL: Record<string, string> = {\n PT1M: '1m',\n PT3M: '3m',\n PT5M: '5m',\n PT15M: '15m',\n PT30M: '30m',\n PT1H: '1h',\n PT2H: '2h',\n PT4H: '4h',\n PT6H: '6h',\n PT8H: '8h',\n PT12H: '12h',\n P1D: '1d',\n P3D: '3d',\n P1W: '1w',\n P1M: '1M',\n};\n\nconst fetchOHLCPageBackward = async (req: {\n product_id: string;\n duration: string;\n time: number;\n series_id: string;\n}): Promise<IOHLC[]> => {\n const [, instType, symbol] = decodePath(req.product_id);\n if (instType !== 'PERP' || !symbol) throw new Error(`Unsupported product_id: ${req.product_id}`);\n\n const interval = DURATION_TO_INTERVAL[req.duration];\n if (!interval) throw new Error(`Unsupported duration: ${req.duration}`);\n\n const endedAtMs = req.time;\n const offset = convertDurationToOffset(req.duration);\n\n const res = await getFApiV1Klines({\n symbol,\n interval,\n endTime: endedAtMs,\n limit: 1000,\n });\n\n return (res ?? [])\n .map((k): IOHLC => {\n const openTimeMs = Number(k[0]);\n return {\n series_id: req.series_id,\n datasource_id: 'ASTER',\n product_id: req.product_id,\n duration: req.duration,\n created_at: formatTime(openTimeMs),\n closed_at: formatTime(openTimeMs + offset),\n open: `${k[1]}`,\n high: `${k[2]}`,\n low: `${k[3]}`,\n close: `${k[4]}`,\n volume: `${k[5]}`,\n open_interest: '0',\n };\n })\n .filter((x) => Date.parse(x.created_at) < endedAtMs);\n};\n\nconst fetchSpotOHLCPageBackward = async (req: {\n product_id: string;\n duration: string;\n time: number;\n series_id: string;\n}): Promise<IOHLC[]> => {\n const [, instType, symbol] = decodePath(req.product_id);\n if (instType !== 'SPOT' || !symbol) throw new Error(`Unsupported product_id: ${req.product_id}`);\n\n const interval = DURATION_TO_INTERVAL[req.duration];\n if (!interval) throw new Error(`Unsupported duration: ${req.duration}`);\n\n const endedAtMs = req.time;\n const offset = convertDurationToOffset(req.duration);\n\n const res = await getApiV1Klines({\n symbol,\n interval,\n endTime: endedAtMs,\n limit: 1000,\n });\n\n return (res ?? [])\n .map((k): IOHLC => {\n const openTimeMs = Number(k[0]);\n return {\n series_id: req.series_id,\n datasource_id: 'ASTER',\n product_id: req.product_id,\n duration: req.duration,\n created_at: formatTime(openTimeMs),\n closed_at: formatTime(openTimeMs + offset),\n open: `${k[1]}`,\n high: `${k[2]}`,\n low: `${k[3]}`,\n close: `${k[4]}`,\n volume: `${k[5]}`,\n open_interest: '0',\n };\n })\n .filter((x) => Date.parse(x.created_at) < endedAtMs);\n};\n\nprovideOHLCService(\n terminal,\n {\n product_id_prefix: 'ASTER/PERP/',\n duration_list: Object.keys(DURATION_TO_INTERVAL),\n direction: 'backward',\n },\n fetchOHLCPageBackward,\n);\n\nprovideOHLCService(\n terminal,\n {\n product_id_prefix: 'ASTER/SPOT/',\n duration_list: Object.keys(DURATION_TO_INTERVAL),\n direction: 'backward',\n },\n fetchSpotOHLCPageBackward,\n);\n"]}
|
package/lib/api/public-api.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface IAsterExchangeInfo {
|
|
|
31
31
|
quotePrecision: number;
|
|
32
32
|
filters: {
|
|
33
33
|
filterType: string;
|
|
34
|
-
[key: string]:
|
|
34
|
+
[key: string]: unknown;
|
|
35
35
|
}[];
|
|
36
36
|
}[];
|
|
37
37
|
rateLimits?: IAsterRateLimit[];
|
|
@@ -41,13 +41,13 @@ export interface IAsterExchangeInfo {
|
|
|
41
41
|
*
|
|
42
42
|
* https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#%E4%BA%A4%E6%98%93%E5%AF%B9%E4%BF%A1%E6%81%AF
|
|
43
43
|
*/
|
|
44
|
-
export declare const getFApiV1ExchangeInfo: (params:
|
|
44
|
+
export declare const getFApiV1ExchangeInfo: (params: Record<string, never>) => Promise<IAsterExchangeInfo>;
|
|
45
45
|
/**
|
|
46
46
|
* 获取现货交易对信息
|
|
47
47
|
*
|
|
48
48
|
* https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api_CN.md#L1080-L1145
|
|
49
49
|
*/
|
|
50
|
-
export declare const getApiV1ExchangeInfo: (params:
|
|
50
|
+
export declare const getApiV1ExchangeInfo: (params: Record<string, never>) => Promise<IAsterExchangeInfo>;
|
|
51
51
|
/**
|
|
52
52
|
* 获取未平仓合约数量
|
|
53
53
|
*
|
|
@@ -65,7 +65,7 @@ export declare const getFApiV1OpenInterest: (params: {
|
|
|
65
65
|
*
|
|
66
66
|
* https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#%E6%9C%80%E6%96%B0%E4%BB%B7%E6%A0%BC
|
|
67
67
|
*/
|
|
68
|
-
export declare const getFApiV1TickerPrice: (params:
|
|
68
|
+
export declare const getFApiV1TickerPrice: (params: Record<string, never>) => Promise<{
|
|
69
69
|
symbol: string;
|
|
70
70
|
price: string;
|
|
71
71
|
time?: number | undefined;
|
|
@@ -95,4 +95,45 @@ export declare const getFApiV1PremiumIndex: (params: {
|
|
|
95
95
|
interestRate: string;
|
|
96
96
|
time: number;
|
|
97
97
|
}[]>;
|
|
98
|
+
export interface IAsterKline extends Array<string | number> {
|
|
99
|
+
0: number;
|
|
100
|
+
1: string;
|
|
101
|
+
2: string;
|
|
102
|
+
3: string;
|
|
103
|
+
4: string;
|
|
104
|
+
5: string;
|
|
105
|
+
6: number;
|
|
106
|
+
7: string;
|
|
107
|
+
8: number;
|
|
108
|
+
9: string;
|
|
109
|
+
10: string;
|
|
110
|
+
11: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 获取 K 线
|
|
114
|
+
*
|
|
115
|
+
* 参考 Binance 风格接口:/fapi/v1/klines
|
|
116
|
+
* https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#k%E7%BA%BF%E6%95%B0%E6%8D%AE
|
|
117
|
+
*/
|
|
118
|
+
export declare const getFApiV1Klines: (params: {
|
|
119
|
+
symbol: string;
|
|
120
|
+
interval: string;
|
|
121
|
+
startTime?: number | undefined;
|
|
122
|
+
endTime?: number | undefined;
|
|
123
|
+
limit?: number | undefined;
|
|
124
|
+
}) => Promise<IAsterKline[]>;
|
|
125
|
+
/**
|
|
126
|
+
* 获取现货 K 线
|
|
127
|
+
*
|
|
128
|
+
* 参考 Binance 风格接口:/api/v1/klines
|
|
129
|
+
*
|
|
130
|
+
* https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api_CN.md
|
|
131
|
+
*/
|
|
132
|
+
export declare const getApiV1Klines: (params: {
|
|
133
|
+
symbol: string;
|
|
134
|
+
interval: string;
|
|
135
|
+
startTime?: number | undefined;
|
|
136
|
+
endTime?: number | undefined;
|
|
137
|
+
limit?: number | undefined;
|
|
138
|
+
}) => Promise<IAsterKline[]>;
|
|
98
139
|
//# sourceMappingURL=public-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":"AA0CA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;YAQrB,MAAM;iBACD,MAAM;iBACN,MAAM;IAES,CAAC;AAEjC,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,E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MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe;YAEhB,MAAM;cACJ,MAAM;;;;4BAMO,CAAC;AAE5B;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;YAEf,MAAM;cACJ,MAAM;;;;4BAMM,CAAC"}
|
package/lib/api/public-api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFApiV1PremiumIndex = exports.getFApiV1TickerPrice = exports.getFApiV1OpenInterest = exports.getApiV1ExchangeInfo = exports.getFApiV1ExchangeInfo = exports.getFApiV1FundingRate = void 0;
|
|
3
|
+
exports.getApiV1Klines = exports.getFApiV1Klines = exports.getFApiV1PremiumIndex = exports.getFApiV1TickerPrice = exports.getFApiV1OpenInterest = exports.getApiV1ExchangeInfo = exports.getFApiV1ExchangeInfo = exports.getFApiV1FundingRate = void 0;
|
|
4
4
|
const protocol_1 = require("@yuants/protocol");
|
|
5
5
|
const MetricsAsterApiCallCounter = protocol_1.GlobalPrometheusRegistry.counter('aster_api_call', 'Number of aster api call');
|
|
6
6
|
const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
@@ -14,10 +14,11 @@ const request = async (method, baseUrl, endpoint, params = {}) => {
|
|
|
14
14
|
}
|
|
15
15
|
console.info(url.toString());
|
|
16
16
|
MetricsAsterApiCallCounter.labels({ path: url.pathname, terminal_id: terminal.terminal_id }).inc();
|
|
17
|
-
const res = await fetch(url.toString(), {
|
|
17
|
+
const res = (await fetch(url.toString(), {
|
|
18
18
|
method,
|
|
19
|
-
}).then((response) => response.json());
|
|
20
|
-
|
|
19
|
+
}).then((response) => response.json()));
|
|
20
|
+
const maybeError = res;
|
|
21
|
+
if (typeof maybeError.code === 'number' && maybeError.code !== 0) {
|
|
21
22
|
throw JSON.stringify(res);
|
|
22
23
|
}
|
|
23
24
|
return res;
|
|
@@ -60,4 +61,19 @@ exports.getFApiV1TickerPrice = createFutureApi('GET', '/fapi/v1/ticker/price');
|
|
|
60
61
|
* https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md
|
|
61
62
|
*/
|
|
62
63
|
exports.getFApiV1PremiumIndex = createFutureApi('GET', '/fapi/v1/premiumIndex');
|
|
64
|
+
/**
|
|
65
|
+
* 获取 K 线
|
|
66
|
+
*
|
|
67
|
+
* 参考 Binance 风格接口:/fapi/v1/klines
|
|
68
|
+
* https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#k%E7%BA%BF%E6%95%B0%E6%8D%AE
|
|
69
|
+
*/
|
|
70
|
+
exports.getFApiV1Klines = createFutureApi('GET', '/fapi/v1/klines');
|
|
71
|
+
/**
|
|
72
|
+
* 获取现货 K 线
|
|
73
|
+
*
|
|
74
|
+
* 参考 Binance 风格接口:/api/v1/klines
|
|
75
|
+
*
|
|
76
|
+
* https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api_CN.md
|
|
77
|
+
*/
|
|
78
|
+
exports.getApiV1Klines = createSpotApi('GET', '/api/v1/klines');
|
|
63
79
|
//# sourceMappingURL=public-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"mappings":";;;AAAA,+CAAsE;AAEtE,MAAM,0BAA0B,GAAG,mCAAwB,CAAC,OAAO,CACjE,gBAAgB,EAChB,0BAA0B,CAC3B,CAAC;AACF,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AACxC,MAAM,OAAO,GAAG,KAAK,EACnB,MAAc,EACd,OAAe,EACf,QAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../src/api/public-api.ts"],"names":[],"m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CAAC;AAEF,MAAM,SAAS,GACb,CAAC,OAAe,EAAE,EAAE,CACpB,CAA6C,MAAc,EAAE,QAAgB,EAAE,EAAE,CACjF,CAAC,MAAY,EAAE,EAAE,CACf,OAAO,CAAO,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAErD,MAAM,eAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC,CAAC;AAC/D,MAAM,aAAa,GAAG,SAAS,CAAC,2BAA2B,CAAC,CAAC;AAE7D;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,eAAe,CAYjD,KAAK,EAAE,sBAAsB,CAAC,CAAC;AA2BjC;;;;GAIG;AACU,QAAA,qBAAqB,GAAG,eAAe,CAClD,KAAK,EACL,uBAAuB,CACxB,CAAC;AAEF;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,aAAa,CAC/C,KAAK,EACL,sBAAsB,CACvB,CAAC;AAEF;;;;GAIG;AACU,QAAA,qBAAqB,GAAG,eAAe,CASlD,KAAK,EAAE,uBAAuB,CAAC,CAAC;AAElC;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,eAAe,CAOjD,KAAK,EAAE,uBAAuB,CAAC,CAAC;AAElC;;;GAGG;AACU,QAAA,qBAAqB,GAAG,eAAe,CAwBlD,KAAK,EAAE,uBAAuB,CAAC,CAAC;AAiBlC;;;;;GAKG;AACU,QAAA,eAAe,GAAG,eAAe,CAS5C,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAE5B;;;;;;GAMG;AACU,QAAA,cAAc,GAAG,aAAa,CASzC,KAAK,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { GlobalPrometheusRegistry, Terminal } from '@yuants/protocol';\n\nconst MetricsAsterApiCallCounter = GlobalPrometheusRegistry.counter(\n 'aster_api_call',\n 'Number of aster api call',\n);\nconst terminal = Terminal.fromNodeEnv();\nconst request = async <T>(\n method: string,\n baseUrl: string,\n endpoint: string,\n params: Record<string, unknown> = {},\n): Promise<T> => {\n const url = new URL(baseUrl);\n url.pathname = endpoint;\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n url.searchParams.set(key, `${value}`);\n }\n\n console.info(url.toString());\n MetricsAsterApiCallCounter.labels({ path: url.pathname, terminal_id: terminal.terminal_id }).inc();\n const res = (await fetch(url.toString(), {\n method,\n }).then((response) => response.json())) as unknown;\n\n const maybeError = res as { code?: number };\n if (typeof maybeError.code === 'number' && maybeError.code !== 0) {\n throw JSON.stringify(res);\n }\n return res as T;\n};\n\nconst createApi =\n (baseUrl: string) =>\n <TReq extends Record<string, unknown>, TRes>(method: string, endpoint: string) =>\n (params: TReq) =>\n request<TRes>(method, baseUrl, endpoint, params);\n\nconst createFutureApi = createApi('https://fapi.asterdex.com');\nconst createSpotApi = createApi('https://sapi.asterdex.com');\n\n/**\n * 获取资金费率历史\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#%E6%9F%A5%E8%AF%A2%E8%B5%84%E9%87%91%E8%B4%B9%E7%8E%87%E5%8E%86%E5%8F%B2\n */\nexport const getFApiV1FundingRate = createFutureApi<\n {\n symbol?: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n },\n {\n symbol: string;\n fundingRate: string;\n fundingTime: number;\n }[]\n>('GET', '/fapi/v1/fundingRate');\n\nexport interface IAsterRateLimit {\n rateLimitType?: string;\n interval?: string;\n intervalNum?: number;\n limit?: number;\n}\n\nexport interface IAsterExchangeInfo {\n symbols: {\n symbol: string;\n status: 'TRADING' | 'BREAK' | 'HALT';\n baseAsset: string;\n quoteAsset: string;\n pricePrecision: number;\n quantityPrecision: number;\n baseAssetPrecision: number;\n quotePrecision: number;\n filters: {\n filterType: string;\n [key: string]: unknown;\n }[];\n }[];\n rateLimits?: IAsterRateLimit[];\n}\n\n/**\n * 获取交易对信息\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#%E4%BA%A4%E6%98%93%E5%AF%B9%E4%BF%A1%E6%81%AF\n */\nexport const getFApiV1ExchangeInfo = createFutureApi<Record<string, never>, IAsterExchangeInfo>(\n 'GET',\n '/fapi/v1/exchangeInfo',\n);\n\n/**\n * 获取现货交易对信息\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api_CN.md#L1080-L1145\n */\nexport const getApiV1ExchangeInfo = createSpotApi<Record<string, never>, IAsterExchangeInfo>(\n 'GET',\n '/api/v1/exchangeInfo',\n);\n\n/**\n * 获取未平仓合约数量\n *\n * 无 API 文档 (weird)\n */\nexport const getFApiV1OpenInterest = createFutureApi<\n {\n symbol: string;\n },\n {\n symbol: string;\n openInterest: string;\n time: number;\n }\n>('GET', '/fapi/v1/openInterest');\n\n/**\n * 获取最新价格\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#%E6%9C%80%E6%96%B0%E4%BB%B7%E6%A0%BC\n */\nexport const getFApiV1TickerPrice = createFutureApi<\n Record<string, never>,\n {\n symbol: string;\n price: string;\n time?: number;\n }[]\n>('GET', '/fapi/v1/ticker/price');\n\n/**\n * 获取资金费率\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md\n */\nexport const getFApiV1PremiumIndex = createFutureApi<\n {\n symbol?: string;\n },\n | {\n symbol: string; // 交易对\n markPrice: string; // 标记价格\n indexPrice: string; // 指数价格\n estimatedSettlePrice: string; // 预估结算价,仅在交割开始前最后一小时有意义\n lastFundingRate: string; // 最近更新的资金费率\n nextFundingTime: number; // 下次资金费时间\n interestRate: string; // 标的资产基础利率\n time: number; // 更新时间\n }\n | {\n symbol: string; // 交易对\n markPrice: string; // 标记价格\n indexPrice: string; // 指数价格\n estimatedSettlePrice: string; // 预估结算价,仅在交割开始前最后一小时有意义\n lastFundingRate: string; // 最近更新的资金费率\n nextFundingTime: number; // 下次资金费时间\n interestRate: string; // 标的资产基础利率\n time: number; // 更新时间\n }[]\n>('GET', '/fapi/v1/premiumIndex');\n\nexport interface IAsterKline extends Array<string | number> {\n 0: number; // Open time\n 1: string; // Open\n 2: string; // High\n 3: string; // Low\n 4: string; // Close\n 5: string; // Volume\n 6: number; // Close time\n 7: string; // Quote asset volume\n 8: number; // Number of trades\n 9: string; // Taker buy base asset volume\n 10: string; // Taker buy quote asset volume\n 11: string; // Ignore\n}\n\n/**\n * 获取 K 线\n *\n * 参考 Binance 风格接口:/fapi/v1/klines\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api_CN.md#k%E7%BA%BF%E6%95%B0%E6%8D%AE\n */\nexport const getFApiV1Klines = createFutureApi<\n {\n symbol: string;\n interval: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n },\n IAsterKline[]\n>('GET', '/fapi/v1/klines');\n\n/**\n * 获取现货 K 线\n *\n * 参考 Binance 风格接口:/api/v1/klines\n *\n * https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api_CN.md\n */\nexport const getApiV1Klines = createSpotApi<\n {\n symbol: string;\n interval: string;\n startTime?: number;\n endTime?: number;\n limit?: number;\n },\n IAsterKline[]\n>('GET', '/api/v1/klines');\n"]}
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kCAAkC,CAAC"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,4CAA0C;AAC1C,sCAAoC;AACpC,oCAAkC;AAClC,+BAA6B;AAC7B,6BAA2B","sourcesContent":["import './services/markets/interest_rate';\nimport './services/markets/product';\nimport './services/markets/quote';\nimport './services/exchange';\nimport './services/quotes';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,4CAA0C;AAC1C,sCAAoC;AACpC,oCAAkC;AAClC,+BAA6B;AAC7B,6BAA2B;AAC3B,mCAAiC;AACjC,4CAA0C","sourcesContent":["import './services/markets/interest_rate';\nimport './services/markets/product';\nimport './services/markets/quote';\nimport './services/exchange';\nimport './services/quotes';\nimport './services/ohlc-service';\nimport './services/interest-rate-service';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interest-rate-service.d.ts","sourceRoot":"","sources":["../../src/services/interest-rate-service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const exchange_1 = require("@yuants/exchange");
|
|
4
|
+
const protocol_1 = require("@yuants/protocol");
|
|
5
|
+
const utils_1 = require("@yuants/utils");
|
|
6
|
+
const public_api_1 = require("../api/public-api");
|
|
7
|
+
const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
8
|
+
const WINDOW_MS = 365 * 24 * 3600000;
|
|
9
|
+
const fetchFundingRateForward = async (req) => {
|
|
10
|
+
const [, instType, symbol] = (0, utils_1.decodePath)(req.product_id);
|
|
11
|
+
if (instType !== 'PERP' || !symbol)
|
|
12
|
+
throw new Error(`Unsupported product_id: ${req.product_id}`);
|
|
13
|
+
const startTime = req.time;
|
|
14
|
+
const res = await (0, public_api_1.getFApiV1FundingRate)({
|
|
15
|
+
symbol,
|
|
16
|
+
startTime,
|
|
17
|
+
endTime: startTime + WINDOW_MS,
|
|
18
|
+
limit: 1000,
|
|
19
|
+
});
|
|
20
|
+
return (res !== null && res !== void 0 ? res : [])
|
|
21
|
+
.map((item) => {
|
|
22
|
+
const rate = Number(item.fundingRate);
|
|
23
|
+
return {
|
|
24
|
+
series_id: req.series_id,
|
|
25
|
+
product_id: req.product_id,
|
|
26
|
+
datasource_id: 'ASTER',
|
|
27
|
+
created_at: (0, utils_1.formatTime)(item.fundingTime),
|
|
28
|
+
long_rate: `${-rate}`,
|
|
29
|
+
short_rate: `${rate}`,
|
|
30
|
+
settlement_price: '',
|
|
31
|
+
};
|
|
32
|
+
})
|
|
33
|
+
.filter((x) => Date.parse(x.created_at) >= startTime);
|
|
34
|
+
};
|
|
35
|
+
(0, exchange_1.provideInterestRateService)(terminal, {
|
|
36
|
+
product_id_prefix: 'ASTER/PERP/',
|
|
37
|
+
direction: 'forward',
|
|
38
|
+
}, fetchFundingRateForward);
|
|
39
|
+
//# sourceMappingURL=interest-rate-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interest-rate-service.js","sourceRoot":"","sources":["../../src/services/interest-rate-service.ts"],"names":[],"mappings":";;AAAA,+CAA8D;AAE9D,+CAA4C;AAC5C,yCAAuD;AACvD,kDAAyD;AAEzD,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,MAAM,SAAS,GAAG,GAAG,GAAG,EAAE,GAAG,OAAQ,CAAC;AAEtC,MAAM,uBAAuB,GAAG,KAAK,EAAE,GAItC,EAA4B,EAAE;IAC7B,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAA,kBAAU,EAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxD,IAAI,QAAQ,KAAK,MAAM,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IAEjG,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,IAAA,iCAAoB,EAAC;QACrC,MAAM;QACN,SAAS;QACT,OAAO,EAAE,SAAS,GAAG,SAAS;QAC9B,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAiB,EAAE;QAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACtC,OAAO;YACL,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,aAAa,EAAE,OAAO;YACtB,UAAU,EAAE,IAAA,kBAAU,EAAC,IAAI,CAAC,WAAW,CAAC;YACxC,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE;YACrB,UAAU,EAAE,GAAG,IAAI,EAAE;YACrB,gBAAgB,EAAE,EAAE;SACrB,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,IAAA,qCAA0B,EACxB,QAAQ,EACR;IACE,iBAAiB,EAAE,aAAa;IAChC,SAAS,EAAE,SAAS;CACrB,EACD,uBAAuB,CACxB,CAAC","sourcesContent":["import { provideInterestRateService } from '@yuants/exchange';\nimport { IInterestRate } from '@yuants/data-interest-rate';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, formatTime } from '@yuants/utils';\nimport { getFApiV1FundingRate } from '../api/public-api';\n\nconst terminal = Terminal.fromNodeEnv();\n\nconst WINDOW_MS = 365 * 24 * 3600_000;\n\nconst fetchFundingRateForward = async (req: {\n product_id: string;\n time: number;\n series_id: string;\n}): Promise<IInterestRate[]> => {\n const [, instType, symbol] = decodePath(req.product_id);\n if (instType !== 'PERP' || !symbol) throw new Error(`Unsupported product_id: ${req.product_id}`);\n\n const startTime = req.time;\n const res = await getFApiV1FundingRate({\n symbol,\n startTime,\n endTime: startTime + WINDOW_MS,\n limit: 1000,\n });\n\n return (res ?? [])\n .map((item): IInterestRate => {\n const rate = Number(item.fundingRate);\n return {\n series_id: req.series_id,\n product_id: req.product_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 .filter((x) => Date.parse(x.created_at) >= startTime);\n};\n\nprovideInterestRateService(\n terminal,\n {\n product_id_prefix: 'ASTER/PERP/',\n direction: 'forward',\n },\n fetchFundingRateForward,\n);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ohlc-service.d.ts","sourceRoot":"","sources":["../../src/services/ohlc-service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const exchange_1 = require("@yuants/exchange");
|
|
4
|
+
const protocol_1 = require("@yuants/protocol");
|
|
5
|
+
const utils_1 = require("@yuants/utils");
|
|
6
|
+
const public_api_1 = require("../api/public-api");
|
|
7
|
+
const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
8
|
+
const DURATION_TO_INTERVAL = {
|
|
9
|
+
PT1M: '1m',
|
|
10
|
+
PT3M: '3m',
|
|
11
|
+
PT5M: '5m',
|
|
12
|
+
PT15M: '15m',
|
|
13
|
+
PT30M: '30m',
|
|
14
|
+
PT1H: '1h',
|
|
15
|
+
PT2H: '2h',
|
|
16
|
+
PT4H: '4h',
|
|
17
|
+
PT6H: '6h',
|
|
18
|
+
PT8H: '8h',
|
|
19
|
+
PT12H: '12h',
|
|
20
|
+
P1D: '1d',
|
|
21
|
+
P3D: '3d',
|
|
22
|
+
P1W: '1w',
|
|
23
|
+
P1M: '1M',
|
|
24
|
+
};
|
|
25
|
+
const fetchOHLCPageBackward = async (req) => {
|
|
26
|
+
const [, instType, symbol] = (0, utils_1.decodePath)(req.product_id);
|
|
27
|
+
if (instType !== 'PERP' || !symbol)
|
|
28
|
+
throw new Error(`Unsupported product_id: ${req.product_id}`);
|
|
29
|
+
const interval = DURATION_TO_INTERVAL[req.duration];
|
|
30
|
+
if (!interval)
|
|
31
|
+
throw new Error(`Unsupported duration: ${req.duration}`);
|
|
32
|
+
const endedAtMs = req.time;
|
|
33
|
+
const offset = (0, utils_1.convertDurationToOffset)(req.duration);
|
|
34
|
+
const res = await (0, public_api_1.getFApiV1Klines)({
|
|
35
|
+
symbol,
|
|
36
|
+
interval,
|
|
37
|
+
endTime: endedAtMs,
|
|
38
|
+
limit: 1000,
|
|
39
|
+
});
|
|
40
|
+
return (res !== null && res !== void 0 ? res : [])
|
|
41
|
+
.map((k) => {
|
|
42
|
+
const openTimeMs = Number(k[0]);
|
|
43
|
+
return {
|
|
44
|
+
series_id: req.series_id,
|
|
45
|
+
datasource_id: 'ASTER',
|
|
46
|
+
product_id: req.product_id,
|
|
47
|
+
duration: req.duration,
|
|
48
|
+
created_at: (0, utils_1.formatTime)(openTimeMs),
|
|
49
|
+
closed_at: (0, utils_1.formatTime)(openTimeMs + offset),
|
|
50
|
+
open: `${k[1]}`,
|
|
51
|
+
high: `${k[2]}`,
|
|
52
|
+
low: `${k[3]}`,
|
|
53
|
+
close: `${k[4]}`,
|
|
54
|
+
volume: `${k[5]}`,
|
|
55
|
+
open_interest: '0',
|
|
56
|
+
};
|
|
57
|
+
})
|
|
58
|
+
.filter((x) => Date.parse(x.created_at) < endedAtMs);
|
|
59
|
+
};
|
|
60
|
+
const fetchSpotOHLCPageBackward = async (req) => {
|
|
61
|
+
const [, instType, symbol] = (0, utils_1.decodePath)(req.product_id);
|
|
62
|
+
if (instType !== 'SPOT' || !symbol)
|
|
63
|
+
throw new Error(`Unsupported product_id: ${req.product_id}`);
|
|
64
|
+
const interval = DURATION_TO_INTERVAL[req.duration];
|
|
65
|
+
if (!interval)
|
|
66
|
+
throw new Error(`Unsupported duration: ${req.duration}`);
|
|
67
|
+
const endedAtMs = req.time;
|
|
68
|
+
const offset = (0, utils_1.convertDurationToOffset)(req.duration);
|
|
69
|
+
const res = await (0, public_api_1.getApiV1Klines)({
|
|
70
|
+
symbol,
|
|
71
|
+
interval,
|
|
72
|
+
endTime: endedAtMs,
|
|
73
|
+
limit: 1000,
|
|
74
|
+
});
|
|
75
|
+
return (res !== null && res !== void 0 ? res : [])
|
|
76
|
+
.map((k) => {
|
|
77
|
+
const openTimeMs = Number(k[0]);
|
|
78
|
+
return {
|
|
79
|
+
series_id: req.series_id,
|
|
80
|
+
datasource_id: 'ASTER',
|
|
81
|
+
product_id: req.product_id,
|
|
82
|
+
duration: req.duration,
|
|
83
|
+
created_at: (0, utils_1.formatTime)(openTimeMs),
|
|
84
|
+
closed_at: (0, utils_1.formatTime)(openTimeMs + offset),
|
|
85
|
+
open: `${k[1]}`,
|
|
86
|
+
high: `${k[2]}`,
|
|
87
|
+
low: `${k[3]}`,
|
|
88
|
+
close: `${k[4]}`,
|
|
89
|
+
volume: `${k[5]}`,
|
|
90
|
+
open_interest: '0',
|
|
91
|
+
};
|
|
92
|
+
})
|
|
93
|
+
.filter((x) => Date.parse(x.created_at) < endedAtMs);
|
|
94
|
+
};
|
|
95
|
+
(0, exchange_1.provideOHLCService)(terminal, {
|
|
96
|
+
product_id_prefix: 'ASTER/PERP/',
|
|
97
|
+
duration_list: Object.keys(DURATION_TO_INTERVAL),
|
|
98
|
+
direction: 'backward',
|
|
99
|
+
}, fetchOHLCPageBackward);
|
|
100
|
+
(0, exchange_1.provideOHLCService)(terminal, {
|
|
101
|
+
product_id_prefix: 'ASTER/SPOT/',
|
|
102
|
+
duration_list: Object.keys(DURATION_TO_INTERVAL),
|
|
103
|
+
direction: 'backward',
|
|
104
|
+
}, fetchSpotOHLCPageBackward);
|
|
105
|
+
//# sourceMappingURL=ohlc-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ohlc-service.js","sourceRoot":"","sources":["../../src/services/ohlc-service.ts"],"names":[],"mappings":";;AAAA,+CAAsD;AAEtD,+CAA4C;AAC5C,yCAAgF;AAChF,kDAAoE;AAEpE,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,MAAM,oBAAoB,GAA2B;IACnD,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;CACV,CAAC;AAEF,MAAM,qBAAqB,GAAG,KAAK,EAAE,GAKpC,EAAoB,EAAE;IACrB,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAA,kBAAU,EAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxD,IAAI,QAAQ,KAAK,MAAM,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IAEjG,MAAM,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACpD,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAExE,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC;IAC3B,MAAM,MAAM,GAAG,IAAA,+BAAuB,EAAC,GAAG,CA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CAAC,CAAC,CAAC,EAAE;YACjB,aAAa,EAAE,GAAG;SACnB,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,IAAA,6BAAkB,EAChB,QAAQ,EACR;IACE,iBAAiB,EAAE,aAAa;IAChC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC;IAChD,SAAS,EAAE,UAAU;CACtB,EACD,qBAAqB,CACtB,CAAC;AAEF,IAAA,6BAAkB,EAChB,QAAQ,EACR;IACE,iBAAiB,EAAE,aAAa;IAChC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC;IAChD,SAAS,EAAE,UAAU;CACtB,EACD,yBAAyB,CAC1B,CAAC","sourcesContent":["import { provideOHLCService } from '@yuants/exchange';\nimport { IOHLC } from '@yuants/data-ohlc';\nimport { Terminal } from '@yuants/protocol';\nimport { convertDurationToOffset, decodePath, formatTime } from '@yuants/utils';\nimport { getApiV1Klines, getFApiV1Klines } from '../api/public-api';\n\nconst terminal = Terminal.fromNodeEnv();\n\nconst DURATION_TO_INTERVAL: Record<string, string> = {\n PT1M: '1m',\n PT3M: '3m',\n PT5M: '5m',\n PT15M: '15m',\n PT30M: '30m',\n PT1H: '1h',\n PT2H: '2h',\n PT4H: '4h',\n PT6H: '6h',\n PT8H: '8h',\n PT12H: '12h',\n P1D: '1d',\n P3D: '3d',\n P1W: '1w',\n P1M: '1M',\n};\n\nconst fetchOHLCPageBackward = async (req: {\n product_id: string;\n duration: string;\n time: number;\n series_id: string;\n}): Promise<IOHLC[]> => {\n const [, instType, symbol] = decodePath(req.product_id);\n if (instType !== 'PERP' || !symbol) throw new Error(`Unsupported product_id: ${req.product_id}`);\n\n const interval = DURATION_TO_INTERVAL[req.duration];\n if (!interval) throw new Error(`Unsupported duration: ${req.duration}`);\n\n const endedAtMs = req.time;\n const offset = convertDurationToOffset(req.duration);\n\n const res = await getFApiV1Klines({\n symbol,\n interval,\n endTime: endedAtMs,\n limit: 1000,\n });\n\n return (res ?? [])\n .map((k): IOHLC => {\n const openTimeMs = Number(k[0]);\n return {\n series_id: req.series_id,\n datasource_id: 'ASTER',\n product_id: req.product_id,\n duration: req.duration,\n created_at: formatTime(openTimeMs),\n closed_at: formatTime(openTimeMs + offset),\n open: `${k[1]}`,\n high: `${k[2]}`,\n low: `${k[3]}`,\n close: `${k[4]}`,\n volume: `${k[5]}`,\n open_interest: '0',\n };\n })\n .filter((x) => Date.parse(x.created_at) < endedAtMs);\n};\n\nconst fetchSpotOHLCPageBackward = async (req: {\n product_id: string;\n duration: string;\n time: number;\n series_id: string;\n}): Promise<IOHLC[]> => {\n const [, instType, symbol] = decodePath(req.product_id);\n if (instType !== 'SPOT' || !symbol) throw new Error(`Unsupported product_id: ${req.product_id}`);\n\n const interval = DURATION_TO_INTERVAL[req.duration];\n if (!interval) throw new Error(`Unsupported duration: ${req.duration}`);\n\n const endedAtMs = req.time;\n const offset = convertDurationToOffset(req.duration);\n\n const res = await getApiV1Klines({\n symbol,\n interval,\n endTime: endedAtMs,\n limit: 1000,\n });\n\n return (res ?? [])\n .map((k): IOHLC => {\n const openTimeMs = Number(k[0]);\n return {\n series_id: req.series_id,\n datasource_id: 'ASTER',\n product_id: req.product_id,\n duration: req.duration,\n created_at: formatTime(openTimeMs),\n closed_at: formatTime(openTimeMs + offset),\n open: `${k[1]}`,\n high: `${k[2]}`,\n low: `${k[3]}`,\n close: `${k[4]}`,\n volume: `${k[5]}`,\n open_interest: '0',\n };\n })\n .filter((x) => Date.parse(x.created_at) < endedAtMs);\n};\n\nprovideOHLCService(\n terminal,\n {\n product_id_prefix: 'ASTER/PERP/',\n duration_list: Object.keys(DURATION_TO_INTERVAL),\n direction: 'backward',\n },\n fetchOHLCPageBackward,\n);\n\nprovideOHLCService(\n terminal,\n {\n product_id_prefix: 'ASTER/SPOT/',\n duration_list: Object.keys(DURATION_TO_INTERVAL),\n direction: 'backward',\n },\n fetchSpotOHLCPageBackward,\n);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuants/vendor-aster",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@yuants/data-interest-rate": "0.1.49",
|
|
21
21
|
"@yuants/transfer": "0.2.40",
|
|
22
22
|
"@yuants/data-quote": "0.4.0",
|
|
23
|
-
"@yuants/exchange": "0.8.
|
|
23
|
+
"@yuants/exchange": "0.8.1",
|
|
24
24
|
"rxjs": "~7.5.6"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
package/temp/package-deps.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
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": "7a2b22e4415dcb9669466d6841344d09b9d8f4fb",
|
|
4
|
+
"apps/vendor-aster/CHANGELOG.md": "5a2de61ae593cef9d745bd14479ed9472612f77f",
|
|
5
5
|
"apps/vendor-aster/SESSION_NOTES.md": "d91f7a251d148fab1715b6da62395455edcb3b93",
|
|
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": "720f1aa9b18161b2dc86cc3d29eeb49b5286114b",
|
|
10
10
|
"apps/vendor-aster/src/api/private-api.ts": "b3288706373f8917be480210f8f02074890d5b34",
|
|
11
|
-
"apps/vendor-aster/src/api/public-api.ts": "
|
|
12
|
-
"apps/vendor-aster/src/index.ts": "
|
|
11
|
+
"apps/vendor-aster/src/api/public-api.ts": "a20ac4c4465ab3e75e2dc024adc12ecc19422375",
|
|
12
|
+
"apps/vendor-aster/src/index.ts": "1decd1aabd3e77bc7a678427a42a9fa5fa84cf29",
|
|
13
13
|
"apps/vendor-aster/src/services/accounts/profile.ts": "fc57e7d2c865790dd257c043c8dd5cf5c641b7fd",
|
|
14
14
|
"apps/vendor-aster/src/services/accounts/spot.ts": "49d045e5daae100ce9919ebd84723506806060ea",
|
|
15
15
|
"apps/vendor-aster/src/services/exchange.ts": "71a555ceec0d84b6f12a9c2002834676f1370d51",
|
|
16
|
+
"apps/vendor-aster/src/services/interest-rate-service.ts": "3113b2a857cf38e9f1cfa86d2f526464009d2018",
|
|
16
17
|
"apps/vendor-aster/src/services/markets/interest_rate.ts": "8512bb506f3d66b16aceb9d153d1b3a4671de5ef",
|
|
17
18
|
"apps/vendor-aster/src/services/markets/product.ts": "cae86f69c6f019747ebad07569ed2bc862a78ac6",
|
|
18
19
|
"apps/vendor-aster/src/services/markets/quote.ts": "01274f7a820656ad480cb80a1cf526ac3805982b",
|
|
20
|
+
"apps/vendor-aster/src/services/ohlc-service.ts": "45c9c44df2ccb3b6cb58aebdcf7b3fa7a21ff047",
|
|
19
21
|
"apps/vendor-aster/src/services/orders/cancelOrder.ts": "09a6d3b10a218ad226346dd68d0ff0207083a7f1",
|
|
20
22
|
"apps/vendor-aster/src/services/orders/listOrders.ts": "579e83c45f6c4435ad3f5a2d3fe163a036bb9fd1",
|
|
21
23
|
"apps/vendor-aster/src/services/orders/submitOrder.ts": "9580e87b195b7bd3631b0b3e5f6c2a1c37b29feb",
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
"libraries/data-interest-rate/temp/package-deps.json": "5a1011b097b18b96c2d8c932d874f69472621efd",
|
|
35
37
|
"libraries/transfer/temp/package-deps.json": "7b0db8291734d10d4f1d9c2c25d9e3918cabc79e",
|
|
36
38
|
"libraries/data-quote/temp/package-deps.json": "c2f009f818a503342bef588da21c9abd52beea00",
|
|
37
|
-
"libraries/exchange/temp/package-deps.json": "
|
|
39
|
+
"libraries/exchange/temp/package-deps.json": "0f0549ddf97292ceadb8c3cbcc8799e31e7a0901",
|
|
38
40
|
"libraries/extension/temp/package-deps.json": "3e0a81b0c863c2daf342dfaf284b8fd7d18c8562",
|
|
39
41
|
"tools/toolkit/temp/package-deps.json": "23e053490eb8feade23e4d45de4e54883e322711"
|
|
40
42
|
}
|