[Mod] use generator script to genrate data_type and struct

This commit is contained in:
vn.py 2019-08-26 23:02:41 +08:00
parent 2b10d4d554
commit 374bb478df
8 changed files with 1500 additions and 12 deletions

View File

@ -0,0 +1,15 @@
DA_STR_SIZE = 256
MAX_BROKER = 4096
DAAPI_VERSION = "1.12"
OS_NAME = "Windows"
OS_NAME = "Linux"
MAX_SUB_COUNT = 20
DAF_TYPE_Stock = 'S'
DAF_TYPE_Future = 'D'
DAF_TYPE_Unknown = 0
DAF_SUB_Append = '1'
DAF_SUB_Replace = '2'
DAF_SUB_Unsubcribe = '3'
DAF_SUB_UnsubcribeAll = '4'
DAF_Market_Full = 'Z'
DAF_Market_Fill = 'Y'

View File

@ -0,0 +1,725 @@
CFutureRspInfoField = {
"ErrorID": "int",
"ErrorMsg": "string",
}
CFutureReqUserLoginField = {
"UserId": "string",
"UserPwd": "string",
"UserType": "string",
"MacAddress": "string",
"ComputerName": "string",
"SoftwareName": "string",
"SoftwareVersion": "string",
"AuthorCode": "string",
"ErrorDescription": "string",
}
CFutureRspAccountField = {
"UserId": "string",
"UserName": "string",
"UserType": "string",
"LoginPwd": "string",
"AccountNo": "string",
"TradePwd": "string",
"IsSimulation": "string",
"FrontendIp": "string",
"FrontendPort": "string",
"CurrencyNo": "string",
"UserState": "string",
"SelAll": "string",
"Strategy": "string",
"Inner": "string",
"YingSun": "string",
"ChaoDan": "string",
"Option": "string",
"CmeMarket": "string",
"CmeCOMEXMarket": "string",
"CmeNYMEXMarket": "string",
"CmeCBTMarket": "string",
"IceUSMarket": "string",
"IceECMarket": "string",
"IceEFMarket": "string",
"CanTradeStockHK": "string",
"CanTradeStockAM": "string",
"MultiLogin": "string",
"SellStockHK": "string",
"SellStockAM": "string",
"CanTradeStockKRX": "string",
"HkexMarket": "string",
"IdNumber": "string",
"HkexMarketFee": "string",
"IsProfessional": "string",
"IsOverSea": "string",
"IsFirstLogin": "string",
"UserMobile": "string",
"HasSetQA": "string",
"CanTradeStockSGXQ": "string",
"ExistMac": "string",
"RatioINE": "string",
"EurexMarket": "string",
"HkexIsOverMaxTerminal": "string",
"HkexOverMoney": "string",
"CanTradeStockAU": "string",
"NyFlag": "string",
}
CFutureReqUserLogoutField = {
"UserId": "string",
"AccountNo": "string",
"ErrorDescription": "string",
}
CFutureReqOrderInsertField = {
"UserId": "string",
"UserType": "string",
"AccountNo": "string",
"LocalNo": "string",
"TradePwd": "string",
"IsRiskOrder": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"AddReduce": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"ForceID": "string",
"TriggerPrice": "string",
"ValidDate": "string",
"StrategyId": "string",
"MaxShow": "string",
"MinQty": "string",
"ErrorDescription": "string",
}
CFutureRspOrderInsertField = {
"UserId": "string",
"AccountNo": "string",
"SystemNo": "string",
"LocalNo": "string",
"OrderNo": "string",
"OrigOrderNo": "string",
"OrderMethod": "string",
"AcceptType": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"FilledPrice": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"OrderDate": "string",
"OrderTime": "string",
"ErrorCode": "string",
"OrderState": "string",
"IsRiskOrder": "string",
"CancelUserId": "string",
"TriggerPrice": "string",
"ValidDate": "string",
"AddReduce": "string",
"StrategyId": "string",
"MaxShow": "string",
"MinQty": "string",
"ExchangeTime": "string",
"CancelTime": "string",
}
CFutureReqOrderModifyField = {
"SystemNo": "string",
"UserId": "string",
"UserType": "string",
"LocalNo": "string",
"AccountNo": "string",
"TradePwd": "string",
"OrderNo": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"ModifyNumber": "string",
"ModifyPrice": "string",
"TradeType": "string",
"PriceType": "string",
"IsRiskOrder": "string",
"TriggerPrice": "string",
"ModifyTriggerPrice": "string",
"ValidDate": "string",
"ErrorDescription": "string",
}
CFutureReqOrderCancelField = {
"UserId": "string",
"UserType": "string",
"LocalNo": "string",
"AccountNo": "string",
"TradePwd": "string",
"IsSimulation": "string",
"SystemNo": "string",
"OrderNo": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"IsRiskOrder": "string",
"ErrorDescription": "string",
}
CFutureRspOrderCancelField = {
"UserId": "string",
"AccountNo": "string",
"SystemNo": "string",
"LocalNo": "string",
"OrderNo": "string",
"CancelNo": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"CancelNumber": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"CancelDate": "string",
"CancelTime": "string",
"ErrorCode": "string",
"IsRiskOrder": "string",
}
CFutureReqPasswordUpdateField = {
"UserId": "string",
"OldPassword": "string",
"NewPassword": "string",
"ErrorDescription": "string",
}
CFutureRspPasswordUpdateField = {
"UserId": "string",
"OldPassword": "string",
"NewPassword": "string",
}
CFutureQryOrderField = {
"UserId": "string",
"UserType": "string",
"AccountNo": "string",
"TradePwd": "string",
"IsSimulation": "string",
"OrderNo": "string",
"OrderDateTime": "string",
"ErrorDescription": "string",
}
CFutureRspOrderField = {
"UserId": "string",
"AccountNo": "string",
"SystemNo": "string",
"LocalNo": "string",
"OrderNo": "string",
"OrigOrderNo": "string",
"OrderMethod": "string",
"AcceptType": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"FilledPrice": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"OrderDate": "string",
"OrderTime": "string",
"ErrorCode": "string",
"OrderState": "string",
"IsRiskOrder": "string",
"CancelUserId": "string",
"TriggerPrice": "string",
"ValidDate": "string",
"AddReduce": "string",
"StrategyId": "string",
"MaxShow": "string",
"MinQty": "string",
"ExchangeTime": "string",
"CancelTime": "string",
}
CFutureQryTradeField = {
"UserId": "string",
"ErrorDescription": "string",
}
CFutureRspTradeField = {
"UserId": "string",
"AccountNo": "string",
"FilledNo": "string",
"OrderNo": "string",
"SystemNo": "string",
"LocalNo": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"FilledNumber": "string",
"FilledPrice": "string",
"FilledDate": "string",
"FilledTime": "string",
"Commsion": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"DeliveryDate": "string",
"FilledType": "string",
"OrderType": "string",
"ValidDate": "string",
"AddReduce": "string",
"ErrorDescription": "string",
}
CFutureQryInstrumentField = {
"PageIndex": "int",
"ExchangeNo": "string",
"CommodityNo": "string",
"CommodityType": "string",
"ContractNo": "string",
"ErrorDescription": "string",
}
CFutureRspInstrumentField = {
"CommodityCode": "string",
"ExchangeNo": "string",
"ContractNo": "string",
"ContractFName": "string",
"CommodityNo": "string",
"CommodityFName": "string",
"CommodityType": "string",
"CommodityFCurrencyNo": "string",
"CurrencyFName": "string",
"ProductDot": "double",
"UpperTick": "double",
"ExchangeName": "string",
"LastSettlePrice": "double",
"TradeMonth": "string",
"DotNum": "int",
"LowerTick": "int",
"DotNumCarry": "int",
"UpperTickCarry": "double",
"FirstNoticeDay": "string",
"FreezenPercent": "double",
"FreezenMoney": "double",
"FeeMoney": "double",
"FeePercent": "double",
"PriceStrike": "double",
"ProductDotStrike": "double",
"UpperTickStrike": "double",
"LastTradeDay": "string",
"LastUpdateDay": "string",
"CriticalPrice": "double",
"CriticalMinChangedPrice": "double",
"ExchangeSub": "string",
"OptionType": "string",
"OptionMonth": "string",
"OptionStrikePrice": "string",
"OptionCommodityNo": "string",
"OptionContractNo": "string",
"ContractFNameEN": "string",
"CommodityFNameEN": "string",
"OptionStyle": "string",
}
CFutureQryExchangeField = {
"ProductGroupID": "string",
"ErrorDescription": "string",
}
CFutureRspExchangeField = {
"ExchangeNo": "string",
"ExchangeName": "string",
"SettleType": "string",
"NameEN": "string",
}
CFutureQryCapitalField = {
"Unused": "char",
"ErrorDescription": "string",
}
CFutureRspCapitalField = {
"UserId": "string",
"InMoney": "string",
"OutMoney": "string",
"TodayCanUse": "string",
"TodayAmount": "string",
"TodayBalance": "string",
"FreezenMoney": "string",
"Commission": "string",
"Margin": "string",
"OldCanUse": "string",
"OldAmount": "string",
"OldBalance": "string",
"FloatingProfit": "string",
"CurrencyNo": "string",
"CurrencyRate": "double",
"UnexpiredProfit": "double",
"UnaccountProfit": "double",
"KeepDeposit": "double",
"Royalty": "double",
"Credit": "double",
"AddCapital": "double",
"IniEquity": "double",
"AccountNo": "string",
"MortgageMoney": "double",
"MarginLimit": "double",
"BorrowValue": "double",
"T1": "double",
"T2": "double",
"T3": "double",
"TN": "double",
"TradeLimit": "double",
"CanCashOut": "double",
"AccruedCrInt": "double",
"AccruedDrInt": "double",
"CrossMax": "double",
"SellFreezenMoney": "double",
"SellInterest": "double",
"SellNeedAddMargin": "double",
"NetProfit": "string",
"ProfitRate": "string",
"RiskRate": "string",
"ErrorDescription": "string",
}
CFutureQryPositionField = {
"ErrorDescription": "string",
}
CFutureRspPositionField = {
"MatchDate": "string",
"MatchNo": "string",
"ClientNo": "string",
"ExchangeNo": "string",
"CommodityNo": "string",
"ContractNo": "string",
"Direct": "string",
"HoldVol": "int",
"HoldPrice": "double",
"CurrencyNo": "string",
"ForciblyPrice": "double",
"Account": "string",
"HoldType": "string",
"DeliveryDate": "string",
"ExchangeName": "string",
"CurrencyName": "string",
"ContCode": "string",
"HoldMargin": "double",
}
CFutureQryTickField = {
"Unused": "char",
"ErrorDescription": "string",
}
CFutureRspTickField = {
"UpperTickCode": "string",
"PriceFrom": "string",
"UpperTick": "string",
"ProductDot": "string",
"DotNum": "string",
"LowerTick": "string",
}
CFutureQryCurrencyField = {
"Unused": "char",
"ErrorDescription": "string",
}
CFutureRspCurrencyField = {
"CurrencyNo": "string",
"IsBase": "int",
"ChangeRate": "double",
"CurrencyName": "string",
"CurrencyNameEN": "string",
}
CFutureQryCommodityField = {
"UpdateDate": "string",
"ExchangeNo": "string",
"ErrorDescription": "string",
}
CFutureRspCommodityField = {
"CommodityNo": "string",
"ExchangeNo": "string",
"CommodityType": "string",
"Name": "string",
"Enabled": "string",
"RegDate": "string",
"CurrencyNo": "string",
"ProductDot": "double",
"LowerTick": "double",
"UpperTick": "double",
"DotNum": "int",
"StrikeCommodityId": "int",
"OptionStyle": "string",
"ExchangeNo2": "string",
"IsSFuture": "string",
}
CFutureQryExchangeTimeField = {
"Unused": "char",
"ErrorDescription": "string",
}
CFutureQryCommodityTimeField = {
"ExchangeNo": "string",
"CommodityNo": "string",
"ErrorDescription": "string",
}
CFutureRspExchangeTimeField = {
"Year": "string",
"SummerBegin": "string",
"WinterBegin": "string",
"ExchangeNo": "string",
"Name": "string",
}
CFutureRspCommodityTimeField = {
"CrossTrade": "string",
"Stage": "string",
"Summer": "string",
"Opendate": "string",
"Closingdate": "string",
"CommodityNo": "string",
"ComName": "string",
"ExchangeNo": "string",
"ExName": "string",
}
CFutureQryVersionField = {
"UserId": "string",
"UserPwd": "string",
"ErrorDescription": "string",
}
CFutureRspVersionField = {
"Version": "string",
"MustUpdate": "string",
"MustVersion": "string",
"VersionContent_CN": "string",
"VersionContent_US": "string",
}
CFutureRtnOrderField = {
"LocalOrderNo": "string",
"ExchangeNo": "string",
"TreatyCode": "string",
"OrderNo": "string",
"OrderNumber": "int",
"FilledNumber": "int",
"FilledAdvPrice": "double",
"BuyHoldNumber": "int",
"BuyHoldOpenPrice": "double",
"BuyHoldPrice": "double",
"SaleHoldNumber": "int",
"SaleHoldOpenPrice": "double",
"SaleHoldPrice": "double",
"IsCanceled": "string",
"FilledTotalFee": "double",
"Status": "int",
"AccountNo": "string",
"HoldType": "string",
"HoldMarginBuy": "double",
"HoldMarginSale": "double",
"CurrPrice": "double",
"FloatProfit": "double",
}
CFutureRtnCapitalField = {
"ClientNo": "string",
"AccountNo": "string",
"CurrencyNo": "string",
"Available": "double",
"YAvailable": "double",
"CanCashOut": "double",
"Money": "double",
"ExpiredProfit": "double",
"FrozenDeposit": "double",
"Fee": "double",
"Deposit": "double",
"KeepDeposit": "double",
"Status": "int",
"InMoney": "double",
"OutMoney": "double",
"UnexpiredProfit": "double",
"TodayTotal": "double",
"UnaccountProfit": "double",
"Royalty": "double",
"ExchangeNo": "string",
"TreatyCode": "string",
"OrderNo": "string",
"OrderNumber": "int",
"FilledNumber": "int",
"FilledAdvPrice": "double",
"BuyHoldNumber": "int",
"BuyHoldOpenPrice": "double",
"BuyHoldPrice": "double",
"SaleHoldNumber": "int",
"SaleHoldOpenPrice": "double",
"SaleHoldPrice": "double",
"IsCanceled": "string",
"FilledTotalFee": "double",
"Credit": "double",
"MarginLimit": "double",
"BorrowValue": "double",
"MortgageMoney": "double",
"T1": "double",
"T2": "double",
"T3": "double",
"TN": "double",
"TradeLimit": "double",
"FCrossMax": "double",
"SellFreezenMoney": "double",
"SellInterest": "double",
"SellNeedAddMargin": "double",
}
CFutureReqGetQuestionField = {
"Unused": "int",
"ErrorDescription": "string",
}
CFutureRspQuestionField = {
"QuestionType": "string",
"QuestionId": "string",
"QuestionCN": "string",
"QuestionEN": "string",
}
CFutureReqSafeVerifyField = {
"UserId": "string",
"UserPwd": "string",
"Type": "string",
"Question": "string",
"Answer": "string",
"MobileNumber": "string",
"VerifyCode": "string",
"SaveMac": "string",
"MacAddress": "string",
"ErrorDescription": "string",
}
CFutureReqSetVerifyQAField = {
"UserId": "string",
"UserPwd": "string",
"Type": "string",
"Question": "string",
"Answer": "string",
"MobileNumber": "string",
"VerifyCode": "string",
"SaveMac": "string",
"ErrorDescription": "string",
}
CFutureReqVerifyCodeField = {
"UserId": "string",
"UserPwd": "string",
"Type": "string",
"Question": "string",
"Answer": "string",
"MobileNumber": "string",
"VerifyCode": "string",
"ErrorDescription": "string",
}
CFutureQryTotalPositionField = {
"AccountNo": "string",
"ErrorDescription": "string",
}
CFutureQryStrategyField = {
"ExchangeNo": "string",
"ErrorDescription": "string",
}
CFutureRspStrategyField = {
"UserId": "string",
"KeyId": "string",
"Name": "string",
"Code": "string",
"PriceType": "int",
"PriceTypeDetailType": "int",
"PriceFormula": "string",
"TriggerMethod": "int",
"InnerProtect": "int",
"PassiveFailCloseMainLeg": "int",
"SlipPoint": "int",
"RecoverPriceMethod": "int",
"RecoverPriceSeconds": "int",
"SetType": "string",
"MinChangePrice": "double",
"MaxNum": "int",
"SuportQuantity": "int",
"SafeDeep": "int",
"MainRange": "int",
"ManualZhuiDanBeyondNum": "string",
"ManualPingZhuDongBeyondNum": "string",
"AutoGuaDanSeconds": "int",
"AutoZhuiBeiDongDots": "int",
"AutoPingZhuDongDots": "int",
"AutoZhiSunDot": "int",
"AutoZhiSunZhuiBeiDongDots": "int",
"AutoZhiSunPingZhuDongDots": "int",
"DotLen": "int",
"TradeTime": "string",
}
CFutureQryStrategyDetailField = {
"StartegyCommodityNo": "string",
"ErrorDescription": "string",
}
CFutureRspStrategyDetailField = {
"StartegyCommodityNo": "string",
"StartegyContractNo": "string",
"Price": "string",
"LegNum": "int",
"LastTradeDate": "string",
"SeqId": "int",
"CommodityNo": "string",
"ContractNo": "string",
"Direct": "string",
"Quantity": "int",
"Model": "string",
"ModifyDate": "string",
"OrderMethod": "string",
"PriceTolerance": "double",
"PriceParam": "double",
"SuportQuantity": "int",
"MinMove": "int",
"TimerOrder": "int",
"TimerOrderBeyondNum": "string",
"TimerOrderPrice": "int",
"TimerOrderPriceBeyondNum": "string",
"TimerOrderPriceTriggerNum": "string",
"ZhiSunOrder": "int",
"ZhiSunOrderBeyondNum": "string",
"TimerPingCang": "int",
"TimerPingCangBeyondNum": "string",
"SafeDeep": "int",
"MainRange": "int",
}

