Merge pull request #1791 from nanoric/tora

Tora Api Fix: GBK encoding.
This commit is contained in:
vn.py 2019-06-06 09:17:27 +08:00 committed by GitHub
commit 09a85f8734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 278 additions and 177 deletions

View File

@ -7,6 +7,7 @@ python -m autocxxpy \
TORATstpUserApiDataType.h\ TORATstpUserApiDataType.h\
TORATstpUserApiStruct.h\ TORATstpUserApiStruct.h\
-I vntora/include \ -I vntora/include \
-A custom/custom_wrappers.hpp\
--copy-autocxxpy-includes vntora/include \ --copy-autocxxpy-includes vntora/include \
--output-dir vntora/generated_files \ --output-dir vntora/generated_files \
--pyi-output-dir . \ --pyi-output-dir . \

Binary file not shown.

View File

@ -7,7 +7,7 @@ if typing.TYPE_CHECKING:
from .vntora import * from .vntora import *
def set_async_callback_exception_handler(handler: Callable[[AsyncDispatchException], None]): def set_async_callback_exception_handler(handler: Callable[[AsyncDispatchException], bool]):
""" """
set a customize exception handler for async callback in this module(pyd) set a customize exception handler for async callback in this module(pyd)
\a handler should return True if it handles that exception, \a handler should return True if it handles that exception,
@ -2312,37 +2312,37 @@ class CTORATstpMdSpi():
def OnFrontConnected(self, )->None: def OnFrontConnected(self, )->Any:
... ...
def OnFrontDisconnected(self, nReason: int)->None: def OnFrontDisconnected(self, nReason: int)->Any:
... ...
def OnRspError(self, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspError(self, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspUserLogin(self, pRspUserLogin: CTORATstpRspUserLoginField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspUserLogin(self, pRspUserLogin: CTORATstpRspUserLoginField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspUserLogout(self, pUserLogout: CTORATstpUserLogoutField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspUserLogout(self, pUserLogout: CTORATstpUserLogoutField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspSubMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspSubMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspUnSubMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspUnSubMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspSubSpecialMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspSubSpecialMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspUnSubSpecialMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspUnSubSpecialMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspSubFundsFlowMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspSubFundsFlowMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspUnSubFundsFlowMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspUnSubFundsFlowMarketData(self, pSpecificSecurity: CTORATstpSpecificSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRtnDepthMarketData(self, pDepthMarketData: CTORATstpMarketDataField)->None: def OnRtnDepthMarketData(self, pDepthMarketData: CTORATstpMarketDataField)->Any:
... ...
def OnRtnSpecialMarketData(self, pSpecialMarketData: CTORATstpSpecialMarketDataField)->None: def OnRtnSpecialMarketData(self, pSpecialMarketData: CTORATstpSpecialMarketDataField)->Any:
... ...
def OnRtnEffectPriceMarketData(self, pEffectPriceMarketData: CTORATstpEffectPriceMarketDataField)->None: def OnRtnEffectPriceMarketData(self, pEffectPriceMarketData: CTORATstpEffectPriceMarketDataField)->Any:
... ...
def OnRtnEffectVolumeMarketData(self, pEffectVolumeMarketData: CTORATstpEffectVolumeMarketDataField)->None: def OnRtnEffectVolumeMarketData(self, pEffectVolumeMarketData: CTORATstpEffectVolumeMarketDataField)->Any:
... ...
def OnRtnFundsFlowMarketData(self, pFundsFlowMarketData: CTORATstpFundsFlowMarketDataField)->None: def OnRtnFundsFlowMarketData(self, pFundsFlowMarketData: CTORATstpFundsFlowMarketDataField)->Any:
... ...
class CTORATstpMdApi(): class CTORATstpMdApi():
@ -2355,19 +2355,19 @@ class CTORATstpMdApi():
@staticmethod @staticmethod
def GetApiVersion()->str: def GetApiVersion()->str:
... ...
def Release(self, )->None: def Release(self, )->Any:
... ...
def Init(self, )->None: def Init(self, )->Any:
... ...
def Join(self, )->int: def Join(self, )->int:
... ...
def RegisterFront(self, pszFrontAddress: str)->None: def RegisterFront(self, pszFrontAddress: str)->Any:
... ...
def RegisterNameServer(self, pszNsAddress: str)->None: def RegisterNameServer(self, pszNsAddress: str)->Any:
... ...
def RegisterDeriveServer(self, pszDeriveAddress: str)->None: def RegisterDeriveServer(self, pszDeriveAddress: str)->Any:
... ...
def RegisterSpi(self, pSpi: CTORATstpMdSpi)->None: def RegisterSpi(self, pSpi: CTORATstpMdSpi)->Any:
... ...
def SubscribeMarketData(self, ppSecurityID: List[str], ExchageID: int)->int: def SubscribeMarketData(self, ppSecurityID: List[str], ExchageID: int)->int:
... ...
@ -2390,145 +2390,145 @@ class CTORATstpTraderSpi():
def OnFrontConnected(self, )->None: def OnFrontConnected(self, )->Any:
... ...
def OnFrontDisconnected(self, nReason: int)->None: def OnFrontDisconnected(self, nReason: int)->Any:
... ...
def OnRspError(self, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspError(self, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspUserLogin(self, pRspUserLoginField: CTORATstpRspUserLoginField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspUserLogin(self, pRspUserLoginField: CTORATstpRspUserLoginField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspUserLogout(self, pUserLogoutField: CTORATstpUserLogoutField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspUserLogout(self, pUserLogoutField: CTORATstpUserLogoutField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspUserPasswordUpdate(self, pUserPasswordUpdateField: CTORATstpUserPasswordUpdateField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspUserPasswordUpdate(self, pUserPasswordUpdateField: CTORATstpUserPasswordUpdateField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspInputDeviceSerial(self, pRspInputDeviceSerialField: CTORATstpRspInputDeviceSerialField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspInputDeviceSerial(self, pRspInputDeviceSerialField: CTORATstpRspInputDeviceSerialField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspOrderInsert(self, pInputOrderField: CTORATstpInputOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspOrderInsert(self, pInputOrderField: CTORATstpInputOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRtnOrder(self, pOrder: CTORATstpOrderField)->None: def OnRtnOrder(self, pOrder: CTORATstpOrderField)->Any:
... ...
def OnErrRtnOrderInsert(self, pInputOrder: CTORATstpInputOrderField, pRspInfo: CTORATstpRspInfoField)->None: def OnErrRtnOrderInsert(self, pInputOrder: CTORATstpInputOrderField, pRspInfo: CTORATstpRspInfoField)->Any:
... ...
def OnRspOrderAction(self, pInputOrderActionField: CTORATstpInputOrderActionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspOrderAction(self, pInputOrderActionField: CTORATstpInputOrderActionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnErrRtnOrderAction(self, pOrderAction: CTORATstpOrderActionField, pRspInfo: CTORATstpRspInfoField)->None: def OnErrRtnOrderAction(self, pOrderAction: CTORATstpOrderActionField, pRspInfo: CTORATstpRspInfoField)->Any:
... ...
def OnRtnTrade(self, pTrade: CTORATstpTradeField)->None: def OnRtnTrade(self, pTrade: CTORATstpTradeField)->Any:
... ...
def OnRtnMarketStatus(self, pMarketStatus: CTORATstpMarketStatusField)->None: def OnRtnMarketStatus(self, pMarketStatus: CTORATstpMarketStatusField)->Any:
... ...
def OnRspCondOrderInsert(self, pInputCondOrderField: CTORATstpInputCondOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspCondOrderInsert(self, pInputCondOrderField: CTORATstpInputCondOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRtnCondOrder(self, pConditionOrder: CTORATstpConditionOrderField)->None: def OnRtnCondOrder(self, pConditionOrder: CTORATstpConditionOrderField)->Any:
... ...
def OnErrRtnCondOrderInsert(self, pInputCondOrder: CTORATstpInputCondOrderField, pRspInfo: CTORATstpRspInfoField)->None: def OnErrRtnCondOrderInsert(self, pInputCondOrder: CTORATstpInputCondOrderField, pRspInfo: CTORATstpRspInfoField)->Any:
... ...
def OnRspCondOrderAction(self, pInputCondOrderActionField: CTORATstpInputCondOrderActionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspCondOrderAction(self, pInputCondOrderActionField: CTORATstpInputCondOrderActionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnErrRtnCondOrderAction(self, pInputCondOrderAction: CTORATstpInputCondOrderActionField, pRspInfo: CTORATstpRspInfoField)->None: def OnErrRtnCondOrderAction(self, pInputCondOrderAction: CTORATstpInputCondOrderActionField, pRspInfo: CTORATstpRspInfoField)->Any:
... ...
def OnRspInquiryJZFund(self, pRspInquiryJZFundField: CTORATstpRspInquiryJZFundField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspInquiryJZFund(self, pRspInquiryJZFundField: CTORATstpRspInquiryJZFundField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspTransferFund(self, pInputTransferFundField: CTORATstpInputTransferFundField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspTransferFund(self, pInputTransferFundField: CTORATstpInputTransferFundField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRtnTransferFund(self, pTransferFund: CTORATstpTransferFundField)->None: def OnRtnTransferFund(self, pTransferFund: CTORATstpTransferFundField)->Any:
... ...
def OnErrRtnTransferFund(self, pInputTransferFund: CTORATstpInputTransferFundField, pRspInfo: CTORATstpRspInfoField)->None: def OnErrRtnTransferFund(self, pInputTransferFund: CTORATstpInputTransferFundField, pRspInfo: CTORATstpRspInfoField)->Any:
... ...
def OnRtnTransferPosition(self, pTransferPosition: CTORATstpTransferPositionField)->None: def OnRtnTransferPosition(self, pTransferPosition: CTORATstpTransferPositionField)->Any:
... ...
def OnErrRtnTransferPosition(self, pInputTransferPosition: CTORATstpInputTransferPositionField, pRspInfo: CTORATstpRspInfoField)->None: def OnErrRtnTransferPosition(self, pInputTransferPosition: CTORATstpInputTransferPositionField, pRspInfo: CTORATstpRspInfoField)->Any:
... ...
def OnRspTransferCollateral(self, pInputTransferCollateralField: CTORATstpInputTransferCollateralField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspTransferCollateral(self, pInputTransferCollateralField: CTORATstpInputTransferCollateralField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspInquiryBankAccountFund(self, pRspInquiryBankAccountFundField: CTORATstpRspInquiryBankAccountFundField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspInquiryBankAccountFund(self, pRspInquiryBankAccountFundField: CTORATstpRspInquiryBankAccountFundField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspInquiryTradeConcentration(self, pInquiryTradeConcentrationField: CTORATstpInquiryTradeConcentrationField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspInquiryTradeConcentration(self, pInquiryTradeConcentrationField: CTORATstpInquiryTradeConcentrationField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRtnTradingNotice(self, pTradingNotice: CTORATstpTradingNoticeField)->None: def OnRtnTradingNotice(self, pTradingNotice: CTORATstpTradingNoticeField)->Any:
... ...
def OnRspInquiryMaxOrderVolume(self, pRspInquiryMaxOrderVolumeField: CTORATstpRspInquiryMaxOrderVolumeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspInquiryMaxOrderVolume(self, pRspInquiryMaxOrderVolumeField: CTORATstpRspInquiryMaxOrderVolumeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRtnPeripheryTransferPosition(self, pPeripheryPositionTransferDetail: CTORATstpPeripheryPositionTransferDetailField)->None: def OnRtnPeripheryTransferPosition(self, pPeripheryPositionTransferDetail: CTORATstpPeripheryPositionTransferDetailField)->Any:
... ...
def OnRspInquiryHistoryOrder(self, pHistoryOrderField: CTORATstpHistoryOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspInquiryHistoryOrder(self, pHistoryOrderField: CTORATstpHistoryOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspInquiryHistoryTrade(self, pHistoryTradeField: CTORATstpHistoryTradeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspInquiryHistoryTrade(self, pHistoryTradeField: CTORATstpHistoryTradeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryExchange(self, pExchange: CTORATstpExchangeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryExchange(self, pExchange: CTORATstpExchangeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryMarketData(self, pMarketData: CTORATstpMarketDataField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryMarketData(self, pMarketData: CTORATstpMarketDataField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQrySecurity(self, pSecurity: CTORATstpSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQrySecurity(self, pSecurity: CTORATstpSecurityField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryETFFile(self, pETFFile: CTORATstpETFFileField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryETFFile(self, pETFFile: CTORATstpETFFileField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryETFBasket(self, pETFBasket: CTORATstpETFBasketField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryETFBasket(self, pETFBasket: CTORATstpETFBasketField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryIPOInfo(self, pIPOInfo: CTORATstpIPOInfoField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryIPOInfo(self, pIPOInfo: CTORATstpIPOInfoField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryBUProxy(self, pBUProxy: CTORATstpBUProxyField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryBUProxy(self, pBUProxy: CTORATstpBUProxyField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryUser(self, pUser: CTORATstpUserField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryUser(self, pUser: CTORATstpUserField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryInvestor(self, pInvestor: CTORATstpInvestorField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryInvestor(self, pInvestor: CTORATstpInvestorField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryShareholderAccount(self, pShareholderAccount: CTORATstpShareholderAccountField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryShareholderAccount(self, pShareholderAccount: CTORATstpShareholderAccountField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryOrder(self, pOrder: CTORATstpOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryOrder(self, pOrder: CTORATstpOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryOrderAction(self, pOrderAction: CTORATstpOrderActionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryOrderAction(self, pOrderAction: CTORATstpOrderActionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryTrade(self, pTrade: CTORATstpTradeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryTrade(self, pTrade: CTORATstpTradeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryTradingAccount(self, pTradingAccount: CTORATstpTradingAccountField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryTradingAccount(self, pTradingAccount: CTORATstpTradingAccountField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryPosition(self, pPosition: CTORATstpPositionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryPosition(self, pPosition: CTORATstpPositionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryTradingFee(self, pTradingFee: CTORATstpTradingFeeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryTradingFee(self, pTradingFee: CTORATstpTradingFeeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryInvestorTradingFee(self, pInvestorTradingFee: CTORATstpInvestorTradingFeeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryInvestorTradingFee(self, pInvestorTradingFee: CTORATstpInvestorTradingFeeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryIPOQuota(self, pIPOQuota: CTORATstpIPOQuotaField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryIPOQuota(self, pIPOQuota: CTORATstpIPOQuotaField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryMarket(self, pMarket: CTORATstpMarketField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryMarket(self, pMarket: CTORATstpMarketField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryOrderFundDetail(self, pOrderFundDetail: CTORATstpOrderFundDetailField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryOrderFundDetail(self, pOrderFundDetail: CTORATstpOrderFundDetailField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryFundTransferDetail(self, pFundTransferDetail: CTORATstpFundTransferDetailField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryFundTransferDetail(self, pFundTransferDetail: CTORATstpFundTransferDetailField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryPositionTransferDetail(self, pPositionTransferDetail: CTORATstpPositionTransferDetailField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryPositionTransferDetail(self, pPositionTransferDetail: CTORATstpPositionTransferDetailField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryPledgePosition(self, pPledgePosition: CTORATstpPledgePositionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryPledgePosition(self, pPledgePosition: CTORATstpPledgePositionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryPledgeInfo(self, pPledgeInfo: CTORATstpPledgeInfoField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryPledgeInfo(self, pPledgeInfo: CTORATstpPledgeInfoField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryConversionBondInfo(self, pConversionBondInfo: CTORATstpConversionBondInfoField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryConversionBondInfo(self, pConversionBondInfo: CTORATstpConversionBondInfoField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryBondPutbackInfo(self, pBondPutbackInfo: CTORATstpBondPutbackInfoField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryBondPutbackInfo(self, pBondPutbackInfo: CTORATstpBondPutbackInfoField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryStandardBondPosition(self, pStandardBondPosition: CTORATstpStandardBondPositionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryStandardBondPosition(self, pStandardBondPosition: CTORATstpStandardBondPositionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQrySpecialMarketData(self, pSpecialMarketData: CTORATstpSpecialMarketDataField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQrySpecialMarketData(self, pSpecialMarketData: CTORATstpSpecialMarketDataField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryPrematurityRepoOrder(self, pPrematurityRepoOrder: CTORATstpPrematurityRepoOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryPrematurityRepoOrder(self, pPrematurityRepoOrder: CTORATstpPrematurityRepoOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryShareholderParam(self, pShareholderParam: CTORATstpShareholderParamField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryShareholderParam(self, pShareholderParam: CTORATstpShareholderParamField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryPeripheryPositionTransferDetail(self, pPeripheryPositionTransferDetail: CTORATstpPeripheryPositionTransferDetailField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryPeripheryPositionTransferDetail(self, pPeripheryPositionTransferDetail: CTORATstpPeripheryPositionTransferDetailField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryInvestorCondOrderLimitParam(self, pInvestorCondOrderLimitParam: CTORATstpInvestorCondOrderLimitParamField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryInvestorCondOrderLimitParam(self, pInvestorCondOrderLimitParam: CTORATstpInvestorCondOrderLimitParamField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryCondOrder(self, pCondOrder: CTORATstpCondOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryCondOrder(self, pCondOrder: CTORATstpCondOrderField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryCondOrderAction(self, pCondOrderAction: CTORATstpCondOrderActionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryCondOrderAction(self, pCondOrderAction: CTORATstpCondOrderActionField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryTradingNotice(self, pTradingNotice: CTORATstpTradingNoticeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryTradingNotice(self, pTradingNotice: CTORATstpTradingNoticeField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryIPONumberResult(self, pIPONumberResult: CTORATstpIPONumberResultField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryIPONumberResult(self, pIPONumberResult: CTORATstpIPONumberResultField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
def OnRspQryIPOMatchNumberResult(self, pIPOMatchNumberResult: CTORATstpIPOMatchNumberResultField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->None: def OnRspQryIPOMatchNumberResult(self, pIPOMatchNumberResult: CTORATstpIPOMatchNumberResultField, pRspInfo: CTORATstpRspInfoField, nRequestID: int, bIsLast: bool)->Any:
... ...
class CTORATstpTraderApi(): class CTORATstpTraderApi():
@ -2541,23 +2541,23 @@ class CTORATstpTraderApi():
@staticmethod @staticmethod
def GetApiVersion()->str: def GetApiVersion()->str:
... ...
def Release(self, )->None: def Release(self, )->Any:
... ...
def Init(self, )->None: def Init(self, )->Any:
... ...
def Join(self, )->int: def Join(self, )->int:
... ...
def RegisterFront(self, pszFrontAddress: str)->None: def RegisterFront(self, pszFrontAddress: str)->Any:
... ...
def RegisterNameServer(self, pszNsAddress: str)->None: def RegisterNameServer(self, pszNsAddress: str)->Any:
... ...
def RegisterDeriveServer(self, pszDeriveAddress: str)->None: def RegisterDeriveServer(self, pszDeriveAddress: str)->Any:
... ...
def RegisterSpi(self, pSpi: CTORATstpTraderSpi)->None: def RegisterSpi(self, pSpi: CTORATstpTraderSpi)->Any:
... ...
def SubscribePrivateTopic(self, nResumeType: TORA_TE_RESUME_TYPE)->None: def SubscribePrivateTopic(self, nResumeType: TORA_TE_RESUME_TYPE)->Any:
... ...
def SubscribePublicTopic(self, nResumeType: TORA_TE_RESUME_TYPE)->None: def SubscribePublicTopic(self, nResumeType: TORA_TE_RESUME_TYPE)->Any:
... ...
def ReqUserLogin(self, pReqUserLoginField: CTORATstpReqUserLoginField, nRequestID: int)->int: def ReqUserLogin(self, pReqUserLoginField: CTORATstpReqUserLoginField, nRequestID: int)->int:
... ...
@ -3293,17 +3293,17 @@ TORA_TSTP_SPT_ClosePriceScopeRatio: int
TORA_TSTP_SPT_OpenDateLimit: int TORA_TSTP_SPT_OpenDateLimit: int
TORA_TSTP_SPT_LimitBoardShamRatio: int TORA_TSTP_SPT_LimitBoardShamRatio: int
TORA_TSTP_SPT_CancelOrderRatio: int TORA_TSTP_SPT_CancelOrderRatio: int
def set_null(v: int)->None: def set_null(v: int)->Any:
... ...
def set_null(v: float)->None: def set_null(v: float)->Any:
... ...
def set_null(v: int)->None: def set_null(v: int)->Any:
... ...
def set_null(v: int)->None: def set_null(v: int)->Any:
... ...
def set_null(v: int)->None: def set_null(v: int)->Any:
... ...
def set_null(v: str)->None: def set_null(v: str)->Any:
... ...
def is_null(v: int)->bool: def is_null(v: int)->bool:
... ...

View File

@ -0,0 +1,65 @@
#pragma once
#include <string>
#include <locale>
#include <codecvt>
#include <autocxxpy/autocxxpy.hpp>
#include <autocxxpy/utils/type_traits.hpp>
#include <pybind11/pybind11.h>
#include "../generated_files/module.hpp"
namespace autocxxpy
{
//½«GBK±àÂëµÄ×Ö·û´®×ª»»ÎªUTF8
inline std::string toUtf(const std::string &gb2312)
{
#ifdef _MSC_VER
const static std::locale loc("zh-CN");
#else
const static std::locale loc("zh_CN.GB18030");
#endif
std::vector<wchar_t> wstr(gb2312.size());
wchar_t* wstrEnd = nullptr;
const char* gbEnd = nullptr;
std::mbstate_t state = {};
int res = std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >
(loc).in(state,
gb2312.data(), gb2312.data() + gb2312.size(), gbEnd,
wstr.data(), wstr.data() + wstr.size(), wstrEnd);
if (std::codecvt_base::ok == res)
{
std::wstring_convert<std::codecvt_utf8<wchar_t>> cutf8;
return cutf8.to_bytes(std::wstring(wstr.data(), wstrEnd));
}
return std::string();
}
template <size_t size>
struct get_string<tag_vntora, size>
{
auto operator()(string_literal<size> &val)
{
return toUtf(val);
}
};
template <size_t size>
struct set_string<tag_vntora, size>
{
void operator()(string_literal<size> &val, const char *str)
{
#ifdef _MSC_VER
strcpy_s(val, toUtf(str).data());
#else
strcpy(val, toUtf(str).data());
#endif
}
};
}

View File

@ -8,6 +8,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_vntora(pybind11::module & parent); void generate_vntora(pybind11::module & parent);

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_vntora(pybind11::module & parent) void generate_vntora(pybind11::module & parent)

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_class_CTORATstpFensUserInfoField(pybind11::object & parent) void generate_class_CTORATstpFensUserInfoField(pybind11::object & parent)

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_class_CTORATstpReqInquiryJZFundField(pybind11::object & parent) void generate_class_CTORATstpReqInquiryJZFundField(pybind11::object & parent)

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_class_CTORATstpPeripheryPositionTransferDetailField(pybind11::object & parent) void generate_class_CTORATstpPeripheryPositionTransferDetailField(pybind11::object & parent)

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_class_CTORATstpBusinessUnitField(pybind11::object & parent) void generate_class_CTORATstpBusinessUnitField(pybind11::object & parent)

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_class_CTORATstpStandardBondPositionField(pybind11::object & parent) void generate_class_CTORATstpStandardBondPositionField(pybind11::object & parent)

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_class_CTORATstpMdApi(pybind11::object & parent) void generate_class_CTORATstpMdApi(pybind11::object & parent)

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_class_CTORATstpTraderApi(pybind11::object & parent) void generate_class_CTORATstpTraderApi(pybind11::object & parent)

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
void generate_enum_TORA_TE_RESUME_TYPE(pybind11::object & parent) void generate_enum_TORA_TE_RESUME_TYPE(pybind11::object & parent)

View File

@ -11,6 +11,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"
autocxxpy::cross_assign module_vntora::cross; autocxxpy::cross_assign module_vntora::cross;
@ -26,7 +27,7 @@ void init_dispatcher(pybind11::module &m)
m.def("set_async_callback_exception_handler", &autocxxpy::async_callback_exception_handler::set_handler); m.def("set_async_callback_exception_handler", &autocxxpy::async_callback_exception_handler::set_handler);
pybind11::class_<autocxxpy::async_dispatch_exception> c(m, "AsyncDispatchException"); pybind11::class_<autocxxpy::async_dispatch_exception> c(m, "AsyncDispatchException");
c.def_property("what", &autocxxpy::async_dispatch_exception::what, nullptr); c.def_property_readonly("what", &autocxxpy::async_dispatch_exception::what_mutable);
c.def_readonly("instance", &autocxxpy::async_dispatch_exception::instance); c.def_readonly("instance", &autocxxpy::async_dispatch_exception::instance);
c.def_readonly("function_name", &autocxxpy::async_dispatch_exception::function_name); c.def_readonly("function_name", &autocxxpy::async_dispatch_exception::function_name);

View File

@ -9,6 +9,7 @@
#include "TORATstpTraderApi.h" #include "TORATstpTraderApi.h"
#include "TORATstpUserApiDataType.h" #include "TORATstpUserApiDataType.h"
#include "TORATstpUserApiStruct.h" #include "TORATstpUserApiStruct.h"
#include "custom/custom_wrappers.hpp"

View File

@ -3,6 +3,7 @@
#include <tuple> #include <tuple>
#include <type_traits> #include <type_traits>
#include <optional> #include <optional>
#include <iostream>
#include "./brigand.hpp" #include "./brigand.hpp"
@ -85,7 +86,9 @@ namespace autocxxpy
{} {}
pybind11::object instance; pybind11::object instance;
std::string function_name; std::string function_name;
inline const char* what() noexcept
// mutable version of what() for pybind11 to make it happy
inline const char* what_mutable() noexcept
{ {
return std::exception::what(); return std::exception::what();
} }
@ -104,11 +107,20 @@ namespace autocxxpy
{ {
custom_handler(e); custom_handler(e);
} }
catch (pybind11::error_already_set & e) catch (pybind11::error_already_set & e2)
{ {
std::cout << "error while calling custom async dispatcher:%s" << e.what() << std::endl; std::cerr << "error while calling custom async callback exception handler:" << std::endl;
std::cerr << e2.what() << std::endl;
std::cerr << "while handling following exception:" << std::endl;
std::cerr << e.what() << std::endl;
} }
} }
else
{
std::cerr << e.what() << std::endl;
std::cerr << "custom async callback exception handler not set." << std::endl;
std::cerr << "Call set_async_callback_exception_handler() to set it. " << std::endl;
}
} }
inline static void set_handler(const handler_type& handler) inline static void set_handler(const handler_type& handler)

View File

@ -30,37 +30,48 @@
<ClCompile Include="generated_files\generated_functions_8.cpp" /> <ClCompile Include="generated_files\generated_functions_8.cpp" />
<ClCompile Include="generated_files\module.cpp" /> <ClCompile Include="generated_files\module.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="custom\custom_wrappers.hpp" />
<ClInclude Include="generated_files\generated_functions.h" />
<ClInclude Include="generated_files\module.hpp" />
<ClInclude Include="generated_files\wrappers.hpp" />
<ClInclude Include="include\TORATstpMdApi.h" />
<ClInclude Include="include\TORATstpTraderApi.h" />
<ClInclude Include="include\TORATstpUserApiDataType.h" />
<ClInclude Include="include\TORATstpUserApiStruct.h" />
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion> <VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{24BBDEB3-6AA7-43EE-A03C-AE527AB1B297}</ProjectGuid> <ProjectGuid>{24BBDEB3-6AA7-43EE-A03C-AE527AB1B297}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>vntora</RootNamespace> <RootNamespace>vntora</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
@ -117,10 +128,11 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -135,10 +147,11 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -155,11 +168,12 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -178,11 +192,12 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>

View File

@ -46,4 +46,30 @@
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="include\TORATstpMdApi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\TORATstpTraderApi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\TORATstpUserApiDataType.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\TORATstpUserApiStruct.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="generated_files\module.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="generated_files\wrappers.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="generated_files\generated_functions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="custom\custom_wrappers.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,10 @@
from vnpy.api.tora.vntora import TORA_TSTP_EXD_SSE, TORA_TSTP_EXD_SZSE, TORA_TSTP_EXD_HK
from vnpy.trader.constant import Exchange
EXCHANGE_TORA2VT = {
TORA_TSTP_EXD_SSE: Exchange.SSE,
TORA_TSTP_EXD_SZSE: Exchange.SZSE,
TORA_TSTP_EXD_HK: Exchange.SEHK,
}
EXCHANGE_VT2TORA = {v: k for k, v in EXCHANGE_TORA2VT.items()}

View File

@ -38,14 +38,7 @@ from vnpy.api.tora.vntora import (
CTORATstpUserLogoutField, CTORATstpUserLogoutField,
CTORATstpRspUserLoginField, CTORATstpRspUserLoginField,
) )
from .constant import EXCHANGE_VT2TORA, EXCHANGE_TORA2VT
EXCHANGE_TORA2VT = {
TORA_TSTP_EXD_SSE: Exchange.SSE,
TORA_TSTP_EXD_SZSE: Exchange.SZSE,
TORA_TSTP_EXD_HK: Exchange.SEHK,
}
EXCHANGE_VT2TORA = {v: k for k, v in EXCHANGE_TORA2VT.items()}
def parse_datetime(date: str, time: str): def parse_datetime(date: str, time: str):
@ -96,7 +89,7 @@ class ToraMdSpi(CTORATstpMdSpi):
nRequestID: int, nRequestID: int,
bIsLast: bool, bIsLast: bool,
) -> Any: ) -> Any:
self.gateway.write_log("OnRspSubMarketData") self.gateway.write_log(f"OnRspSubMarketData({pRspInfo.ErrorID})")
def OnRspUnSubMarketData( def OnRspUnSubMarketData(
self, self,
@ -180,6 +173,7 @@ class ToraMdSpi(CTORATstpMdSpi):
ask_volume_4=data.AskVolume4, ask_volume_4=data.AskVolume4,
ask_volume_5=data.AskVolume5, ask_volume_5=data.AskVolume5,
) )
self.gateway.on_tick(tick_data)
self.gateway.write_log("OnRtnDepthMarketData") self.gateway.write_log("OnRtnDepthMarketData")
def OnRtnSpecialMarketData( def OnRtnSpecialMarketData(

View File

@ -1,53 +1,17 @@
from typing import Any, Sequence, List, Optional from typing import Optional
from datetime import datetime
from threading import Thread
from vnpy.event import EventEngine
from vnpy.trader.event import EVENT_TIMER
from vnpy.trader.constant import Exchange, Product, Direction, OrderType, Status, Offset
from vnpy.trader.gateway import BaseGateway from vnpy.trader.gateway import BaseGateway
from vnpy.trader.object import (
CancelRequest,
OrderRequest,
SubscribeRequest,
TickData,
ContractData,
OrderData,
TradeData,
PositionData,
AccountData,
)
from vnpy.trader.utility import get_folder_path from vnpy.trader.utility import get_folder_path
from vnpy.api.tora.vntora import ( from vnpy.api.tora.vntora import (
set_async_callback_exception_handler,
AsyncDispatchException,
CTORATstpTraderApi, CTORATstpTraderApi,
CTORATstpMdApi,
CTORATstpMdSpi,
CTORATstpTraderSpi, CTORATstpTraderSpi,
TORA_TSTP_EXD_SSE, TORA_TSTP_EXD_SSE,
TORA_TSTP_EXD_SZSE,
TORA_TSTP_EXD_HK,
CTORATstpFundsFlowMarketDataField,
CTORATstpEffectVolumeMarketDataField,
CTORATstpEffectPriceMarketDataField,
CTORATstpSpecialMarketDataField,
CTORATstpMarketDataField,
CTORATstpSpecificSecurityField,
CTORATstpRspInfoField, CTORATstpRspInfoField,
CTORATstpUserLogoutField,
CTORATstpRspUserLoginField, CTORATstpRspUserLoginField,
CTORATstpQrySecurityField, CTORATstpSecurityField, CTORATstpReqUserLoginField, CTORATstpQrySecurityField, CTORATstpSecurityField, CTORATstpReqUserLoginField,
TORA_TSTP_LACT_AccountID, CTORATstpQryExchangeField) TORA_TSTP_LACT_AccountID, CTORATstpQryExchangeField, CTORATstpQryMarketDataField)
from .error_codes import error_codes, get_error_msg from .error_codes import get_error_msg
EXCHANGE_TORA2VT = {
TORA_TSTP_EXD_SSE: Exchange.SSE,
TORA_TSTP_EXD_SZSE: Exchange.SZSE,
TORA_TSTP_EXD_HK: Exchange.SEHK,
}
EXCHANGE_VT2TORA = {v: k for k, v in EXCHANGE_TORA2VT.items()}
class ToraTdSpi(CTORATstpTraderSpi): class ToraTdSpi(CTORATstpTraderSpi):
@ -69,6 +33,7 @@ class ToraTdSpi(CTORATstpTraderSpi):
self.gateway.write_log("交易服务器登录成功") self.gateway.write_log("交易服务器登录成功")
self._api.query_contracts() self._api.query_contracts()
self._api.query_exchange() self._api.query_exchange()
self._api.query_market_data()
def OnFrontDisconnected(self, nReason: int) -> None: def OnFrontDisconnected(self, nReason: int) -> None:
self.gateway.write_log("交易服务器连接断开") self.gateway.write_log("交易服务器连接断开")
@ -101,7 +66,7 @@ class ToraTdApi:
def query_contracts(self): def query_contracts(self):
info = CTORATstpQrySecurityField() info = CTORATstpQrySecurityField()
info.ExchangeID = TORA_TSTP_EXD_SSE # info.ExchangeID = TORA_TSTP_EXD_SSE
err = self._native_api.ReqQrySecurity(info, self._get_new_req_id()) err = self._native_api.ReqQrySecurity(info, self._get_new_req_id())
self._if_error_write_log(err, "ReqQrySecurity") self._if_error_write_log(err, "ReqQrySecurity")
@ -109,8 +74,16 @@ class ToraTdApi:
info = CTORATstpQryExchangeField() info = CTORATstpQryExchangeField()
info.ExchangeID = TORA_TSTP_EXD_SSE info.ExchangeID = TORA_TSTP_EXD_SSE
err = self._native_api.ReqQryExchange(info, self._get_new_req_id()) err = self._native_api.ReqQryExchange(info, self._get_new_req_id())
self._if_error_write_log(err, "ReqQryExchange") self._if_error_write_log(err, "ReqQryExchange")
def query_market_data(self):
info = CTORATstpQryMarketDataField()
info.ExchangeID = TORA_TSTP_EXD_SSE
info.SecurityID = "010303"
err = self._native_api.ReqQryMarketData(info, self._get_new_req_id())
self._if_error_write_log(err, "ReqQryMarketData")
def stop(self): def stop(self):
if self._native_api: if self._native_api:
self._native_api.RegisterSpi(None) self._native_api.RegisterSpi(None)

View File

@ -20,20 +20,13 @@ CTORATstpTraderSpi,
) )
from .md import ToraMdApi from .md import ToraMdApi
from .td import ToraTdApi from .td import ToraTdApi
from .error_codes import get_error_msg from .constant import EXCHANGE_VT2TORA
EXCHANGE_TORA2VT = {
}
EXCHANGE_VT2TORA = {v:k for k,v in EXCHANGE_TORA2VT.items()}
def is_valid_front_address(address: str): def is_valid_front_address(address: str):
return address.startswith("tcp://") or address.startswith("udp://") return address.startswith("tcp://") or address.startswith("udp://")
class ToraGateway(BaseGateway): class ToraGateway(BaseGateway):
default_setting = { default_setting = {
"账号": "", "账号": "",