ctp-rs 0.3.2+ctp.6.7.11.darwin.6.7.7

Safe & idiomatic Rust bindings for CTP; cross-platform (Windows/Linux/macOS) with built-in LocalCTP support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
#pragma once

struct DisseminationField;
struct ReqUserLoginField;
struct RspUserLoginField;
struct UserLogoutField;
struct ForceUserLogoutField;
struct ReqAuthenticateField;
struct RspAuthenticateField;
struct AuthenticationInfoField;
struct RspUserLogin2Field;
struct TransferHeaderField;
struct TransferBankToFutureReqField;
struct TransferBankToFutureRspField;
struct TransferFutureToBankReqField;
struct TransferFutureToBankRspField;
struct TransferQryBankReqField;
struct TransferQryBankRspField;
struct TransferQryDetailReqField;
struct TransferQryDetailRspField;
struct RspInfoField;
struct ExchangeField;
struct ProductField;
struct InstrumentField;
struct BrokerField;
struct TraderField;
struct InvestorField;
struct TradingCodeField;
struct PartBrokerField;
struct SuperUserField;
struct SuperUserFunctionField;
struct InvestorGroupField;
struct TradingAccountField;
struct InvestorPositionField;
struct InstrumentMarginRateField;
struct InstrumentCommissionRateField;
struct DepthMarketDataField;
struct InstrumentTradingRightField;
struct BrokerUserField;
struct BrokerUserPasswordField;
struct BrokerUserFunctionField;
struct TraderOfferField;
struct SettlementInfoField;
struct InstrumentMarginRateAdjustField;
struct ExchangeMarginRateField;
struct ExchangeMarginRateAdjustField;
struct ExchangeRateField;
struct SettlementRefField;
struct CurrentTimeField;
struct CommPhaseField;
struct LoginInfoField;
struct LogoutAllField;
struct FrontStatusField;
struct UserPasswordUpdateField;
struct InputOrderField;
struct OrderField;
struct ExchangeOrderField;
struct ExchangeOrderInsertErrorField;
struct InputOrderActionField;
struct OrderActionField;
struct ExchangeOrderActionField;
struct ExchangeOrderActionErrorField;
struct ExchangeTradeField;
struct TradeField;
struct UserSessionField;
struct QryMaxOrderVolumeField;
struct SettlementInfoConfirmField;
struct SyncDepositField;
struct SyncFundMortgageField;
struct BrokerSyncField;
struct SyncingInvestorField;
struct SyncingTradingCodeField;
struct SyncingInvestorGroupField;
struct SyncingTradingAccountField;
struct SyncingInvestorPositionField;
struct SyncingInstrumentMarginRateField;
struct SyncingInstrumentCommissionRateField;
struct SyncingInstrumentTradingRightField;
struct QryOrderField;
struct QryTradeField;
struct QryInvestorPositionField;
struct QryTradingAccountField;
struct QryInvestorField;
struct QryTradingCodeField;
struct QryInvestorGroupField;
struct QryInstrumentMarginRateField;
struct QryInstrumentCommissionRateField;
struct QryInstrumentTradingRightField;
struct QryBrokerField;
struct QryTraderField;
struct QrySuperUserFunctionField;
struct QryUserSessionField;
struct QryPartBrokerField;
struct QryFrontStatusField;
struct QryExchangeOrderField;
struct QryOrderActionField;
struct QryExchangeOrderActionField;
struct QrySuperUserField;
struct QryExchangeField;
struct QryProductField;
struct QryInstrumentField;
struct QryDepthMarketDataField;
struct QryBrokerUserField;
struct QryBrokerUserFunctionField;
struct QryTraderOfferField;
struct QrySyncDepositField;
struct QrySettlementInfoField;
struct QryExchangeMarginRateField;
struct QryExchangeMarginRateAdjustField;
struct QryExchangeRateField;
struct QrySyncFundMortgageField;
struct QryHisOrderField;
struct OptionInstrMiniMarginField;
struct OptionInstrMarginAdjustField;
struct OptionInstrCommRateField;
struct OptionInstrTradeCostField;
struct QryOptionInstrTradeCostField;
struct QryOptionInstrCommRateField;
struct IndexPriceField;
struct InputExecOrderField;
struct InputExecOrderActionField;
struct ExecOrderField;
struct ExecOrderActionField;
struct QryExecOrderField;
struct ExchangeExecOrderField;
struct QryExchangeExecOrderField;
struct QryExecOrderActionField;
struct ExchangeExecOrderActionField;
struct QryExchangeExecOrderActionField;
struct ErrExecOrderField;
struct QryErrExecOrderField;
struct ErrExecOrderActionField;
struct QryErrExecOrderActionField;
struct OptionInstrTradingRightField;
struct QryOptionInstrTradingRightField;
struct InputForQuoteField;
struct ForQuoteField;
struct QryForQuoteField;
struct ExchangeForQuoteField;
struct QryExchangeForQuoteField;
struct InputQuoteField;
struct InputQuoteActionField;
struct QuoteField;
struct QuoteActionField;
struct QryQuoteField;
struct ExchangeQuoteField;
struct QryExchangeQuoteField;
struct QryQuoteActionField;
struct ExchangeQuoteActionField;
struct QryExchangeQuoteActionField;
struct OptionInstrDeltaField;
struct ForQuoteRspField;
struct StrikeOffsetField;
struct QryStrikeOffsetField;
struct InputBatchOrderActionField;
struct BatchOrderActionField;
struct ExchangeBatchOrderActionField;
struct QryBatchOrderActionField;
struct CombInstrumentGuardField;
struct QryCombInstrumentGuardField;
struct InputCombActionField;
struct CombActionField;
struct QryCombActionField;
struct ExchangeCombActionField;
struct QryExchangeCombActionField;
struct ProductExchRateField;
struct QryProductExchRateField;
struct QryForQuoteParamField;
struct ForQuoteParamField;
struct MMOptionInstrCommRateField;
struct QryMMOptionInstrCommRateField;
struct MMInstrumentCommissionRateField;
struct QryMMInstrumentCommissionRateField;
struct InstrumentOrderCommRateField;
struct QryInstrumentOrderCommRateField;
struct TradeParamField;
struct InstrumentMarginRateULField;
struct FutureLimitPosiParamField;
struct LoginForbiddenIPField;
struct IPListField;
struct InputOptionSelfCloseField;
struct InputOptionSelfCloseActionField;
struct OptionSelfCloseField;
struct OptionSelfCloseActionField;
struct QryOptionSelfCloseField;
struct ExchangeOptionSelfCloseField;
struct QryOptionSelfCloseActionField;
struct ExchangeOptionSelfCloseActionField;
struct SyncDelaySwapField;
struct QrySyncDelaySwapField;
struct InvestUnitField;
struct QryInvestUnitField;
struct SecAgentCheckModeField;
struct SecAgentTradeInfoField;
struct MarketDataField;
struct MarketDataBaseField;
struct MarketDataStaticField;
struct MarketDataLastMatchField;
struct MarketDataBestPriceField;
struct MarketDataBid23Field;
struct MarketDataAsk23Field;
struct MarketDataBid45Field;
struct MarketDataAsk45Field;
struct MarketDataUpdateTimeField;
struct MarketDataBandingPriceField;
struct MarketDataExchangeField;
struct SpecificInstrumentField;
struct InstrumentStatusField;
struct QryInstrumentStatusField;
struct InvestorAccountField;
struct PositionProfitAlgorithmField;
struct DiscountField;
struct QryTransferBankField;
struct TransferBankField;
struct QryInvestorPositionDetailField;
struct InvestorPositionDetailField;
struct TradingAccountPasswordField;
struct MDTraderOfferField;
struct QryMDTraderOfferField;
struct QryNoticeField;
struct NoticeField;
struct UserRightField;
struct QrySettlementInfoConfirmField;
struct LoadSettlementInfoField;
struct BrokerWithdrawAlgorithmField;
struct TradingAccountPasswordUpdateV1Field;
struct TradingAccountPasswordUpdateField;
struct QryCombinationLegField;
struct QrySyncStatusField;
struct CombinationLegField;
struct SyncStatusField;
struct QryLinkManField;
struct LinkManField;
struct QryBrokerUserEventField;
struct BrokerUserEventField;
struct QryContractBankField;
struct ContractBankField;
struct InvestorPositionCombineDetailField;
struct ParkedOrderField;
struct ParkedOrderActionField;
struct QryParkedOrderField;
struct QryParkedOrderActionField;
struct RemoveParkedOrderField;
struct RemoveParkedOrderActionField;
struct InvestorWithdrawAlgorithmField;
struct QryInvestorPositionCombineDetailField;
struct MarketDataAveragePriceField;
struct VerifyInvestorPasswordField;
struct UserIPField;
struct TradingNoticeInfoField;
struct TradingNoticeField;
struct QryTradingNoticeField;
struct QryErrOrderField;
struct ErrOrderField;
struct ErrorConditionalOrderField;
struct QryErrOrderActionField;
struct ErrOrderActionField;
struct QryExchangeSequenceField;
struct ExchangeSequenceField;
struct QryMaxOrderVolumeWithPriceField;
struct QryBrokerTradingParamsField;
struct BrokerTradingParamsField;
struct QryBrokerTradingAlgosField;
struct BrokerTradingAlgosField;
struct QueryBrokerDepositField;
struct BrokerDepositField;
struct QryCFMMCBrokerKeyField;
struct CFMMCBrokerKeyField;
struct CFMMCTradingAccountKeyField;
struct QryCFMMCTradingAccountKeyField;
struct BrokerUserOTPParamField;
struct ManualSyncBrokerUserOTPField;
struct CommRateModelField;
struct QryCommRateModelField;
struct MarginModelField;
struct QryMarginModelField;
struct EWarrantOffsetField;
struct QryEWarrantOffsetField;
struct QryInvestorProductGroupMarginField;
struct InvestorProductGroupMarginField;
struct QueryCFMMCTradingAccountTokenField;
struct CFMMCTradingAccountTokenField;
struct QryProductGroupField;
struct ProductGroupField;
struct BulletinField;
struct QryBulletinField;
struct MulticastInstrumentField;
struct QryMulticastInstrumentField;
struct AppIDAuthAssignField;
struct ReqOpenAccountField;
struct ReqCancelAccountField;
struct ReqChangeAccountField;
struct ReqTransferField;
struct RspTransferField;
struct ReqRepealField;
struct RspRepealField;
struct ReqQueryAccountField;
struct RspQueryAccountField;
struct FutureSignIOField;
struct RspFutureSignInField;
struct ReqFutureSignOutField;
struct RspFutureSignOutField;
struct ReqQueryTradeResultBySerialField;
struct RspQueryTradeResultBySerialField;
struct ReqDayEndFileReadyField;
struct ReturnResultField;
struct VerifyFuturePasswordField;
struct VerifyCustInfoField;
struct VerifyFuturePasswordAndCustInfoField;
struct DepositResultInformField;
struct ReqSyncKeyField;
struct RspSyncKeyField;
struct NotifyQueryAccountField;
struct TransferSerialField;
struct QryTransferSerialField;
struct NotifyFutureSignInField;
struct NotifyFutureSignOutField;
struct NotifySyncKeyField;
struct QryAccountregisterField;
struct AccountregisterField;
struct OpenAccountField;
struct CancelAccountField;
struct ChangeAccountField;
struct SecAgentACIDMapField;
struct QrySecAgentACIDMapField;
struct UserRightsAssignField;
struct BrokerUserRightAssignField;
struct DRTransferField;
struct FensUserInfoField;
struct CurrTransferIdentityField;
struct LoginForbiddenUserField;
struct QryLoginForbiddenUserField;
struct TradingAccountReserveField;
struct QryLoginForbiddenIPField;
struct QryIPListField;
struct QryUserRightsAssignField;
struct ReserveOpenAccountConfirmField;
struct ReserveOpenAccountField;
struct AccountPropertyField;
struct QryCurrDRIdentityField;
struct CurrDRIdentityField;
struct QrySecAgentCheckModeField;
struct QrySecAgentTradeInfoField;
struct ReqUserAuthMethodField;
struct RspUserAuthMethodField;
struct ReqGenUserCaptchaField;
struct RspGenUserCaptchaField;
struct ReqGenUserTextField;
struct RspGenUserTextField;
struct ReqUserLoginWithCaptchaField;
struct ReqUserLoginWithTextField;
struct ReqUserLoginWithOTPField;
struct ReqApiHandshakeField;
struct RspApiHandshakeField;
struct ReqVerifyApiKeyField;
struct DepartmentUserField;
struct QueryFreqField;
struct AuthForbiddenIPField;
struct QryAuthForbiddenIPField;
struct SyncDelaySwapFrozenField;
struct UserSystemInfoField;
struct AuthUserIDField;
struct AuthIPField;
struct QryClassifiedInstrumentField;
struct QryCombPromotionParamField;
struct CombPromotionParamField;
struct ReqUserLoginSMField;
struct QryRiskSettleInvstPositionField;
struct QryRiskSettleProductStatusField;
struct RiskSettleInvstPositionField;
struct RiskSettleProductStatusField;
struct SyncDeltaInfoField;
struct SyncDeltaProductStatusField;
struct SyncDeltaInvstPosDtlField;
struct SyncDeltaInvstPosCombDtlField;
struct SyncDeltaTradingAccountField;
struct SyncDeltaInitInvstMarginField;
struct SyncDeltaDceCombInstrumentField;
struct SyncDeltaInvstMarginRateField;
struct SyncDeltaExchMarginRateField;
struct SyncDeltaOptExchMarginField;
struct SyncDeltaOptInvstMarginField;
struct SyncDeltaInvstMarginRateULField;
struct SyncDeltaOptInvstCommRateField;
struct SyncDeltaInvstCommRateField;
struct SyncDeltaProductExchRateField;
struct SyncDeltaDepthMarketDataField;
struct SyncDeltaIndexPriceField;
struct SyncDeltaEWarrantOffsetField;
struct SPBMFutureParameterField;
struct SPBMOptionParameterField;
struct SPBMIntraParameterField;
struct SPBMInterParameterField;
struct SyncSPBMParameterEndField;
struct QrySPBMFutureParameterField;
struct QrySPBMOptionParameterField;
struct QrySPBMIntraParameterField;
struct QrySPBMInterParameterField;
struct SPBMPortfDefinitionField;
struct SPBMInvestorPortfDefField;
struct InvestorPortfMarginRatioField;
struct QrySPBMPortfDefinitionField;
struct QrySPBMInvestorPortfDefField;
struct QryInvestorPortfMarginRatioField;
struct InvestorProdSPBMDetailField;
struct QryInvestorProdSPBMDetailField;
struct PortfTradeParamSettingField;
struct InvestorTradingRightField;
struct MortgageParamField;
struct WithDrawParamField;
struct ThostUserFunctionField;
struct QryThostUserFunctionField;
struct SPBMAddOnInterParameterField;
struct QrySPBMAddOnInterParameterField;
struct QryInvestorCommoditySPMMMarginField;
struct QryInvestorCommodityGroupSPMMMarginField;
struct QrySPMMInstParamField;
struct QrySPMMProductParamField;
struct InvestorCommoditySPMMMarginField;
struct InvestorCommodityGroupSPMMMarginField;
struct SPMMInstParamField;
struct SPMMProductParamField;
struct QryTraderAssignField;
struct TraderAssignField;
struct InvestorInfoCntSettingField;
struct RCAMSCombProductInfoField;
struct RCAMSInstrParameterField;
struct RCAMSIntraParameterField;
struct RCAMSInterParameterField;
struct RCAMSShortOptAdjustParamField;
struct RCAMSInvestorCombPositionField;
struct InvestorProdRCAMSMarginField;
struct QryRCAMSCombProductInfoField;
struct QryRCAMSInstrParameterField;
struct QryRCAMSIntraParameterField;
struct QryRCAMSInterParameterField;
struct QryRCAMSShortOptAdjustParamField;
struct QryRCAMSInvestorCombPositionField;
struct QryInvestorProdRCAMSMarginField;
struct RULEInstrParameterField;
struct RULEIntraParameterField;
struct RULEInterParameterField;
struct QryRULEInstrParameterField;
struct QryRULEIntraParameterField;
struct QryRULEInterParameterField;
struct InvestorProdRULEMarginField;
struct QryInvestorProdRULEMarginField;
struct SyncDeltaSPBMPortfDefinitionField;
struct SyncDeltaSPBMInvstPortfDefField;
struct SyncDeltaSPBMFutureParameterField;
struct SyncDeltaSPBMOptionParameterField;
struct SyncDeltaSPBMIntraParameterField;
struct SyncDeltaSPBMInterParameterField;
struct SyncDeltaSPBMAddOnInterParamField;
struct SyncDeltaSPMMInstParamField;
struct SyncDeltaSPMMProductParamField;
struct SyncDeltaInvestorSPMMModelField;
struct SyncDeltaSPMMModelParamField;
struct SyncDeltaRCAMSCombProdInfoField;
struct SyncDeltaRCAMSInstrParameterField;
struct SyncDeltaRCAMSIntraParameterField;
struct SyncDeltaRCAMSInterParameterField;
struct SyncDeltaRCAMSSOptAdjParamField;
struct SyncDeltaRCAMSCombRuleDtlField;
struct SyncDeltaRCAMSInvstCombPosField;
struct SyncDeltaRULEInstrParameterField;
struct SyncDeltaRULEIntraParameterField;
struct SyncDeltaRULEInterParameterField;
struct IpAddrParamField;
struct QryIpAddrParamField;
struct TGIpAddrParamField;
struct QryTGIpAddrParamField;
struct TGSessionQryStatusField;
struct LocalAddrConfigField;
struct QryLocalAddrConfigField;
struct ReqQueryBankAccountBySecField;
struct RspQueryBankAccountBySecField;
struct ReqTransferBySecField;
struct RspTransferBySecField;
struct NotifyQueryFutureAccountBySecField;
struct ExitEmergencyField;
struct InvestorPortfMarginModelField;
struct InvestorPortfSettingField;
struct QryInvestorPortfSettingField;
struct UserPasswordUpdateFromSecField;
struct SettlementInfoConfirmFromSecField;
struct TradingAccountPasswordUpdateFromSecField;
struct RiskForbiddenRightField;
struct InvestorInfoCommRecField;
struct QryInvestorInfoCommRecField;
struct CombLegField;
struct QryCombLegField;
struct InputOffsetSettingField;
struct OffsetSettingField;
struct CancelOffsetSettingField;
struct QryOffsetSettingField;
struct AddrAppIDRelationField;
struct QryAddrAppIDRelationField;
struct WechatUserSystemInfoField;
struct InvestorReserveInfoField;
struct QryInvestorDepartmentFlatField;
struct InvestorDepartmentFlatField;
struct QryDepartmentUserField;
struct FrontInfoField;