View File

@ -0,0 +1,120 @@
CMarketRspInfoField = {
"ErrorID": "int",
"ErrorMsg": "string",
}
CMarketReqUserLoginField = {
"UserId": "string",
"UserPwd": "string",
"UserType": "string",
"MacAddress": "string",
"ComputerName": "string",
"SoftwareName": "string",
"SoftwareVersion": "string",
"AuthorCode": "string",
"ErrorDescription": "string",
}
CMarketRspUserLoginField = {
"UserName": "string",
"UserPwd": "string",
"UserType": "string",
}
CMarketReqUserLogoutField = {
"BrokerID": "string",
"UserId": "string",
"ErrorDescription": "string",
}
CMarketReqMarketDataField = {
"MarketType": "char",
"SubscMode": "char",
"MarketCount": "int",
"MarketTrcode[MAX_SUB_COUNT]": "string",
"ErrorDescription": "string",
}
CMarketRspMarketDataField = {
"ExchangeCode": "string",
"TreatyCode": "string",
"BuyPrice": "string",
"BuyNumber": "string",
"SalePrice": "string",
"SaleNumber": "string",
"CurrPrice": "string",
"CurrNumber": "string",
"High": "string",
"Low": "string",
"Open": "string",
"IntradaySettlePrice": "string",
"Close": "string",
"Time": "string",
"FilledNum": "string",
"HoldNum": "string",
"BuyPrice2": "string",
"BuyPrice3": "string",
"BuyPrice4": "string",
"BuyPrice5": "string",
"BuyNumber2": "string",
"BuyNumber3": "string",
"BuyNumber4": "string",
"BuyNumber5": "string",
"SalePrice2": "string",
"SalePrice3": "string",
"SalePrice4": "string",
"SalePrice5": "string",
"SaleNumber2": "string",
"SaleNumber3": "string",
"SaleNumber4": "string",
"SaleNumber5": "string",
"HideBuyPrice": "string",
"HideBuyNumber": "string",
"HideSalePrice": "string",
"HideSaleNumber": "string",
"LimitDownPrice": "string",
"LimitUpPrice": "string",
"TradeDay": "string",
"BuyPrice6": "string",
"BuyPrice7": "string",
"BuyPrice8": "string",
"BuyPrice9": "string",
"BuyPrice10": "string",
"BuyNumber6": "string",
"BuyNumber7": "string",
"BuyNumber8": "string",
"BuyNumber9": "string",
"BuyNumber10": "string",
"SalePrice6": "string",
"SalePrice7": "string",
"SalePrice8": "string",
"SalePrice9": "string",
"SalePrice10": "string",
"SaleNumber6": "string",
"SaleNumber7": "string",
"SaleNumber8": "string",
"SaleNumber9": "string",
"SaleNumber10": "string",
"TradeFlag": "string",
"DataTimestamp": "string",
"DataSourceId": "string",
"CanSellVol": "string",
"QuoteType": "string",
"AggressorSide": "string",
"PreSettlementPrice": "string",
}
CMarketReqBrokerDataField = {
"ContCode": "string",
"ErrorDescription": "string",
}
CMarketRspBrokerDataField = {
"BrokerData": "string",
}
CMarketRspTradeDateField = {
"TradeDate": "string",
"TradeProduct": "string",
}

