@hitrading/ctp-node 2.0.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 (79) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +47 -32
  3. package/README.zh-CN.md +37 -27
  4. package/RELEASING.md +78 -0
  5. package/dist/client.d.ts +36 -15
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +234 -62
  8. package/dist/client.js.map +1 -1
  9. package/dist/codec.d.ts.map +1 -1
  10. package/dist/codec.js +84 -19
  11. package/dist/codec.js.map +1 -1
  12. package/dist/generated/structs.gen.d.ts +5461 -5461
  13. package/dist/generated/structs.gen.d.ts.map +1 -1
  14. package/dist/generated/trader.gen.d.ts.map +1 -1
  15. package/dist/generated/trader.gen.js +788 -94
  16. package/dist/generated/trader.gen.js.map +1 -1
  17. package/dist/index.cjs +1875 -415
  18. package/dist/index.d.cts +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/market-data.d.ts +41 -24
  23. package/dist/market-data.d.ts.map +1 -1
  24. package/dist/market-data.js +148 -29
  25. package/dist/market-data.js.map +1 -1
  26. package/dist/native-binding.d.ts.map +1 -1
  27. package/dist/native-binding.js +4 -0
  28. package/dist/native-binding.js.map +1 -1
  29. package/dist/trader.d.ts +111 -71
  30. package/dist/trader.d.ts.map +1 -1
  31. package/dist/trader.js +774 -180
  32. package/dist/trader.js.map +1 -1
  33. package/dist/validation.d.ts +27 -0
  34. package/dist/validation.d.ts.map +1 -0
  35. package/dist/validation.js +85 -0
  36. package/dist/validation.js.map +1 -0
  37. package/docs/API.md +1437 -0
  38. package/docs/API.zh-CN.md +1278 -0
  39. package/docs/MIGRATION.md +54 -0
  40. package/docs/assets/validation.svg +27 -0
  41. package/docs/integration.md +60 -0
  42. package/docs/native-hooks.md +281 -0
  43. package/docs/native-hooks.zh-CN.md +205 -0
  44. package/docs/troubleshooting.md +257 -0
  45. package/docs/troubleshooting.zh-CN.md +220 -0
  46. package/package.json +12 -4
  47. package/prebuilds/linux-x64/@hitrading+ctp-node.node +0 -0
  48. package/prebuilds/win32-x64/@hitrading+ctp-node.node +0 -0
  49. package/scripts/bench-decode.mjs +37 -0
  50. package/scripts/bench-fullmarket-offline.mjs +207 -0
  51. package/scripts/stress-fullmarket.mjs +255 -0
  52. package/src/addon.cc +2 -2
  53. package/src/client.ts +255 -65
  54. package/src/codec.ts +86 -19
  55. package/src/generated/structs.gen.ts +5461 -5461
  56. package/src/generated/trader.gen.ts +309 -94
  57. package/src/generated/traderreq.gen.cc +194 -18
  58. package/src/generated/traderreq.gen.h +4 -0
  59. package/src/generated/traderspi.gen.cc +129 -15
  60. package/src/generated/traderspi.gen.h +4 -2
  61. package/src/index.ts +8 -1
  62. package/src/market-data.ts +199 -46
  63. package/src/native/arm.cc +114 -30
  64. package/src/native/arm.h +16 -4
  65. package/src/native/channel.cc +209 -81
  66. package/src/native/channel.h +65 -24
  67. package/src/native/ctp_field.h +23 -0
  68. package/src/native/mdapi.cc +582 -69
  69. package/src/native/mdspi.cc +219 -16
  70. package/src/native/mdspi.h +59 -10
  71. package/src/native/order_capability.h +75 -0
  72. package/src/native/risk.cc +2030 -213
  73. package/src/native/risk.h +431 -78
  74. package/src/native/shared_handle.h +37 -0
  75. package/src/native/snapshot.h +75 -16
  76. package/src/native/traderapi.cc +753 -124
  77. package/src/native-binding.ts +4 -0
  78. package/src/trader.ts +971 -204
  79. package/src/validation.ts +96 -0
@@ -1,5 +1,6 @@
1
1
  /* AUTO-GENERATED by scripts/codegen/generate-trader.mjs. Do not edit. */
2
2
  import { CtpClient } from "../client.js";
3
+ import { copyOwnRecord } from "../validation.js";
3
4
  import { STRUCT_ID } from "./structs.gen.js";
4
5
  export var TraderEvent;
5
6
  (function (TraderEvent) {
@@ -368,10 +369,35 @@ export class TraderBase extends CtpClient {
368
369
  return this.request((id) => this.native._req(1, this.encode(STRUCT_ID.ReqAuthenticate, req), id), true);
369
370
  }
370
371
  reqUserLogin(req = {}) {
371
- return this.request((id) => this.native._req(2, this.encode(STRUCT_ID.ReqUserLogin, req), id), true);
372
+ let cleanReq;
373
+ let encoded;
374
+ try {
375
+ cleanReq = copyOwnRecord(req, "reqUserLogin request");
376
+ encoded = this.encode(STRUCT_ID.ReqUserLogin, cleanReq);
377
+ }
378
+ catch (error) {
379
+ return Promise.reject(error);
380
+ }
381
+ this.beginRequestContextTransition("trader session transition started");
382
+ return this.request((id) => this.native._req(2, encoded, id), true, undefined, true).then((value) => {
383
+ const row = value;
384
+ 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))
385
+ throw new Error("trader login response has missing or mismatched session identity");
386
+ return value;
387
+ });
372
388
  }
373
389
  reqUserLogout(req = {}) {
374
- return this.request((id) => this.native._req(3, this.encode(STRUCT_ID.UserLogout, req), id), true);
390
+ let cleanReq;
391
+ let encoded;
392
+ try {
393
+ cleanReq = copyOwnRecord(req, "reqUserLogout request");
394
+ encoded = this.encode(STRUCT_ID.UserLogout, cleanReq);
395
+ }
396
+ catch (error) {
397
+ return Promise.reject(error);
398
+ }
399
+ this.beginRequestContextTransition("trader session transition started");
400
+ return this.request((id) => this.native._req(3, encoded, id), true, undefined, true);
375
401
  }
376
402
  reqUserPasswordUpdate(req = {}) {
377
403
  return this.request((id) => this.native._req(4, this.encode(STRUCT_ID.UserPasswordUpdate, req), id), true);
@@ -389,13 +415,58 @@ export class TraderBase extends CtpClient {
389
415
  return this.request((id) => this.native._req(8, this.encode(STRUCT_ID.ReqGenUserText, req), id), true);
390
416
  }
391
417
  reqUserLoginWithCaptcha(req = {}) {
392
- return this.request((id) => this.native._req(9, this.encode(STRUCT_ID.ReqUserLoginWithCaptcha, req), id), true);
418
+ let cleanReq;
419
+ let encoded;
420
+ try {
421
+ cleanReq = copyOwnRecord(req, "reqUserLoginWithCaptcha request");
422
+ encoded = this.encode(STRUCT_ID.ReqUserLoginWithCaptcha, cleanReq);
423
+ }
424
+ catch (error) {
425
+ return Promise.reject(error);
426
+ }
427
+ this.beginRequestContextTransition("trader session transition started");
428
+ return this.request((id) => this.native._req(9, encoded, id), true, undefined, true).then((value) => {
429
+ const row = value;
430
+ 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))
431
+ throw new Error("trader login response has missing or mismatched session identity");
432
+ return value;
433
+ });
393
434
  }