struct TraderApi;
struct TraderSpi;
class CTraderSpi;

#include "ctp-rs/src/lib.rs.h"
#include "ctp-rs/wrapper/include/CTraderSpi.h"
#include "ThostFtdcMdApi.h"
#include "ThostFtdcTraderApi.h"

#if defined(__APPLE__) && defined(CTP_RS_DARWIN_TRADER_DLOPEN)
// On the macOS-dlopen build the dylib's vtable was compiled against the
// darwin 6.7.7 SDK (125 API methods). Calling through the linux-shaped
// CThostFtdcTraderApi vtable (133 methods, with extras inserted at slots
// 14, 15, 51) would dispatch every slot >= 14 to the wrong dylib method.
// Holding the api pointer typed as the shim makes the compiler emit
// vtable-index calls that match the dylib's actual layout.
#include "ctp-rs/wrapper/include/DarwinSdkShim.h"
using CtpRsTraderApiBase = CThostFtdcTraderApiDarwinShim;
#else
using CtpRsTraderApiBase = CThostFtdcTraderApi;
#endif

#include "rust/cxx.h"
#include <memory>

struct TraderApi {
    TraderApi(rust::Box<TraderSpi> gateway, rust::String flow_path, bool is_production_mode);
    ~TraderApi();
    FrontInfoField GetFrontInfo() const;

