@hitrading/ctp-node 1.2.0 → 3.0.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +52 -31
  3. package/README.zh-CN.md +42 -26
  4. package/RELEASING.md +78 -0
  5. package/binding.gyp +13 -13
  6. package/dist/client.d.ts +40 -15
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +241 -62
  9. package/dist/client.js.map +1 -1
  10. package/dist/codec.d.ts.map +1 -1
  11. package/dist/codec.js +84 -19
  12. package/dist/codec.js.map +1 -1
  13. package/dist/generated/structs.gen.d.ts +5461 -5461
  14. package/dist/generated/structs.gen.d.ts.map +1 -1
  15. package/dist/generated/trader.gen.d.ts.map +1 -1
  16. package/dist/generated/trader.gen.js +788 -94
  17. package/dist/generated/trader.gen.js.map +1 -1
  18. package/dist/index.cjs +1896 -420
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/market-data.d.ts +48 -21
  24. package/dist/market-data.d.ts.map +1 -1
  25. package/dist/market-data.js +165 -26
  26. package/dist/market-data.js.map +1 -1
  27. package/dist/native-binding.d.ts.map +1 -1
  28. package/dist/native-binding.js +5 -1
  29. package/dist/native-binding.js.map +1 -1
  30. package/dist/trader.d.ts +127 -79
  31. package/dist/trader.d.ts.map +1 -1
  32. package/dist/trader.js +788 -200
  33. package/dist/trader.js.map +1 -1
  34. package/dist/validation.d.ts +27 -0
  35. package/dist/validation.d.ts.map +1 -0
  36. package/dist/validation.js +85 -0
  37. package/dist/validation.js.map +1 -0
  38. package/docs/API.md +1437 -0
  39. package/docs/API.zh-CN.md +1278 -0
  40. package/docs/MIGRATION.md +54 -0
  41. package/docs/assets/validation.svg +27 -0
  42. package/docs/integration.md +60 -0
  43. package/docs/native-hooks.md +281 -0
  44. package/docs/native-hooks.zh-CN.md +205 -0
  45. package/docs/troubleshooting.md +257 -0
  46. package/docs/troubleshooting.zh-CN.md +220 -0
  47. package/package.json +14 -6
  48. package/prebuilds/linux-x64/@hitrading+ctp-node.node +0 -0
  49. package/prebuilds/win32-x64/@hitrading+ctp-node.node +0 -0
  50. package/scripts/bench-decode.mjs +37 -0
  51. package/scripts/bench-fullmarket-offline.mjs +207 -0
  52. package/scripts/stress-fullmarket.mjs +255 -0
  53. package/src/addon.cc +2 -2
  54. package/src/client.ts +263 -65
  55. package/src/codec.ts +86 -19
  56. package/src/generated/structs.gen.ts +5461 -5461
  57. package/src/generated/trader.gen.ts +309 -94
  58. package/src/generated/traderreq.gen.cc +194 -18
  59. package/src/generated/traderreq.gen.h +4 -0
  60. package/src/generated/traderspi.gen.cc +130 -10
  61. package/src/generated/traderspi.gen.h +4 -2
  62. package/src/index.ts +8 -1
  63. package/src/market-data.ts +219 -43
  64. package/src/native/arm.cc +114 -30
  65. package/src/native/arm.h +16 -4
  66. package/src/native/channel.cc +209 -81
  67. package/src/native/channel.h +65 -24
  68. package/src/native/ctp_field.h +23 -0
  69. package/src/native/mdapi.cc +621 -61
  70. package/src/native/mdspi.cc +221 -14
  71. package/src/native/mdspi.h +62 -9
  72. package/src/native/order_capability.h +75 -0
  73. package/src/native/risk.cc +2051 -205
  74. package/src/native/risk.h +450 -57
  75. package/src/native/shared_handle.h +37 -0
  76. package/src/native/snapshot.h +120 -0
  77. package/src/native/traderapi.cc +749 -170
  78. package/src/native-binding.ts +5 -1
  79. package/src/trader.ts +993 -229
  80. package/src/validation.ts +96 -0
  81. /package/{tradeapi → ctpsdk}/ThostFtdcMdApi.h +0 -0
  82. /package/{tradeapi → ctpsdk}/ThostFtdcTraderApi.h +0 -0
  83. /package/{tradeapi → ctpsdk}/ThostFtdcUserApiDataType.h +0 -0
  84. /package/{tradeapi → ctpsdk}/ThostFtdcUserApiStruct.h +0 -0
  85. /package/{tradeapi → ctpsdk}/error.dtd +0 -0
  86. /package/{tradeapi → ctpsdk}/error.xml +0 -0
  87. /package/{tradeapi → ctpsdk}/linux/thostmduserapi_se.so +0 -0
  88. /package/{tradeapi → ctpsdk}/linux/thosttraderapi_se.so +0 -0
  89. /package/{tradeapi → ctpsdk}/macos/thostmduserapi_se.framework/Versions/A/Headers/ThostFtdcMdApi.h +0 -0
  90. /package/{tradeapi → ctpsdk}/macos/thostmduserapi_se.framework/Versions/A/Headers/ThostFtdcUserApiDataType.h +0 -0
  91. /package/{tradeapi → ctpsdk}/macos/thostmduserapi_se.framework/Versions/A/Headers/ThostFtdcUserApiStruct.h +0 -0
  92. /package/{tradeapi → ctpsdk}/macos/thostmduserapi_se.framework/Versions/A/Resources/Info.plist +0 -0
  93. /package/{tradeapi → ctpsdk}/macos/thostmduserapi_se.framework/Versions/A/_CodeSignature/CodeResources +0 -0
  94. /package/{tradeapi → ctpsdk}/macos/thostmduserapi_se.framework/Versions/A/thostmduserapi_se +0 -0
  95. /package/{tradeapi → ctpsdk}/macos/thosttraderapi_se.framework/Versions/A/Headers/ThostFtdcTraderApi.h +0 -0
  96. /package/{tradeapi → ctpsdk}/macos/thosttraderapi_se.framework/Versions/A/Headers/ThostFtdcUserApiDataType.h +0 -0
  97. /package/{tradeapi → ctpsdk}/macos/thosttraderapi_se.framework/Versions/A/Headers/ThostFtdcUserApiStruct.h +0 -0
  98. /package/{tradeapi → ctpsdk}/macos/thosttraderapi_se.framework/Versions/A/Resources/Info.plist +0 -0
  99. /package/{tradeapi → ctpsdk}/macos/thosttraderapi_se.framework/Versions/A/_CodeSignature/CodeResources +0 -0
  100. /package/{tradeapi → ctpsdk}/macos/thosttraderapi_se.framework/Versions/A/thosttraderapi_se +0 -0
  101. /package/{tradeapi → ctpsdk}/windows/thostmduserapi_se.dll +0 -0
  102. /package/{tradeapi → ctpsdk}/windows/thostmduserapi_se.lib +0 -0
  103. /package/{tradeapi → ctpsdk}/windows/thosttraderapi_se.dll +0 -0
  104. /package/{tradeapi → ctpsdk}/windows/thosttraderapi_se.lib +0 -0
@@ -1,6 +1,7 @@
1
1
  /* AUTO-GENERATED by scripts/codegen/generate-trader.mjs. Do not edit. */
2
2
 
3
3
  import { CtpClient } from "../client.js";
4
+ import { copyOwnRecord } from "../validation.js";
4
5
  import { STRUCT_ID } from "./structs.gen.js";
5
6
  import type * as S from "./structs.gen.js";
6
7
 
@@ -372,10 +373,22 @@ export abstract class TraderBase extends CtpClient {
372
373
  return this.request((id) => this.native._req(1, this.encode(STRUCT_ID.ReqAuthenticate, req as Record<string, unknown>), id), true);
373
374
  }
