@yuants/vendor-aster 0.11.11 → 0.11.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/services/exchange.ts"],"names":[],"mappings":";;AAEA,+CAA2D;AAC3D,+CAA4C;AAC5C,yCAA2C;AAC3C,+CAAiD;AACjD,gDAAqD;AACrD,0CAA+C;AAC/C,oDAAiF;AACjF,sDAAyD;AAEzD,sDAAyD;AAEzD,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,kCAAuB,EAAc,QAAQ,EAAE;IAC7C,IAAI,EAAE,OAAO;IACb,gBAAgB,EAAE;QAChB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC;QAC9C,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC9B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC5B;KACF;IACD,eAAe,EAAf,yBAAe;IACf,YAAY,EAAZ,sBAAY;IACZ,YAAY,EAAE,mBAAY;IAC1B,SAAS,EAAE,uBAAU;IACrB,uBAAuB,EAAE,KAAK,WAC5B,UAAuB,EACvB,UAAkB;QAElB,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC,CAAC,qBAAqB;QACnE,MAAM,SAAS,GAAG,MAAM,IAAA,mBAAY,EAAC,UAAU,CAAC,CAAC;QACjD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;IAC5E,CAAC;IACD,oBAAoB,EAAE,KAAK,WAAW,UAAuB,EAAE,UAAkB;QAC/E,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC,CAAC,8BAA8B;QAC5E,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAc,EAAC,UAAU,CAAC,CAAC;YAChD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAc,EAAC,UAAU,CAAC,CAAC;YAChD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,WAAW,EAAE,+BAAiB;IAC9B,WAAW,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IACD,WAAW,EAAE,+BAAiB;CAC/B,CAAC,CAAC","sourcesContent":["import { IPosition } from '@yuants/data-account';\nimport { IOrder } from '@yuants/data-order';\nimport { provideExchangeServices } from '@yuants/exchange';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath } from '@yuants/utils';\nimport { listProducts } from './markets/product';\nimport { getCredentialId } from './accounts/profile';\nimport { getPositions } from './accounts/spot';\nimport { listOrders, listPrepOrders, listSpotOrders } from './orders/listOrders';\nimport { handleSubmitOrder } from './orders/submitOrder';\nimport { ICredential } from '../api/private-api';\nimport { handleCancelOrder } from './orders/cancelOrder';\n\nconst terminal = Terminal.fromNodeEnv();\n\nprovideExchangeServices<ICredential>(terminal, {\n name: 'ASTER',\n credentialSchema: {\n type: 'object',\n required: ['address', 'secret_key', 'api_key'],\n properties: {\n address: { type: 'string' },\n secret_key: { type: 'string' },\n api_key: { type: 'string' },\n },\n },\n getCredentialId,\n listProducts,\n getPositions: getPositions,\n getOrders: listOrders,\n getPositionsByProductId: async function (\n credential: ICredential,\n product_id: string,\n ): Promise<IPosition[]> {\n const [_, instType] = decodePath(product_id); // ASTER/PERP/ADAUSDT\n const positions = await getPositions(credential);\n return positions.filter((position) => position.product_id === product_id);\n },\n getOrdersByProductId: async function (credential: ICredential, product_id: string): Promise<IOrder[]> {\n const [_, instType] = decodePath(product_id); // BITGET/USDT-FUTURES/BTCUSDT\n if (instType === 'SPOT') {\n const orders = await listSpotOrders(credential);\n return orders.filter((order) => order.product_id === product_id);\n }\n if (instType === 'PERP') {\n const orders = await listPrepOrders(credential);\n return orders.filter((order) => order.product_id === product_id);\n }\n throw new Error(`Unsupported instType: ${instType}`);\n },\n submitOrder: handleSubmitOrder,\n modifyOrder: () => {\n throw new Error('Not implemented');\n },\n cancelOrder: handleCancelOrder,\n});\n"]}
1
+ {"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/services/exchange.ts"],"names":[],"mappings":";;AAEA,+CAA2D;AAC3D,+CAA4C;AAC5C,yCAAqD;AACrD,+CAAiD;AACjD,gDAAqD;AACrD,0CAA+C;AAC/C,oDAAiF;AACjF,sDAAyD;AAEzD,sDAAyD;AACzD,4DAA8D;AAE9D,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,kCAAuB,EAAc,QAAQ,EAAE;IAC7C,IAAI,EAAE,OAAO;IACb,gBAAgB,EAAE;QAChB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC;QAC9C,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC9B,O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AAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IACD,WAAW,EAAE,+BAAiB;IAC9B,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE;QAC9C,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,MAAkD,CAAC;QACpF,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAA,gBAAQ,EAAC,sCAAsC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC,CAAC,6BAA6B;QAC7E,MAAM,KAAK,GAAG,MAAM,IAAA,oCAAmB,EAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { IPosition } from '@yuants/data-account';\nimport { IOrder } from '@yuants/data-order';\nimport { provideExchangeServices } from '@yuants/exchange';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, newError } from '@yuants/utils';\nimport { listProducts } from './markets/product';\nimport { getCredentialId } from './accounts/profile';\nimport { getPositions } from './accounts/spot';\nimport { listOrders, listPrepOrders, listSpotOrders } from './orders/listOrders';\nimport { handleSubmitOrder } from './orders/submitOrder';\nimport { ICredential } from '../api/private-api';\nimport { handleCancelOrder } from './orders/cancelOrder';\nimport { getTradeOrderDetail } from './orders/getOrderDetail';\n\nconst terminal = Terminal.fromNodeEnv();\n\nprovideExchangeServices<ICredential>(terminal, {\n name: 'ASTER',\n credentialSchema: {\n type: 'object',\n required: ['address', 'secret_key', 'api_key'],\n properties: {\n address: { type: 'string' },\n secret_key: { type: 'string' },\n api_key: { type: 'string' },\n },\n },\n getCredentialId,\n listProducts,\n getPositions: getPositions,\n getOrders: listOrders,\n getPositionsByProductId: async function (\n credential: ICredential,\n product_id: string,\n ): Promise<IPosition[]> {\n const [_, instType] = decodePath(product_id); // ASTER/PERP/ADAUSDT\n const positions = await getPositions(credential);\n return positions.filter((position) => position.product_id === product_id);\n },\n getOrdersByProductId: async function (credential: ICredential, product_id: string): Promise<IOrder[]> {\n const [_, instType] = decodePath(product_id); // BITGET/USDT-FUTURES/BTCUSDT\n if (instType === 'SPOT') {\n const orders = await listSpotOrders(credential);\n return orders.filter((order) => order.product_id === product_id);\n }\n if (instType === 'PERP') {\n const orders = await listPrepOrders(credential);\n return orders.filter((order) => order.product_id === product_id);\n }\n throw new Error(`Unsupported instType: ${instType}`);\n },\n submitOrder: handleSubmitOrder,\n modifyOrder: () => {\n throw new Error('Not implemented');\n },\n cancelOrder: handleCancelOrder,\n getOrderByOrderId: async (credential, params) => {\n const { product_id, order_id } = params as { product_id: string; order_id: number };\n if (!product_id || !order_id) {\n throw newError('ASTER_GET_ORDER_BY_ID_MISSING_PARAMS', { params });\n }\n const [_, __, symbol] = decodePath(product_id); // ASTER/USDT-FUTURES/ADAUSDT\n const order = await getTradeOrderDetail(credential, symbol, order_id);\n return order;\n },\n});\n"]}
@@ -0,0 +1,26 @@
1
+ import { ICredential } from '../../api/private-api';
2
+ export declare const getTradeOrderDetail: (credential: ICredential, symbol: string, orderId: number) => Promise<{
3
+ clientOrderId: string;
4
+ cumQty: string;
5
+ cumQuote: string;
6
+ executedQty: string;
7
+ orderId: number;
8
+ origQty: string;
9
+ price: string;
10
+ reduceOnly: false;
11
+ side: string;
12
+ positionSide: string;
13
+ status: string;
14
+ stopPrice: string;
15
+ closePosition: boolean;
16
+ symbol: string;
17
+ timeInForce: string;
18
+ origType: string;
19
+ type: string;
20
+ activatePrice: string;
21
+ priceRate: string;
22
+ updateTime: number;
23
+ workingType: string;
24
+ priceProtect: boolean;
25
+ }>;
26
+ //# sourceMappingURL=getOrderDetail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOrderDetail.d.ts","sourceRoot":"","sources":["../../../src/services/orders/getOrderDetail.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE7E,eAAO,MAAM,mBAAmB,GAAU,YAAY,WAAW,EAAE,QAAQ,MAAM,EAAE,SAAS,MAAM;;;;;;;;;;;;;;;;;;;;;;;EAUjG,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTradeOrderDetail = void 0;
4
+ const private_api_1 = require("../../api/private-api");
5
+ const getTradeOrderDetail = async (credential, symbol, orderId) => {
6
+ const res = await (0, private_api_1.getTradeOrderDetailById)(credential, {
7
+ symbol,
8
+ orderId,
9
+ timestamp: Date.now(),
10
+ });
11
+ if (!res) {
12
+ throw new Error(`ASTER get order detail failed`);
13
+ }
14
+ return res;
15
+ };
16
+ exports.getTradeOrderDetail = getTradeOrderDetail;
17
+ //# sourceMappingURL=getOrderDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOrderDetail.js","sourceRoot":"","sources":["../../../src/services/orders/getOrderDetail.ts"],"names":[],"mappings":";;;AAAA,uDAA6E;AAEtE,MAAM,mBAAmB,GAAG,KAAK,EAAE,UAAuB,EAAE,MAAc,EAAE,OAAe,EAAE,EAAE;IACpG,MAAM,GAAG,GAAG,MAAM,IAAA,qCAAuB,EAAC,UAAU,EAAE;QACpD,MAAM;QACN,OAAO;QACP,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAVW,QAAA,mBAAmB,uBAU9B","sourcesContent":["import { getTradeOrderDetailById, ICredential } from '../../api/private-api';\n\nexport const getTradeOrderDetail = async (credential: ICredential, symbol: string, orderId: number) => {\n const res = await getTradeOrderDetailById(credential, {\n symbol,\n orderId,\n timestamp: Date.now(),\n });\n if (!res) {\n throw new Error(`ASTER get order detail failed`);\n }\n return res;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuants/vendor-aster",
3
- "version": "0.11.11",
3
+ "version": "0.11.13",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "dist",
@@ -12,18 +12,18 @@
12
12
  "@yuants/protocol": "0.55.0",
13
13
  "@yuants/data-account": "0.11.12",
14
14
  "@yuants/cache": "0.3.15",
15
- "@yuants/http-services": "0.5.3",
16
15
  "@yuants/utils": "0.19.7",
16
+ "@yuants/http-services": "0.5.3",
17
17
  "@yuants/data-series": "0.3.65",
18
18
  "@yuants/sql": "0.9.43",
19
19
  "@yuants/data-product": "0.5.13",
20
- "@yuants/data-ohlc": "0.6.8",
21
- "@yuants/data-order": "0.7.13",
22
20
  "@yuants/data-trade": "0.1.38",
21
+ "@yuants/data-ohlc": "0.6.8",
23
22
  "@yuants/data-interest-rate": "0.2.13",
24
- "@yuants/data-quote": "0.4.12",
25
23
  "@yuants/transfer": "0.2.52",
26
- "@yuants/exchange": "0.8.24"
24
+ "@yuants/data-order": "0.7.13",
25
+ "@yuants/exchange": "0.8.26",
26
+ "@yuants/data-quote": "0.4.12"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@microsoft/api-extractor": "~7.55.2",