View File

@ -0,0 +1,604 @@
CStockRspInfoField = {
"ErrorID": "int",
"ErrorMsg": "string",
}
CStockReqUserLoginField = {
"UserId": "string",
"UserPwd": "string",
"UserType": "string",
"MacAddress": "string",
"ComputerName": "string",
"SoftwareName": "string",
"SoftwareVersion": "string",
"AuthorCode": "string",
"ErrorDescription": "string",
}
CStockRspAccountField = {
"UserId": "string",
"UserName": "string",
"UserType": "string",
"LoginPwd": "string",
"AccountNo": "string",
"TradePwd": "string",
"IsSimulation": "string",
"FrontendIp": "string",
"FrontendPort": "string",
"CurrencyNo": "string",
"UserState": "string",
"SelAll": "string",
"Strategy": "string",
"Inner": "string",
"YingSun": "string",
"ChaoDan": "string",
"Option": "string",
"CmeMarket": "string",
"CmeCOMEXMarket": "string",
"CmeNYMEXMarket": "string",
"CmeCBTMarket": "string",
"IceUSMarket": "string",
"IceECMarket": "string",
"IceEFMarket": "string",
"CanTradeStockHK": "string",
"CanTradeStockAM": "string",
"MultiLogin": "string",
"SellStockHK": "string",
"SellStockAM": "string",
"CanTradeStockKRX": "string",
"HkexMarket": "string",
"IdNumber": "string",
"HkexMarketFee": "string",
"IsProfessional": "string",
"IsOverSea": "string",
"IsFirstLogin": "string",
"UserMobile": "string",
"HasSetQA": "string",
"CanTradeStockSGXQ": "string",
"ExistMac": "string",
"RatioINE": "string",
"EurexMarket": "string",
"HkexIsOverMaxTerminal": "string",
"HkexOverMoney": "string",
"CanTradeStockAU": "string",
"NyFlag": "string",
}
CStockReqUserLogoutField = {
"UserId": "string",
"AccountNo": "string",
"ErrorDescription": "string",
}
CStockReqOrderInsertField = {
"UserId": "string",
"UserType": "string",
"AccountNo": "string",
"LocalNo": "string",
"TradePwd": "string",
"IsRiskOrder": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"AddReduce": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"ForceID": "string",
"TriggerPrice": "string",
"ValidDate": "string",
"StrategyId": "string",
"MaxShow": "string",
"MinQty": "string",
"ErrorDescription": "string",
}
CStockRspOrderInsertField = {
"UserId": "string",
"AccountNo": "string",
"SystemNo": "string",
"LocalNo": "string",
"OrderNo": "string",
"OrigOrderNo": "string",
"OrderMethod": "string",
"AcceptType": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"FilledPrice": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"OrderDate": "string",
"OrderTime": "string",
"ErrorCode": "string",
"OrderState": "string",
"IsRiskOrder": "string",
"CancelUserId": "string",
"TriggerPrice": "string",
"ValidDate": "string",
"AddReduce": "string",
"StrategyId": "string",
"MaxShow": "string",
"MinQty": "string",
"ExchangeTime": "string",
"CancelTime": "string",
}
CStockReqOrderModifyField = {
"SystemNo": "string",
"UserId": "string",
"UserType": "string",
"LocalNo": "string",
"AccountNo": "string",
"TradePwd": "string",
"OrderNo": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"ModifyNumber": "string",
"ModifyPrice": "string",
"TradeType": "string",
"PriceType": "string",
"IsRiskOrder": "string",
"TriggerPrice": "string",
"ModifyTriggerPrice": "string",
"ValidDate": "string",
"ErrorDescription": "string",
}
CStockReqOrderCancelField = {
"UserId": "string",
"UserType": "string",
"LocalNo": "string",
"AccountNo": "string",
"TradePwd": "string",
"IsSimulation": "string",
"SystemNo": "string",
"OrderNo": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"IsRiskOrder": "string",
"ErrorDescription": "string",
}
CStockRspOrderCancelField = {
"UserId": "string",
"AccountNo": "string",
"SystemNo": "string",
"LocalNo": "string",
"OrderNo": "string",
"CancelNo": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"CancelNumber": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"CancelDate": "string",
"CancelTime": "string",
"ErrorCode": "string",
"IsRiskOrder": "string",
}
CStockReqPasswordUpdateField = {
"UserId": "string",
"OldPassword": "string",
"NewPassword": "string",
"ErrorDescription": "string",
}
CStockRspPasswordUpdateField = {
"UserId": "string",
"OldPassword": "string",
"NewPassword": "string",
}
CStockQryOrderField = {
"UserId": "string",
"UserType": "string",
"AccountNo": "string",
"TradePwd": "string",
"IsSimulation": "string",
"OrderNo": "string",
"OrderDateTime": "string",
"ErrorDescription": "string",
}
CStockRspOrderField = {
"UserId": "string",
"AccountNo": "string",
"SystemNo": "string",
"LocalNo": "string",
"OrderNo": "string",
"OrigOrderNo": "string",
"OrderMethod": "string",
"AcceptType": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"FilledNumber": "string",
"FilledPrice": "string",
"TradeType": "string",
"PriceType": "string",
"HtsType": "string",
"OrderDate": "string",
"OrderTime": "string",
"ErrorCode": "string",
"OrderState": "string",
"IsRiskOrder": "string",
"CancelUserId": "string",
"TriggerPrice": "string",
"ValidDate": "string",
"AddReduce": "string",
"StrategyId": "string",
"MaxShow": "string",
"MinQty": "string",
"ExchangeTime": "string",
"CancelTime": "string",
}
CStockQryTradeField = {
"UserId": "string",
"ErrorDescription": "string",
}
CStockRspTradeField = {
"UserId": "string",
"AccountNo": "string",
"FilledNo": "string",
"OrderNo": "string",
"SystemNo": "string",
"LocalNo": "string",
"ExchangeCode": "string",
"TreatyCode": "string",
"BuySale": "string",
"FilledNumber": "string",
"FilledPrice": "string",
"FilledDate": "string",
"FilledTime": "string",
"Commsion": "string",
"OrderNumber": "string",
"OrderPrice": "string",
"DeliveryDate": "string",
"FilledType": "string",
"OrderType": "string",
"ValidDate": "string",
"AddReduce": "string",
"ErrorDescription": "string",
}
CStockQryInstrumentField = {
"PageIndex": "int",
"ExchangeNo": "string",
"ErrorDescription": "string",
}
CStockRspInstrumentField = {
"ExchangeNo": "string",
"ExchangeName": "string",
"CommodityNo": "string",
"CommodityName": "string",
"CommodityType": "string",
"CurrencyNo": "string",
"CurrencyName": "string",
"ProductDot": "double",
"UpperTick": "double",
"SettlePrice": "double",
"TradeMonth": "string",
"DotNum": "int",
"LowerTick": "int",
"DotNumCarry": "int",
"UpperTickCarry": "double",
"FirstNoticeDay": "string",
"FreezenPercent": "double",
"FreezenMoney": "double",
"FeeMoney": "double",
"FeePercent": "double",
"PriceStrike": "double",
"ProductDotStrike": "double",
"UpperTickStrike": "double",
"LastTradeDay": "string",
"LastUpdateDay": "string",
"CriticalPrice": "double",
"CriticalMinChangedPrice": "double",
"ExchangeSub": "string",
"OptionType": "string",
"OptionMonth": "string",
"OptionStrikePrice": "string",
"OptionCommodityNo": "string",
"OptionContractNo": "string",
"MortgagePercent": "string",
"UpperTickCode": "string",
"LotSize": "string",
"FlatTime": "string",
"CommodityFNameEN": "string",
"CanSell": "string",
"SellRate": "double",
"SellMax": "double",
"StrikeRate": "double",
"StrikePrice": "double",
"ReceivePrice": "double",
"ExpireDate": "string",
"SellRateKeep": "double",
"StrikeCommodityNo": "string",
"CallPutFlag": "string",
"Publisher": "string",
}
CStockQryExchangeField = {
"ProductGroupID": "string",
"ErrorDescription": "string",
}
CStockRspExchangeField = {
"ExchangeNo": "string",
"ExchangeName": "string",
"SettleType": "string",
"NameEN": "string",
}
CStockQryCapitalField = {
"Unused": "char",
"ErrorDescription": "string",
}
CStockRspCapitalField = {
"UserId": "string",
"InMoney": "string",
"OutMoney": "string",
"TodayCanUse": "string",
"TodayAmount": "string",
"TodayBalance": "string",
"FreezenMoney": "string",
"Commission": "string",
"Margin": "string",
"OldCanUse": "string",
"OldAmount": "string",
"OldBalance": "string",
"FloatingProfit": "string",
"CurrencyNo": "string",
"CurrencyRate": "double",
"UnexpiredProfit": "double",
"UnaccountProfit": "double",
"KeepDeposit": "double",
"Royalty": "double",
"Credit": "double",
"AddCapital": "double",
"IniEquity": "double",
"AccountNo": "string",
"MortgageMoney": "double",
"MarginLimit": "double",
"BorrowValue": "double",
"T1": "double",
"T2": "double",
"T3": "double",
"TN": "double",
"TradeLimit": "double",
"CanCashOut": "double",
"AccruedCrInt": "double",
"AccruedDrInt": "double",
"CrossMax": "double",
"SellFreezenMoney": "double",
"SellInterest": "double",
"SellNeedAddMargin": "double",
"NetProfit": "string",
"ProfitRate": "string",
"RiskRate": "string",
"ErrorDescription": "string",
}
CStockQryPositionField = {
"ErrorDescription": "string",
}
CStockRspPositionField = {
"ClientNo": "string",
"ExchangeNo": "string",
"CommodityNo": "string",
"Direct": "string",
"HoldPrice": "double",
"CanTradeVol": "int",
"TodayBuyVol": "int",
"FrozenVol": "int",
"TotalBuyMoney": "double",
"TotalSellMoney": "double",
"TotalBuyVol": "int",
"TotalSellVol": "int",
"OpenDate": "string",
"FlatProfit": "double",
"HkexT1": "int",
"HkexT2": "int",
"HkexT3": "int",
"UnsettleVol": "int",
"SettledVol": "int",
"HoldVol": "int",
"TodaySaleVol": "int",
"SellFrozenMoney": "double",
"OpenPrice": "double",
}
CStockQryTickField = {
"Unused": "char",
"ErrorDescription": "string",
}
CStockRspTickField = {
"UpperTickCode": "string",
"PriceFrom": "string",
"UpperTick": "string",
"ProductDot": "string",
"DotNum": "string",
"LowerTick": "string",
}
CStockQryCurrencyField = {
"Unused": "char",
"ErrorDescription": "string",
}
CStockRspCurrencyField = {
"CurrencyNo": "string",
"IsBase": "int",
"ChangeRate": "double",
"CurrencyName": "string",
"CurrencyNameEN": "string",
}
CStockQryVersionField = {
"UserId": "string",
"UserPwd": "string",
"ErrorDescription": "string",
}
CStockRspVersionField = {
"Version": "string",
"MustUpdate": "string",
"MustVersion": "string",
"VersionContent_CN": "string",
"VersionContent_US": "string",
}
CStockRtnOrderField = {
"LocalOrderNo": "string",
"ExchangeNo": "string",
"TreatyCode": "string",
"OrderNo": "string",
"OrderNumber": "int",
"FilledNumber": "int",
"FilledAdvPrice": "double",
"BuyHoldNumber": "int",
"BuyHoldOpenPrice": "double",
"BuyHoldPrice": "double",
"SaleHoldNumber": "int",
"SaleHoldOpenPrice": "double",
"SaleHoldPrice": "double",
"IsCanceled": "string",
"FilledTotalFee": "double",
"Status": "int",
"AccountNo": "string",
"HoldType": "string",
"HoldMarginBuy": "double",
"HoldMarginSale": "double",
"CurrPrice": "double",
"FloatProfit": "double",
}
CStockRtnCapitalField = {
"ClientNo": "string",
"AccountNo": "string",
"CurrencyNo": "string",
"Available": "double",
"YAvailable": "double",
"CanCashOut": "double",
"Money": "double",
"ExpiredProfit": "double",
"FrozenDeposit": "double",
"Fee": "double",
"Deposit": "double",
"KeepDeposit": "double",
"Status": "int",
"InMoney": "double",
"OutMoney": "double",
"UnexpiredProfit": "double",
"TodayTotal": "double",
"UnaccountProfit": "double",
"Royalty": "double",
"ExchangeNo": "string",
"TreatyCode": "string",
"OrderNo": "string",
"OrderNumber": "int",
"FilledNumber": "int",
"FilledAdvPrice": "double",
"BuyHoldNumber": "int",
"BuyHoldOpenPrice": "double",
"BuyHoldPrice": "double",
"SaleHoldNumber": "int",
"SaleHoldOpenPrice": "double",
"SaleHoldPrice": "double",
"IsCanceled": "string",
"FilledTotalFee": "double",
"Credit": "double",
"MarginLimit": "double",
"BorrowValue": "double",
"MortgageMoney": "double",
"T1": "double",
"T2": "double",
"T3": "double",
"TN": "double",
"TradeLimit": "double",
"FCrossMax": "double",
"SellFreezenMoney": "double",
"SellInterest": "double",
"SellNeedAddMargin": "double",
}
CStockReqGetQuestionField = {
"Unused": "int",
"ErrorDescription": "string",
}
CStockRspQuestionField = {
"QuestionType": "string",
"QuestionId": "string",
"QuestionCN": "string",
"QuestionEN": "string",
}
CStockReqSafeVerifyField = {
"UserId": "string",
"UserPwd": "string",
"Type": "string",
"Question": "string",
"Answer": "string",
"MobileNumber": "string",
"VerifyCode": "string",
"SaveMac": "string",
"MacAddress": "string",
"ErrorDescription": "string",
}
CStockReqSetVerifyQAField = {
"UserId": "string",
"UserPwd": "string",
"Type": "string",
"Question": "string",
"Answer": "string",
"MobileNumber": "string",
"VerifyCode": "string",
"SaveMac": "string",
"ErrorDescription": "string",
}
CStockReqVerifyCodeField = {
"UserId": "string",
"UserPwd": "string",
"Type": "string",
"Question": "string",
"Answer": "string",
"MobileNumber": "string",
"VerifyCode": "string",
"ErrorDescription": "string",
}