374
375
  reqUserLogin(req: Partial<S.ReqUserLogin> = {}): Promise<unknown> {
375
- return this.request((id) => this.native._req(2, this.encode(STRUCT_ID.ReqUserLogin, req as Record<string, unknown>), id), true);
376
+ let cleanReq: Record<string, unknown>;
377
+ let encoded: Uint8Array;
378
+ try { cleanReq = copyOwnRecord(req, "reqUserLogin request"); encoded = this.encode(STRUCT_ID.ReqUserLogin, cleanReq); } catch (error) { return Promise.reject(error); }
379
+ this.beginRequestContextTransition("trader session transition started");
380
+ return this.request((id) => this.native._req(2, encoded, id), true, undefined, true).then((value) => {
381
+ const row = value as { brokerId?: unknown; userId?: unknown; frontId?: unknown; sessionId?: unknown } | undefined;
382
+ if (!row || typeof row.brokerId !== "string" || !row.brokerId || typeof row.userId !== "string" || !row.userId || !Number.isInteger(row.frontId) || Number(row.frontId) <= 0 || !Number.isInteger(row.sessionId) || Number(row.sessionId) <= 0 || (typeof cleanReq.brokerId === "string" && cleanReq.brokerId && row.brokerId !== cleanReq.brokerId) || (typeof cleanReq.userId === "string" && cleanReq.userId && row.userId !== cleanReq.userId)) throw new Error("trader login response has missing or mismatched session identity");
383
+ return value;
384
+ });
376
385
  }
377
386
  reqUserLogout(req: Partial<S.UserLogout> = {}): Promise<unknown> {
378
- return this.request((id) => this.native._req(3, this.encode(STRUCT_ID.UserLogout, req as Record<string, unknown>), id), true);
387
+ let cleanReq: Record<string, unknown>;
388
+ let encoded: Uint8Array;
389
+ try { cleanReq = copyOwnRecord(req, "reqUserLogout request"); encoded = this.encode(STRUCT_ID.UserLogout, cleanReq); } catch (error) { return Promise.reject(error); }
390
+ this.beginRequestContextTransition("trader session transition started");
391
+ return this.request((id) => this.native._req(3, encoded, id), true, undefined, true);
379
392
  }
