@yuants/vendor-okx 0.33.12 → 0.33.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,6 +1,6 @@
1
1
  import { provideExchangeServices } from '@yuants/exchange';
2
2
  import { Terminal } from '@yuants/protocol';
3
- import { encodePath, newError } from '@yuants/utils';
3
+ import { decodePath, encodePath, newError } from '@yuants/utils';
4
4
  import { getAccountConfig } from '../api/private-api';
5
5
  import { cancelOrder } from '../orders/cancelOrder';
6
6
  import { modifyOrder } from '../orders/modifyOrder';
@@ -45,7 +45,8 @@ provideExchangeServices(terminal, {
45
45
  if (!product_id || !order_id) {
46
46
  throw newError('OKX_GET_ORDER_BY_ID_MISSING_PARAMS', { params });
47
47
  }
48
- const order = await getTradeOrderDetail(credential, product_id, order_id);
48
+ const [_, __, instId] = decodePath(product_id);
49
+ const order = await getTradeOrderDetail(credential, instId, order_id);
49
50
  return order;
50
51
  },
51
52
  submitOrder: submitOrder,
@@ -1 +1 @@
1
- {"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/experimental/exchange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC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AC3C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;IAC3D,CAAC;IACD,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,QAAQ,CAAC,oCAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;CACzB,CAAC,CAAC","sourcesContent":["import { provideExchangeServices } from '@yuants/exchange';\nimport { Terminal } from '@yuants/protocol';\nimport { encodePath, newError } from '@yuants/utils';\nimport { getAccountConfig, ICredential } from '../api/private-api';\nimport { cancelOrder } from '../orders/cancelOrder';\nimport { modifyOrder } from '../orders/modifyOrder';\nimport { submitOrder } from '../orders/submitOrder';\nimport { getOrders } from './getOrders';\nimport { getPositions } from './getPositions';\nimport { listProducts } from './product';\nimport { getTradeOrderDetail } from './getOrderDetail';\n\nconst terminal = Terminal.fromNodeEnv();\n\nprovideExchangeServices<ICredential>(terminal, {\n name: 'OKX',\n credentialSchema: {\n type: 'object',\n required: ['access_key', 'secret_key', 'passphrase'],\n properties: {\n access_key: { type: 'string' },\n secret_key: { type: 'string' },\n passphrase: { type: 'string' },\n },\n },\n getCredentialId: async function (credential: ICredential): Promise<string> {\n const res = await getAccountConfig(credential);\n const uid = res.data?.[0]?.uid;\n if (!uid) throw newError('OKX_CREDENTIAL_INVALID', { res });\n return encodePath('OKX', uid);\n },\n listProducts: listProducts,\n getPositions: getPositions,\n getOrders,\n getPositionsByProductId: async (credential, product_id) => {\n const positions = await getPositions(credential);\n return positions.filter((x) => x.product_id === product_id);\n },\n getOrdersByProductId: async (credential, product_id) => {\n const orders = await getOrders(credential);\n return orders.filter((x) => x.product_id === product_id);\n },\n getOrderByOrderId: async (credential, params) => {\n const { product_id, order_id } = params as { product_id: string; order_id: string };\n if (!product_id || !order_id) {\n throw newError('OKX_GET_ORDER_BY_ID_MISSING_PARAMS', { params });\n }\n const order = await getTradeOrderDetail(credential, product_id, order_id);\n return order;\n },\n submitOrder: submitOrder,\n modifyOrder: modifyOrder,\n cancelOrder: cancelOrder,\n});\n"]}
1
+ {"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/experimental/exchange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,uBAAuB,CAAc,QAAQ,EAAE;IAC7C,IAAI,EAAE,KAAK;IACX,gBAAgB,EAAE;QAChB,IAAI,EAAE,QA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AU,EAAE,QAAQ,EAAE,GAAG,MAAkD,CAAC;QACpF,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7B,MAAM,QAAQ,CAAC,oCAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;CACzB,CAAC,CAAC","sourcesContent":["import { provideExchangeServices } from '@yuants/exchange';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, encodePath, newError } from '@yuants/utils';\nimport { getAccountConfig, ICredential } from '../api/private-api';\nimport { cancelOrder } from '../orders/cancelOrder';\nimport { modifyOrder } from '../orders/modifyOrder';\nimport { submitOrder } from '../orders/submitOrder';\nimport { getOrders } from './getOrders';\nimport { getPositions } from './getPositions';\nimport { listProducts } from './product';\nimport { getTradeOrderDetail } from './getOrderDetail';\n\nconst terminal = Terminal.fromNodeEnv();\n\nprovideExchangeServices<ICredential>(terminal, {\n name: 'OKX',\n credentialSchema: {\n type: 'object',\n required: ['access_key', 'secret_key', 'passphrase'],\n properties: {\n access_key: { type: 'string' },\n secret_key: { type: 'string' },\n passphrase: { type: 'string' },\n },\n },\n getCredentialId: async function (credential: ICredential): Promise<string> {\n const res = await getAccountConfig(credential);\n const uid = res.data?.[0]?.uid;\n if (!uid) throw newError('OKX_CREDENTIAL_INVALID', { res });\n return encodePath('OKX', uid);\n },\n listProducts: listProducts,\n getPositions: getPositions,\n getOrders,\n getPositionsByProductId: async (credential, product_id) => {\n const positions = await getPositions(credential);\n return positions.filter((x) => x.product_id === product_id);\n },\n getOrdersByProductId: async (credential, product_id) => {\n const orders = await getOrders(credential);\n return orders.filter((x) => x.product_id === product_id);\n },\n getOrderByOrderId: async (credential, params) => {\n const { product_id, order_id } = params as { product_id: string; order_id: string };\n if (!product_id || !order_id) {\n throw newError('OKX_GET_ORDER_BY_ID_MISSING_PARAMS', { params });\n }\n const [_, __, instId] = decodePath(product_id);\n const order = await getTradeOrderDetail(credential, instId, order_id);\n return order;\n },\n submitOrder: submitOrder,\n modifyOrder: modifyOrder,\n cancelOrder: cancelOrder,\n});\n"]}
@@ -47,7 +47,8 @@ const terminal = protocol_1.Terminal.fromNodeEnv();
47
47
  if (!product_id || !order_id) {
48
48
  throw (0, utils_1.newError)('OKX_GET_ORDER_BY_ID_MISSING_PARAMS', { params });
49
49
  }
50
- const order = await (0, getOrderDetail_1.getTradeOrderDetail)(credential, product_id, order_id);
50
+ const [_, __, instId] = (0, utils_1.decodePath)(product_id);
51
+ const order = await (0, getOrderDetail_1.getTradeOrderDetail)(credential, instId, order_id);
51
52
  return order;
52
53
  },