View File

@ -0,0 +1,8 @@
TDACharType = "char"
TDAStringType = "string"
TDABrokerType = "string"
TDAIntType = "int"
TDAVolumeType = "int"
TDADoubleType = "double"
TDAPriceType = "double"
TDAMoneyType = "double"

View File

@ -35,6 +35,7 @@ class DataTypeGenerator:
"""处理每行"""
line = line.replace("\n", "")
line = line.replace(";", "")
line = line.replace("\t", " ")
if line.startswith("#define"):
self.process_define(line)
@ -51,13 +52,16 @@ class DataTypeGenerator:
name = words[1]
value = words[2]
if "__" in value:
return
new_line = f"{name} = {value}\n"
self.f_define.write(new_line)
def process_typedef(self, line: str):
"""处理类型定义"""
words = line.split(" ")
words = [word for word in words if word != " "]
words = [word for word in words if word]
name = words[2]
typedef = TYPE_CPP2PY[words[1]]
@ -72,5 +76,5 @@ class DataTypeGenerator:
if __name__ == "__main__":
generator = DataTypeGenerator("../include/ctp/ThostFtdcUserApiDataType.h", "ctp")
generator = DataTypeGenerator("../include/da/DADataType.h", "da")
generator.run()

View File

@ -5,10 +5,11 @@ import importlib
class StructGenerator:
"""Struct生成器"""
def __init__(self, filename: str, prefix: str):
def __init__(self, filename: str, prefix: str, sub_name: str):
"""Constructor"""
self.filename = filename
self.prefix = prefix
self.sub_name = sub_name
self.typedefs = {}
self.load_constant()
@ -25,7 +26,7 @@ class StructGenerator:
def run(self):
"""运行生成"""
self.f_cpp = open(self.filename, "r")
self.f_struct = open(f"{self.prefix}_struct.py", "w")
self.f_struct = open(f"{self.prefix}_{self.sub_name}_struct.py", "w")
for line in self.f_cpp:
self.process_line(line)
@ -40,7 +41,9 @@ class StructGenerator:
line = line.replace(";", "")
line = line.replace("\n", "")
if line.startswith("struct"):
if line.startswith("typedef"):
self.process_typedef(line)
elif line.startswith("struct"):
self.process_declare(line)
elif line.startswith("{"):
self.process_start(line)
@ -49,6 +52,10 @@ class StructGenerator:
elif "\t" in line and "///" not in line:
self.process_member(line)
def process_typedef(self, line: str):
"""处理类型定义"""
print("typdef注意", line) # 一共三行,手动处理
def process_declare(self, line: str):
"""处理声明"""
words = line.split(" ")
@ -70,8 +77,7 @@ class StructGenerator:
def process_member(self, line: str):
"""处理成员"""
words = line.split("\t")
words = [word for word in words if word]
words = [word.replace(" ", "") for word in words if word]
py_type = self.typedefs[words[0]]
name = words[1]
@ -80,5 +86,11 @@ class StructGenerator:
if __name__ == "__main__":
generator = StructGenerator("../include/ctp/ThostFtdcUserApiStruct.h", "ctp")
generator.run()
generator_future = StructGenerator("../include/da/DAFutureStruct.h", "da", "future")
generator_future.run()
generator_stock = StructGenerator("../include/da/DAStockStruct.h", "da", "stock")
generator_stock.run()
generator_market = StructGenerator("../include/da/DAMarketStruct.h", "da", "market")
generator_market.run()