    rust::String GetApiVersion() const;
    void Init() const;
    int32_t Join() const;
    rust::String GetTradingDay() const;
    void RegisterFront(rust::String pszFrontAddress) const;
    void RegisterNameServer(rust::String pszNsAddress) const;
    void RegisterFensUserInfo(FensUserInfoField pFensUserInfo) const;
    void SubscribePrivateTopic(int32_t nResumeType) const;
    void SubscribePublicTopic(int32_t nResumeType) const;
    int32_t ReqAuthenticate(ReqAuthenticateField pReqAuthenticateField, int32_t nRequestID) const;
    int32_t RegisterUserSystemInfo(UserSystemInfoField pUserSystemInfo) const;
    int32_t SubmitUserSystemInfo(UserSystemInfoField pUserSystemInfo) const;
    int32_t RegisterWechatUserSystemInfo(WechatUserSystemInfoField pUserSystemInfo) const;
    int32_t SubmitWechatUserSystemInfo(WechatUserSystemInfoField pUserSystemInfo) const;
    int32_t ReqUserLogin(ReqUserLoginField pReqUserLoginField, int32_t nRequestID) const;
    int32_t ReqUserLogout(UserLogoutField pUserLogout, int32_t nRequestID) const;
    int32_t ReqUserPasswordUpdate(UserPasswordUpdateField pUserPasswordUpdate, int32_t nRequestID) const;
    int32_t ReqTradingAccountPasswordUpdate(TradingAccountPasswordUpdateField pTradingAccountPasswordUpdate, int32_t nRequestID) const;
    int32_t ReqUserAuthMethod(ReqUserAuthMethodField pReqUserAuthMethod, int32_t nRequestID) const;
    int32_t ReqGenUserCaptcha(ReqGenUserCaptchaField pReqGenUserCaptcha, int32_t nRequestID) const;
    int32_t ReqGenUserText(ReqGenUserTextField pReqGenUserText, int32_t nRequestID) const;
    int32_t ReqUserLoginWithCaptcha(ReqUserLoginWithCaptchaField pReqUserLoginWithCaptcha, int32_t nRequestID) const;
    int32_t ReqUserLoginWithText(ReqUserLoginWithTextField pReqUserLoginWithText, int32_t nRequestID) const;
    int32_t ReqUserLoginWithOTP(ReqUserLoginWithOTPField pReqUserLoginWithOTP, int32_t nRequestID) const;
    int32_t ReqOrderInsert(InputOrderField pInputOrder, int32_t nRequestID) const;
    int32_t ReqParkedOrderInsert(ParkedOrderField pParkedOrder, int32_t nRequestID) const;
    int32_t ReqParkedOrderAction(ParkedOrderActionField pParkedOrderAction, int32_t nRequestID) const;
    int32_t ReqOrderAction(InputOrderActionField pInputOrderAction, int32_t nRequestID) const;
    int32_t ReqQryMaxOrderVolume(QryMaxOrderVolumeField pQryMaxOrderVolume, int32_t nRequestID) const;
    int32_t ReqSettlementInfoConfirm(SettlementInfoConfirmField pSettlementInfoConfirm, int32_t nRequestID) const;
    int32_t ReqRemoveParkedOrder(RemoveParkedOrderField pRemoveParkedOrder, int32_t nRequestID) const;
    int32_t ReqRemoveParkedOrderAction(RemoveParkedOrderActionField pRemoveParkedOrderAction, int32_t nRequestID) const;
    int32_t ReqExecOrderInsert(InputExecOrderField pInputExecOrder, int32_t nRequestID) const;
    int32_t ReqExecOrderAction(InputExecOrderActionField pInputExecOrderAction, int32_t nRequestID) const;
    int32_t ReqForQuoteInsert(InputForQuoteField pInputForQuote, int32_t nRequestID) const;
    int32_t ReqQuoteInsert(InputQuoteField pInputQuote, int32_t nRequestID) const;
    int32_t ReqQuoteAction(InputQuoteActionField pInputQuoteAction, int32_t nRequestID) const;
    int32_t ReqBatchOrderAction(InputBatchOrderActionField pInputBatchOrderAction, int32_t nRequestID) const;
    int32_t ReqOptionSelfCloseInsert(InputOptionSelfCloseField pInputOptionSelfClose, int32_t nRequestID) const;
    int32_t ReqOptionSelfCloseAction(InputOptionSelfCloseActionField pInputOptionSelfCloseAction, int32_t nRequestID) const;
    int32_t ReqCombActionInsert(InputCombActionField pInputCombAction, int32_t nRequestID) const;
    int32_t ReqQryOrder(QryOrderField pQryOrder, int32_t nRequestID) const;
    int32_t ReqQryTrade(QryTradeField pQryTrade, int32_t nRequestID) const;
    int32_t ReqQryInvestorPosition(QryInvestorPositionField pQryInvestorPosition, int32_t nRequestID) const;
    int32_t ReqQryTradingAccount(QryTradingAccountField pQryTradingAccount, int32_t nRequestID) const;
    int32_t ReqQryInvestor(QryInvestorField pQryInvestor, int32_t nRequestID) const;
    int32_t ReqQryTradingCode(QryTradingCodeField pQryTradingCode, int32_t nRequestID) const;
    int32_t ReqQryInstrumentMarginRate(QryInstrumentMarginRateField pQryInstrumentMarginRate, int32_t nRequestID) const;
    int32_t ReqQryInstrumentCommissionRate(QryInstrumentCommissionRateField pQryInstrumentCommissionRate, int32_t nRequestID) const;
    int32_t ReqQryUserSession(QryUserSessionField pQryUserSession, int32_t nRequestID) const;
    int32_t ReqQryExchange(QryExchangeField pQryExchange, int32_t nRequestID) const;
    int32_t ReqQryProduct(QryProductField pQryProduct, int32_t nRequestID) const;
    int32_t ReqQryInstrument(QryInstrumentField pQryInstrument, int32_t nRequestID) const;
    int32_t ReqQryDepthMarketData(QryDepthMarketDataField pQryDepthMarketData, int32_t nRequestID) const;
    int32_t ReqQryTraderOffer(QryTraderOfferField pQryTraderOffer, int32_t nRequestID) const;
    int32_t ReqQrySettlementInfo(QrySettlementInfoField pQrySettlementInfo, int32_t nRequestID) const;
    int32_t ReqQryTransferBank(QryTransferBankField pQryTransferBank, int32_t nRequestID) const;
    int32_t ReqQryInvestorPositionDetail(QryInvestorPositionDetailField pQryInvestorPositionDetail, int32_t nRequestID) const;
    int32_t ReqQryNotice(QryNoticeField pQryNotice, int32_t nRequestID) const;
    int32_t ReqQrySettlementInfoConfirm(QrySettlementInfoConfirmField pQrySettlementInfoConfirm, int32_t nRequestID) const;
    int32_t ReqQryInvestorPositionCombineDetail(QryInvestorPositionCombineDetailField pQryInvestorPositionCombineDetail, int32_t nRequestID) const;
    int32_t ReqQryCFMMCTradingAccountKey(QryCFMMCTradingAccountKeyField pQryCFMMCTradingAccountKey, int32_t nRequestID) const;
    int32_t ReqQryEWarrantOffset(QryEWarrantOffsetField pQryEWarrantOffset, int32_t nRequestID) const;
    int32_t ReqQryInvestorProductGroupMargin(QryInvestorProductGroupMarginField pQryInvestorProductGroupMargin, int32_t nRequestID) const;
    int32_t ReqQryExchangeMarginRate(QryExchangeMarginRateField pQryExchangeMarginRate, int32_t nRequestID) const;
    int32_t ReqQryExchangeMarginRateAdjust(QryExchangeMarginRateAdjustField pQryExchangeMarginRateAdjust, int32_t nRequestID) const;
    int32_t ReqQryExchangeRate(QryExchangeRateField pQryExchangeRate, int32_t nRequestID) const;
    int32_t ReqQrySecAgentACIDMap(QrySecAgentACIDMapField pQrySecAgentACIDMap, int32_t nRequestID) const;
    int32_t ReqQryProductExchRate(QryProductExchRateField pQryProductExchRate, int32_t nRequestID) const;
    int32_t ReqQryProductGroup(QryProductGroupField pQryProductGroup, int32_t nRequestID) const;
    int32_t ReqQryMMInstrumentCommissionRate(QryMMInstrumentCommissionRateField pQryMMInstrumentCommissionRate, int32_t nRequestID) const;
    int32_t ReqQryMMOptionInstrCommRate(QryMMOptionInstrCommRateField pQryMMOptionInstrCommRate, int32_t nRequestID) const;
    int32_t ReqQryInstrumentOrderCommRate(QryInstrumentOrderCommRateField pQryInstrumentOrderCommRate, int32_t nRequestID) const;
    int32_t ReqQrySecAgentTradingAccount(QryTradingAccountField pQryTradingAccount, int32_t nRequestID) const;
    int32_t ReqQrySecAgentCheckMode(QrySecAgentCheckModeField pQrySecAgentCheckMode, int32_t nRequestID) const;
    int32_t ReqQrySecAgentTradeInfo(QrySecAgentTradeInfoField pQrySecAgentTradeInfo, int32_t nRequestID) const;
    int32_t ReqQryOptionInstrTradeCost(QryOptionInstrTradeCostField pQryOptionInstrTradeCost, int32_t nRequestID) const;
    int32_t ReqQryOptionInstrCommRate(QryOptionInstrCommRateField pQryOptionInstrCommRate, int32_t nRequestID) const;
    int32_t ReqQryExecOrder(QryExecOrderField pQryExecOrder, int32_t nRequestID) const;
    int32_t ReqQryForQuote(QryForQuoteField pQryForQuote, int32_t nRequestID) const;
    int32_t ReqQryQuote(QryQuoteField pQryQuote, int32_t nRequestID) const;
    int32_t ReqQryOptionSelfClose(QryOptionSelfCloseField pQryOptionSelfClose, int32_t nRequestID) const;
    int32_t ReqQryInvestUnit(QryInvestUnitField pQryInvestUnit, int32_t nRequestID) const;
    int32_t ReqQryCombInstrumentGuard(QryCombInstrumentGuardField pQryCombInstrumentGuard, int32_t nRequestID) const;
    int32_t ReqQryCombAction(QryCombActionField pQryCombAction, int32_t nRequestID) const;
    int32_t ReqQryTransferSerial(QryTransferSerialField pQryTransferSerial, int32_t nRequestID) const;
    int32_t ReqQryAccountregister(QryAccountregisterField pQryAccountregister, int32_t nRequestID) const;
    int32_t ReqQryContractBank(QryContractBankField pQryContractBank, int32_t nRequestID) const;
    int32_t ReqQryParkedOrder(QryParkedOrderField pQryParkedOrder, int32_t nRequestID) const;
    int32_t ReqQryParkedOrderAction(QryParkedOrderActionField pQryParkedOrderAction, int32_t nRequestID) const;
    int32_t ReqQryTradingNotice(QryTradingNoticeField pQryTradingNotice, int32_t nRequestID) const;
    int32_t ReqQryBrokerTradingParams(QryBrokerTradingParamsField pQryBrokerTradingParams, int32_t nRequestID) const;
    int32_t ReqQryBrokerTradingAlgos(QryBrokerTradingAlgosField pQryBrokerTradingAlgos, int32_t nRequestID) const;
    int32_t ReqQueryCFMMCTradingAccountToken(QueryCFMMCTradingAccountTokenField pQueryCFMMCTradingAccountToken, int32_t nRequestID) const;
    int32_t ReqFromBankToFutureByFuture(ReqTransferField pReqTransfer, int32_t nRequestID) const;
    int32_t ReqFromFutureToBankByFuture(ReqTransferField pReqTransfer, int32_t nRequestID) const;
    int32_t ReqQueryBankAccountMoneyByFuture(ReqQueryAccountField pReqQueryAccount, int32_t nRequestID) const;
    int32_t ReqQryClassifiedInstrument(QryClassifiedInstrumentField pQryClassifiedInstrument, int32_t nRequestID) const;
    int32_t ReqQryCombPromotionParam(QryCombPromotionParamField pQryCombPromotionParam, int32_t nRequestID) const;
    int32_t ReqQryRiskSettleInvstPosition(QryRiskSettleInvstPositionField pQryRiskSettleInvstPosition, int32_t nRequestID) const;
    int32_t ReqQryRiskSettleProductStatus(QryRiskSettleProductStatusField pQryRiskSettleProductStatus, int32_t nRequestID) const;
    int32_t ReqQrySPBMFutureParameter(QrySPBMFutureParameterField pQrySPBMFutureParameter, int32_t nRequestID) const;
    int32_t ReqQrySPBMOptionParameter(QrySPBMOptionParameterField pQrySPBMOptionParameter, int32_t nRequestID) const;
    int32_t ReqQrySPBMIntraParameter(QrySPBMIntraParameterField pQrySPBMIntraParameter, int32_t nRequestID) const;
    int32_t ReqQrySPBMInterParameter(QrySPBMInterParameterField pQrySPBMInterParameter, int32_t nRequestID) const;
    int32_t ReqQrySPBMPortfDefinition(QrySPBMPortfDefinitionField pQrySPBMPortfDefinition, int32_t nRequestID) const;
    int32_t ReqQrySPBMInvestorPortfDef(QrySPBMInvestorPortfDefField pQrySPBMInvestorPortfDef, int32_t nRequestID) const;
    int32_t ReqQryInvestorPortfMarginRatio(QryInvestorPortfMarginRatioField pQryInvestorPortfMarginRatio, int32_t nRequestID) const;
    int32_t ReqQryInvestorProdSPBMDetail(QryInvestorProdSPBMDetailField pQryInvestorProdSPBMDetail, int32_t nRequestID) const;
    int32_t ReqQryInvestorCommoditySPMMMargin(QryInvestorCommoditySPMMMarginField pQryInvestorCommoditySPMMMargin, int32_t nRequestID) const;
    int32_t ReqQryInvestorCommodityGroupSPMMMargin(QryInvestorCommodityGroupSPMMMarginField pQryInvestorCommodityGroupSPMMMargin, int32_t nRequestID) const;
    int32_t ReqQrySPMMInstParam(QrySPMMInstParamField pQrySPMMInstParam, int32_t nRequestID) const;
    int32_t ReqQrySPMMProductParam(QrySPMMProductParamField pQrySPMMProductParam, int32_t nRequestID) const;
    int32_t ReqQrySPBMAddOnInterParameter(QrySPBMAddOnInterParameterField pQrySPBMAddOnInterParameter, int32_t nRequestID) const;
    int32_t ReqQryRCAMSCombProductInfo(QryRCAMSCombProductInfoField pQryRCAMSCombProductInfo, int32_t nRequestID) const;
    int32_t ReqQryRCAMSInstrParameter(QryRCAMSInstrParameterField pQryRCAMSInstrParameter, int32_t nRequestID) const;
    int32_t ReqQryRCAMSIntraParameter(QryRCAMSIntraParameterField pQryRCAMSIntraParameter, int32_t nRequestID) const;
    int32_t ReqQryRCAMSInterParameter(QryRCAMSInterParameterField pQryRCAMSInterParameter, int32_t nRequestID) const;
    int32_t ReqQryRCAMSShortOptAdjustParam(QryRCAMSShortOptAdjustParamField pQryRCAMSShortOptAdjustParam, int32_t nRequestID) const;
    int32_t ReqQryRCAMSInvestorCombPosition(QryRCAMSInvestorCombPositionField pQryRCAMSInvestorCombPosition, int32_t nRequestID) const;
    int32_t ReqQryInvestorProdRCAMSMargin(QryInvestorProdRCAMSMarginField pQryInvestorProdRCAMSMargin, int32_t nRequestID) const;
    int32_t ReqQryRULEInstrParameter(QryRULEInstrParameterField pQryRULEInstrParameter, int32_t nRequestID) const;
    int32_t ReqQryRULEIntraParameter(QryRULEIntraParameterField pQryRULEIntraParameter, int32_t nRequestID) const;
    int32_t ReqQryRULEInterParameter(QryRULEInterParameterField pQryRULEInterParameter, int32_t nRequestID) const;
    int32_t ReqQryInvestorProdRULEMargin(QryInvestorProdRULEMarginField pQryInvestorProdRULEMargin, int32_t nRequestID) const;
    int32_t ReqQryInvestorPortfSetting(QryInvestorPortfSettingField pQryInvestorPortfSetting, int32_t nRequestID) const;
    int32_t ReqQryInvestorInfoCommRec(QryInvestorInfoCommRecField pQryInvestorInfoCommRec, int32_t nRequestID) const;
    int32_t ReqQryCombLeg(QryCombLegField pQryCombLeg, int32_t nRequestID) const;
    int32_t ReqOffsetSetting(InputOffsetSettingField pInputOffsetSetting, int32_t nRequestID) const;
    int32_t ReqCancelOffsetSetting(InputOffsetSettingField pInputOffsetSetting, int32_t nRequestID) const;
    int32_t ReqQryOffsetSetting(QryOffsetSettingField pQryOffsetSetting, int32_t nRequestID) const;

    CtpRsTraderApiBase *api;
    CTraderSpi *spi;
};

std::unique_ptr<TraderApi> CreateTraderApi(rust::Box<TraderSpi> gateway, rust::String flow_path, bool is_production_mode);