53
54
  submitOrder: submitOrder_1.submitOrder,
@@ -1 +1 @@
1
- {"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/experimental/exchange.ts"],"names":[],"mappings":";;AAAA,+CAA2D;AAC3D,+CAA4C;AAC5C,yCAAqD;AACrD,oDAAmE;AACnE,uDAAoD;AACpD,uDAAoD;AACpD,uDAAoD;AACpD,2CAAwC;AACxC,iDAA8C;AAC9C,uCAAyC;AACzC,qDAAuD;AAEvD,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,kCAAuB,EAAc,QAAQ,EAAE;IAC7C,IAAI,EAAE,KAAK;IACX,gBAAgB,EAAE;QAChB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC;QACpD,UAAU,EAAE;YACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC9B,UAAU,E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C;YAC7B,MAAM,IAAA,gBAAQ,EAAC,oCAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,IAAA,oCAAmB,EAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,WAAW,EAAE,yBAAW;IACxB,WAAW,EAAE,yBAAW;IACxB,WAAW,EAAE,yBAAW;CACzB,CAAC,CAAC","sourcesContent":["import { provideExchangeServices } from '@yuants/exchange';\nimport { Terminal } from '@yuants/protocol';\nimport { encodePath, newError } from '@yuants/utils';\nimport { getAccountConfig, ICredential } from '../api/private-api';\nimport { cancelOrder } from '../orders/cancelOrder';\nimport { modifyOrder } from '../orders/modifyOrder';\nimport { submitOrder } from '../orders/submitOrder';\nimport { getOrders } from './getOrders';\nimport { getPositions } from './getPositions';\nimport { listProducts } from './product';\nimport { getTradeOrderDetail } from './getOrderDetail';\n\nconst terminal = Terminal.fromNodeEnv();\n\nprovideExchangeServices<ICredential>(terminal, {\n name: 'OKX',\n credentialSchema: {\n type: 'object',\n required: ['access_key', 'secret_key', 'passphrase'],\n properties: {\n access_key: { type: 'string' },\n secret_key: { type: 'string' },\n passphrase: { type: 'string' },\n },\n },\n getCredentialId: async function (credential: ICredential): Promise<string> {\n const res = await getAccountConfig(credential);\n const uid = res.data?.[0]?.uid;\n if (!uid) throw newError('OKX_CREDENTIAL_INVALID', { res });\n return encodePath('OKX', uid);\n },\n listProducts: listProducts,\n getPositions: getPositions,\n getOrders,\n getPositionsByProductId: async (credential, product_id) => {\n const positions = await getPositions(credential);\n return positions.filter((x) => x.product_id === product_id);\n },\n getOrdersByProductId: async (credential, product_id) => {\n const orders = await getOrders(credential);\n return orders.filter((x) => x.product_id === product_id);\n },\n getOrderByOrderId: async (credential, params) => {\n const { product_id, order_id } = params as { product_id: string; order_id: string };\n if (!product_id || !order_id) {\n throw newError('OKX_GET_ORDER_BY_ID_MISSING_PARAMS', { params });\n }\n const order = await getTradeOrderDetail(credential, product_id, order_id);\n return order;\n },\n submitOrder: submitOrder,\n modifyOrder: modifyOrder,\n cancelOrder: cancelOrder,\n});\n"]}
1
+ {"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/experimental/exchange.ts"],"names":[],"mappings":";;AAAA,+CAA2D;AAC3D,+CAA4C;AAC5C,yCAAiE;AACjE,oDAAmE;AACnE,uDAAoD;AACpD,uDAAoD;AACpD,uDAAoD;AACpD,2CAAwC;AACxC,iDAA8C;AAC9C,uCAAyC;AACzC,qDAAuD;AAEvD,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,kCAAuB,EAAc,QAAQ,EAAE;IAC7C,IAAI,EAAE,KAAK;IACX,gBAAgB,EAAE;QAChB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC;QACpD,UAAU,EAAE;YACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC/B;KACF;IACD,eAAe,EAAE,KAAK,WAAW,UAAuB;;QACtD,MAAM,GAAG,GAAG,MAAM,IAAA,8BAAgB,EAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,MAAA,MAAA,GAAG,CAAC,IAAI,0CAAG,CAAC,CAAC,0CAAE,GAAG,CAAC;QAC/B,IAAI,CAAC,GAAG;YAAE,MAAM,IAAA,gBAAQ,EAAC,wBAAwB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC5D,OAAO,IAAA,kBAAU,EAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,YAAY,EAAE,sBAAY;IAC1B,YAAY,EAAE,2BAAY;IAC1B,SAAS,EAAT,qBAAS;IACT,uBAAuB,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;QACxD,MAAM,SAAS,GAAG,MAAM,IAAA,2BAAY,EAAC,UAAU,CAAC,CAAC;QACjD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;IAC9D,CAAC;IACD,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;QACrD,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAS,EAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;IAC3D,CAAC;IACD,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,oCAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,MAAM,IAAA,oCAAmB,EAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,WAAW,EAAE,yBAAW;IACxB,WAAW,EAAE,yBAAW;IACxB,WAAW,EAAE,yBAAW;CACzB,CAAC,CAAC","sourcesContent":["import { provideExchangeServices } from '@yuants/exchange';\nimport { Terminal } from '@yuants/protocol';\nimport { decodePath, encodePath, newError } from '@yuants/utils';\nimport { getAccountConfig, ICredential } from '../api/private-api';\nimport { cancelOrder } from '../orders/cancelOrder';\nimport { modifyOrder } from '../orders/modifyOrder';\nimport { submitOrder } from '../orders/submitOrder';\nimport { getOrders } from './getOrders';\nimport { getPositions } from './getPositions';\nimport { listProducts } from './product';\nimport { getTradeOrderDetail } from './getOrderDetail';\n\nconst terminal = Terminal.fromNodeEnv();\n\nprovideExchangeServices<ICredential>(terminal, {\n name: 'OKX',\n credentialSchema: {\n type: 'object',\n required: ['access_key', 'secret_key', 'passphrase'],\n properties: {\n access_key: { type: 'string' },\n secret_key: { type: 'string' },\n passphrase: { type: 'string' },\n },\n },\n getCredentialId: async function (credential: ICredential): Promise<string> {\n const res = await getAccountConfig(credential);\n const uid = res.data?.[0]?.uid;\n if (!uid) throw newError('OKX_CREDENTIAL_INVALID', { res });\n return encodePath('OKX', uid);\n },\n listProducts: listProducts,\n getPositions: getPositions,\n getOrders,\n getPositionsByProductId: async (credential, product_id) => {\n const positions = await getPositions(credential);\n return positions.filter((x) => x.product_id === product_id);\n },\n getOrdersByProductId: async (credential, product_id) => {\n const orders = await getOrders(credential);\n return orders.filter((x) => x.product_id === product_id);\n },\n getOrderByOrderId: async (credential, params) => {\n const { product_id, order_id } = params as { product_id: string; order_id: string };\n if (!product_id || !order_id) {\n throw newError('OKX_GET_ORDER_BY_ID_MISSING_PARAMS', { params });\n }\n const [_, __, instId] = decodePath(product_id);\n const order = await getTradeOrderDetail(credential, instId, order_id);\n return order;\n },\n submitOrder: submitOrder,\n modifyOrder: modifyOrder,\n cancelOrder: cancelOrder,\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuants/vendor-okx",
3
- "version": "0.33.12",
3
+ "version": "0.33.13",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "dist",
@@ -12,19 +12,19 @@
12
12
  "ws": "~8.8.1",
13
13
  "@yuants/protocol": "0.55.0",
14
14
  "@yuants/transfer": "0.2.52",
15
+ "@yuants/data-account": "0.11.12",
15
16
  "@yuants/data-order": "0.7.13",
16
17
  "@yuants/utils": "0.19.7",
17
- "@yuants/data-account": "0.11.12",
18
18
  "@yuants/http-services": "0.5.3",
19
19
  "@yuants/cache": "0.3.15",
20
- "@yuants/sql": "0.9.43",
21
20
  "@yuants/data-series": "0.3.65",
21
+ "@yuants/sql": "0.9.43",
22
22
  "@yuants/data-product": "0.5.13",
23
- "@yuants/data-interest-rate": "0.2.13",
24
23
  "@yuants/data-ohlc": "0.6.8",
25
- "@yuants/data-trade": "0.1.38",
24
+ "@yuants/data-interest-rate": "0.2.13",
26
25
  "@yuants/data-quote": "0.4.12",
27
- "@yuants/exchange": "0.8.24"
26
+ "@yuants/exchange": "0.8.25",
27
+ "@yuants/data-trade": "0.1.38"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@microsoft/api-extractor": "~7.55.2",