394
435
  reqUserLoginWithText(req = {}) {
395
- return this.request((id) => this.native._req(10, this.encode(STRUCT_ID.ReqUserLoginWithText, req), id), true);
436
+ let cleanReq;
437
+ let encoded;
438
+ try {
439
+ cleanReq = copyOwnRecord(req, "reqUserLoginWithText request");
440
+ encoded = this.encode(STRUCT_ID.ReqUserLoginWithText, cleanReq);
441
+ }
442
+ catch (error) {
443
+ return Promise.reject(error);
444
+ }
445
+ this.beginRequestContextTransition("trader session transition started");
446
+ return this.request((id) => this.native._req(10, encoded, id), true, undefined, true).then((value) => {
447
+ const row = value;
448
+ 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))
449
+ throw new Error("trader login response has missing or mismatched session identity");
450
+ return value;
451
+ });
396
452
  }
397
453
  reqUserLoginWithOtp(req = {}) {
398
- return this.request((id) => this.native._req(11, this.encode(STRUCT_ID.ReqUserLoginWithOTP, req), id), true);
454
+ let cleanReq;
455
+ let encoded;
456
+ try {
457
+ cleanReq = copyOwnRecord(req, "reqUserLoginWithOtp request");
458
+ encoded = this.encode(STRUCT_ID.ReqUserLoginWithOTP, cleanReq);
459
+ }
460
+ catch (error) {
461
+ return Promise.reject(error);
462
+ }
463
+ this.beginRequestContextTransition("trader session transition started");
464
+ return this.request((id) => this.native._req(11, encoded, id), true, undefined, true).then((value) => {
465
+ const row = value;
466
+ 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))
467
+ throw new Error("trader login response has missing or mismatched session identity");
468
+ return value;
469
+ });
399
470
  }
