@yuants/vendor-gate 0.9.15 → 0.9.16

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.
@@ -42,6 +42,7 @@ export const submitOrder = async (credential, order) => {
42
42
  }
43
43
  return {
44
44
  order_id: `${res.id}`,
45
+ order_detail: res,
45
46
  };
46
47
  }
47
48
  throw new Error('Product type not support');
@@ -1 +1 @@
1
- {"version":3,"file":"submitOrder.js","sourceRoot":"","sources":["../../../src/services/orders/submitOrder.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,eAAe,GAAG,CAAC,eAAwB,EAAU,EAAE;IAC3D,QAAQ,eAAe,EAAE,CAAC;QACxB,KAAK,WAAW,CAAC;QACjB,KAAK,aAAa;YAChB,OAAO,CAAC,CAAC;QACX,KAAK,YAAY,CAAC;QAClB,KAAK,YAAY;YACf,OAAO,CAAC,CAAC,CAAC;QACZ;YACE,MAAM,IAAI,KAAK,CAAC,gCAAgC,eAAe,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAA6C,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE;IAC/F,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,eAAe,CAAC,CA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ent":["import { IActionHandlerOfSubmitOrder } from '@yuants/data-order';\nimport { ICredential, postFutureOrders } from '../../api/private-api';\nimport { decodePath } from '@yuants/utils';\nimport { mapOrderTypeToTif } from './mapOrderTypeToTif';\n\nconst resolveSizeSign = (order_direction?: string): number => {\n switch (order_direction) {\n case 'OPEN_LONG':\n case 'CLOSE_SHORT':\n return 1;\n case 'OPEN_SHORT':\n case 'CLOSE_LONG':\n return -1;\n default:\n throw new Error(`Unsupported order_direction: ${order_direction}`);\n }\n};\n\nexport const submitOrder: IActionHandlerOfSubmitOrder<ICredential> = async (credential, order) => {\n if (!order.product_id) {\n throw new Error('Missing product_id');\n }\n if (!order.volume || order.volume <= 0) {\n throw new Error('Invalid order volume');\n }\n\n const size = order.volume * resolveSizeSign(order.order_direction);\n const tif = mapOrderTypeToTif(order.order_type);\n const reduce_only = order.order_direction === 'CLOSE_LONG' || order.order_direction === 'CLOSE_SHORT';\n const price =\n order.order_type === 'MARKET' ? '0' : order.price !== undefined ? `${order.price}` : undefined;\n if (price === undefined) {\n throw new Error('Limit/Maker order requires price');\n }\n const [, TYPE, contract] = decodePath(order.product_id);\n if (TYPE === 'FUTURE') {\n const res = await postFutureOrders(credential, 'usdt', {\n contract,\n size,\n price,\n tif,\n reduce_only,\n });\n\n if (res.label) {\n const detail = [res.label, res.message, res.detail].filter((v) => !!v).join(': ');\n throw new Error(detail);\n }\n return {\n order_id: `${res.id}`,\n };\n }\n throw new Error('Product type not support');\n};\n"]}
1
+ {"version":3,"file":"submitOrder.js","sourceRoot":"","sources":["../../../src/services/orders/submitOrder.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,eAAe,GAAG,CAAC,eAAwB,EAAU,EAAE;IAC3D,QAAQ,eAAe,EAAE,CAAC;QAC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,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE;YACrD,QAAQ;YACR,IAAI;YACJ,KAAK;YACL,GAAG;YACH,WAAW;SACZ,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACd,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClF,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,GAAG,GAAG,CAAC,EAAE,EAAE;YACrB,YAAY,EAAE,GAAG;SAClB,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["import { IActionHandlerOfSubmitOrder } from '@yuants/data-order';\nimport { ICredential, postFutureOrders } from '../../api/private-api';\nimport { decodePath } from '@yuants/utils';\nimport { mapOrderTypeToTif } from './mapOrderTypeToTif';\n\nconst resolveSizeSign = (order_direction?: string): number => {\n switch (order_direction) {\n case 'OPEN_LONG':\n case 'CLOSE_SHORT':\n return 1;\n case 'OPEN_SHORT':\n case 'CLOSE_LONG':\n return -1;\n default:\n throw new Error(`Unsupported order_direction: ${order_direction}`);\n }\n};\n\nexport const submitOrder: IActionHandlerOfSubmitOrder<ICredential> = async (credential, order) => {\n if (!order.product_id) {\n throw new Error('Missing product_id');\n }\n if (!order.volume || order.volume <= 0) {\n throw new Error('Invalid order volume');\n }\n\n const size = order.volume * resolveSizeSign(order.order_direction);\n const tif = mapOrderTypeToTif(order.order_type);\n const reduce_only = order.order_direction === 'CLOSE_LONG' || order.order_direction === 'CLOSE_SHORT';\n const price =\n order.order_type === 'MARKET' ? '0' : order.price !== undefined ? `${order.price}` : undefined;\n if (price === undefined) {\n throw new Error('Limit/Maker order requires price');\n }\n const [, TYPE, contract] = decodePath(order.product_id);\n if (TYPE === 'FUTURE') {\n const res = await postFutureOrders(credential, 'usdt', {\n contract,\n size,\n price,\n tif,\n reduce_only,\n });\n\n if (res.label) {\n const detail = [res.label, res.message, res.detail].filter((v) => !!v).join(': ');\n throw new Error(detail);\n }\n\n return {\n order_id: `${res.id}`,\n order_detail: res,\n };\n }\n throw new Error('Product type not support');\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"submitOrder.d.ts","sourceRoot":"","sources":["../../../src/services/orders/submitOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAoB,MAAM,uBAAuB,CAAC;AAiBtE,eAAO,MAAM,WAAW,EAAE,2BAA2B,CAAC,WAAW,CAmChE,CAAC"}
1
+ {"version":3,"file":"submitOrder.d.ts","sourceRoot":"","sources":["../../../src/services/orders/submitOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAoB,MAAM,uBAAuB,CAAC;AAiBtE,eAAO,MAAM,WAAW,EAAE,2BAA2B,CAAC,WAAW,CAqChE,CAAC"}
@@ -45,6 +45,7 @@ const submitOrder = async (credential, order) => {
45
45
  }
46
46
  return {
47
47
  order_id: `${res.id}`,
48
+ order_detail: res,
48
49
  };
49
50
  }
50
51
  throw new Error('Product type not support');
@@ -1 +1 @@
1
- {"version":3,"file":"submitOrder.js","sourceRoot":"","sources":["../../../src/services/orders/submitOrder.ts"],"names":[],"mappings":";;;AACA,uDAAsE;AACtE,yCAA2C;AAC3C,2DAAwD;AAExD,MAAM,eAAe,GAAG,CAAC,eAAwB,EAAU,EAAE;IAC3D,QAAQ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UAAU,CAAC,CAAC;IACxD,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,MAAM,IAAA,8BAAgB,EAAC,UAAU,EAAE,MAAM,EAAE;YACrD,QAAQ;YACR,IAAI;YACJ,KAAK;YACL,GAAG;YACH,WAAW;SACZ,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACd,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClF,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,GAAG,GAAG,CAAC,EAAE,EAAE;SACtB,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAC9C,CAAC,CAAC;AAnCW,QAAA,WAAW,eAmCtB","sourcesContent":["import { IActionHandlerOfSubmitOrder } from '@yuants/data-order';\nimport { ICredential, postFutureOrders } from '../../api/private-api';\nimport { decodePath } from '@yuants/utils';\nimport { mapOrderTypeToTif } from './mapOrderTypeToTif';\n\nconst resolveSizeSign = (order_direction?: string): number => {\n switch (order_direction) {\n case 'OPEN_LONG':\n case 'CLOSE_SHORT':\n return 1;\n case 'OPEN_SHORT':\n case 'CLOSE_LONG':\n return -1;\n default:\n throw new Error(`Unsupported order_direction: ${order_direction}`);\n }\n};\n\nexport const submitOrder: IActionHandlerOfSubmitOrder<ICredential> = async (credential, order) => {\n if (!order.product_id) {\n throw new Error('Missing product_id');\n }\n if (!order.volume || order.volume <= 0) {\n throw new Error('Invalid order volume');\n }\n\n const size = order.volume * resolveSizeSign(order.order_direction);\n const tif = mapOrderTypeToTif(order.order_type);\n const reduce_only = order.order_direction === 'CLOSE_LONG' || order.order_direction === 'CLOSE_SHORT';\n const price =\n order.order_type === 'MARKET' ? '0' : order.price !== undefined ? `${order.price}` : undefined;\n if (price === undefined) {\n throw new Error('Limit/Maker order requires price');\n }\n const [, TYPE, contract] = decodePath(order.product_id);\n if (TYPE === 'FUTURE') {\n const res = await postFutureOrders(credential, 'usdt', {\n contract,\n size,\n price,\n tif,\n reduce_only,\n });\n\n if (res.label) {\n const detail = [res.label, res.message, res.detail].filter((v) => !!v).join(': ');\n throw new Error(detail);\n }\n return {\n order_id: `${res.id}`,\n };\n }\n throw new Error('Product type not support');\n};\n"]}
1
+ {"version":3,"file":"submitOrder.js","sourceRoot":"","sources":["../../../src/services/orders/submitOrder.ts"],"names":[],"mappings":";;;AACA,uDAAsE;AACtE,yCAA2C;AAC3C,2DAAwD;AAExD,MAAM,eAAe,GAAG,CAAC,eAAwB,EAAU,EAAE;IAC3D,QAAQ,eAAe,EAAE,CAAC;QACxB,KAAK,WAAW,CAAC;QACjB,KAAK,aAAa;YAChB,OAAO,CAAC,CAAC;QACX,KAAK,YAAY,CAAC;QAClB,KAAK,YAAY;YACf,OAAO,CAAC,CAAC,CAAC;QACZ;YACE,MAAM,IAAI,KAAK,CAAC,gCAAgC,eAAe,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC,CAAC;AAEK,MAAM,WAAW,GAA6C,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE;IAC/F,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,eAA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K,CAAC,0BAA0B,CAAC,CAAC;AAC9C,CAAC,CAAC;AArCW,QAAA,WAAW,eAqCtB","sourcesContent":["import { IActionHandlerOfSubmitOrder } from '@yuants/data-order';\nimport { ICredential, postFutureOrders } from '../../api/private-api';\nimport { decodePath } from '@yuants/utils';\nimport { mapOrderTypeToTif } from './mapOrderTypeToTif';\n\nconst resolveSizeSign = (order_direction?: string): number => {\n switch (order_direction) {\n case 'OPEN_LONG':\n case 'CLOSE_SHORT':\n return 1;\n case 'OPEN_SHORT':\n case 'CLOSE_LONG':\n return -1;\n default:\n throw new Error(`Unsupported order_direction: ${order_direction}`);\n }\n};\n\nexport const submitOrder: IActionHandlerOfSubmitOrder<ICredential> = async (credential, order) => {\n if (!order.product_id) {\n throw new Error('Missing product_id');\n }\n if (!order.volume || order.volume <= 0) {\n throw new Error('Invalid order volume');\n }\n\n const size = order.volume * resolveSizeSign(order.order_direction);\n const tif = mapOrderTypeToTif(order.order_type);\n const reduce_only = order.order_direction === 'CLOSE_LONG' || order.order_direction === 'CLOSE_SHORT';\n const price =\n order.order_type === 'MARKET' ? '0' : order.price !== undefined ? `${order.price}` : undefined;\n if (price === undefined) {\n throw new Error('Limit/Maker order requires price');\n }\n const [, TYPE, contract] = decodePath(order.product_id);\n if (TYPE === 'FUTURE') {\n const res = await postFutureOrders(credential, 'usdt', {\n contract,\n size,\n price,\n tif,\n reduce_only,\n });\n\n if (res.label) {\n const detail = [res.label, res.message, res.detail].filter((v) => !!v).join(': ');\n throw new Error(detail);\n }\n\n return {\n order_id: `${res.id}`,\n order_detail: res,\n };\n }\n throw new Error('Product type not support');\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuants/vendor-gate",
3
- "version": "0.9.15",
3
+ "version": "0.9.16",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "lib",
@@ -9,20 +9,20 @@
9
9
  ],
10
10
  "dependencies": {
11
11
  "rxjs": "~7.5.6",
12
- "@yuants/protocol": "0.55.0",
13
12
  "@yuants/cache": "0.3.15",
13
+ "@yuants/protocol": "0.55.0",
14
14
  "@yuants/transfer": "0.2.52",
15
15
  "@yuants/data-order": "0.7.13",
16
16
  "@yuants/data-account": "0.11.12",
17
17
  "@yuants/data-ohlc": "0.6.8",
18
18
  "@yuants/data-trade": "0.1.38",
19
19
  "@yuants/sql": "0.9.43",
20
+ "@yuants/data-product": "0.5.13",
20
21
  "@yuants/utils": "0.19.7",
21
22
  "@yuants/http-services": "0.5.3",
22
23
  "@yuants/data-series": "0.3.65",
23
24
  "@yuants/data-interest-rate": "0.2.13",
24
- "@yuants/exchange": "0.8.25",
25
- "@yuants/data-product": "0.5.13",
25
+ "@yuants/exchange": "0.8.26",
26
26
  "@yuants/data-quote": "0.4.12"
27
27
  },
28
28
  "devDependencies": {
@@ -33,8 +33,8 @@
33
33
  "@types/heft-jest": "1.0.6",
34
34
  "@types/node": "24",
35
35
  "typescript": "~5.9.3",
36
- "@yuants/extension": "0.2.43",
37
- "@yuants/tool-kit": "0.2.3"
36
+ "@yuants/tool-kit": "0.2.3",
37
+ "@yuants/extension": "0.2.43"
38
38
  },
39
39
  "publishConfig": {
40
40
  "registry": "https://registry.npmjs.org",