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
#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 MdApi;
struct MdSpi;
class CMdSpi;

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

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

struct MdApi {
    MdApi(rust::Box<MdSpi> gateway, rust::String flow_path, bool is_using_udp, bool is_multicast, bool is_production_mode);
    ~MdApi();

    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;
    int32_t SubscribeMarketData(rust::Vec<rust::String> ppInstrumentID) const;
    int32_t UnSubscribeMarketData(rust::Vec<rust::String> ppInstrumentID) const;
    int32_t SubscribeForQuoteRsp(rust::Vec<rust::String> ppInstrumentID) const;
    int32_t UnSubscribeForQuoteRsp(rust::Vec<rust::String> ppInstrumentID) const;
    int32_t ReqUserLogin(ReqUserLoginField pReqUserLoginField, int32_t nRequestID) const;
    int32_t ReqUserLogout(UserLogoutField pUserLogout, int32_t nRequestID) const;
    int32_t ReqQryMulticastInstrument(QryMulticastInstrumentField pQryMulticastInstrument, int32_t nRequestID) const;

    CThostFtdcMdApi *api;
    CMdSpi *spi;
};

std::unique_ptr<MdApi> CreateMdApi(rust::Box<MdSpi> gateway, rust::String flow_path, bool is_using_udp, bool is_multicast, bool is_production_mode);