400
471
  reqOrderInsert(req = {}) {
401
472
  return this.submit((id) => this.native._req(12, this.encode(STRUCT_ID.InputOrder, req), id));
@@ -410,7 +481,14 @@ export class TraderBase extends CtpClient {
410
481
  return this.submit((id) => this.native._req(15, this.encode(STRUCT_ID.InputOrderAction, req), id));
411
482
  }
412
483
  reqQryMaxOrderVolume(req = {}) {
413
- return this.request((id) => this.native._req(16, this.encode(STRUCT_ID.QryMaxOrderVolume, req), id), false);
484
+ let encoded;
485
+ try {
486
+ encoded = this.encode(STRUCT_ID.QryMaxOrderVolume, req);
487
+ }
488
+ catch (error) {
489
+ return Promise.reject(error);
490
+ }
491
+ return this.queryRequest((id) => this.native._req(16, encoded, id), false);
414
492
  }
415
493
  reqSettlementInfoConfirm(req = {}) {
416
494
  return this.request((id) => this.native._req(17, this.encode(STRUCT_ID.SettlementInfoConfirm, req), id), true);
@@ -449,163 +527,534 @@ export class TraderBase extends CtpClient {
449
527
  return this.submit((id) => this.native._req(28, this.encode(STRUCT_ID.InputCombAction, req), id));
450
528
  }
451
529
  reqQryOrder(req = {}) {
452
- return this.request((id) => this.native._req(29, this.encode(STRUCT_ID.QryOrder, req), id), false);
530
+ let encoded;
531
+ try {
532
+ encoded = this.encode(STRUCT_ID.QryOrder, req);
533
+ }
534
+ catch (error) {
535
+ return Promise.reject(error);
536
+ }
537
+ return this.queryRequest((id) => this.native._req(29, encoded, id), false);
453
538
  }
454
539
  reqQryTrade(req = {}) {
455
- return this.request((id) => this.native._req(30, this.encode(STRUCT_ID.QryTrade, req), id), false);
540
+ let encoded;
541
+ try {
542
+ encoded = this.encode(STRUCT_ID.QryTrade, req);
543
+ }
544
+ catch (error) {
545
+ return Promise.reject(error);
546
+ }
547
+ return this.queryRequest((id) => this.native._req(30, encoded, id), false);
456
548
  }
457
549
  reqQryInvestorPosition(req = {}) {
458
- return this.request((id) => this.native._req(31, this.encode(STRUCT_ID.QryInvestorPosition, req), id), false);
550
+ let encoded;
551
+ try {
552
+ encoded = this.encode(STRUCT_ID.QryInvestorPosition, req);
553
+ }
554
+ catch (error) {
555
+ return Promise.reject(error);
556
+ }
557
+ return this.queryRequest((id) => this.native._req(31, encoded, id), false);
459
558
  }
460
559
  reqQryTradingAccount(req = {}) {
461
- return this.request((id) => this.native._req(32, this.encode(STRUCT_ID.QryTradingAccount, req), id), false);
560
+ let encoded;
561
+ try {
562
+ encoded = this.encode(STRUCT_ID.QryTradingAccount, req);
563
+ }
564
+ catch (error) {
565
+ return Promise.reject(error);
566
+ }
567
+ return this.queryRequest((id) => this.native._req(32, encoded, id), false);
462
568
  }
463
569
  reqQryInvestor(req = {}) {
464
- return this.request((id) => this.native._req(33, this.encode(STRUCT_ID.QryInvestor, req), id), false);
570
+ let encoded;
571
+ try {
572
+ encoded = this.encode(STRUCT_ID.QryInvestor, req);
573
+ }
574
+ catch (error) {
575
+ return Promise.reject(error);
576
+ }
577
+ return this.queryRequest((id) => this.native._req(33, encoded, id), false);
465
578
  }
466
579
  reqQryTradingCode(req = {}) {
467
- return this.request((id) => this.native._req(34, this.encode(STRUCT_ID.QryTradingCode, req), id), false);
580
+ let encoded;
581
+ try {
582
+ encoded = this.encode(STRUCT_ID.QryTradingCode, req);
583
+ }
584
+ catch (error) {
585
+ return Promise.reject(error);
586
+ }
587
+ return this.queryRequest((id) => this.native._req(34, encoded, id), false);
468
588
  }
469
589
  reqQryInstrumentMarginRate(req = {}) {
470
- return this.request((id) => this.native._req(35, this.encode(STRUCT_ID.QryInstrumentMarginRate, req), id), false);
590
+ let encoded;
591
+ try {
592
+ encoded = this.encode(STRUCT_ID.QryInstrumentMarginRate, req);
593
+ }
594
+ catch (error) {
595
+ return Promise.reject(error);
596
+ }
597
+ return this.queryRequest((id) => this.native._req(35, encoded, id), false);
471
598
  }
472
599
  reqQryInstrumentCommissionRate(req = {}) {
473
- return this.request((id) => this.native._req(36, this.encode(STRUCT_ID.QryInstrumentCommissionRate, req), id), false);
600
+ let encoded;
601
+ try {
602
+ encoded = this.encode(STRUCT_ID.QryInstrumentCommissionRate, req);
603
+ }
604
+ catch (error) {
605
+ return Promise.reject(error);
606
+ }
607
+ return this.queryRequest((id) => this.native._req(36, encoded, id), false);
474
608
  }
475
609
  reqQryUserSession(req = {}) {
476
- return this.request((id) => this.native._req(37, this.encode(STRUCT_ID.QryUserSession, req), id), false);
610
+ let encoded;
611
+ try {
612
+ encoded = this.encode(STRUCT_ID.QryUserSession, req);
613
+ }
614
+ catch (error) {
615
+ return Promise.reject(error);
616
+ }
617
+ return this.queryRequest((id) => this.native._req(37, encoded, id), false);
477
618
  }
478
619
  reqQryExchange(req = {}) {
479
- return this.request((id) => this.native._req(38, this.encode(STRUCT_ID.QryExchange, req), id), false);
620
+ let encoded;
621
+ try {
622
+ encoded = this.encode(STRUCT_ID.QryExchange, req);
623
+ }
624
+ catch (error) {
625
+ return Promise.reject(error);
626
+ }
627
+ return this.queryRequest((id) => this.native._req(38, encoded, id), false);
480
628
  }
481
629
  reqQryProduct(req = {}) {
482
- return this.request((id) => this.native._req(39, this.encode(STRUCT_ID.QryProduct, req), id), false);
630
+ let encoded;
631
+ try {
632
+ encoded = this.encode(STRUCT_ID.QryProduct, req);
633
+ }
634
+ catch (error) {
635
+ return Promise.reject(error);
636
+ }
637
+ return this.queryRequest((id) => this.native._req(39, encoded, id), false);
483
638
  }
484
639
  reqQryInstrument(req = {}) {
485
- return this.request((id) => this.native._req(40, this.encode(STRUCT_ID.QryInstrument, req), id), false);
640
+ let encoded;
641
+ try {
642
+ encoded = this.encode(STRUCT_ID.QryInstrument, req);
643
+ }
644
+ catch (error) {
645
+ return Promise.reject(error);
646
+ }
647
+ return this.queryRequest((id) => this.native._req(40, encoded, id), false);
486
648
  }
487
649
  reqQryDepthMarketData(req = {}) {
488
- return this.request((id) => this.native._req(41, this.encode(STRUCT_ID.QryDepthMarketData, req), id), false);
650
+ let encoded;
651
+ try {
652
+ encoded = this.encode(STRUCT_ID.QryDepthMarketData, req);
653
+ }
654
+ catch (error) {
655
+ return Promise.reject(error);
656
+ }
657
+ return this.queryRequest((id) => this.native._req(41, encoded, id), false);
489
658
  }
490
659
  reqQryTraderOffer(req = {}) {
491
- return this.request((id) => this.native._req(42, this.encode(STRUCT_ID.QryTraderOffer, req), id), false);
660
+ let encoded;
661
+ try {
662
+ encoded = this.encode(STRUCT_ID.QryTraderOffer, req);
663
+ }
664
+ catch (error) {
665
+ return Promise.reject(error);
666
+ }
667
+ return this.queryRequest((id) => this.native._req(42, encoded, id), false);
492
668
  }
493
669
  reqQrySettlementInfo(req = {}) {
494
- return this.request((id) => this.native._req(43, this.encode(STRUCT_ID.QrySettlementInfo, req), id), false);
670
+ let encoded;
671
+ try {
672
+ encoded = this.encode(STRUCT_ID.QrySettlementInfo, req);
673
+ }
674
+ catch (error) {
675
+ return Promise.reject(error);
676
+ }
677
+ return this.queryRequest((id) => this.native._req(43, encoded, id), false);
495
678
  }
496
679
  reqQryTransferBank(req = {}) {
497
- return this.request((id) => this.native._req(44, this.encode(STRUCT_ID.QryTransferBank, req), id), false);
680
+ let encoded;
681
+ try {
682
+ encoded = this.encode(STRUCT_ID.QryTransferBank, req);
683
+ }
684
+ catch (error) {
685
+ return Promise.reject(error);
686
+ }
687
+ return this.queryRequest((id) => this.native._req(44, encoded, id), false);
498
688
  }
499
689
  reqQryInvestorPositionDetail(req = {}) {
500
- return this.request((id) => this.native._req(45, this.encode(STRUCT_ID.QryInvestorPositionDetail, req), id), false);
690
+ let encoded;
691
+ try {
692
+ encoded = this.encode(STRUCT_ID.QryInvestorPositionDetail, req);
693
+ }
694
+ catch (error) {
695
+ return Promise.reject(error);
696
+ }
697
+ return this.queryRequest((id) => this.native._req(45, encoded, id), false);
501
698
  }
502
699
  reqQryNotice(req = {}) {
503
- return this.request((id) => this.native._req(46, this.encode(STRUCT_ID.QryNotice, req), id), false);
700
+ let encoded;
701
+ try {
702
+ encoded = this.encode(STRUCT_ID.QryNotice, req);
703
+ }
704
+ catch (error) {
705
+ return Promise.reject(error);
706
+ }
707
+ return this.queryRequest((id) => this.native._req(46, encoded, id), false);
504
708
  }
505
709
  reqQrySettlementInfoConfirm(req = {}) {
506
- return this.request((id) => this.native._req(47, this.encode(STRUCT_ID.QrySettlementInfoConfirm, req), id), false);
710
+ let encoded;
711
+ try {
712
+ encoded = this.encode(STRUCT_ID.QrySettlementInfoConfirm, req);
713
+ }
714
+ catch (error) {
715
+ return Promise.reject(error);
716
+ }
717
+ return this.queryRequest((id) => this.native._req(47, encoded, id), false);
507
718
  }
508
719
  reqQryInvestorPositionCombineDetail(req = {}) {
509
- return this.request((id) => this.native._req(48, this.encode(STRUCT_ID.QryInvestorPositionCombineDetail, req), id), false);
720
+ let encoded;
721
+ try {
722
+ encoded = this.encode(STRUCT_ID.QryInvestorPositionCombineDetail, req);
723
+ }
724
+ catch (error) {
725
+ return Promise.reject(error);
726
+ }
727
+ return this.queryRequest((id) => this.native._req(48, encoded, id), false);
510
728
  }
511
729
  reqQryCfmmcTradingAccountKey(req = {}) {
512
- return this.request((id) => this.native._req(49, this.encode(STRUCT_ID.QryCFMMCTradingAccountKey, req), id), false);
730
+ let encoded;
731
+ try {
732
+ encoded = this.encode(STRUCT_ID.QryCFMMCTradingAccountKey, req);
733
+ }
734
+ catch (error) {
735
+ return Promise.reject(error);
736
+ }
737
+ return this.queryRequest((id) => this.native._req(49, encoded, id), false);
513
738
  }
514
739
  reqQryEWarrantOffset(req = {}) {
515
- return this.request((id) => this.native._req(50, this.encode(STRUCT_ID.QryEWarrantOffset, req), id), false);
740
+ let encoded;
741
+ try {
742
+ encoded = this.encode(STRUCT_ID.QryEWarrantOffset, req);
743
+ }
744
+ catch (error) {
745
+ return Promise.reject(error);
746
+ }
747
+ return this.queryRequest((id) => this.native._req(50, encoded, id), false);
516
748
  }
517
749
  reqQryInvestorProductGroupMargin(req = {}) {
518
- return this.request((id) => this.native._req(51, this.encode(STRUCT_ID.QryInvestorProductGroupMargin, req), id), false);
750
+ let encoded;
751
+ try {
752
+ encoded = this.encode(STRUCT_ID.QryInvestorProductGroupMargin, req);
753
+ }
754
+ catch (error) {
755
+ return Promise.reject(error);
756
+ }
757
+ return this.queryRequest((id) => this.native._req(51, encoded, id), false);
519
758
  }
520
759
  reqQryExchangeMarginRate(req = {}) {
521
- return this.request((id) => this.native._req(52, this.encode(STRUCT_ID.QryExchangeMarginRate, req), id), false);
760
+ let encoded;
761
+ try {
762
+ encoded = this.encode(STRUCT_ID.QryExchangeMarginRate, req);
763
+ }
764
+ catch (error) {
765
+ return Promise.reject(error);
766
+ }
767
+ return this.queryRequest((id) => this.native._req(52, encoded, id), false);
522
768
  }
523
769
  reqQryExchangeMarginRateAdjust(req = {}) {
524
- return this.request((id) => this.native._req(53, this.encode(STRUCT_ID.QryExchangeMarginRateAdjust, req), id), false);
770
+ let encoded;
771
+ try {
772
+ encoded = this.encode(STRUCT_ID.QryExchangeMarginRateAdjust, req);
773
+ }
774
+ catch (error) {
775
+ return Promise.reject(error);
776
+ }
777
+ return this.queryRequest((id) => this.native._req(53, encoded, id), false);
525
778
  }
526
779
  reqQryExchangeRate(req = {}) {
527
- return this.request((id) => this.native._req(54, this.encode(STRUCT_ID.QryExchangeRate, req), id), false);
780
+ let encoded;
781
+ try {
782
+ encoded = this.encode(STRUCT_ID.QryExchangeRate, req);
783
+ }
784
+ catch (error) {
785
+ return Promise.reject(error);
786
+ }
787
+ return this.queryRequest((id) => this.native._req(54, encoded, id), false);
528
788
  }
529
789
  reqQrySecAgentAcidMap(req = {}) {
530
- return this.request((id) => this.native._req(55, this.encode(STRUCT_ID.QrySecAgentACIDMap, req), id), false);
790
+ let encoded;
791
+ try {
792
+ encoded = this.encode(STRUCT_ID.QrySecAgentACIDMap, req);
793
+ }
794
+ catch (error) {
795
+ return Promise.reject(error);
796
+ }
797
+ return this.queryRequest((id) => this.native._req(55, encoded, id), false);
531
798
  }
532
799
  reqQryProductExchRate(req = {}) {
533
- return this.request((id) => this.native._req(56, this.encode(STRUCT_ID.QryProductExchRate, req), id), false);
800
+ let encoded;
801
+ try {
802
+ encoded = this.encode(STRUCT_ID.QryProductExchRate, req);
803
+ }
804
+ catch (error) {
805
+ return Promise.reject(error);
806
+ }
807
+ return this.queryRequest((id) => this.native._req(56, encoded, id), false);
534
808
  }
535
809
  reqQryProductGroup(req = {}) {
536
- return this.request((id) => this.native._req(57, this.encode(STRUCT_ID.QryProductGroup, req), id), false);
810
+ let encoded;
811
+ try {
812
+ encoded = this.encode(STRUCT_ID.QryProductGroup, req);
813
+ }
814
+ catch (error) {
815
+ return Promise.reject(error);
816
+ }
817
+ return this.queryRequest((id) => this.native._req(57, encoded, id), false);
537
818
  }
538
819
  reqQryMmInstrumentCommissionRate(req = {}) {
539
- return this.request((id) => this.native._req(58, this.encode(STRUCT_ID.QryMMInstrumentCommissionRate, req), id), false);
820
+ let encoded;
821
+ try {
822
+ encoded = this.encode(STRUCT_ID.QryMMInstrumentCommissionRate, req);
823
+ }
824
+ catch (error) {
825
+ return Promise.reject(error);
826
+ }
827
+ return this.queryRequest((id) => this.native._req(58, encoded, id), false);
540
828
  }
541
829
  reqQryMmOptionInstrCommRate(req = {}) {
542
- return this.request((id) => this.native._req(59, this.encode(STRUCT_ID.QryMMOptionInstrCommRate, req), id), false);
830
+ let encoded;
831
+ try {
832
+ encoded = this.encode(STRUCT_ID.QryMMOptionInstrCommRate, req);
833
+ }
834
+ catch (error) {
835
+ return Promise.reject(error);
836
+ }
837
+ return this.queryRequest((id) => this.native._req(59, encoded, id), false);
543
838
  }
544
839
  reqQryInstrumentOrderCommRate(req = {}) {
545
- return this.request((id) => this.native._req(60, this.encode(STRUCT_ID.QryInstrumentOrderCommRate, req), id), false);
840
+ let encoded;
841
+ try {
842
+ encoded = this.encode(STRUCT_ID.QryInstrumentOrderCommRate, req);
843
+ }
844
+ catch (error) {
845
+ return Promise.reject(error);
846
+ }
847
+ return this.queryRequest((id) => this.native._req(60, encoded, id), false);
546
848
  }
547
849
  reqQrySecAgentTradingAccount(req = {}) {
548
- return this.request((id) => this.native._req(61, this.encode(STRUCT_ID.QryTradingAccount, req), id), false);
850
+ let encoded;
851
+ try {
852
+ encoded = this.encode(STRUCT_ID.QryTradingAccount, req);
853
+ }
854
+ catch (error) {
855
+ return Promise.reject(error);
856
+ }
857
+ return this.queryRequest((id) => this.native._req(61, encoded, id), false);
549
858
  }
550
859
  reqQrySecAgentCheckMode(req = {}) {
551
- return this.request((id) => this.native._req(62, this.encode(STRUCT_ID.QrySecAgentCheckMode, req), id), false);
860
+ let encoded;
861
+ try {
862
+ encoded = this.encode(STRUCT_ID.QrySecAgentCheckMode, req);
863
+ }
864
+ catch (error) {
865
+ return Promise.reject(error);
866
+ }
867
+ return this.queryRequest((id) => this.native._req(62, encoded, id), false);
552
868
  }
553
869
  reqQrySecAgentTradeInfo(req = {}) {
554
- return this.request((id) => this.native._req(63, this.encode(STRUCT_ID.QrySecAgentTradeInfo, req), id), false);
870
+ let encoded;
871
+ try {
872
+ encoded = this.encode(STRUCT_ID.QrySecAgentTradeInfo, req);
873
+ }
874
+ catch (error) {
875
+ return Promise.reject(error);
876
+ }
877
+ return this.queryRequest((id) => this.native._req(63, encoded, id), false);
555
878
  }
556
879
  reqQryOptionInstrTradeCost(req = {}) {
557
- return this.request((id) => this.native._req(64, this.encode(STRUCT_ID.QryOptionInstrTradeCost, req), id), false);
880
+ let encoded;
881
+ try {
882
+ encoded = this.encode(STRUCT_ID.QryOptionInstrTradeCost, req);
883
+ }
884
+ catch (error) {
885
+ return Promise.reject(error);
886
+ }
887
+ return this.queryRequest((id) => this.native._req(64, encoded, id), false);
558
888
  }
559
889
  reqQryOptionInstrCommRate(req = {}) {
560
- return this.request((id) => this.native._req(65, this.encode(STRUCT_ID.QryOptionInstrCommRate, req), id), false);
890
+ let encoded;
891
+ try {
892
+ encoded = this.encode(STRUCT_ID.QryOptionInstrCommRate, req);
893
+ }
894
+ catch (error) {
895
+ return Promise.reject(error);
896
+ }
897
+ return this.queryRequest((id) => this.native._req(65, encoded, id), false);
561
898
  }
562
899
  reqQryExecOrder(req = {}) {
563
- return this.request((id) => this.native._req(66, this.encode(STRUCT_ID.QryExecOrder, req), id), false);
900
+ let encoded;
901
+ try {
902
+ encoded = this.encode(STRUCT_ID.QryExecOrder, req);
903
+ }
904
+ catch (error) {
905
+ return Promise.reject(error);
906
+ }
907
+ return this.queryRequest((id) => this.native._req(66, encoded, id), false);
564
908
  }
565
909
  reqQryForQuote(req = {}) {
566
- return this.request((id) => this.native._req(67, this.encode(STRUCT_ID.QryForQuote, req), id), false);
910
+ let encoded;
911
+ try {
912
+ encoded = this.encode(STRUCT_ID.QryForQuote, req);
913
+ }
914
+ catch (error) {
915
+ return Promise.reject(error);
916
+ }
917
+ return this.queryRequest((id) => this.native._req(67, encoded, id), false);
567
918
  }
568
919
  reqQryQuote(req = {}) {
569
- return this.request((id) => this.native._req(68, this.encode(STRUCT_ID.QryQuote, req), id), false);
920
+ let encoded;
921
+ try {
922
+ encoded = this.encode(STRUCT_ID.QryQuote, req);
923
+ }
924
+ catch (error) {
925
+ return Promise.reject(error);
926
+ }
927
+ return this.queryRequest((id) => this.native._req(68, encoded, id), false);
570
928
  }
571
929
  reqQryOptionSelfClose(req = {}) {
572
- return this.request((id) => this.native._req(69, this.encode(STRUCT_ID.QryOptionSelfClose, req), id), false);
930
+ let encoded;
931
+ try {
932
+ encoded = this.encode(STRUCT_ID.QryOptionSelfClose, req);
933
+ }
934
+ catch (error) {
935
+ return Promise.reject(error);
936
+ }
937
+ return this.queryRequest((id) => this.native._req(69, encoded, id), false);
573
938
  }
574
939
  reqQryInvestUnit(req = {}) {
575
- return this.request((id) => this.native._req(70, this.encode(STRUCT_ID.QryInvestUnit, req), id), false);
940
+ let encoded;
941
+ try {
942
+ encoded = this.encode(STRUCT_ID.QryInvestUnit, req);
943
+ }
944
+ catch (error) {
945
+ return Promise.reject(error);
946
+ }
947
+ return this.queryRequest((id) => this.native._req(70, encoded, id), false);
576
948
  }
577
949
  reqQryCombInstrumentGuard(req = {}) {
578
- return this.request((id) => this.native._req(71, this.encode(STRUCT_ID.QryCombInstrumentGuard, req), id), false);
950
+ let encoded;
951
+ try {
952
+ encoded = this.encode(STRUCT_ID.QryCombInstrumentGuard, req);
953
+ }
954
+ catch (error) {
955
+ return Promise.reject(error);
956
+ }
957
+ return this.queryRequest((id) => this.native._req(71, encoded, id), false);
579
958
  }
580
959
  reqQryCombAction(req = {}) {
581
- return this.request((id) => this.native._req(72, this.encode(STRUCT_ID.QryCombAction, req), id), false);
960
+ let encoded;
961
+ try {
962
+ encoded = this.encode(STRUCT_ID.QryCombAction, req);
963
+ }
964
+ catch (error) {
965
+ return Promise.reject(error);
966
+ }
967
+ return this.queryRequest((id) => this.native._req(72, encoded, id), false);
582
968
  }
583
969
  reqQryTransferSerial(req = {}) {
584
- return this.request((id) => this.native._req(73, this.encode(STRUCT_ID.QryTransferSerial, req), id), false);
970
+ let encoded;
971
+ try {
972
+ encoded = this.encode(STRUCT_ID.QryTransferSerial, req);
973
+ }
974
+ catch (error) {
975
+ return Promise.reject(error);
976
+ }
977
+ return this.queryRequest((id) => this.native._req(73, encoded, id), false);
585
978
  }
586
979
  reqQryAccountregister(req = {}) {
587
- return this.request((id) => this.native._req(74, this.encode(STRUCT_ID.QryAccountregister, req), id), false);
980
+ let encoded;
981
+ try {
982
+ encoded = this.encode(STRUCT_ID.QryAccountregister, req);
983
+ }
984
+ catch (error) {
985
+ return Promise.reject(error);
986
+ }
987
+ return this.queryRequest((id) => this.native._req(74, encoded, id), false);
588
988
  }
589
989
  reqQryContractBank(req = {}) {
590
- return this.request((id) => this.native._req(75, this.encode(STRUCT_ID.QryContractBank, req), id), false);
990
+ let encoded;
991
+ try {
992
+ encoded = this.encode(STRUCT_ID.QryContractBank, req);
993
+ }
994
+ catch (error) {
995
+ return Promise.reject(error);
996
+ }
997
+ return this.queryRequest((id) => this.native._req(75, encoded, id), false);
591
998
  }
592
999
  reqQryParkedOrder(req = {}) {
593
- return this.request((id) => this.native._req(76, this.encode(STRUCT_ID.QryParkedOrder, req), id), false);
1000
+ let encoded;
1001
+ try {
1002
+ encoded = this.encode(STRUCT_ID.QryParkedOrder, req);
1003
+ }
1004
+ catch (error) {
1005
+ return Promise.reject(error);
1006
+ }
1007
+ return this.queryRequest((id) => this.native._req(76, encoded, id), false);
594
1008
  }
595
1009
  reqQryParkedOrderAction(req = {}) {
596
- return this.request((id) => this.native._req(77, this.encode(STRUCT_ID.QryParkedOrderAction, req), id), false);
1010
+ let encoded;
1011
+ try {
1012
+ encoded = this.encode(STRUCT_ID.QryParkedOrderAction, req);
1013
+ }
1014
+ catch (error) {
1015
+ return Promise.reject(error);
1016
+ }
1017
+ return this.queryRequest((id) => this.native._req(77, encoded, id), false);
597
1018
  }
598
1019
  reqQryTradingNotice(req = {}) {
599
- return this.request((id) => this.native._req(78, this.encode(STRUCT_ID.QryTradingNotice, req), id), false);
1020
+ let encoded;
1021
+ try {
1022
+ encoded = this.encode(STRUCT_ID.QryTradingNotice, req);
1023
+ }
1024
+ catch (error) {
1025
+ return Promise.reject(error);
1026
+ }
1027
+ return this.queryRequest((id) => this.native._req(78, encoded, id), false);
600
1028
  }
601
1029
  reqQryBrokerTradingParams(req = {}) {
602
- return this.request((id) => this.native._req(79, this.encode(STRUCT_ID.QryBrokerTradingParams, req), id), false);
1030
+ let encoded;
1031
+ try {
1032
+ encoded = this.encode(STRUCT_ID.QryBrokerTradingParams, req);
1033
+ }
1034
+ catch (error) {
1035
+ return Promise.reject(error);
1036
+ }
1037
+ return this.queryRequest((id) => this.native._req(79, encoded, id), false);
603
1038
  }
604
1039
  reqQryBrokerTradingAlgos(req = {}) {
605
- return this.request((id) => this.native._req(80, this.encode(STRUCT_ID.QryBrokerTradingAlgos, req), id), false);
1040
+ let encoded;
1041
+ try {
1042
+ encoded = this.encode(STRUCT_ID.QryBrokerTradingAlgos, req);
1043
+ }
1044
+ catch (error) {
1045
+ return Promise.reject(error);
1046
+ }
1047
+ return this.queryRequest((id) => this.native._req(80, encoded, id), false);
606
1048
  }
607
1049
  reqQueryCfmmcTradingAccountToken(req = {}) {
608
- return this.request((id) => this.native._req(81, this.encode(STRUCT_ID.QueryCFMMCTradingAccountToken, req), id), true);
1050
+ let encoded;
1051
+ try {
1052
+ encoded = this.encode(STRUCT_ID.QueryCFMMCTradingAccountToken, req);
1053
+ }
1054
+ catch (error) {
1055
+ return Promise.reject(error);
1056
+ }
1057
+ return this.queryRequest((id) => this.native._req(81, encoded, id), true);
609
1058
  }
610
1059
  reqFromBankToFutureByFuture(req = {}) {
611
1060
  return this.request((id) => this.native._req(82, this.encode(STRUCT_ID.ReqTransfer, req), id), true);
@@ -614,100 +1063,324 @@ export class TraderBase extends CtpClient {
614
1063
  return this.request((id) => this.native._req(83, this.encode(STRUCT_ID.ReqTransfer, req), id), true);
615
1064
  }
616
1065
  reqQueryBankAccountMoneyByFuture(req = {}) {
617
- return this.request((id) => this.native._req(84, this.encode(STRUCT_ID.ReqQueryAccount, req), id), true);
1066
+ let encoded;
1067
+ try {
1068
+ encoded = this.encode(STRUCT_ID.ReqQueryAccount, req);
1069
+ }
1070
+ catch (error) {
1071
+ return Promise.reject(error);
1072
+ }
1073
+ return this.queryRequest((id) => this.native._req(84, encoded, id), true);
618
1074
  }
619
1075
  reqQryClassifiedInstrument(req = {}) {
620
- return this.request((id) => this.native._req(85, this.encode(STRUCT_ID.QryClassifiedInstrument, req), id), false);
1076
+ let encoded;
1077
+ try {
1078
+ encoded = this.encode(STRUCT_ID.QryClassifiedInstrument, req);
1079
+ }
1080
+ catch (error) {
1081
+ return Promise.reject(error);
1082
+ }
1083
+ return this.queryRequest((id) => this.native._req(85, encoded, id), false);
621
1084
  }
622
1085
  reqQryCombPromotionParam(req = {}) {
623
- return this.request((id) => this.native._req(86, this.encode(STRUCT_ID.QryCombPromotionParam, req), id), false);
1086
+ let encoded;
1087
+ try {
1088
+ encoded = this.encode(STRUCT_ID.QryCombPromotionParam, req);
1089
+ }
1090
+ catch (error) {
1091
+ return Promise.reject(error);
1092
+ }
1093
+ return this.queryRequest((id) => this.native._req(86, encoded, id), false);
624
1094
  }
625
1095
  reqQryRiskSettleInvstPosition(req = {}) {
626
- return this.request((id) => this.native._req(87, this.encode(STRUCT_ID.QryRiskSettleInvstPosition, req), id), false);
1096
+ let encoded;
1097
+ try {
1098
+ encoded = this.encode(STRUCT_ID.QryRiskSettleInvstPosition, req);
1099
+ }
1100
+ catch (error) {
1101
+ return Promise.reject(error);
1102
+ }
1103
+ return this.queryRequest((id) => this.native._req(87, encoded, id), false);
627
1104
  }
628
1105
  reqQryRiskSettleProductStatus(req = {}) {
629
- return this.request((id) => this.native._req(88, this.encode(STRUCT_ID.QryRiskSettleProductStatus, req), id), false);
1106
+ let encoded;
1107
+ try {
1108
+ encoded = this.encode(STRUCT_ID.QryRiskSettleProductStatus, req);
1109
+ }
1110
+ catch (error) {
1111
+ return Promise.reject(error);
1112
+ }
1113
+ return this.queryRequest((id) => this.native._req(88, encoded, id), false);
630
1114
  }
631
1115
  reqQrySpbmFutureParameter(req = {}) {
632
- return this.request((id) => this.native._req(89, this.encode(STRUCT_ID.QrySPBMFutureParameter, req), id), false);
1116
+ let encoded;
1117
+ try {
1118
+ encoded = this.encode(STRUCT_ID.QrySPBMFutureParameter, req);
1119
+ }
1120
+ catch (error) {
1121
+ return Promise.reject(error);
1122
+ }
1123
+ return this.queryRequest((id) => this.native._req(89, encoded, id), false);
633
1124
  }
634
1125
  reqQrySpbmOptionParameter(req = {}) {
635
- return this.request((id) => this.native._req(90, this.encode(STRUCT_ID.QrySPBMOptionParameter, req), id), false);
1126
+ let encoded;
1127
+ try {
1128
+ encoded = this.encode(STRUCT_ID.QrySPBMOptionParameter, req);
1129
+ }
1130
+ catch (error) {
1131
+ return Promise.reject(error);
1132
+ }
1133
+ return this.queryRequest((id) => this.native._req(90, encoded, id), false);
636
1134
  }
637
1135
  reqQrySpbmIntraParameter(req = {}) {
638
- return this.request((id) => this.native._req(91, this.encode(STRUCT_ID.QrySPBMIntraParameter, req), id), false);
1136
+ let encoded;
1137
+ try {
1138
+ encoded = this.encode(STRUCT_ID.QrySPBMIntraParameter, req);
1139
+ }
1140
+ catch (error) {
1141
+ return Promise.reject(error);
1142
+ }
1143
+ return this.queryRequest((id) => this.native._req(91, encoded, id), false);
639
1144
  }
640
1145
  reqQrySpbmInterParameter(req = {}) {
641
- return this.request((id) => this.native._req(92, this.encode(STRUCT_ID.QrySPBMInterParameter, req), id), false);
1146
+ let encoded;
1147
+ try {
1148
+ encoded = this.encode(STRUCT_ID.QrySPBMInterParameter, req);
1149
+ }
1150
+ catch (error) {
1151
+ return Promise.reject(error);
1152
+ }
1153
+ return this.queryRequest((id) => this.native._req(92, encoded, id), false);
642
1154
  }
643
1155
  reqQrySpbmPortfDefinition(req = {}) {
644
- return this.request((id) => this.native._req(93, this.encode(STRUCT_ID.QrySPBMPortfDefinition, req), id), false);
1156
+ let encoded;
1157
+ try {
1158
+ encoded = this.encode(STRUCT_ID.QrySPBMPortfDefinition, req);
1159
+ }
1160
+ catch (error) {
1161
+ return Promise.reject(error);
1162
+ }
1163
+ return this.queryRequest((id) => this.native._req(93, encoded, id), false);
645
1164
  }
646
1165
  reqQrySpbmInvestorPortfDef(req = {}) {
647
- return this.request((id) => this.native._req(94, this.encode(STRUCT_ID.QrySPBMInvestorPortfDef, req), id), false);
1166
+ let encoded;
1167
+ try {
1168
+ encoded = this.encode(STRUCT_ID.QrySPBMInvestorPortfDef, req);
1169
+ }
1170
+ catch (error) {
1171
+ return Promise.reject(error);
1172
+ }
1173
+ return this.queryRequest((id) => this.native._req(94, encoded, id), false);
648
1174
  }
649
1175
  reqQryInvestorPortfMarginRatio(req = {}) {
650
- return this.request((id) => this.native._req(95, this.encode(STRUCT_ID.QryInvestorPortfMarginRatio, req), id), false);
1176
+ let encoded;
1177
+ try {
1178
+ encoded = this.encode(STRUCT_ID.QryInvestorPortfMarginRatio, req);
1179
+ }
1180
+ catch (error) {
1181
+ return Promise.reject(error);
1182
+ }
1183
+ return this.queryRequest((id) => this.native._req(95, encoded, id), false);
651
1184
  }
652
1185
  reqQryInvestorProdSpbmDetail(req = {}) {
653
- return this.request((id) => this.native._req(96, this.encode(STRUCT_ID.QryInvestorProdSPBMDetail, req), id), false);
1186
+ let encoded;
1187
+ try {
1188
+ encoded = this.encode(STRUCT_ID.QryInvestorProdSPBMDetail, req);
1189
+ }
1190
+ catch (error) {
1191
+ return Promise.reject(error);
1192
+ }
1193
+ return this.queryRequest((id) => this.native._req(96, encoded, id), false);
654
1194
  }
655
1195
  reqQryInvestorCommoditySpmmMargin(req = {}) {
656
- return this.request((id) => this.native._req(97, this.encode(STRUCT_ID.QryInvestorCommoditySPMMMargin, req), id), false);
1196
+ let encoded;
1197
+ try {
1198
+ encoded = this.encode(STRUCT_ID.QryInvestorCommoditySPMMMargin, req);
1199
+ }
1200
+ catch (error) {
1201
+ return Promise.reject(error);
1202
+ }
1203
+ return this.queryRequest((id) => this.native._req(97, encoded, id), false);
657
1204
  }
658
1205
  reqQryInvestorCommodityGroupSpmmMargin(req = {}) {
659
- return this.request((id) => this.native._req(98, this.encode(STRUCT_ID.QryInvestorCommodityGroupSPMMMargin, req), id), false);
1206
+ let encoded;
1207
+ try {
1208
+ encoded = this.encode(STRUCT_ID.QryInvestorCommodityGroupSPMMMargin, req);
1209
+ }
1210
+ catch (error) {
1211
+ return Promise.reject(error);
1212
+ }
1213
+ return this.queryRequest((id) => this.native._req(98, encoded, id), false);
660
1214
  }
661
1215
  reqQrySpmmInstParam(req = {}) {
662
- return this.request((id) => this.native._req(99, this.encode(STRUCT_ID.QrySPMMInstParam, req), id), false);
1216
+ let encoded;
1217
+ try {
1218
+ encoded = this.encode(STRUCT_ID.QrySPMMInstParam, req);
1219
+ }
1220
+ catch (error) {
1221
+ return Promise.reject(error);
1222
+ }
1223
+ return this.queryRequest((id) => this.native._req(99, encoded, id), false);
663
1224
  }
664
1225
  reqQrySpmmProductParam(req = {}) {
665
- return this.request((id) => this.native._req(100, this.encode(STRUCT_ID.QrySPMMProductParam, req), id), false);
1226
+ let encoded;
1227
+ try {
1228
+ encoded = this.encode(STRUCT_ID.QrySPMMProductParam, req);
1229
+ }
1230
+ catch (error) {
1231
+ return Promise.reject(error);
1232
+ }
1233
+ return this.queryRequest((id) => this.native._req(100, encoded, id), false);
666
1234
  }
667
1235
  reqQrySpbmAddOnInterParameter(req = {}) {
668
- return this.request((id) => this.native._req(101, this.encode(STRUCT_ID.QrySPBMAddOnInterParameter, req), id), false);
1236
+ let encoded;
1237
+ try {
1238
+ encoded = this.encode(STRUCT_ID.QrySPBMAddOnInterParameter, req);
1239
+ }
1240
+ catch (error) {
1241
+ return Promise.reject(error);
1242
+ }
1243
+ return this.queryRequest((id) => this.native._req(101, encoded, id), false);
669
1244
  }
670
1245
  reqQryRcamsCombProductInfo(req = {}) {
671
- return this.request((id) => this.native._req(102, this.encode(STRUCT_ID.QryRCAMSCombProductInfo, req), id), false);
1246
+ let encoded;
1247
+ try {
1248
+ encoded = this.encode(STRUCT_ID.QryRCAMSCombProductInfo, req);
1249
+ }
1250
+ catch (error) {
1251
+ return Promise.reject(error);
1252
+ }
1253
+ return this.queryRequest((id) => this.native._req(102, encoded, id), false);
672
1254
  }
673
1255
  reqQryRcamsInstrParameter(req = {}) {
674
- return this.request((id) => this.native._req(103, this.encode(STRUCT_ID.QryRCAMSInstrParameter, req), id), false);
1256
+ let encoded;
1257
+ try {
1258
+ encoded = this.encode(STRUCT_ID.QryRCAMSInstrParameter, req);
1259
+ }
1260
+ catch (error) {
1261
+ return Promise.reject(error);
1262
+ }
1263
+ return this.queryRequest((id) => this.native._req(103, encoded, id), false);
675
1264
  }
676
1265
  reqQryRcamsIntraParameter(req = {}) {
677
- return this.request((id) => this.native._req(104, this.encode(STRUCT_ID.QryRCAMSIntraParameter, req), id), false);
1266
+ let encoded;
1267
+ try {
1268
+ encoded = this.encode(STRUCT_ID.QryRCAMSIntraParameter, req);
1269
+ }
1270
+ catch (error) {
1271
+ return Promise.reject(error);
1272
+ }
1273
+ return this.queryRequest((id) => this.native._req(104, encoded, id), false);
678
1274
  }
679
1275
  reqQryRcamsInterParameter(req = {}) {
680
- return this.request((id) => this.native._req(105, this.encode(STRUCT_ID.QryRCAMSInterParameter, req), id), false);
1276
+ let encoded;
1277
+ try {
1278
+ encoded = this.encode(STRUCT_ID.QryRCAMSInterParameter, req);
1279
+ }
1280
+ catch (error) {
1281
+ return Promise.reject(error);
1282
+ }
1283
+ return this.queryRequest((id) => this.native._req(105, encoded, id), false);
681
1284
  }
682
1285
  reqQryRcamsShortOptAdjustParam(req = {}) {
683
- return this.request((id) => this.native._req(106, this.encode(STRUCT_ID.QryRCAMSShortOptAdjustParam, req), id), false);
1286
+ let encoded;
1287
+ try {
1288
+ encoded = this.encode(STRUCT_ID.QryRCAMSShortOptAdjustParam, req);
1289
+ }
1290
+ catch (error) {
1291
+ return Promise.reject(error);
1292
+ }
1293
+ return this.queryRequest((id) => this.native._req(106, encoded, id), false);
684
1294
  }
685
1295
  reqQryRcamsInvestorCombPosition(req = {}) {
686
- return this.request((id) => this.native._req(107, this.encode(STRUCT_ID.QryRCAMSInvestorCombPosition, req), id), false);
1296
+ let encoded;
1297
+ try {
1298
+ encoded = this.encode(STRUCT_ID.QryRCAMSInvestorCombPosition, req);
1299
+ }
1300
+ catch (error) {
1301
+ return Promise.reject(error);
1302
+ }
1303
+ return this.queryRequest((id) => this.native._req(107, encoded, id), false);
687
1304
  }
688
1305
  reqQryInvestorProdRcamsMargin(req = {}) {
689
- return this.request((id) => this.native._req(108, this.encode(STRUCT_ID.QryInvestorProdRCAMSMargin, req), id), false);
1306
+ let encoded;
1307
+ try {
1308
+ encoded = this.encode(STRUCT_ID.QryInvestorProdRCAMSMargin, req);
1309
+ }
1310
+ catch (error) {
1311
+ return Promise.reject(error);
1312
+ }
1313
+ return this.queryRequest((id) => this.native._req(108, encoded, id), false);
690
1314
  }
691
1315
  reqQryRuleInstrParameter(req = {}) {
692
- return this.request((id) => this.native._req(109, this.encode(STRUCT_ID.QryRULEInstrParameter, req), id), false);
1316
+ let encoded;
1317
+ try {
1318
+ encoded = this.encode(STRUCT_ID.QryRULEInstrParameter, req);
1319
+ }
1320
+ catch (error) {
1321
+ return Promise.reject(error);
1322
+ }
1323
+ return this.queryRequest((id) => this.native._req(109, encoded, id), false);
693
1324
  }
694
1325
  reqQryRuleIntraParameter(req = {}) {
695
- return this.request((id) => this.native._req(110, this.encode(STRUCT_ID.QryRULEIntraParameter, req), id), false);
1326
+ let encoded;
1327
+ try {
1328
+ encoded = this.encode(STRUCT_ID.QryRULEIntraParameter, req);
1329
+ }
1330
+ catch (error) {
1331
+ return Promise.reject(error);
1332
+ }
1333
+ return this.queryRequest((id) => this.native._req(110, encoded, id), false);
696
1334
  }
697
1335
  reqQryRuleInterParameter(req = {}) {
698
- return this.request((id) => this.native._req(111, this.encode(STRUCT_ID.QryRULEInterParameter, req), id), false);
1336
+ let encoded;
1337
+ try {
1338
+ encoded = this.encode(STRUCT_ID.QryRULEInterParameter, req);
1339
+ }
1340
+ catch (error) {
1341
+ return Promise.reject(error);
1342
+ }
1343
+ return this.queryRequest((id) => this.native._req(111, encoded, id), false);
699
1344
  }
700
1345
  reqQryInvestorProdRuleMargin(req = {}) {
701
- return this.request((id) => this.native._req(112, this.encode(STRUCT_ID.QryInvestorProdRULEMargin, req), id), false);
1346
+ let encoded;
1347
+ try {
1348
+ encoded = this.encode(STRUCT_ID.QryInvestorProdRULEMargin, req);
1349
+ }
1350
+ catch (error) {
1351
+ return Promise.reject(error);
1352
+ }
1353
+ return this.queryRequest((id) => this.native._req(112, encoded, id), false);
702
1354
  }
703
1355
  reqQryInvestorPortfSetting(req = {}) {
704
- return this.request((id) => this.native._req(113, this.encode(STRUCT_ID.QryInvestorPortfSetting, req), id), false);
1356
+ let encoded;
1357
+ try {
1358
+ encoded = this.encode(STRUCT_ID.QryInvestorPortfSetting, req);
1359
+ }
1360
+ catch (error) {
1361
+ return Promise.reject(error);
1362
+ }
1363
+ return this.queryRequest((id) => this.native._req(113, encoded, id), false);
705
1364
  }
706
1365
  reqQryInvestorInfoCommRec(req = {}) {
707
- return this.request((id) => this.native._req(114, this.encode(STRUCT_ID.QryInvestorInfoCommRec, req), id), false);
1366
+ let encoded;
1367
+ try {
1368
+ encoded = this.encode(STRUCT_ID.QryInvestorInfoCommRec, req);
1369
+ }
1370
+ catch (error) {
1371
+ return Promise.reject(error);
1372
+ }
1373
+ return this.queryRequest((id) => this.native._req(114, encoded, id), false);
708
1374
  }
709
1375
  reqQryCombLeg(req = {}) {
710
- return this.request((id) => this.native._req(115, this.encode(STRUCT_ID.QryCombLeg, req), id), false);
1376
+ let encoded;
1377
+ try {
1378
+ encoded = this.encode(STRUCT_ID.QryCombLeg, req);
1379
+ }
1380
+ catch (error) {
1381
+ return Promise.reject(error);
1382
+ }
1383
+ return this.queryRequest((id) => this.native._req(115, encoded, id), false);
711
1384
  }
712
1385
  reqOffsetSetting(req = {}) {
713
1386
  return this.request((id) => this.native._req(116, this.encode(STRUCT_ID.InputOffsetSetting, req), id), true);
@@ -716,7 +1389,14 @@ export class TraderBase extends CtpClient {
716
1389
  return this.request((id) => this.native._req(117, this.encode(STRUCT_ID.InputOffsetSetting, req), id), true);
717
1390
  }
718
1391
  reqQryOffsetSetting(req = {}) {
719
- return this.request((id) => this.native._req(118, this.encode(STRUCT_ID.QryOffsetSetting, req), id), false);
1392
+ let encoded;
1393
+ try {
1394
+ encoded = this.encode(STRUCT_ID.QryOffsetSetting, req);
1395
+ }
1396
+ catch (error) {
1397
+ return Promise.reject(error);
1398
+ }
1399
+ return this.queryRequest((id) => this.native._req(118, encoded, id), false);
720
1400
  }
721
1401
  reqGenSmsCode(req = {}) {
722
1402
  return this.request((id) => this.native._req(119, this.encode(STRUCT_ID.ReqGenSMSCode, req), id), true);
@@ -728,7 +1408,14 @@ export class TraderBase extends CtpClient {
728
1408
  return this.request((id) => this.native._req(121, this.encode(STRUCT_ID.InputSpdApplyAction, req), id), true);
729
1409
  }
730
1410
  reqQrySpdApply(req = {}) {
731
- return this.request((id) => this.native._req(122, this.encode(STRUCT_ID.QrySpdApply, req), id), false);
1411
+ let encoded;
1412
+ try {
1413
+ encoded = this.encode(STRUCT_ID.QrySpdApply, req);
1414
+ }
1415
+ catch (error) {
1416
+ return Promise.reject(error);
1417
+ }
1418
+ return this.queryRequest((id) => this.native._req(122, encoded, id), false);
732
1419
  }
733
1420
  reqHedgeCfm(req = {}) {
734
1421
  return this.request((id) => this.native._req(123, this.encode(STRUCT_ID.InputHedgeCfm, req), id), true);
@@ -737,7 +1424,14 @@ export class TraderBase extends CtpClient {
737
1424
  return this.request((id) => this.native._req(124, this.encode(STRUCT_ID.InputHedgeCfmAction, req), id), true);
738
1425
  }
739
1426
  reqQryHedgeCfm(req = {}) {
740
- return this.request((id) => this.native._req(125, this.encode(STRUCT_ID.QryHedgeCfm, req), id), false);
1427
+ let encoded;
1428
+ try {
1429
+ encoded = this.encode(STRUCT_ID.QryHedgeCfm, req);
1430
+ }
1431
+ catch (error) {
1432
+ return Promise.reject(error);
1433
+ }
1434
+ return this.queryRequest((id) => this.native._req(125, encoded, id), false);
741
1435
  }
742
1436
  }
743
1437
  //# sourceMappingURL=trader.gen.js.map