380
393
  reqUserPasswordUpdate(req: Partial<S.UserPasswordUpdate> = {}): Promise<unknown> {
381
394
  return this.request((id) => this.native._req(4, this.encode(STRUCT_ID.UserPasswordUpdate, req as Record<string, unknown>), id), true);
@@ -393,13 +406,37 @@ export abstract class TraderBase extends CtpClient {
393
406
  return this.request((id) => this.native._req(8, this.encode(STRUCT_ID.ReqGenUserText, req as Record<string, unknown>), id), true);
394
407
  }
395
408
  reqUserLoginWithCaptcha(req: Partial<S.ReqUserLoginWithCaptcha> = {}): Promise<unknown> {
396
- return this.request((id) => this.native._req(9, this.encode(STRUCT_ID.ReqUserLoginWithCaptcha, req as Record<string, unknown>), id), true);
409
+ let cleanReq: Record<string, unknown>;
410
+ let encoded: Uint8Array;
411
+ try { cleanReq = copyOwnRecord(req, "reqUserLoginWithCaptcha request"); encoded = this.encode(STRUCT_ID.ReqUserLoginWithCaptcha, cleanReq); } catch (error) { return Promise.reject(error); }
412
+ this.beginRequestContextTransition("trader session transition started");
413
+ return this.request((id) => this.native._req(9, encoded, id), true, undefined, true).then((value) => {
414
+ const row = value as { brokerId?: unknown; userId?: unknown; frontId?: unknown; sessionId?: unknown } | undefined;
415
+ if (!row || typeof row.brokerId !== "string" || !row.brokerId || typeof row.userId !== "string" || !row.userId || !Number.isInteger(row.frontId) || Number(row.frontId) <= 0 || !Number.isInteger(row.sessionId) || Number(row.sessionId) <= 0 || (typeof cleanReq.brokerId === "string" && cleanReq.brokerId && row.brokerId !== cleanReq.brokerId) || (typeof cleanReq.userId === "string" && cleanReq.userId && row.userId !== cleanReq.userId)) throw new Error("trader login response has missing or mismatched session identity");
416
+ return value;
417
+ });
397
418
  }
398
419
  reqUserLoginWithText(req: Partial<S.ReqUserLoginWithText> = {}): Promise<unknown> {
399
- return this.request((id) => this.native._req(10, this.encode(STRUCT_ID.ReqUserLoginWithText, req as Record<string, unknown>), id), true);
420
+ let cleanReq: Record<string, unknown>;
421
+ let encoded: Uint8Array;
422
+ try { cleanReq = copyOwnRecord(req, "reqUserLoginWithText request"); encoded = this.encode(STRUCT_ID.ReqUserLoginWithText, cleanReq); } catch (error) { return Promise.reject(error); }
423
+ this.beginRequestContextTransition("trader session transition started");
424
+ return this.request((id) => this.native._req(10, encoded, id), true, undefined, true).then((value) => {
425
+ const row = value as { brokerId?: unknown; userId?: unknown; frontId?: unknown; sessionId?: unknown } | undefined;
426
+ if (!row || typeof row.brokerId !== "string" || !row.brokerId || typeof row.userId !== "string" || !row.userId || !Number.isInteger(row.frontId) || Number(row.frontId) <= 0 || !Number.isInteger(row.sessionId) || Number(row.sessionId) <= 0 || (typeof cleanReq.brokerId === "string" && cleanReq.brokerId && row.brokerId !== cleanReq.brokerId) || (typeof cleanReq.userId === "string" && cleanReq.userId && row.userId !== cleanReq.userId)) throw new Error("trader login response has missing or mismatched session identity");
427
+ return value;
428
+ });
400
429
  }
401
430
  reqUserLoginWithOtp(req: Partial<S.ReqUserLoginWithOTP> = {}): Promise<unknown> {
402
- return this.request((id) => this.native._req(11, this.encode(STRUCT_ID.ReqUserLoginWithOTP, req as Record<string, unknown>), id), true);
431
+ let cleanReq: Record<string, unknown>;
432
+ let encoded: Uint8Array;
433
+ try { cleanReq = copyOwnRecord(req, "reqUserLoginWithOtp request"); encoded = this.encode(STRUCT_ID.ReqUserLoginWithOTP, cleanReq); } catch (error) { return Promise.reject(error); }
434
+ this.beginRequestContextTransition("trader session transition started");
435
+ return this.request((id) => this.native._req(11, encoded, id), true, undefined, true).then((value) => {
436
+ const row = value as { brokerId?: unknown; userId?: unknown; frontId?: unknown; sessionId?: unknown } | undefined;
437
+ if (!row || typeof row.brokerId !== "string" || !row.brokerId || typeof row.userId !== "string" || !row.userId || !Number.isInteger(row.frontId) || Number(row.frontId) <= 0 || !Number.isInteger(row.sessionId) || Number(row.sessionId) <= 0 || (typeof cleanReq.brokerId === "string" && cleanReq.brokerId && row.brokerId !== cleanReq.brokerId) || (typeof cleanReq.userId === "string" && cleanReq.userId && row.userId !== cleanReq.userId)) throw new Error("trader login response has missing or mismatched session identity");
438
+ return value;
439
+ });
403
440
  }
404
441
  reqOrderInsert(req: Partial<S.InputOrder> = {}): Promise<void> {
405
442
  return this.submit((id) => this.native._req(12, this.encode(STRUCT_ID.InputOrder, req as Record<string, unknown>), id));
@@ -414,7 +451,9 @@ export abstract class TraderBase extends CtpClient {
414
451
  return this.submit((id) => this.native._req(15, this.encode(STRUCT_ID.InputOrderAction, req as Record<string, unknown>), id));
415
452
  }
416
453
  reqQryMaxOrderVolume(req: Partial<S.QryMaxOrderVolume> = {}): Promise<unknown[]> {
417
- return this.request((id) => this.native._req(16, this.encode(STRUCT_ID.QryMaxOrderVolume, req as Record<string, unknown>), id), false);
454
+ let encoded: Uint8Array;
455
+ try { encoded = this.encode(STRUCT_ID.QryMaxOrderVolume, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
456
+ return this.queryRequest((id) => this.native._req(16, encoded, id), false);
418
457
  }
419
458
  reqSettlementInfoConfirm(req: Partial<S.SettlementInfoConfirm> = {}): Promise<unknown> {
420
459
  return this.request((id) => this.native._req(17, this.encode(STRUCT_ID.SettlementInfoConfirm, req as Record<string, unknown>), id), true);
@@ -453,163 +492,269 @@ export abstract class TraderBase extends CtpClient {
453
492
  return this.submit((id) => this.native._req(28, this.encode(STRUCT_ID.InputCombAction, req as Record<string, unknown>), id));
454
493
  }
455
494
  reqQryOrder(req: Partial<S.QryOrder> = {}): Promise<unknown[]> {
456
- return this.request((id) => this.native._req(29, this.encode(STRUCT_ID.QryOrder, req as Record<string, unknown>), id), false);
495
+ let encoded: Uint8Array;
496
+ try { encoded = this.encode(STRUCT_ID.QryOrder, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
497
+ return this.queryRequest((id) => this.native._req(29, encoded, id), false);
457
498
  }
458
499
  reqQryTrade(req: Partial<S.QryTrade> = {}): Promise<unknown[]> {
459
- return this.request((id) => this.native._req(30, this.encode(STRUCT_ID.QryTrade, req as Record<string, unknown>), id), false);
500
+ let encoded: Uint8Array;
501
+ try { encoded = this.encode(STRUCT_ID.QryTrade, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
502
+ return this.queryRequest((id) => this.native._req(30, encoded, id), false);
460
503
  }
461
504
  reqQryInvestorPosition(req: Partial<S.QryInvestorPosition> = {}): Promise<unknown[]> {
462
- return this.request((id) => this.native._req(31, this.encode(STRUCT_ID.QryInvestorPosition, req as Record<string, unknown>), id), false);
505
+ let encoded: Uint8Array;
506
+ try { encoded = this.encode(STRUCT_ID.QryInvestorPosition, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
507
+ return this.queryRequest((id) => this.native._req(31, encoded, id), false);
463
508
  }
464
509
  reqQryTradingAccount(req: Partial<S.QryTradingAccount> = {}): Promise<unknown[]> {
465
- return this.request((id) => this.native._req(32, this.encode(STRUCT_ID.QryTradingAccount, req as Record<string, unknown>), id), false);
510
+ let encoded: Uint8Array;
511
+ try { encoded = this.encode(STRUCT_ID.QryTradingAccount, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
512
+ return this.queryRequest((id) => this.native._req(32, encoded, id), false);
466
513
  }
467
514
  reqQryInvestor(req: Partial<S.QryInvestor> = {}): Promise<unknown[]> {
468
- return this.request((id) => this.native._req(33, this.encode(STRUCT_ID.QryInvestor, req as Record<string, unknown>), id), false);
515
+ let encoded: Uint8Array;
516
+ try { encoded = this.encode(STRUCT_ID.QryInvestor, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
517
+ return this.queryRequest((id) => this.native._req(33, encoded, id), false);
469
518
  }
470
519
  reqQryTradingCode(req: Partial<S.QryTradingCode> = {}): Promise<unknown[]> {
471
- return this.request((id) => this.native._req(34, this.encode(STRUCT_ID.QryTradingCode, req as Record<string, unknown>), id), false);
520
+ let encoded: Uint8Array;
521
+ try { encoded = this.encode(STRUCT_ID.QryTradingCode, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
522
+ return this.queryRequest((id) => this.native._req(34, encoded, id), false);
472
523
  }
473
524
  reqQryInstrumentMarginRate(req: Partial<S.QryInstrumentMarginRate> = {}): Promise<unknown[]> {
474
- return this.request((id) => this.native._req(35, this.encode(STRUCT_ID.QryInstrumentMarginRate, req as Record<string, unknown>), id), false);
525
+ let encoded: Uint8Array;
526
+ try { encoded = this.encode(STRUCT_ID.QryInstrumentMarginRate, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
527
+ return this.queryRequest((id) => this.native._req(35, encoded, id), false);
475
528
  }
476
529
  reqQryInstrumentCommissionRate(req: Partial<S.QryInstrumentCommissionRate> = {}): Promise<unknown[]> {
477
- return this.request((id) => this.native._req(36, this.encode(STRUCT_ID.QryInstrumentCommissionRate, req as Record<string, unknown>), id), false);
530
+ let encoded: Uint8Array;
531
+ try { encoded = this.encode(STRUCT_ID.QryInstrumentCommissionRate, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
532
+ return this.queryRequest((id) => this.native._req(36, encoded, id), false);
478
533
  }
479
534
  reqQryUserSession(req: Partial<S.QryUserSession> = {}): Promise<unknown[]> {
480
- return this.request((id) => this.native._req(37, this.encode(STRUCT_ID.QryUserSession, req as Record<string, unknown>), id), false);
535
+ let encoded: Uint8Array;
536
+ try { encoded = this.encode(STRUCT_ID.QryUserSession, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
537
+ return this.queryRequest((id) => this.native._req(37, encoded, id), false);
481
538
  }
482
539
  reqQryExchange(req: Partial<S.QryExchange> = {}): Promise<unknown[]> {
483
- return this.request((id) => this.native._req(38, this.encode(STRUCT_ID.QryExchange, req as Record<string, unknown>), id), false);
540
+ let encoded: Uint8Array;
541
+ try { encoded = this.encode(STRUCT_ID.QryExchange, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
542
+ return this.queryRequest((id) => this.native._req(38, encoded, id), false);
484
543
  }
485
544
  reqQryProduct(req: Partial<S.QryProduct> = {}): Promise<unknown[]> {
486
- return this.request((id) => this.native._req(39, this.encode(STRUCT_ID.QryProduct, req as Record<string, unknown>), id), false);
545
+ let encoded: Uint8Array;
546
+ try { encoded = this.encode(STRUCT_ID.QryProduct, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
547
+ return this.queryRequest((id) => this.native._req(39, encoded, id), false);
487
548
  }
488
549
  reqQryInstrument(req: Partial<S.QryInstrument> = {}): Promise<unknown[]> {
489
- return this.request((id) => this.native._req(40, this.encode(STRUCT_ID.QryInstrument, req as Record<string, unknown>), id), false);
550
+ let encoded: Uint8Array;
551
+ try { encoded = this.encode(STRUCT_ID.QryInstrument, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
552
+ return this.queryRequest((id) => this.native._req(40, encoded, id), false);
490
553
  }
491
554
  reqQryDepthMarketData(req: Partial<S.QryDepthMarketData> = {}): Promise<unknown[]> {
492
- return this.request((id) => this.native._req(41, this.encode(STRUCT_ID.QryDepthMarketData, req as Record<string, unknown>), id), false);
555
+ let encoded: Uint8Array;
556
+ try { encoded = this.encode(STRUCT_ID.QryDepthMarketData, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
557
+ return this.queryRequest((id) => this.native._req(41, encoded, id), false);
493
558
  }
494
559
  reqQryTraderOffer(req: Partial<S.QryTraderOffer> = {}): Promise<unknown[]> {
495
- return this.request((id) => this.native._req(42, this.encode(STRUCT_ID.QryTraderOffer, req as Record<string, unknown>), id), false);
560
+ let encoded: Uint8Array;
561
+ try { encoded = this.encode(STRUCT_ID.QryTraderOffer, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
562
+ return this.queryRequest((id) => this.native._req(42, encoded, id), false);
496
563
  }
497
564
  reqQrySettlementInfo(req: Partial<S.QrySettlementInfo> = {}): Promise<unknown[]> {
498
- return this.request((id) => this.native._req(43, this.encode(STRUCT_ID.QrySettlementInfo, req as Record<string, unknown>), id), false);
565
+ let encoded: Uint8Array;
566
+ try { encoded = this.encode(STRUCT_ID.QrySettlementInfo, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
567
+ return this.queryRequest((id) => this.native._req(43, encoded, id), false);
499
568
  }
500
569
  reqQryTransferBank(req: Partial<S.QryTransferBank> = {}): Promise<unknown[]> {
501
- return this.request((id) => this.native._req(44, this.encode(STRUCT_ID.QryTransferBank, req as Record<string, unknown>), id), false);
570
+ let encoded: Uint8Array;
571
+ try { encoded = this.encode(STRUCT_ID.QryTransferBank, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
572
+ return this.queryRequest((id) => this.native._req(44, encoded, id), false);
502
573
  }
503
574
  reqQryInvestorPositionDetail(req: Partial<S.QryInvestorPositionDetail> = {}): Promise<unknown[]> {
504
- return this.request((id) => this.native._req(45, this.encode(STRUCT_ID.QryInvestorPositionDetail, req as Record<string, unknown>), id), false);
575
+ let encoded: Uint8Array;
576
+ try { encoded = this.encode(STRUCT_ID.QryInvestorPositionDetail, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
577
+ return this.queryRequest((id) => this.native._req(45, encoded, id), false);
505
578
  }
506
579
  reqQryNotice(req: Partial<S.QryNotice> = {}): Promise<unknown[]> {
507
- return this.request((id) => this.native._req(46, this.encode(STRUCT_ID.QryNotice, req as Record<string, unknown>), id), false);
580
+ let encoded: Uint8Array;
581
+ try { encoded = this.encode(STRUCT_ID.QryNotice, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
582
+ return this.queryRequest((id) => this.native._req(46, encoded, id), false);
508
583
  }
509
584
  reqQrySettlementInfoConfirm(req: Partial<S.QrySettlementInfoConfirm> = {}): Promise<unknown[]> {
510
- return this.request((id) => this.native._req(47, this.encode(STRUCT_ID.QrySettlementInfoConfirm, req as Record<string, unknown>), id), false);
585
+ let encoded: Uint8Array;
586
+ try { encoded = this.encode(STRUCT_ID.QrySettlementInfoConfirm, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
587
+ return this.queryRequest((id) => this.native._req(47, encoded, id), false);
511
588
  }
512
589
  reqQryInvestorPositionCombineDetail(req: Partial<S.QryInvestorPositionCombineDetail> = {}): Promise<unknown[]> {
513
- return this.request((id) => this.native._req(48, this.encode(STRUCT_ID.QryInvestorPositionCombineDetail, req as Record<string, unknown>), id), false);
590
+ let encoded: Uint8Array;
591
+ try { encoded = this.encode(STRUCT_ID.QryInvestorPositionCombineDetail, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
592
+ return this.queryRequest((id) => this.native._req(48, encoded, id), false);
514
593
  }
515
594
  reqQryCfmmcTradingAccountKey(req: Partial<S.QryCFMMCTradingAccountKey> = {}): Promise<unknown[]> {
516
- return this.request((id) => this.native._req(49, this.encode(STRUCT_ID.QryCFMMCTradingAccountKey, req as Record<string, unknown>), id), false);
595
+ let encoded: Uint8Array;
596
+ try { encoded = this.encode(STRUCT_ID.QryCFMMCTradingAccountKey, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
597
+ return this.queryRequest((id) => this.native._req(49, encoded, id), false);
517
598
  }
518
599
  reqQryEWarrantOffset(req: Partial<S.QryEWarrantOffset> = {}): Promise<unknown[]> {
519
- return this.request((id) => this.native._req(50, this.encode(STRUCT_ID.QryEWarrantOffset, req as Record<string, unknown>), id), false);
600
+ let encoded: Uint8Array;
601
+ try { encoded = this.encode(STRUCT_ID.QryEWarrantOffset, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
602
+ return this.queryRequest((id) => this.native._req(50, encoded, id), false);
520
603
  }
521
604
  reqQryInvestorProductGroupMargin(req: Partial<S.QryInvestorProductGroupMargin> = {}): Promise<unknown[]> {
522
- return this.request((id) => this.native._req(51, this.encode(STRUCT_ID.QryInvestorProductGroupMargin, req as Record<string, unknown>), id), false);
605
+ let encoded: Uint8Array;
606
+ try { encoded = this.encode(STRUCT_ID.QryInvestorProductGroupMargin, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
607
+ return this.queryRequest((id) => this.native._req(51, encoded, id), false);
523
608
  }
524
609
  reqQryExchangeMarginRate(req: Partial<S.QryExchangeMarginRate> = {}): Promise<unknown[]> {
525
- return this.request((id) => this.native._req(52, this.encode(STRUCT_ID.QryExchangeMarginRate, req as Record<string, unknown>), id), false);
610
+ let encoded: Uint8Array;
611
+ try { encoded = this.encode(STRUCT_ID.QryExchangeMarginRate, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
612
+ return this.queryRequest((id) => this.native._req(52, encoded, id), false);
526
613
  }
527
614
  reqQryExchangeMarginRateAdjust(req: Partial<S.QryExchangeMarginRateAdjust> = {}): Promise<unknown[]> {
528
- return this.request((id) => this.native._req(53, this.encode(STRUCT_ID.QryExchangeMarginRateAdjust, req as Record<string, unknown>), id), false);
615
+ let encoded: Uint8Array;
616
+ try { encoded = this.encode(STRUCT_ID.QryExchangeMarginRateAdjust, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
617
+ return this.queryRequest((id) => this.native._req(53, encoded, id), false);
529
618
  }
530
619
  reqQryExchangeRate(req: Partial<S.QryExchangeRate> = {}): Promise<unknown[]> {
531
- return this.request((id) => this.native._req(54, this.encode(STRUCT_ID.QryExchangeRate, req as Record<string, unknown>), id), false);
620
+ let encoded: Uint8Array;
621
+ try { encoded = this.encode(STRUCT_ID.QryExchangeRate, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
622
+ return this.queryRequest((id) => this.native._req(54, encoded, id), false);
532
623
  }
533
624
  reqQrySecAgentAcidMap(req: Partial<S.QrySecAgentACIDMap> = {}): Promise<unknown[]> {
534
- return this.request((id) => this.native._req(55, this.encode(STRUCT_ID.QrySecAgentACIDMap, req as Record<string, unknown>), id), false);
625
+ let encoded: Uint8Array;
626
+ try { encoded = this.encode(STRUCT_ID.QrySecAgentACIDMap, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
627
+ return this.queryRequest((id) => this.native._req(55, encoded, id), false);
535
628
  }
536
629
  reqQryProductExchRate(req: Partial<S.QryProductExchRate> = {}): Promise<unknown[]> {
537
- return this.request((id) => this.native._req(56, this.encode(STRUCT_ID.QryProductExchRate, req as Record<string, unknown>), id), false);
630
+ let encoded: Uint8Array;
631
+ try { encoded = this.encode(STRUCT_ID.QryProductExchRate, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
632
+ return this.queryRequest((id) => this.native._req(56, encoded, id), false);
538
633
  }
539
634
  reqQryProductGroup(req: Partial<S.QryProductGroup> = {}): Promise<unknown[]> {
540
- return this.request((id) => this.native._req(57, this.encode(STRUCT_ID.QryProductGroup, req as Record<string, unknown>), id), false);
635
+ let encoded: Uint8Array;
636
+ try { encoded = this.encode(STRUCT_ID.QryProductGroup, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
637
+ return this.queryRequest((id) => this.native._req(57, encoded, id), false);
541
638
  }
542
639
  reqQryMmInstrumentCommissionRate(req: Partial<S.QryMMInstrumentCommissionRate> = {}): Promise<unknown[]> {
543
- return this.request((id) => this.native._req(58, this.encode(STRUCT_ID.QryMMInstrumentCommissionRate, req as Record<string, unknown>), id), false);
640
+ let encoded: Uint8Array;
641
+ try { encoded = this.encode(STRUCT_ID.QryMMInstrumentCommissionRate, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
642
+ return this.queryRequest((id) => this.native._req(58, encoded, id), false);
544
643
  }
545
644
  reqQryMmOptionInstrCommRate(req: Partial<S.QryMMOptionInstrCommRate> = {}): Promise<unknown[]> {
546
- return this.request((id) => this.native._req(59, this.encode(STRUCT_ID.QryMMOptionInstrCommRate, req as Record<string, unknown>), id), false);
645
+ let encoded: Uint8Array;
646
+ try { encoded = this.encode(STRUCT_ID.QryMMOptionInstrCommRate, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
647
+ return this.queryRequest((id) => this.native._req(59, encoded, id), false);
547
648
  }
548
649
  reqQryInstrumentOrderCommRate(req: Partial<S.QryInstrumentOrderCommRate> = {}): Promise<unknown[]> {
549
- return this.request((id) => this.native._req(60, this.encode(STRUCT_ID.QryInstrumentOrderCommRate, req as Record<string, unknown>), id), false);
650
+ let encoded: Uint8Array;
651
+ try { encoded = this.encode(STRUCT_ID.QryInstrumentOrderCommRate, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
652
+ return this.queryRequest((id) => this.native._req(60, encoded, id), false);
550
653
  }
551
654
  reqQrySecAgentTradingAccount(req: Partial<S.QryTradingAccount> = {}): Promise<unknown[]> {
552
- return this.request((id) => this.native._req(61, this.encode(STRUCT_ID.QryTradingAccount, req as Record<string, unknown>), id), false);
655
+ let encoded: Uint8Array;
656
+ try { encoded = this.encode(STRUCT_ID.QryTradingAccount, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
657
+ return this.queryRequest((id) => this.native._req(61, encoded, id), false);
553
658
  }
554
659
  reqQrySecAgentCheckMode(req: Partial<S.QrySecAgentCheckMode> = {}): Promise<unknown[]> {
555
- return this.request((id) => this.native._req(62, this.encode(STRUCT_ID.QrySecAgentCheckMode, req as Record<string, unknown>), id), false);
660
+ let encoded: Uint8Array;
661
+ try { encoded = this.encode(STRUCT_ID.QrySecAgentCheckMode, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
662
+ return this.queryRequest((id) => this.native._req(62, encoded, id), false);
556
663
  }
557
664
  reqQrySecAgentTradeInfo(req: Partial<S.QrySecAgentTradeInfo> = {}): Promise<unknown[]> {
558
- return this.request((id) => this.native._req(63, this.encode(STRUCT_ID.QrySecAgentTradeInfo, req as Record<string, unknown>), id), false);
665
+ let encoded: Uint8Array;
666
+ try { encoded = this.encode(STRUCT_ID.QrySecAgentTradeInfo, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
667
+ return this.queryRequest((id) => this.native._req(63, encoded, id), false);
559
668
  }
560
669
  reqQryOptionInstrTradeCost(req: Partial<S.QryOptionInstrTradeCost> = {}): Promise<unknown[]> {
561
- return this.request((id) => this.native._req(64, this.encode(STRUCT_ID.QryOptionInstrTradeCost, req as Record<string, unknown>), id), false);
670
+ let encoded: Uint8Array;
671
+ try { encoded = this.encode(STRUCT_ID.QryOptionInstrTradeCost, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
672
+ return this.queryRequest((id) => this.native._req(64, encoded, id), false);
562
673
  }
563
674
  reqQryOptionInstrCommRate(req: Partial<S.QryOptionInstrCommRate> = {}): Promise<unknown[]> {
564
- return this.request((id) => this.native._req(65, this.encode(STRUCT_ID.QryOptionInstrCommRate, req as Record<string, unknown>), id), false);
675
+ let encoded: Uint8Array;
676
+ try { encoded = this.encode(STRUCT_ID.QryOptionInstrCommRate, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
677
+ return this.queryRequest((id) => this.native._req(65, encoded, id), false);
565
678
  }
566
679
  reqQryExecOrder(req: Partial<S.QryExecOrder> = {}): Promise<unknown[]> {
567
- return this.request((id) => this.native._req(66, this.encode(STRUCT_ID.QryExecOrder, req as Record<string, unknown>), id), false);
680
+ let encoded: Uint8Array;
681
+ try { encoded = this.encode(STRUCT_ID.QryExecOrder, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
682
+ return this.queryRequest((id) => this.native._req(66, encoded, id), false);
568
683
  }
569
684
  reqQryForQuote(req: Partial<S.QryForQuote> = {}): Promise<unknown[]> {
570
- return this.request((id) => this.native._req(67, this.encode(STRUCT_ID.QryForQuote, req as Record<string, unknown>), id), false);
685
+ let encoded: Uint8Array;
686
+ try { encoded = this.encode(STRUCT_ID.QryForQuote, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
687
+ return this.queryRequest((id) => this.native._req(67, encoded, id), false);
571
688
  }
572
689
  reqQryQuote(req: Partial<S.QryQuote> = {}): Promise<unknown[]> {
573
- return this.request((id) => this.native._req(68, this.encode(STRUCT_ID.QryQuote, req as Record<string, unknown>), id), false);
690
+ let encoded: Uint8Array;
691
+ try { encoded = this.encode(STRUCT_ID.QryQuote, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
692
+ return this.queryRequest((id) => this.native._req(68, encoded, id), false);
574
693
  }
575
694
  reqQryOptionSelfClose(req: Partial<S.QryOptionSelfClose> = {}): Promise<unknown[]> {
576
- return this.request((id) => this.native._req(69, this.encode(STRUCT_ID.QryOptionSelfClose, req as Record<string, unknown>), id), false);
695
+ let encoded: Uint8Array;
696
+ try { encoded = this.encode(STRUCT_ID.QryOptionSelfClose, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
697
+ return this.queryRequest((id) => this.native._req(69, encoded, id), false);
577
698
  }
578
699
  reqQryInvestUnit(req: Partial<S.QryInvestUnit> = {}): Promise<unknown[]> {
579
- return this.request((id) => this.native._req(70, this.encode(STRUCT_ID.QryInvestUnit, req as Record<string, unknown>), id), false);
700
+ let encoded: Uint8Array;
701
+ try { encoded = this.encode(STRUCT_ID.QryInvestUnit, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
702
+ return this.queryRequest((id) => this.native._req(70, encoded, id), false);
580
703
  }
581
704
  reqQryCombInstrumentGuard(req: Partial<S.QryCombInstrumentGuard> = {}): Promise<unknown[]> {
582
- return this.request((id) => this.native._req(71, this.encode(STRUCT_ID.QryCombInstrumentGuard, req as Record<string, unknown>), id), false);
705
+ let encoded: Uint8Array;
706
+ try { encoded = this.encode(STRUCT_ID.QryCombInstrumentGuard, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
707
+ return this.queryRequest((id) => this.native._req(71, encoded, id), false);
583
708
  }
584
709
  reqQryCombAction(req: Partial<S.QryCombAction> = {}): Promise<unknown[]> {
585
- return this.request((id) => this.native._req(72, this.encode(STRUCT_ID.QryCombAction, req as Record<string, unknown>), id), false);
710
+ let encoded: Uint8Array;
711
+ try { encoded = this.encode(STRUCT_ID.QryCombAction, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
712
+ return this.queryRequest((id) => this.native._req(72, encoded, id), false);
586
713
  }
587
714
  reqQryTransferSerial(req: Partial<S.QryTransferSerial> = {}): Promise<unknown[]> {
588
- return this.request((id) => this.native._req(73, this.encode(STRUCT_ID.QryTransferSerial, req as Record<string, unknown>), id), false);
715
+ let encoded: Uint8Array;
716
+ try { encoded = this.encode(STRUCT_ID.QryTransferSerial, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
717
+ return this.queryRequest((id) => this.native._req(73, encoded, id), false);
589
718
  }
590
719
  reqQryAccountregister(req: Partial<S.QryAccountregister> = {}): Promise<unknown[]> {
591
- return this.request((id) => this.native._req(74, this.encode(STRUCT_ID.QryAccountregister, req as Record<string, unknown>), id), false);
720
+ let encoded: Uint8Array;
721
+ try { encoded = this.encode(STRUCT_ID.QryAccountregister, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
722
+ return this.queryRequest((id) => this.native._req(74, encoded, id), false);
592
723
  }
593
724
  reqQryContractBank(req: Partial<S.QryContractBank> = {}): Promise<unknown[]> {
594
- return this.request((id) => this.native._req(75, this.encode(STRUCT_ID.QryContractBank, req as Record<string, unknown>), id), false);
725
+ let encoded: Uint8Array;
726
+ try { encoded = this.encode(STRUCT_ID.QryContractBank, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
727
+ return this.queryRequest((id) => this.native._req(75, encoded, id), false);
595
728
  }
596
729
  reqQryParkedOrder(req: Partial<S.QryParkedOrder> = {}): Promise<unknown[]> {
597
- return this.request((id) => this.native._req(76, this.encode(STRUCT_ID.QryParkedOrder, req as Record<string, unknown>), id), false);
730
+ let encoded: Uint8Array;
731
+ try { encoded = this.encode(STRUCT_ID.QryParkedOrder, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
732
+ return this.queryRequest((id) => this.native._req(76, encoded, id), false);
598
733
  }
599
734
  reqQryParkedOrderAction(req: Partial<S.QryParkedOrderAction> = {}): Promise<unknown[]> {
600
- return this.request((id) => this.native._req(77, this.encode(STRUCT_ID.QryParkedOrderAction, req as Record<string, unknown>), id), false);
735
+ let encoded: Uint8Array;
736
+ try { encoded = this.encode(STRUCT_ID.QryParkedOrderAction, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
737
+ return this.queryRequest((id) => this.native._req(77, encoded, id), false);
601
738
  }
602
739
  reqQryTradingNotice(req: Partial<S.QryTradingNotice> = {}): Promise<unknown[]> {
603
- return this.request((id) => this.native._req(78, this.encode(STRUCT_ID.QryTradingNotice, req as Record<string, unknown>), id), false);
740
+ let encoded: Uint8Array;
741
+ try { encoded = this.encode(STRUCT_ID.QryTradingNotice, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
742
+ return this.queryRequest((id) => this.native._req(78, encoded, id), false);
604
743
  }
605
744
  reqQryBrokerTradingParams(req: Partial<S.QryBrokerTradingParams> = {}): Promise<unknown[]> {
606
- return this.request((id) => this.native._req(79, this.encode(STRUCT_ID.QryBrokerTradingParams, req as Record<string, unknown>), id), false);
745
+ let encoded: Uint8Array;
746
+ try { encoded = this.encode(STRUCT_ID.QryBrokerTradingParams, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
747
+ return this.queryRequest((id) => this.native._req(79, encoded, id), false);
607
748
  }
608
749
  reqQryBrokerTradingAlgos(req: Partial<S.QryBrokerTradingAlgos> = {}): Promise<unknown[]> {
609
- return this.request((id) => this.native._req(80, this.encode(STRUCT_ID.QryBrokerTradingAlgos, req as Record<string, unknown>), id), false);
750
+ let encoded: Uint8Array;
751
+ try { encoded = this.encode(STRUCT_ID.QryBrokerTradingAlgos, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
752
+ return this.queryRequest((id) => this.native._req(80, encoded, id), false);
610
753
  }
611
754
  reqQueryCfmmcTradingAccountToken(req: Partial<S.QueryCFMMCTradingAccountToken> = {}): Promise<unknown> {
612
- return this.request((id) => this.native._req(81, this.encode(STRUCT_ID.QueryCFMMCTradingAccountToken, req as Record<string, unknown>), id), true);
755
+ let encoded: Uint8Array;
756
+ try { encoded = this.encode(STRUCT_ID.QueryCFMMCTradingAccountToken, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
757
+ return this.queryRequest((id) => this.native._req(81, encoded, id), true);
613
758
  }
614
759
  reqFromBankToFutureByFuture(req: Partial<S.ReqTransfer> = {}): Promise<unknown> {
615
760
  return this.request((id) => this.native._req(82, this.encode(STRUCT_ID.ReqTransfer, req as Record<string, unknown>), id), true);
@@ -618,100 +763,164 @@ export abstract class TraderBase extends CtpClient {
618
763
  return this.request((id) => this.native._req(83, this.encode(STRUCT_ID.ReqTransfer, req as Record<string, unknown>), id), true);
619
764
  }
620
765
  reqQueryBankAccountMoneyByFuture(req: Partial<S.ReqQueryAccount> = {}): Promise<unknown> {
621
- return this.request((id) => this.native._req(84, this.encode(STRUCT_ID.ReqQueryAccount, req as Record<string, unknown>), id), true);
766
+ let encoded: Uint8Array;
767
+ try { encoded = this.encode(STRUCT_ID.ReqQueryAccount, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
768
+ return this.queryRequest((id) => this.native._req(84, encoded, id), true);
622
769
  }
623
770
  reqQryClassifiedInstrument(req: Partial<S.QryClassifiedInstrument> = {}): Promise<unknown[]> {
624
- return this.request((id) => this.native._req(85, this.encode(STRUCT_ID.QryClassifiedInstrument, req as Record<string, unknown>), id), false);
771
+ let encoded: Uint8Array;
772
+ try { encoded = this.encode(STRUCT_ID.QryClassifiedInstrument, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
773
+ return this.queryRequest((id) => this.native._req(85, encoded, id), false);
625
774
  }
626
775
  reqQryCombPromotionParam(req: Partial<S.QryCombPromotionParam> = {}): Promise<unknown[]> {
627
- return this.request((id) => this.native._req(86, this.encode(STRUCT_ID.QryCombPromotionParam, req as Record<string, unknown>), id), false);
776
+ let encoded: Uint8Array;
777
+ try { encoded = this.encode(STRUCT_ID.QryCombPromotionParam, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
778
+ return this.queryRequest((id) => this.native._req(86, encoded, id), false);
628
779
  }
629
780
  reqQryRiskSettleInvstPosition(req: Partial<S.QryRiskSettleInvstPosition> = {}): Promise<unknown[]> {
630
- return this.request((id) => this.native._req(87, this.encode(STRUCT_ID.QryRiskSettleInvstPosition, req as Record<string, unknown>), id), false);
781
+ let encoded: Uint8Array;
782
+ try { encoded = this.encode(STRUCT_ID.QryRiskSettleInvstPosition, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
783
+ return this.queryRequest((id) => this.native._req(87, encoded, id), false);
631
784
  }
632
785
  reqQryRiskSettleProductStatus(req: Partial<S.QryRiskSettleProductStatus> = {}): Promise<unknown[]> {
633
- return this.request((id) => this.native._req(88, this.encode(STRUCT_ID.QryRiskSettleProductStatus, req as Record<string, unknown>), id), false);
786
+ let encoded: Uint8Array;
787
+ try { encoded = this.encode(STRUCT_ID.QryRiskSettleProductStatus, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
788
+ return this.queryRequest((id) => this.native._req(88, encoded, id), false);
634
789
  }
635
790
  reqQrySpbmFutureParameter(req: Partial<S.QrySPBMFutureParameter> = {}): Promise<unknown[]> {
636
- return this.request((id) => this.native._req(89, this.encode(STRUCT_ID.QrySPBMFutureParameter, req as Record<string, unknown>), id), false);
791
+ let encoded: Uint8Array;
792
+ try { encoded = this.encode(STRUCT_ID.QrySPBMFutureParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
793
+ return this.queryRequest((id) => this.native._req(89, encoded, id), false);
637
794
  }
638
795
  reqQrySpbmOptionParameter(req: Partial<S.QrySPBMOptionParameter> = {}): Promise<unknown[]> {
639
- return this.request((id) => this.native._req(90, this.encode(STRUCT_ID.QrySPBMOptionParameter, req as Record<string, unknown>), id), false);
796
+ let encoded: Uint8Array;
797
+ try { encoded = this.encode(STRUCT_ID.QrySPBMOptionParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
798
+ return this.queryRequest((id) => this.native._req(90, encoded, id), false);
640
799
  }
641
800
  reqQrySpbmIntraParameter(req: Partial<S.QrySPBMIntraParameter> = {}): Promise<unknown[]> {
642
- return this.request((id) => this.native._req(91, this.encode(STRUCT_ID.QrySPBMIntraParameter, req as Record<string, unknown>), id), false);
801
+ let encoded: Uint8Array;
802
+ try { encoded = this.encode(STRUCT_ID.QrySPBMIntraParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
803
+ return this.queryRequest((id) => this.native._req(91, encoded, id), false);
643
804
  }
644
805
  reqQrySpbmInterParameter(req: Partial<S.QrySPBMInterParameter> = {}): Promise<unknown[]> {
645
- return this.request((id) => this.native._req(92, this.encode(STRUCT_ID.QrySPBMInterParameter, req as Record<string, unknown>), id), false);
806
+ let encoded: Uint8Array;
807
+ try { encoded = this.encode(STRUCT_ID.QrySPBMInterParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
808
+ return this.queryRequest((id) => this.native._req(92, encoded, id), false);
646
809
  }
647
810
  reqQrySpbmPortfDefinition(req: Partial<S.QrySPBMPortfDefinition> = {}): Promise<unknown[]> {
648
- return this.request((id) => this.native._req(93, this.encode(STRUCT_ID.QrySPBMPortfDefinition, req as Record<string, unknown>), id), false);
811
+ let encoded: Uint8Array;
812
+ try { encoded = this.encode(STRUCT_ID.QrySPBMPortfDefinition, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
813
+ return this.queryRequest((id) => this.native._req(93, encoded, id), false);
649
814
  }
650
815
  reqQrySpbmInvestorPortfDef(req: Partial<S.QrySPBMInvestorPortfDef> = {}): Promise<unknown[]> {
651
- return this.request((id) => this.native._req(94, this.encode(STRUCT_ID.QrySPBMInvestorPortfDef, req as Record<string, unknown>), id), false);
816
+ let encoded: Uint8Array;
817
+ try { encoded = this.encode(STRUCT_ID.QrySPBMInvestorPortfDef, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
818
+ return this.queryRequest((id) => this.native._req(94, encoded, id), false);
652
819
  }
653
820
  reqQryInvestorPortfMarginRatio(req: Partial<S.QryInvestorPortfMarginRatio> = {}): Promise<unknown[]> {
654
- return this.request((id) => this.native._req(95, this.encode(STRUCT_ID.QryInvestorPortfMarginRatio, req as Record<string, unknown>), id), false);
821
+ let encoded: Uint8Array;
822
+ try { encoded = this.encode(STRUCT_ID.QryInvestorPortfMarginRatio, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
823
+ return this.queryRequest((id) => this.native._req(95, encoded, id), false);
655
824
  }
656
825
  reqQryInvestorProdSpbmDetail(req: Partial<S.QryInvestorProdSPBMDetail> = {}): Promise<unknown[]> {
657
- return this.request((id) => this.native._req(96, this.encode(STRUCT_ID.QryInvestorProdSPBMDetail, req as Record<string, unknown>), id), false);
826
+ let encoded: Uint8Array;
827
+ try { encoded = this.encode(STRUCT_ID.QryInvestorProdSPBMDetail, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
828
+ return this.queryRequest((id) => this.native._req(96, encoded, id), false);
658
829
  }
659
830
  reqQryInvestorCommoditySpmmMargin(req: Partial<S.QryInvestorCommoditySPMMMargin> = {}): Promise<unknown[]> {
660
- return this.request((id) => this.native._req(97, this.encode(STRUCT_ID.QryInvestorCommoditySPMMMargin, req as Record<string, unknown>), id), false);
831
+ let encoded: Uint8Array;
832
+ try { encoded = this.encode(STRUCT_ID.QryInvestorCommoditySPMMMargin, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
833
+ return this.queryRequest((id) => this.native._req(97, encoded, id), false);
661
834
  }
662
835
  reqQryInvestorCommodityGroupSpmmMargin(req: Partial<S.QryInvestorCommodityGroupSPMMMargin> = {}): Promise<unknown[]> {
663
- return this.request((id) => this.native._req(98, this.encode(STRUCT_ID.QryInvestorCommodityGroupSPMMMargin, req as Record<string, unknown>), id), false);
836
+ let encoded: Uint8Array;
837
+ try { encoded = this.encode(STRUCT_ID.QryInvestorCommodityGroupSPMMMargin, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
838
+ return this.queryRequest((id) => this.native._req(98, encoded, id), false);
664
839
  }
665
840
  reqQrySpmmInstParam(req: Partial<S.QrySPMMInstParam> = {}): Promise<unknown[]> {
666
- return this.request((id) => this.native._req(99, this.encode(STRUCT_ID.QrySPMMInstParam, req as Record<string, unknown>), id), false);
841
+ let encoded: Uint8Array;
842
+ try { encoded = this.encode(STRUCT_ID.QrySPMMInstParam, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
843
+ return this.queryRequest((id) => this.native._req(99, encoded, id), false);
667
844
  }
668
845
  reqQrySpmmProductParam(req: Partial<S.QrySPMMProductParam> = {}): Promise<unknown[]> {
669
- return this.request((id) => this.native._req(100, this.encode(STRUCT_ID.QrySPMMProductParam, req as Record<string, unknown>), id), false);
846
+ let encoded: Uint8Array;
847
+ try { encoded = this.encode(STRUCT_ID.QrySPMMProductParam, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
848
+ return this.queryRequest((id) => this.native._req(100, encoded, id), false);
670
849
  }
671
850
  reqQrySpbmAddOnInterParameter(req: Partial<S.QrySPBMAddOnInterParameter> = {}): Promise<unknown[]> {
672
- return this.request((id) => this.native._req(101, this.encode(STRUCT_ID.QrySPBMAddOnInterParameter, req as Record<string, unknown>), id), false);
851
+ let encoded: Uint8Array;
852
+ try { encoded = this.encode(STRUCT_ID.QrySPBMAddOnInterParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
853
+ return this.queryRequest((id) => this.native._req(101, encoded, id), false);
673
854
  }
674
855
  reqQryRcamsCombProductInfo(req: Partial<S.QryRCAMSCombProductInfo> = {}): Promise<unknown[]> {
675
- return this.request((id) => this.native._req(102, this.encode(STRUCT_ID.QryRCAMSCombProductInfo, req as Record<string, unknown>), id), false);
856
+ let encoded: Uint8Array;
857
+ try { encoded = this.encode(STRUCT_ID.QryRCAMSCombProductInfo, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
858
+ return this.queryRequest((id) => this.native._req(102, encoded, id), false);
676
859
  }
677
860
  reqQryRcamsInstrParameter(req: Partial<S.QryRCAMSInstrParameter> = {}): Promise<unknown[]> {
678
- return this.request((id) => this.native._req(103, this.encode(STRUCT_ID.QryRCAMSInstrParameter, req as Record<string, unknown>), id), false);
861
+ let encoded: Uint8Array;
862
+ try { encoded = this.encode(STRUCT_ID.QryRCAMSInstrParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
863
+ return this.queryRequest((id) => this.native._req(103, encoded, id), false);
679
864
  }
680
865
  reqQryRcamsIntraParameter(req: Partial<S.QryRCAMSIntraParameter> = {}): Promise<unknown[]> {
681
- return this.request((id) => this.native._req(104, this.encode(STRUCT_ID.QryRCAMSIntraParameter, req as Record<string, unknown>), id), false);
866
+ let encoded: Uint8Array;
867
+ try { encoded = this.encode(STRUCT_ID.QryRCAMSIntraParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
868
+ return this.queryRequest((id) => this.native._req(104, encoded, id), false);
682
869
  }
683
870
  reqQryRcamsInterParameter(req: Partial<S.QryRCAMSInterParameter> = {}): Promise<unknown[]> {
684
- return this.request((id) => this.native._req(105, this.encode(STRUCT_ID.QryRCAMSInterParameter, req as Record<string, unknown>), id), false);
871
+ let encoded: Uint8Array;
872
+ try { encoded = this.encode(STRUCT_ID.QryRCAMSInterParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
873
+ return this.queryRequest((id) => this.native._req(105, encoded, id), false);
685
874
  }
686
875
  reqQryRcamsShortOptAdjustParam(req: Partial<S.QryRCAMSShortOptAdjustParam> = {}): Promise<unknown[]> {
687
- return this.request((id) => this.native._req(106, this.encode(STRUCT_ID.QryRCAMSShortOptAdjustParam, req as Record<string, unknown>), id), false);
876
+ let encoded: Uint8Array;
877
+ try { encoded = this.encode(STRUCT_ID.QryRCAMSShortOptAdjustParam, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
878
+ return this.queryRequest((id) => this.native._req(106, encoded, id), false);
688
879
  }
689
880
  reqQryRcamsInvestorCombPosition(req: Partial<S.QryRCAMSInvestorCombPosition> = {}): Promise<unknown[]> {
690
- return this.request((id) => this.native._req(107, this.encode(STRUCT_ID.QryRCAMSInvestorCombPosition, req as Record<string, unknown>), id), false);
881
+ let encoded: Uint8Array;
882
+ try { encoded = this.encode(STRUCT_ID.QryRCAMSInvestorCombPosition, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
883
+ return this.queryRequest((id) => this.native._req(107, encoded, id), false);
691
884
  }
692
885
  reqQryInvestorProdRcamsMargin(req: Partial<S.QryInvestorProdRCAMSMargin> = {}): Promise<unknown[]> {
693
- return this.request((id) => this.native._req(108, this.encode(STRUCT_ID.QryInvestorProdRCAMSMargin, req as Record<string, unknown>), id), false);
886
+ let encoded: Uint8Array;
887
+ try { encoded = this.encode(STRUCT_ID.QryInvestorProdRCAMSMargin, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
888
+ return this.queryRequest((id) => this.native._req(108, encoded, id), false);
694
889
  }
695
890
  reqQryRuleInstrParameter(req: Partial<S.QryRULEInstrParameter> = {}): Promise<unknown[]> {
696
- return this.request((id) => this.native._req(109, this.encode(STRUCT_ID.QryRULEInstrParameter, req as Record<string, unknown>), id), false);
891
+ let encoded: Uint8Array;
892
+ try { encoded = this.encode(STRUCT_ID.QryRULEInstrParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
893
+ return this.queryRequest((id) => this.native._req(109, encoded, id), false);
697
894
  }
698
895
  reqQryRuleIntraParameter(req: Partial<S.QryRULEIntraParameter> = {}): Promise<unknown[]> {
699
- return this.request((id) => this.native._req(110, this.encode(STRUCT_ID.QryRULEIntraParameter, req as Record<string, unknown>), id), false);
896
+ let encoded: Uint8Array;
897
+ try { encoded = this.encode(STRUCT_ID.QryRULEIntraParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
898
+ return this.queryRequest((id) => this.native._req(110, encoded, id), false);
700
899
  }
701
900
  reqQryRuleInterParameter(req: Partial<S.QryRULEInterParameter> = {}): Promise<unknown[]> {
702
- return this.request((id) => this.native._req(111, this.encode(STRUCT_ID.QryRULEInterParameter, req as Record<string, unknown>), id), false);
901
+ let encoded: Uint8Array;
902
+ try { encoded = this.encode(STRUCT_ID.QryRULEInterParameter, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
903
+ return this.queryRequest((id) => this.native._req(111, encoded, id), false);
703
904
  }
704
905
  reqQryInvestorProdRuleMargin(req: Partial<S.QryInvestorProdRULEMargin> = {}): Promise<unknown[]> {
705
- return this.request((id) => this.native._req(112, this.encode(STRUCT_ID.QryInvestorProdRULEMargin, req as Record<string, unknown>), id), false);
906
+ let encoded: Uint8Array;
907
+ try { encoded = this.encode(STRUCT_ID.QryInvestorProdRULEMargin, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
908
+ return this.queryRequest((id) => this.native._req(112, encoded, id), false);
706
909
  }
707
910
  reqQryInvestorPortfSetting(req: Partial<S.QryInvestorPortfSetting> = {}): Promise<unknown[]> {
708
- return this.request((id) => this.native._req(113, this.encode(STRUCT_ID.QryInvestorPortfSetting, req as Record<string, unknown>), id), false);
911
+ let encoded: Uint8Array;
912
+ try { encoded = this.encode(STRUCT_ID.QryInvestorPortfSetting, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
913
+ return this.queryRequest((id) => this.native._req(113, encoded, id), false);
709
914
  }
710
915
  reqQryInvestorInfoCommRec(req: Partial<S.QryInvestorInfoCommRec> = {}): Promise<unknown[]> {
711
- return this.request((id) => this.native._req(114, this.encode(STRUCT_ID.QryInvestorInfoCommRec, req as Record<string, unknown>), id), false);
916
+ let encoded: Uint8Array;
917
+ try { encoded = this.encode(STRUCT_ID.QryInvestorInfoCommRec, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
918
+ return this.queryRequest((id) => this.native._req(114, encoded, id), false);
712
919
  }
713
920
  reqQryCombLeg(req: Partial<S.QryCombLeg> = {}): Promise<unknown[]> {
714
- return this.request((id) => this.native._req(115, this.encode(STRUCT_ID.QryCombLeg, req as Record<string, unknown>), id), false);
921
+ let encoded: Uint8Array;
922
+ try { encoded = this.encode(STRUCT_ID.QryCombLeg, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
923
+ return this.queryRequest((id) => this.native._req(115, encoded, id), false);
715
924
  }
716
925
  reqOffsetSetting(req: Partial<S.InputOffsetSetting> = {}): Promise<unknown> {
717
926
  return this.request((id) => this.native._req(116, this.encode(STRUCT_ID.InputOffsetSetting, req as Record<string, unknown>), id), true);
@@ -720,7 +929,9 @@ export abstract class TraderBase extends CtpClient {
720
929
  return this.request((id) => this.native._req(117, this.encode(STRUCT_ID.InputOffsetSetting, req as Record<string, unknown>), id), true);
721
930
  }
722
931
  reqQryOffsetSetting(req: Partial<S.QryOffsetSetting> = {}): Promise<unknown[]> {
723
- return this.request((id) => this.native._req(118, this.encode(STRUCT_ID.QryOffsetSetting, req as Record<string, unknown>), id), false);
932
+ let encoded: Uint8Array;
933
+ try { encoded = this.encode(STRUCT_ID.QryOffsetSetting, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
934
+ return this.queryRequest((id) => this.native._req(118, encoded, id), false);
724
935
  }
725
936
  reqGenSmsCode(req: Partial<S.ReqGenSMSCode> = {}): Promise<unknown> {
726
937
  return this.request((id) => this.native._req(119, this.encode(STRUCT_ID.ReqGenSMSCode, req as Record<string, unknown>), id), true);
@@ -732,7 +943,9 @@ export abstract class TraderBase extends CtpClient {
732
943
  return this.request((id) => this.native._req(121, this.encode(STRUCT_ID.InputSpdApplyAction, req as Record<string, unknown>), id), true);
733
944
  }
734
945
  reqQrySpdApply(req: Partial<S.QrySpdApply> = {}): Promise<unknown[]> {
735
- return this.request((id) => this.native._req(122, this.encode(STRUCT_ID.QrySpdApply, req as Record<string, unknown>), id), false);
946
+ let encoded: Uint8Array;
947
+ try { encoded = this.encode(STRUCT_ID.QrySpdApply, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
948
+ return this.queryRequest((id) => this.native._req(122, encoded, id), false);
736
949
  }
737
950
  reqHedgeCfm(req: Partial<S.InputHedgeCfm> = {}): Promise<unknown> {
738
951
  return this.request((id) => this.native._req(123, this.encode(STRUCT_ID.InputHedgeCfm, req as Record<string, unknown>), id), true);
@@ -741,6 +954,8 @@ export abstract class TraderBase extends CtpClient {
741
954
  return this.request((id) => this.native._req(124, this.encode(STRUCT_ID.InputHedgeCfmAction, req as Record<string, unknown>), id), true);
742
955
  }
743
956
  reqQryHedgeCfm(req: Partial<S.QryHedgeCfm> = {}): Promise<unknown[]> {
744
- return this.request((id) => this.native._req(125, this.encode(STRUCT_ID.QryHedgeCfm, req as Record<string, unknown>), id), false);
957
+ let encoded: Uint8Array;
958
+ try { encoded = this.encode(STRUCT_ID.QryHedgeCfm, req as Record<string, unknown>); } catch (error) { return Promise.reject(error); }
959
+ return this.queryRequest((id) => this.native._req(125, encoded, id), false);
745
960
  }
746
961
  }