├── .gitignore ├── AllCppProjects.sln ├── CMakeLists.txt ├── CopyApiDll.bat ├── LICENSE ├── LICENSE.txt ├── README.md ├── Synthetic.md ├── apis ├── ATP_Quote │ ├── ATP_Quote.vcxproj │ ├── ATP_Quote.vcxproj.filters │ ├── Include.h │ ├── ReadMe.txt │ ├── dllmain.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── ATP_Trade │ ├── ATP_Trade.vcxproj │ ├── ATP_Trade.vcxproj.filters │ ├── Include.h │ ├── ReadMe.txt │ ├── dllmain.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── CTP │ ├── CServerConfig.cpp │ ├── CServerConfig.h │ ├── CUserConfig.cpp │ ├── CUserConfig.h │ ├── Makefile │ ├── Quote │ │ ├── MdUserApi.cpp │ │ ├── MdUserApi.h │ │ └── main.cpp │ ├── README.md │ ├── Trade │ │ ├── TraderApi.cpp │ │ ├── TraderApi.h │ │ └── main.cpp │ ├── TypeConvert.h │ ├── dllmain.cpp │ └── include_pub.h ├── CTPZQ_Quote │ ├── CTPZQ_Quote.cpp │ ├── CTPZQ_Quote.vcxproj │ ├── CTPZQ_Quote.vcxproj.filters │ ├── Include.h │ ├── ReadMe.txt │ ├── Redefine.h │ ├── dllmain.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── CTPZQ_Trade │ ├── CTPZQ_Trade.cpp │ ├── CTPZQ_Trade.vcxproj │ ├── CTPZQ_Trade.vcxproj.filters │ ├── Include.h │ ├── ReadMe.txt │ ├── dllmain.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── CTP_SE_Quote │ ├── CTP_SE_Quote.vcxproj │ ├── CTP_SE_Quote.vcxproj.filters │ ├── Include.h │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── CTP_SE_Trade │ ├── CTP_SE_Trade.vcxproj │ ├── CTP_SE_Trade.vcxproj.filters │ ├── Include.h │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── CTP_SOPT_SE_Quote │ ├── CTP_SOPT_SE_Quote.vcxproj │ ├── CTP_SOPT_SE_Quote.vcxproj.filters │ ├── Include.h │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── CTP_SOPT_SE_Trade │ ├── CTP_SOPT_SE_Trade.vcxproj │ ├── CTP_SOPT_SE_Trade.vcxproj.filters │ ├── Include.h │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── Kingstar_Quote │ ├── Include.h │ ├── Kingstar_Quote.vcxproj │ ├── Kingstar_Quote.vcxproj.filters │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── Kingstar_Trade │ ├── Include.h │ ├── Kingstar_Trade.vcxproj │ ├── Kingstar_Trade.vcxproj.filters │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── LTS_Query_v2 │ ├── LTS_Query_v2.vcxproj │ ├── LTS_Query_v2.vcxproj.filters │ ├── QueryApi.cpp │ ├── QueryApi.h │ ├── ReadMe.txt │ ├── dllmain.cpp │ ├── main.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── LTS_Quote_v2 │ ├── LTS_Quote.cbp │ ├── LTS_Quote_v2.vcxproj │ ├── LTS_Quote_v2.vcxproj.filters │ ├── MdUserApi.cpp │ ├── MdUserApi.h │ ├── ReadMe.txt │ ├── dllmain.cpp │ ├── main.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── LTS_Trade_v2 │ ├── LTS_Trade.cbp │ ├── LTS_Trade_v2.vcxproj │ ├── LTS_Trade_v2.vcxproj.filters │ ├── ReadMe.txt │ ├── TraderApi.cpp │ ├── TraderApi.h │ ├── TypeConvert.cpp │ ├── TypeConvert.h │ ├── dllmain.cpp │ ├── main.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── REM_Quote │ ├── CServerConfig.cpp │ ├── CServerConfig.h │ ├── CUserConfig.cpp │ ├── CUserConfig.h │ ├── MdUserApi.cpp │ ├── MdUserApi.h │ ├── REM_Quote.vcxproj │ ├── REM_Quote.vcxproj.filters │ ├── dllmain.cpp │ ├── main.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── REM_Trade │ ├── CProcessor.cpp │ ├── CProcessor.h │ ├── CServerConfig.cpp │ ├── CServerConfig.h │ ├── CUserConfig.cpp │ ├── CUserConfig.h │ ├── OrderMap.h │ ├── PositionManager.h │ ├── REM_Trade.vcxproj │ ├── REM_Trade.vcxproj.filters │ ├── TraderApi.cpp │ ├── TraderApi.h │ ├── TypeConvert.cpp │ ├── TypeConvert.h │ ├── dllmain.cpp │ ├── main.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── Sgit_Quote │ ├── Include.h │ ├── ReadMe.txt │ ├── Sgit_Quote.vcxproj │ ├── Sgit_Quote.vcxproj.filters │ ├── dllmain.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── Sgit_Trade │ ├── Include.h │ ├── ReadMe.txt │ ├── Sgit_Trade.vcxproj │ ├── Sgit_Trade.vcxproj.filters │ ├── dllmain.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── Tap_Quote │ ├── CServerConfig.cpp │ ├── CServerConfig.h │ ├── CUserConfig.cpp │ ├── CUserConfig.h │ ├── MdUserApi.cpp │ ├── MdUserApi.h │ ├── ReadMe.txt │ ├── Tap_Quote.vcxproj │ ├── Tap_Quote.vcxproj.filters │ ├── dllmain.cpp │ ├── main.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── Tap_Trade │ ├── CProcessor.cpp │ ├── CProcessor.h │ ├── CServerConfig.cpp │ ├── CServerConfig.h │ ├── CUserConfig.cpp │ ├── CUserConfig.h │ ├── InstrumentManager.h │ ├── OrderMap.h │ ├── PositionManager.h │ ├── ReadMe.txt │ ├── Tap_Trade.vcxproj │ ├── Tap_Trade.vcxproj.filters │ ├── TraderApi.cpp │ ├── TraderApi.h │ ├── TypeConvert.cpp │ ├── TypeConvert.h │ ├── dllmain.cpp │ ├── main.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── TongShi_Quote │ ├── DialogStockDrv.cpp │ ├── DialogStockDrv.h │ ├── MdUserApi.cpp │ ├── MdUserApi.h │ ├── ReadMe.txt │ ├── Stockdrv.h │ ├── TongShi_Quote.cpp │ ├── TongShi_Quote.h │ ├── TongShi_Quote.rc │ ├── TongShi_Quote.vcxproj │ ├── TongShi_Quote.vcxproj.filters │ ├── TypeConvert.cpp │ ├── TypeConvert.h │ ├── main.cpp │ ├── res │ │ └── TongShi_Quote.rc2 │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── UFX_Trade │ ├── Log.h │ ├── O32 │ │ ├── O32Codec.cpp │ │ ├── O32Codec.h │ │ ├── O32Processor.cpp │ │ ├── O32Processor.h │ │ ├── TypeConvert_o32.cpp │ │ ├── TypeConvert_o32.h │ │ ├── ufx_enum_o32.h │ │ └── ufx_struct_o32.h │ ├── OrderMap.h │ ├── ReadMe.txt │ ├── TraderApi.cpp │ ├── TraderApi.h │ ├── UFX_Log.txt │ ├── UFX_Recv.dat │ ├── UFX_Trade.vcxproj │ ├── UFX_Trade.vcxproj.filters │ ├── UFX日志_上午盘休时撤单.txt │ ├── UFX日志_订阅失败.txt │ ├── UFX日志_证券数量不对.txt │ ├── UFX日志_风控禁止.txt │ ├── ZQ │ │ ├── ZQCodec.cpp │ │ ├── ZQCodec.h │ │ ├── ufx_enum_zq.h │ │ └── ufx_struct_zq.h │ ├── dllmain.cpp │ ├── main.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ └── 开发说明.txt ├── Wind_Quote │ ├── MdUserApi.cpp │ ├── MdUserApi.h │ ├── ReadMe.txt │ ├── Wind_Quote.rc │ ├── Wind_Quote.vcxproj │ ├── Wind_Quote.vcxproj.filters │ ├── dllmain.cpp │ ├── main.cpp │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── XTP │ ├── Quote │ │ ├── MdUserApi.cpp │ │ ├── MdUserApi.h │ │ └── main.cpp │ ├── Trade │ │ ├── TraderApi.cpp │ │ ├── TraderApi.h │ │ └── main.cpp │ ├── TypeConvert.cpp │ └── TypeConvert.h ├── XTP_Quote │ ├── Include.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h └── XTP_Trade │ ├── Include.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── build.bat ├── build.sh ├── clear.bat ├── clearBin.bat ├── common ├── License │ ├── License.cpp │ ├── License.h │ ├── License.vcxproj │ ├── License.vcxproj.filters │ ├── LicenseMaker.cpp │ ├── README.md │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h └── www │ ├── CheckSignin.php │ ├── ConvertCode.vbs │ ├── DirFileFun.php │ ├── EnumFun.php │ ├── Home.php │ ├── JSON.php │ ├── Join.php │ ├── License.exe │ ├── LicenseInfoAction.php │ ├── LicenseInfoAdd.php │ ├── LicenseInfoGenerate.php │ ├── LicenseInfoListView.php │ ├── LicenseInfoListView2.php │ ├── LicenseInfoListView99.php │ ├── LicenseInfoReview.php │ ├── LicenseInfoView.php │ ├── Logout.php │ ├── ProductInfoListView.php │ ├── Session.php │ ├── Signin.php │ ├── Signin_admin.php │ ├── Signup.php │ ├── SwitchUserID.php │ ├── User2ListView.php │ ├── UserInfoAction.php │ ├── UserInfoView.php │ ├── aboutus.php │ ├── config.php │ ├── products │ └── CTP_Trade_x86 │ │ └── index.html │ ├── 安装方法.txt │ ├── 开发计划.txt │ └── 表结构.txt ├── design.md ├── example └── cpp │ ├── CTP │ └── example_ctp.cpp │ └── XTP │ └── example_xtp.cpp ├── include ├── ATP │ ├── ThostFtdcMdApi.h │ ├── ThostFtdcTraderApi.h │ ├── ThostFtdcUserApiDataType.h │ ├── ThostFtdcUserApiStruct.h │ ├── error.dtd │ ├── error.xml │ └── md5.txt ├── ApiDataType.h ├── ApiEnum.h ├── ApiHeader.def ├── ApiHeader.h ├── ApiProcess.h ├── ApiStruct.h ├── CSubscribeManager.cpp ├── CSubscribeManager.h ├── CSubscribeManager1.cpp ├── CSubscribeManager1.h ├── CSubscribeManager2.cpp ├── CSubscribeManager2.h ├── CSyntheticCalculate_DepthMarketDataNField.h ├── CTPZQ │ ├── ZQThostFtdcMdApi.h │ ├── ZQThostFtdcTraderApi.h │ ├── ZQThostFtdcUserApiDataType.h │ ├── ZQThostFtdcUserApiStruct.h │ ├── error.dtd │ ├── error.xml │ ├── linux64 │ │ └── 请so文件添加lib前缀.txt │ ├── version.txt │ └── win64 │ │ └── 请复制dll与lib文件.txt ├── CTP_SE │ ├── ThostFtdcMdApi.h │ ├── ThostFtdcTraderApi.h │ ├── ThostFtdcUserApiDataType.h │ ├── ThostFtdcUserApiStruct.h │ ├── error.dtd │ ├── error.xml │ ├── linux64 │ │ └── 请so文件添加lib前缀.txt │ └── win64 │ │ └── 请复制dll与lib文件.txt ├── CTP_SOPT_SE │ ├── ThostFtdcMdApi.h │ ├── ThostFtdcTraderApi.h │ ├── ThostFtdcUserApiDataType.h │ ├── ThostFtdcUserApiStruct.h │ ├── error.dtd │ ├── error.xml │ ├── linux64 │ │ └── 请so文件添加lib前缀.txt │ └── win64 │ │ └── 请复制dll与lib文件.txt ├── ChinaStock.cpp ├── ChinaStock.h ├── CrossPlatform.h ├── IDGenerator.cpp ├── IDGenerator.h ├── Kingstar │ ├── IncEx │ │ ├── KSCosApi.h │ │ ├── KSMdApiEx.h │ │ ├── KSOptionApi.h │ │ ├── KSPrdApi.h │ │ ├── KSTraderApiEx.h │ │ ├── KSUserApiDataTypeEx.h │ │ ├── KSUserApiStructEx.h │ │ ├── KSVocApi.h │ │ ├── KSVocApiDataType.h │ │ ├── KSVocApiStruct.h │ │ └── KSVocMdApi.h │ ├── inc │ │ ├── KSMarketDataAPI.h │ │ └── KSTradeAPI.h │ └── version.txt ├── LTS_v2 │ ├── SecurityFtdcMdApi.h │ ├── SecurityFtdcQueryApi.h │ ├── SecurityFtdcTraderApi.h │ ├── SecurityFtdcUserApiDataType.h │ ├── SecurityFtdcUserApiStruct.h │ ├── linux64 │ │ └── 请文件名添加lib前缀.txt │ └── version.txt ├── QueueEnum.h ├── REM │ ├── EesTraderErr.h │ ├── linux64 │ │ └── 请so文件添加lib前缀.txt │ └── win64 │ │ └── 请复制dll与lib文件.txt ├── Sgit │ ├── SgitFtdcMdApi.h │ ├── SgitFtdcTraderApi.h │ ├── SgitFtdcUserApiDataType.h │ ├── SgitFtdcUserApiStruct.h │ ├── linux64 │ │ └── 请so文件添加lib前缀.txt │ └── win64 │ │ └── 请复制dll与lib文件.txt ├── Tap │ └── TapAPIError.h ├── UFX │ ├── data_def.h │ ├── t2sdk_interface.h │ └── win32 │ │ ├── license_hundsun.dat │ │ ├── t2sdk.ini │ │ └── 请复制dll与lib文件.txt ├── Wind │ └── WAPIWrapperCpp.h ├── XApiC.def ├── XApiC.h ├── XApiCpp.h ├── XTP │ ├── changelist.txt │ ├── linux64 │ │ └── 请so文件添加lib前缀.txt │ ├── macosx │ │ ├── libxtpquoteapi.dylib │ │ └── libxtptraderapi.dylib │ ├── win64 │ │ └── 请复制dll与lib文件.txt │ ├── xoms_api_fund_struct.h │ ├── xoms_api_struct.h │ ├── xquote_api_struct.h │ ├── xtp_api_data_type.h │ ├── xtp_api_struct.h │ ├── xtp_api_struct_common.h │ ├── xtp_quote_api.h │ └── xtp_trader_api.h ├── cryptopp.zip ├── inirw.cpp ├── inirw.h ├── queue │ ├── ArrayLockFreeQueue.h │ ├── ArrayLockFreeQueueImp.h │ ├── MsgQueue.h │ └── atom_opt.h ├── rapidjson │ ├── allocators.h │ ├── document.h │ ├── encodedstream.h │ ├── encodings.h │ ├── error │ │ ├── en.h │ │ └── error.h │ ├── filereadstream.h │ ├── filewritestream.h │ ├── fwd.h │ ├── internal │ │ ├── biginteger.h │ │ ├── diyfp.h │ │ ├── dtoa.h │ │ ├── ieee754.h │ │ ├── itoa.h │ │ ├── meta.h │ │ ├── pow10.h │ │ ├── regex.h │ │ ├── stack.h │ │ ├── strfunc.h │ │ ├── strtod.h │ │ └── swap.h │ ├── istreamwrapper.h │ ├── memorybuffer.h │ ├── memorystream.h │ ├── msinttypes │ │ ├── inttypes.h │ │ └── stdint.h │ ├── ostreamwrapper.h │ ├── pointer.h │ ├── prettywriter.h │ ├── rapidjson.h │ ├── reader.h │ ├── schema.h │ ├── stream.h │ ├── stringbuffer.h │ └── writer.h ├── stdafx.h ├── switch_string.h ├── synthetic │ ├── CSyntheticConfig.h │ ├── CSyntheticInfos.h │ ├── CSyntheticManager.h │ └── CSyntheticMarketData.h └── toolkit.h ├── languages ├── CPP │ └── XAPI_CPP │ │ ├── ReadMe.txt │ │ ├── XAPI_CPP.cbp │ │ ├── XAPI_CPP.cpp │ │ ├── XAPI_CPP.vcxproj │ │ ├── XAPI_CPP.vcxproj.filters │ │ ├── XApiC.cpp │ │ ├── XApiCpp.cpp │ │ ├── XApiImpl.cpp │ │ ├── XApiImpl.h │ │ ├── dllmain.cpp │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h ├── CSharp │ ├── XAPI_COM │ │ ├── COM │ │ │ ├── ClassFactoryBase.cs │ │ │ ├── Delegate.cs │ │ │ ├── GarbageCollection.cs │ │ │ ├── IClassFactory.cs │ │ │ ├── IXApi.cs │ │ │ ├── IXApiEvents.cs │ │ │ ├── ManagedCOMLocalServer.cs │ │ │ ├── SimpleCOMObject.cs │ │ │ ├── Struct.cs │ │ │ ├── XApiCom.cs │ │ │ └── XApiCom.resx │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── XAPI.snk │ │ └── XAPI_COM.csproj │ ├── XAPI_CSharp.sln │ └── XAPI_CSharp │ │ ├── Callback │ │ ├── BaseApi.cs │ │ ├── XApi.HistoricalData.cs │ │ ├── XApi.Instrument.cs │ │ ├── XApi.MarketData.cs │ │ ├── XApi.Query.cs │ │ ├── XApi.QuoteRequest.cs │ │ ├── XApi.Trade.cs │ │ └── XApi.cs │ │ ├── Delegate.cs │ │ ├── DllInvoke.cs │ │ ├── Enum.cs │ │ ├── Event │ │ ├── EventArgs.cs │ │ └── XApiWrapper.cs │ │ ├── Extensions.cs │ │ ├── GB2312Marshaler.cs │ │ ├── Helper.cs │ │ ├── IObjectSafety.cs │ │ ├── IXApi.cs │ │ ├── IXSpi.cs │ │ ├── InvokeBase.cs │ │ ├── OptimizedEnum.cs │ │ ├── PInvokeUtility.cs │ │ ├── PositionFieldEx.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Proxy.cs │ │ ├── QueryType.cs │ │ ├── RequestType.cs │ │ ├── ResponseType.cs │ │ ├── SoInvoke.cs │ │ ├── Struct.cs │ │ ├── XAPI_CSharp.csproj │ │ └── XApiHelper.cs ├── Java │ ├── README.md │ ├── XAPI.h │ ├── XAPI.jar │ └── jnaerator.bat ├── MATLAB │ ├── COM │ │ ├── BuyLimit.m │ │ ├── CTP_Connect.m │ │ ├── CancelOrders.m │ │ ├── OnMdConnectionStatus.m │ │ ├── OnRspQryInstrument.m │ │ ├── OnRspQryInvestorPosition.m │ │ ├── OnRspQryOrder.m │ │ ├── OnRspQrySettlementInfo.m │ │ ├── OnRspQryTradingAccount.m │ │ ├── OnRtnDepthMarketData.m │ │ ├── OnRtnOrder.m │ │ ├── OnTdConnectionStatus.m │ │ ├── ReqQryInstrument.m │ │ ├── ReqQryInvestorPosition.m │ │ ├── ReqQryOrder.m │ │ ├── ReqQrySettlementInfo.m │ │ ├── ReqQryTradingAccount.m │ │ ├── SellLimit.m │ │ ├── SetWait.m │ │ ├── Wait.m │ │ ├── mycallbacks.m │ │ ├── object_2_table.m │ │ └── test_CTP.m │ ├── DotNET │ │ ├── BuyLimit.m │ │ ├── KSInterB2C.lkc │ │ ├── NLog.dll │ │ ├── OnMdConnectionStatus.m │ │ ├── OnRtnDepthMarketData.m │ │ ├── OnRtnOrder.m │ │ ├── OnTdConnectionStatus.m │ │ ├── test_CTP.m │ │ └── test_Kingstar.m │ └── README.md ├── Python │ ├── MyXSpi.py │ ├── README.md │ ├── config.py │ ├── config_default.py │ ├── config_override.py │ ├── fix_stock_table.py │ ├── mail.py │ ├── runme.bat │ ├── runme_auto1.bat │ ├── runme_auto2.bat │ ├── runme_auto3.bat │ ├── test_ctp │ │ └── 某用户 │ │ │ ├── config_ctp.py │ │ │ ├── incremental_position.csv │ │ │ ├── portfolio_1.csv │ │ │ ├── portfolio_2.csv │ │ │ ├── portfolio_3.csv │ │ │ ├── runme.bat │ │ │ ├── runme_auto.bat │ │ │ └── target_position.csv │ ├── test_ctp_api.py │ ├── test_ctp_sopt │ │ └── 某用户 │ │ │ └── config_ctp.py │ ├── test_ctp_sopt_api.py │ ├── xapi │ │ ├── XApi.py │ │ ├── XDataType.py │ │ ├── XEnum.py │ │ ├── XQueueEnum.py │ │ ├── XSpi.py │ │ ├── XStruct.py │ │ ├── __init__.py │ │ ├── symbol.py │ │ └── utils.py │ └── 流程说明.txt └── Server │ ├── README.md │ ├── __init__.py │ ├── app │ ├── __init__.py │ ├── api │ │ ├── __init__.py │ │ ├── events.py │ │ ├── history_mongo.py │ │ └── spi.py │ ├── main │ │ ├── __init__.py │ │ ├── events.py │ │ ├── forms.py │ │ └── routes.py │ ├── socketio_queue.py │ └── templates │ │ ├── chat.html │ │ └── index.html │ ├── config.py │ ├── config_sim.py │ ├── config_sim_se.py │ ├── logging.yaml │ ├── requirements.txt │ ├── setup_logging.py │ ├── td_spi.py │ ├── test.txt │ ├── xapi_sio_server.py │ └── xapi_td_downloader.py ├── tests ├── COM │ ├── TEST.vbs │ ├── TEST2.vbs │ ├── TEST_JS.htm │ ├── TEST_VBS.htm │ ├── reg │ │ ├── RegCOM_exe.bat │ │ ├── clear_InprocServer32.reg │ │ └── clear_LocalServer32.reg │ ├── wscript.exe │ └── 注册COM组件的方法.txt └── CPP │ ├── CPP_TEST.cpp │ ├── CPP_TEST.vcxproj │ ├── CPP_TEST.vcxproj.filters │ ├── Makefile │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h └── tools └── FakeAPI ├── FakeAPI.cpp ├── FakeAPI.rc ├── FakeAPI.vcxproj ├── FakeAPI.vcxproj.filters ├── README.md ├── ReadMe.txt ├── SecurityFtdcTraderApi.cpp ├── StockDrv.cpp ├── StockDrv.h ├── ThostFtdcTraderApi.cpp ├── ThostFtdcTraderApi_SE.cpp ├── ZQThostFtdcTraderApi.cpp ├── dllmain.cpp ├── export.def ├── resource.h ├── stdafx.cpp ├── stdafx.h └── targetver.h /CopyApiDll.bat: -------------------------------------------------------------------------------- 1 | REM 32位调试版 2 | xcopy "include\Tdx\win32\*.*" "bin\Debug\x86\Tdx" /Y 3 | xcopy "include\CTP\win32\*.dll" "bin\Debug\x86\CTP" /Y 4 | xcopy "include\Kingstar\win32\*.*" "bin\Debug\x86\Kingstar" /Y 5 | xcopy "include\LTS_v2\win32\*.dll" "bin\Debug\x86\LTS_v2" /Y 6 | xcopy "include\UFX\win32\*.*" "bin\Debug\x86\UFX" /Y 7 | xcopy "include\Wind\win32\*.dll" "bin\Debug\x86\Wind" /Y 8 | xcopy "include\Sgit\win32\*.dll" "bin\Debug\x86\Sgit" /Y 9 | xcopy "include\CTP_SOPT\win32\*.dll" "bin\Debug\x86\CTP_SOPT" /Y 10 | xcopy "include\ATP\win32\*.dll" "bin\Debug\x86\ATP" /Y 11 | xcopy "include\CTPZQ\win32\*.dll" "bin\Debug\x86\CTPZQ" /Y 12 | xcopy "include\CTP_SE\win32\*.dll" "bin\Debug\x86\CTP_SE" /Y 13 | 14 | REM 32位发布版 15 | xcopy "include\Tdx\win32\*.*" "bin\Release\x86\Tdx" /Y 16 | xcopy "include\CTP\win32\*.dll" "bin\Release\x86\CTP" /Y 17 | xcopy "include\Kingstar\win32\*.*" "bin\Release\x86\Kingstar" /Y 18 | xcopy "include\LTS_v2\win32\*.dll" "bin\Release\x86\LTS_v2" /Y 19 | xcopy "include\UFX\win32\*.*" "bin\Release\x86\UFX" /Y 20 | xcopy "include\Wind\win32\*.dll" "bin\Release\x86\Wind" /Y 21 | xcopy "include\Sgit\win32\*.dll" "bin\Release\x86\Sgit" /Y 22 | xcopy "include\CTP_SOPT\win32\*.dll" "bin\Release\x86\CTP_SOPT" /Y 23 | xcopy "include\ATP\win32\*.dll" "bin\Release\x86\ATP" /Y 24 | xcopy "include\CTPZQ\win32\*.dll" "bin\Release\x86\CTPZQ" /Y 25 | 26 | REM 64位调试版 27 | xcopy "include\CTP\win64\*.dll" "bin\Debug64\x64\CTP" /Y 28 | xcopy "include\CTP_SE\win64\*.dll" "bin\Debug64\x64\CTP_SE" /Y 29 | 30 | REM 64位发布版 31 | xcopy "include\CTP\win64\*.dll" "bin\Release64\x64\CTP" /Y 32 | 33 | pause -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2020, QuantBox 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD License -------------------------------------------------------------------------------- /Synthetic.md: -------------------------------------------------------------------------------- 1 | # 指数合成说明 2 | 3 | ## 需求 4 | * 部分用户有使用指数来驱动,下单到主力的需求。使用指数驱动的好处是数据波动小 5 | * 这里提供了通过配置文件生成合成行情的功能,目前所有CTP和仿CTP接口都支持此功能 6 | 7 | ## 使用方法 8 | 1. 第一次调用时自动在CTP_Quote_x86.dll下生成Synthetic.json 9 | 2. 编辑此json文件,格式严格不能有误,然后重新启动 10 | 3. 订阅json文件中设置好的合成合约即可收到行情。 11 | 4. 默认是成份合约的行情都到达才能合成新的行情,由于CTP对于很不活跃的合约在初次订阅时也会推送一条行情。而没有这个机制的API在这个功能下会遇到问题。 12 | 13 | ## 格式说明 14 | 1. Symbol:合成合约代码。用于上层接口调用 15 | 2. Method:所使用的算法 16 | 3. Emits: 触发行情的合约数组,为空则任意成份合约行情过来都触发。出于效率考虑,只保留一个主力合约最合适 17 | 4. Legs: 成份合约和权重 18 | 19 | ## 算法说明 20 | 1. OpenInterest:持仓量加权。Legs中的权重参数被忽略。大部分品种的指数是使用的此方法,如IF000 21 | 2. Weight:权重法。权重参数可以任意设置,但在这里一般是让权重和等于1。如南华商品指数 22 | 3. Spread:价差法。算法与Weight法一样,但多加了买卖一价和买卖一量的计算。参数一般会有正有负,权重之和也不会等于1了 23 | 4. Copy:复制法。纯粹是给合约换个名,所以权重参数被忽略。如IF888这种主力合约行情 -------------------------------------------------------------------------------- /apis/ATP_Quote/Include.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/ATP_Quote/Include.h -------------------------------------------------------------------------------- /apis/ATP_Quote/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/ATP_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // ATP_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/ATP_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /apis/ATP_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/ATP_Trade/Include.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define API_VERSION "0.1.0.20170722" 9 | #define API_NAME "ATP" 10 | #define DLL_PUBLIC_KEY "30819D300D06092A864886F70D010101050003818B0030818702818100A5CE42E5AA1A873D797C8E7F4618070A746E218ED3C7A739C3772FF85960A56BF29C0FD2BBBB3124CE58231BB89C72009A4FDEC28D56FFF557BE855412F8F32BC5A57873C70599A8E19B61746F52BCBAC910588D4C021E8FCF6FF275100C71EF0082F7D9465D9F2408D2962B73D2B119BDEB10B9E17D0F8BB75BEEDD57EE6561020111" 11 | 12 | #include "../../include/ATP/ThostFtdcUserApiDataType.h" 13 | #include "../../include/ATP/ThostFtdcUserApiStruct.h" 14 | #include "../../include/ATP/ThostFtdcTraderApi.h" 15 | 16 | #ifdef _WIN64 17 | #pragma comment(lib, "../../include/ATP/win64/thosttraderapi.lib") 18 | #ifdef _DEBUG 19 | #pragma comment(lib, "../../lib/Queue_x64d.lib") 20 | #else 21 | #pragma comment(lib, "../../lib/Queue_x64.lib") 22 | #endif 23 | #else 24 | #pragma comment(lib, "../../include/ATP/win32/thosttraderapi.lib") 25 | #ifdef _DEBUG 26 | #pragma comment(lib, "../../lib/Queue_x86d.lib") 27 | #else 28 | #pragma comment(lib, "../../lib/Queue_x86.lib") 29 | #endif 30 | #endif 31 | 32 | // 条件编译 33 | #include "../CTP/include_pub.h" 34 | 35 | #undef USE_LONG_ORDER_REF 36 | #undef HAS_ExchangeID_Position 37 | #undef HAS_ExchangeID_Order 38 | #undef HAS_ExchangeID_Quote 39 | #undef HAS_ExchangeID_Quote_ForQuoteSysID -------------------------------------------------------------------------------- /apis/ATP_Trade/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/ATP_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // ATP_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/ATP_Trade/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /apis/ATP_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/CTP/CServerConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct ServerItem 10 | { 11 | bool IsUsingUdp = false; 12 | bool IsMulticast = false; 13 | ///经纪商ID 14 | string BrokerID; 15 | ///产品信息 16 | string UserProductInfo; 17 | ///授权码 18 | string AuthCode; 19 | ///App代码 20 | string AppID; 21 | ///地址信息 22 | list Address; 23 | 24 | map ResumeType; 25 | }; 26 | 27 | class CServerConfig 28 | { 29 | public: 30 | void WriteMd(const char* filename, ServerItem* pItem); 31 | void WriteTd(const char* filename, ServerItem* pItem); 32 | ServerItem ReadMd(const char* filename); 33 | ServerItem ReadTd(const char* filename); 34 | 35 | void WriteMdDefault(const char* filename); 36 | void WriteTdDefault(const char* filename); 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /apis/CTP/CUserConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct UserItem 10 | { 11 | ///用户名 12 | string UserID; 13 | ///密码 14 | string Password; 15 | }; 16 | 17 | class CUserConfig 18 | { 19 | public: 20 | void WriteDefault(const char* filename); 21 | void Write(const char* filename, UserItem* pItem); 22 | UserItem Read(const char* filename); 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /apis/CTP/Makefile: -------------------------------------------------------------------------------- 1 | ALL=libQuantBox_CTP_Quote.so libQuantBox_CTP_Trade.so 2 | include ../../Makefile.global 3 | 4 | DEPS=../../include/toolkit.o \ 5 | ../../include/ApiProcess.o 6 | 7 | LFLAGS=-Wl,-rpath,\$$ORIGIN -ldl -L../../include/CTP/linux64 -L../../common/Queue -lQueue 8 | 9 | libQuantBox_CTP_Quote.so: Quote/main.cpp Quote/MdUserApi.cpp TypeConvert.cpp $(DEPS) 10 | $(CXX) --shared $(IFLAGS) $(LFLAGS) $(CFLAGS) -lthostmduserapi -I../CTP_Quote -o $@ $^ 11 | libQuantBox_CTP_Trade.so: Trade/main.cpp Trade/TraderApi.cpp TypeConvert.cpp $(DEPS) 12 | $(CXX) --shared $(IFLAGS) $(LFLAGS) $(CFLAGS) -lthosttraderapi -I../CTP_Trade -o $@ $^ 13 | 14 | -------------------------------------------------------------------------------- /apis/CTP/README.md: -------------------------------------------------------------------------------- 1 | # CTP兼容统一封装 2 | 3 | ##介绍 4 | Kingstar\UFT\XSpeed都有CTP兼容的接口,所以将公共部分写一起,应当以后要移植就更快了 5 | 6 | ##操作 7 | 每个项目有自己特殊的Inluce.h,然后再设置Include目录即可 8 | 9 | -------------------------------------------------------------------------------- /apis/CTP/TypeConvert.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/CTP/TypeConvert.h -------------------------------------------------------------------------------- /apis/CTP/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/CTP/include_pub.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | // 条件编译 9 | 10 | // 使用长报单引用,飞鼠的12位前需要补0 11 | #define USE_LONG_ORDER_REF 1 12 | // 是否有做市商报价功能 13 | #define HAS_Quote 1 14 | #define HAS_Account_Future 1 15 | #define HAS_InstrumentStatus 1 16 | #define HAS_Settlement 1 17 | #define HAS_TradingDay_UserLogin 1 18 | #define CreateFtdcMdApi_argc_3 1 19 | #define SubscribeMarketData_argc_2 1 20 | 21 | #define HAS_ExchangeID_Position 1 22 | #define HAS_ExchangeID_Order 1 23 | #define HAS_ExchangeID_Quote 1 24 | #define HAS_ExchangeID_Quote_ForQuoteSysID 1 25 | 26 | //使用穿透试认证 27 | #define USE_APP_ID 1 28 | #undef USE_APP_ID 29 | 30 | -------------------------------------------------------------------------------- /apis/CTPZQ_Quote/CTPZQ_Quote.cpp: -------------------------------------------------------------------------------- 1 | // CTPZQ_Quote.cpp : Defines the exported functions for the DLL application. 2 | // 3 | 4 | #include "stdafx.h" 5 | 6 | 7 | -------------------------------------------------------------------------------- /apis/CTPZQ_Quote/Include.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define API_VERSION "0.1.0.20170921" 9 | #define API_NAME "CTPZQ" 10 | #define DLL_PUBLIC_KEY "" 11 | 12 | // 由于CTPZQ与CTP各种类型定义不一样,所以重新定义一下 13 | #include "Redefine.h" 14 | 15 | #include "../../include/CrossPlatform.h" 16 | #include "../../include/CTPZQ/ZQThostFtdcUserApiDataType.h" 17 | #include "../../include/CTPZQ/ZQThostFtdcUserApiStruct.h" 18 | #include "../../include/CTPZQ/ZQThostFtdcMdApi.h" 19 | 20 | #ifndef USE_CMAKE 21 | #ifdef _WIN64 22 | #pragma comment(lib, "../../include/CTPZQ/win64/zqthostmdapi.lib") 23 | #else 24 | #pragma comment(lib, "../../include/CTPZQ/win32/zqthostmdapi.lib") 25 | #endif 26 | #endif 27 | 28 | 29 | // 条件编译 30 | #include "../CTP/include_pub.h" 31 | 32 | #undef HAS_TradingDay_UserLogin 33 | #undef HAS_Quote 34 | #undef CreateFtdcMdApi_argc_3 35 | #undef SubscribeMarketData_argc_2 36 | -------------------------------------------------------------------------------- /apis/CTPZQ_Quote/Redefine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/CTPZQ_Quote/Redefine.h -------------------------------------------------------------------------------- /apis/CTPZQ_Quote/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/CTPZQ_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // CTPZQ_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/CTPZQ_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /apis/CTPZQ_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/CTPZQ_Trade/CTPZQ_Trade.cpp: -------------------------------------------------------------------------------- 1 | // CTPZQ_Trade.cpp : Defines the exported functions for the DLL application. 2 | // 3 | 4 | #include "stdafx.h" 5 | 6 | 7 | -------------------------------------------------------------------------------- /apis/CTPZQ_Trade/Include.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define API_VERSION "0.1.0.20170921" 9 | #define API_NAME "CTPZQ" 10 | #define DLL_PUBLIC_KEY "" 11 | 12 | // 由于CTPZQ与CTP各种类型定义不一样,所以重新定义一下 13 | #include "../CTPZQ_Quote/Redefine.h" 14 | 15 | #include "../../include/CrossPlatform.h" 16 | #include "../../include/CTPZQ/ZQThostFtdcUserApiDataType.h" 17 | #include "../../include/CTPZQ/ZQThostFtdcUserApiStruct.h" 18 | #include "../../include/CTPZQ/ZQThostFtdcTraderApi.h" 19 | 20 | #ifndef USE_CMAKE 21 | #ifdef _WIN64 22 | #pragma comment(lib, "../../include/CTPZQ/win64/zqthosttraderapi.lib") 23 | #else 24 | #pragma comment(lib, "../../include/CTPZQ/win32/zqthosttraderapi.lib") 25 | #endif 26 | #endif 27 | 28 | // 条件编译 29 | #include "../CTP/include_pub.h" 30 | 31 | #undef HAS_Quote 32 | #undef HAS_Account_Future 33 | #undef HAS_TradingDay_UserLogin 34 | #undef HAS_InstrumentStatus 35 | #undef HAS_Settlement 36 | #undef USE_LONG_ORDER_REF 37 | -------------------------------------------------------------------------------- /apis/CTPZQ_Trade/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/CTPZQ_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // CTPZQ_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/CTPZQ_Trade/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /apis/CTPZQ_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/CTP_SE_Quote/Include.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/CTP_SE_Quote/Include.h -------------------------------------------------------------------------------- /apis/CTP_SE_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_CTP_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/CTP_SE_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined 24 | -------------------------------------------------------------------------------- /apis/CTP_SE_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/CTP_SE_Trade/Include.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define API_VERSION "0.4.0.20190418" 9 | #define API_NAME "CTP_SE" 10 | #define DLL_PUBLIC_KEY "30819D300D06092A864886F70D010101050003818B0030818702818100A5411C1BAC072723B8EC84F609B88DF913308C6B38D2F304B4285AA290686888D05D731793AD30342E8917ACC57AF8DA4976877AC1B701A664EDEB668B14027F5ED4A96A61DA00AB0208E3E7DD4C8249E88B7A3BA511C7C082979B23AA1876ED2B7A77BB1A405D15B164E586431CD3ECFB3E448A193A41BA21C34A659196C353020111" 11 | 12 | #include "../../include/CrossPlatform.h" 13 | #include "../../include/CTP_SE/ThostFtdcUserApiDataType.h" 14 | #include "../../include/CTP_SE/ThostFtdcUserApiStruct.h" 15 | #include "../../include/CTP_SE/ThostFtdcTraderApi.h" 16 | 17 | #ifndef USE_CMAKE 18 | #ifdef _WIN64 19 | #pragma comment(lib, "../../include/CTP_SE/win64/thosttraderapi_se.lib") 20 | #else 21 | #pragma comment(lib, "../../include/CTP_SE/win32/thosttraderapi_se.lib") 22 | #endif 23 | #endif 24 | 25 | // 条件编译 26 | #include "../CTP/include_pub.h" 27 | 28 | // #undef HAS_ExchangeID_Position 29 | #undef USE_LONG_ORDER_REF 30 | #define USE_APP_ID 1 31 | -------------------------------------------------------------------------------- /apis/CTP_SE_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_CTP_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/CTP_SE_Trade/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined 24 | -------------------------------------------------------------------------------- /apis/CTP_SE_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/CTP_SOPT_SE_Quote/Include.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/CTP_SOPT_SE_Quote/Include.h -------------------------------------------------------------------------------- /apis/CTP_SOPT_SE_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_CTP_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/CTP_SOPT_SE_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined 24 | -------------------------------------------------------------------------------- /apis/CTP_SOPT_SE_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/CTP_SOPT_SE_Trade/Include.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define API_VERSION "0.2.0.20200916" 9 | #define API_NAME "CTP_SOPT_SE" 10 | #define DLL_PUBLIC_KEY "0" 11 | 12 | #include "../../include/CrossPlatform.h" 13 | #include "../../include/CTP_SOPT_SE/ThostFtdcUserApiDataType.h" 14 | #include "../../include/CTP_SOPT_SE/ThostFtdcUserApiStruct.h" 15 | #include "../../include/CTP_SOPT_SE/ThostFtdcTraderApi.h" 16 | 17 | using namespace ctp_sopt; 18 | 19 | #ifndef USE_CMAKE 20 | #ifdef _WIN64 21 | #pragma comment(lib, "../../include/CTP_SOPT_SE/win64/soptthosttraderapi_se.lib") 22 | #else 23 | #pragma comment(lib, "../../include/CTP_SOPT_SE/win32/soptthosttraderapi_se.lib") 24 | #endif 25 | #endif 26 | 27 | // 条件编译 28 | #include "../CTP/include_pub.h" 29 | 30 | // #undef HAS_ExchangeID_Position 31 | #undef USE_LONG_ORDER_REF 32 | #define USE_APP_ID 1 33 | -------------------------------------------------------------------------------- /apis/CTP_SOPT_SE_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_CTP_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/CTP_SOPT_SE_Trade/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined 24 | -------------------------------------------------------------------------------- /apis/CTP_SOPT_SE_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/Kingstar_Quote/Include.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define API_VERSION "0.3.0.20151216" 9 | #define API_NAME "Kingstar" 10 | #define DLL_PUBLIC_KEY "" 11 | 12 | #include "../../include/CrossPlatform.h" 13 | #include "../../include/Kingstar/IncEx/KSUserApiDataTypeEx.h" 14 | #include "../../include/Kingstar/IncEx/KSUserApiStructEx.h" 15 | #include "../../include/Kingstar/inc/KSMarketDataAPI.h" 16 | 17 | using namespace KingstarAPI; 18 | 19 | #ifndef USE_CMAKE 20 | #ifdef _WIN64 21 | #pragma comment(lib, "../../include/Kingstar/win64/KSMarketDataAPI.lib") 22 | #else 23 | #pragma comment(lib, "../../include/Kingstar/win32/KSMarketDataAPI.lib") 24 | #endif 25 | #endif 26 | 27 | // 为了解决金仕达授权问题而加的功能 28 | #define KS_LKC_FILENAME "KSInterB2C" 29 | #define KS_LKC_EXT "lkc" 30 | 31 | #define KS_COPYFILE 1 32 | 33 | // 条件编译 34 | #include "../CTP/include_pub.h" 35 | -------------------------------------------------------------------------------- /apis/Kingstar_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // Kingstar_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/Kingstar_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /apis/Kingstar_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/Kingstar_Trade/Include.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define API_VERSION "0.3.0.20151216" 9 | #define API_NAME "Kingstar" 10 | #define DLL_PUBLIC_KEY "" 11 | 12 | #include "../../include/CrossPlatform.h" 13 | #include "../../include/Kingstar/IncEx/KSUserApiDataTypeEx.h" 14 | #include "../../include/Kingstar/IncEx/KSUserApiStructEx.h" 15 | #include "../../include/Kingstar/inc/KSTradeAPI.h" 16 | 17 | using namespace KingstarAPI; 18 | 19 | #ifndef USE_CMAKE 20 | #ifdef _WIN64 21 | #pragma comment(lib, "../../include/Kingstar/win64/KSTradeAPI.lib") 22 | #else 23 | #pragma comment(lib, "../../include/Kingstar/win32/KSTradeAPI.lib") 24 | #endif 25 | #endif 26 | 27 | // 为了解决金仕达授权问题而加的功能 28 | #define KS_LKC_FILENAME "KSInterB2C" 29 | #define KS_LKC_EXT "lkc" 30 | 31 | #define KS_COPYFILE 1 32 | 33 | // 条件编译 34 | #include "../CTP/include_pub.h" 35 | 36 | #undef USE_LONG_ORDER_REF 37 | -------------------------------------------------------------------------------- /apis/Kingstar_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // Kingstar_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/Kingstar_Trade/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /apis/Kingstar_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/LTS_Query_v2/QueryApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/LTS_Query_v2/QueryApi.h -------------------------------------------------------------------------------- /apis/LTS_Query_v2/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/LTS_Query_v2/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_LTS_Query_v2.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/LTS_Query_v2/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /apis/LTS_Query_v2/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/LTS_Quote_v2/MdUserApi.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/LTS_Quote_v2/MdUserApi.cpp -------------------------------------------------------------------------------- /apis/LTS_Quote_v2/MdUserApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/LTS_Quote_v2/MdUserApi.h -------------------------------------------------------------------------------- /apis/LTS_Quote_v2/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/LTS_Quote_v2/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_LTS_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/LTS_Quote_v2/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined 24 | -------------------------------------------------------------------------------- /apis/LTS_Quote_v2/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/LTS_Trade_v2/TypeConvert.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/LTS_Trade_v2/TypeConvert.cpp -------------------------------------------------------------------------------- /apis/LTS_Trade_v2/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/LTS_Trade_v2/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_LTS_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/LTS_Trade_v2/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined 24 | -------------------------------------------------------------------------------- /apis/LTS_Trade_v2/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/REM_Quote/CServerConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct ServerItem 10 | { 11 | bool IsMulticast = false; 12 | // TCP行情 13 | string eqsIp; 14 | unsigned short eqsPort; 15 | // 组播行情 16 | string mcIp; 17 | unsigned short mcPort; ///< 组播端口1-65535 18 | string mcLoacalIp; ///< 本机地址 19 | unsigned short mcLocalPort; ///< 本机端口1-65535, 本机未被使用的端口号 20 | string exchangeId; ///< 交易所代码,参考EESQuoteExchangeIDType取值范围 21 | }; 22 | 23 | class CServerConfig 24 | { 25 | public: 26 | void WriteMd(const char* filename, ServerItem* pItem); 27 | ServerItem ReadMd(const char* filename); 28 | void WriteMdDefault(const char* filename); 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /apis/REM_Quote/CUserConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CUserConfig.h" 3 | 4 | #include 5 | 6 | #include "../../include/rapidjson/rapidjson.h" 7 | #include "../../include/rapidjson/document.h" 8 | #include "../../include/rapidjson/prettywriter.h" 9 | #include "../../include/rapidjson/istreamwrapper.h" 10 | #include "../../include/rapidjson/ostreamwrapper.h" 11 | 12 | using namespace std; 13 | using namespace rapidjson; 14 | 15 | void CUserConfig::Write(const char* filename, UserItem* pItem) 16 | { 17 | Document doc; 18 | doc.SetObject(); 19 | rapidjson::Document::AllocatorType& allocator = doc.GetAllocator(); 20 | 21 | doc.StartObject(); 22 | 23 | doc.AddMember("loginId", StringRef(pItem->loginId), allocator); 24 | doc.AddMember("password", StringRef(pItem->password), allocator); 25 | 26 | doc.EndObject(0); 27 | 28 | ofstream ofs(filename); 29 | OStreamWrapper osw(ofs); 30 | PrettyWriter writer(osw); 31 | doc.Accept(writer); 32 | } 33 | 34 | void CUserConfig::WriteDefault(const char* filename) 35 | { 36 | UserItem item; 37 | 38 | strcpy(item.loginId, "38662071"); 39 | strcpy(item.password, "7"); 40 | 41 | Write(filename, &item); 42 | } 43 | 44 | UserItem CUserConfig::Read(const char* filename) 45 | { 46 | ifstream ifs(filename); 47 | IStreamWrapper isw(ifs); 48 | 49 | Document doc; 50 | doc.ParseStream(isw); 51 | 52 | UserItem item; 53 | const Value& object = doc; 54 | 55 | strcpy(item.loginId, object["loginId"].GetString()); 56 | strcpy(item.password, object["password"].GetString()); 57 | 58 | return item; 59 | } 60 | -------------------------------------------------------------------------------- /apis/REM_Quote/CUserConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct UserItem 10 | { 11 | char loginId[32]; 12 | char password[32]; 13 | }; 14 | 15 | class CUserConfig 16 | { 17 | public: 18 | void WriteDefault(const char* filename); 19 | void Write(const char* filename, UserItem* pItem); 20 | UserItem Read(const char* filename); 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /apis/REM_Quote/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/REM_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // UFX_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/REM_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined -------------------------------------------------------------------------------- /apis/REM_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/REM_Trade/CProcessor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "OrderMap.h" 4 | 5 | #include "../../include/REM/EesTraderDefine.h" 6 | 7 | #include "../../include/ApiStruct.h" 8 | 9 | 10 | using namespace std; 11 | 12 | class CProcessor 13 | { 14 | public: 15 | OrderField* OnOrderAccept(EES_OrderAcceptField* pAccept, OrderField* pOrder); 16 | OrderField* OnOrderMarketAccept(EES_OrderMarketAcceptField* pAccept, OrderField* pOrder); 17 | OrderField* OnOrderReject(EES_OrderRejectField* pReject, OrderField* pOrder); 18 | OrderField* OnOrderMarketReject(EES_OrderMarketRejectField* pReject, OrderField* pOrder); 19 | TradeField* OnOrderExecution(EES_OrderExecutionField* pExec, OrderField* pOrder, TradeField* pTrade); 20 | OrderField* OnOrderCxled(EES_OrderCxled* pCxled, OrderField* pOrder); 21 | OrderField* OnCxlOrderReject(EES_CxlOrderRej* pReject, OrderField* pOrder); 22 | 23 | public: 24 | // 外部传入,不要动它 25 | COrderMap* m_pOrderMap = nullptr; 26 | mutex m_csOrderMap; 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /apis/REM_Trade/CServerConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct ServerItem 10 | { 11 | string RemoteTradeIp; 12 | unsigned short RemoteTradeTCPPort; 13 | unsigned short RemoteTradeUDPPort; 14 | 15 | string RemoteQueryIp; 16 | unsigned short RemoteQueryTCPPort; 17 | 18 | string LocalTradeIp; 19 | unsigned short LocalTradeUDPPort; 20 | 21 | string SessionMask; 22 | }; 23 | 24 | class CServerConfig 25 | { 26 | public: 27 | void WriteTd(const char* filename, ServerItem* pItem); 28 | ServerItem ReadTd(const char* filename); 29 | void WriteTdDefault(const char* filename); 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /apis/REM_Trade/CUserConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct UserItem 10 | { 11 | char user_id[32]; 12 | char user_pwd[32]; 13 | char app_id[32]; 14 | char auth_code[32]; 15 | 16 | char account_id[32]; 17 | }; 18 | 19 | class CUserConfig 20 | { 21 | public: 22 | void WriteDefault(const char* filename); 23 | void Write(const char* filename, UserItem* pItem); 24 | UserItem Read(const char* filename); 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /apis/REM_Trade/OrderMap.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/REM_Trade/OrderMap.h -------------------------------------------------------------------------------- /apis/REM_Trade/TypeConvert.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/REM_Trade/TypeConvert.cpp -------------------------------------------------------------------------------- /apis/REM_Trade/TypeConvert.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../include/ApiStruct.h" 4 | #include "../../include/REM/EesTraderDefine.h" 5 | 6 | OrderSide EES_SideType_2_OrderSide(EES_SideType m_Side); 7 | OpenCloseType EES_SideType_2_OpenCloseType(EES_SideType m_Side); 8 | EES_SideType OrderSide_OpenCloseType_2_EES_SideType(OrderSide side, OpenCloseType openclose); 9 | EES_ExchangeID ExchangeID_2_EES_ExchangeID(const char* exchange); 10 | const char* EES_ExchangeID_2_ExchangeID(EES_ExchangeID exchange); 11 | EES_HedgeFlag HedgeFlagType_2_EES_HedgeFlag(HedgeFlagType In); 12 | HedgeFlagType EES_HedgeFlag_2_HedgeFlagType(EES_HedgeFlag In); 13 | PositionSide EES_PosiDirection_2_PositionSide(EES_PosiDirection In); 14 | 15 | TradingPhaseType EES_InstrumentStatus_2_InstrumentStatus(unsigned char In); 16 | const char* EES_CxlReasonCode_2_str(EES_CxlReasonCode In); 17 | 18 | 19 | -------------------------------------------------------------------------------- /apis/REM_Trade/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/REM_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // UFX_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/REM_Trade/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined -------------------------------------------------------------------------------- /apis/REM_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/Sgit_Quote/Include.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/Sgit_Quote/Include.h -------------------------------------------------------------------------------- /apis/Sgit_Quote/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/Sgit_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // Sgit_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/Sgit_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /apis/Sgit_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/Sgit_Trade/Include.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define API_VERSION "0.1.0.20161121" 9 | #define API_NAME "Sgit" 10 | #define DLL_PUBLIC_KEY "30819D300D06092A864886F70D010101050003818B0030818702818100DD88CBCCD46787C55F942428A33ED92F1F4BE6EEDFE382E1C8350451382E7E9774942C8B1B02E12A7D34B9832D21134361F51F400E372097F5CFB71F9655EDD8F6F29EBB35D94C7502C04849485389ABD1BCA977E098327435D62413ABC56637C0638C839A2496714BEE502064DACFF621E1B5E5DA101B3BE8879988E4E8D939020111" 11 | 12 | #include "../../include/CrossPlatform.h" 13 | #include "../../include/Sgit/SgitFtdcUserApiDataType.h" 14 | #include "../../include/Sgit/SgitFtdcUserApiStruct.h" 15 | #include "../../include/Sgit/SgitFtdcTraderApi.h" 16 | 17 | using namespace fstech; 18 | 19 | #ifndef USE_CMAKE 20 | #ifdef _WIN64 21 | #pragma comment(lib, "../../include/Sgit/win64/sgittradeapi.lib") 22 | #else 23 | #pragma comment(lib, "../../include/Sgit/win32/sgittradeapi.lib") 24 | #endif 25 | #endif 26 | 27 | // 是否飞鼠API 28 | #define IS_SGIT_API 1 29 | 30 | // 条件编译 31 | #include "../CTP/include_pub.h" 32 | 33 | #undef HAS_ExchangeID_Position 34 | #undef HAS_ExchangeID_Quote 35 | -------------------------------------------------------------------------------- /apis/Sgit_Trade/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/Sgit_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // Sgit_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/Sgit_Trade/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | // BOOLEAN与asn.h中的冲突,不得不将asn.h中的改了,希望有人帮忙解决这个问题 18 | // 已经解决,移动到这就可以了 19 | #include 20 | #include 21 | #pragma comment(lib, "IPHLPAPI.lib") -------------------------------------------------------------------------------- /apis/Sgit_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/Tap_Quote/CServerConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct ServerItem 10 | { 11 | string AuthCode; 12 | 13 | string IP; 14 | unsigned short Port; 15 | 16 | }; 17 | 18 | class CServerConfig 19 | { 20 | public: 21 | void WriteMd(const char* filename, ServerItem* pItem); 22 | ServerItem ReadMd(const char* filename); 23 | void WriteMdDefault(const char* filename); 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /apis/Tap_Quote/CUserConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CUserConfig.h" 3 | 4 | #include 5 | 6 | #include "../../include/rapidjson/rapidjson.h" 7 | #include "../../include/rapidjson/document.h" 8 | #include "../../include/rapidjson/prettywriter.h" 9 | #include "../../include/rapidjson/istreamwrapper.h" 10 | #include "../../include/rapidjson/ostreamwrapper.h" 11 | 12 | using namespace std; 13 | using namespace rapidjson; 14 | 15 | void CUserConfig::Write(const char* filename, UserItem* pItem) 16 | { 17 | Document doc; 18 | doc.SetObject(); 19 | rapidjson::Document::AllocatorType& allocator = doc.GetAllocator(); 20 | 21 | doc.StartObject(); 22 | 23 | doc.AddMember("UserNo", StringRef(pItem->UserNo), allocator); 24 | doc.AddMember("Password", StringRef(pItem->Password), allocator); 25 | 26 | doc.EndObject(0); 27 | 28 | ofstream ofs(filename); 29 | OStreamWrapper osw(ofs); 30 | PrettyWriter writer(osw); 31 | doc.Accept(writer); 32 | } 33 | 34 | void CUserConfig::WriteDefault(const char* filename) 35 | { 36 | UserItem item; 37 | 38 | strcpy(item.UserNo, "UserNo"); 39 | strcpy(item.Password, "Password"); 40 | 41 | Write(filename, &item); 42 | } 43 | 44 | UserItem CUserConfig::Read(const char* filename) 45 | { 46 | ifstream ifs(filename); 47 | IStreamWrapper isw(ifs); 48 | 49 | Document doc; 50 | doc.ParseStream(isw); 51 | 52 | UserItem item; 53 | const Value& object = doc; 54 | 55 | strcpy(item.UserNo, object["UserNo"].GetString()); 56 | strcpy(item.Password, object["Password"].GetString()); 57 | 58 | return item; 59 | } 60 | -------------------------------------------------------------------------------- /apis/Tap_Quote/CUserConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct UserItem 10 | { 11 | char UserNo[21]; 12 | char Password[21]; 13 | }; 14 | 15 | class CUserConfig 16 | { 17 | public: 18 | void WriteDefault(const char* filename); 19 | void Write(const char* filename, UserItem* pItem); 20 | UserItem Read(const char* filename); 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /apis/Tap_Quote/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/Tap_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // UFX_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/Tap_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined -------------------------------------------------------------------------------- /apis/Tap_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/Tap_Trade/CProcessor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "OrderMap.h" 4 | 5 | #include "../../include/Tap/TapTradeAPIDataType.h" 6 | 7 | #include "../../include/ApiStruct.h" 8 | 9 | 10 | using namespace std; 11 | 12 | class CProcessor 13 | { 14 | public: 15 | OrderField* OnOrderAccept(const TapAPIOrderInfoNotice* pAccept, OrderField* pOrder); 16 | OrderField* OnOrderMarketAccept(const TapAPIOrderInfoNotice* pAccept, OrderField* pOrder); 17 | OrderField* OnOrderReject(const TapAPIOrderInfoNotice* pReject, OrderField* pOrder); 18 | //OrderField* OnOrderMarketReject(const TapAPIOrderInfoNotice* pReject, OrderField* pOrder); 19 | TradeField* OnOrderExecution(const TapAPIFillInfo* pExec, OrderField* pOrder, TradeField* pTrade); 20 | OrderField* OnOrderCxled(const TapAPIOrderInfoNotice* pCxled, OrderField* pOrder); 21 | //OrderField* OnCxlOrderReject(EES_CxlOrderRej* pReject, OrderField* pOrder); 22 | 23 | public: 24 | // 外部传入,不要动它 25 | COrderMap* m_pOrderMap = nullptr; 26 | mutex m_csOrderMap; 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /apis/Tap_Trade/CServerConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct ServerItem 10 | { 11 | string AuthCode; 12 | 13 | string IP; 14 | unsigned short Port; 15 | 16 | }; 17 | 18 | class CServerConfig 19 | { 20 | public: 21 | void Write(const char* filename, ServerItem* pItem); 22 | ServerItem Read(const char* filename); 23 | void WriteDefault(const char* filename); 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /apis/Tap_Trade/CUserConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | struct UserItem 10 | { 11 | char UserNo[21]; 12 | char Password[21]; 13 | char AuthCode[51]; 14 | char AppID[31]; 15 | char NewPassword[31]; 16 | char ISModifyPassword; 17 | }; 18 | 19 | class CUserConfig 20 | { 21 | public: 22 | void WriteDefault(const char* filename); 23 | void Write(const char* filename, UserItem* pItem); 24 | UserItem Read(const char* filename); 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /apis/Tap_Trade/OrderMap.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/Tap_Trade/OrderMap.h -------------------------------------------------------------------------------- /apis/Tap_Trade/TypeConvert.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/Tap_Trade/TypeConvert.cpp -------------------------------------------------------------------------------- /apis/Tap_Trade/TypeConvert.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../include/ApiStruct.h" 4 | #include "../../include/Tap/TapTradeAPIDataType.h" 5 | 6 | OrderSide TAPISideType_2_OrderSide(TAPISideType In); 7 | TAPISideType OrderSide_2_TAPISideType(OrderSide In); 8 | 9 | OpenCloseType TAPIPositionEffectType_2_OpenCloseType(TAPIPositionEffectType In); 10 | TAPIPositionEffectType OpenCloseType_2_TAPIPositionEffectType(OpenCloseType In); 11 | 12 | //TAPIOrderStateType OrderStatus_2_TAPIOrderStateType(OrderStatus In); 13 | OrderStatus TAPIOrderStateType_2_OrderStatus(TAPIOrderStateType In); 14 | 15 | TradingPhaseType TAPITradingStateType_2_InstrumentStatus(TAPITradingStateType In); 16 | 17 | const char* ExchangeNo_2_ExchangeID(const char* In); 18 | const char* ExchangeID_2_ExchangeNo(const char* In); 19 | 20 | //OpenCloseType EES_SideType_2_OpenCloseType(EES_SideType m_Side); 21 | //EES_SideType OrderSide_OpenCloseType_2_EES_SideType(OrderSide side, OpenCloseType openclose); 22 | //EES_ExchangeID ExchangeID_2_EES_ExchangeID(const char* exchange); 23 | //const char* EES_ExchangeID_2_ExchangeID(EES_ExchangeID exchange); 24 | TAPIHedgeFlagType HedgeFlagType_2_TAPIHedgeFlagType(HedgeFlagType In); 25 | HedgeFlagType TAPIHedgeFlagType_2_HedgeFlagType(TAPIHedgeFlagType In); 26 | PositionSide TAPISideType_2_PositionSide(TAPISideType In); 27 | // 28 | //TradingPhaseType EES_InstrumentStatus_2_InstrumentStatus(unsigned char In); 29 | //const char* EES_CxlReasonCode_2_str(EES_CxlReasonCode In); 30 | 31 | 32 | -------------------------------------------------------------------------------- /apis/Tap_Trade/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/Tap_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // UFX_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/Tap_Trade/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined -------------------------------------------------------------------------------- /apis/Tap_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/TongShi_Quote/DialogStockDrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | class CMdUserApi; 5 | // CDialogStockDrv dialog 6 | 7 | class CDialogStockDrv : public CDialogEx 8 | { 9 | DECLARE_DYNAMIC(CDialogStockDrv) 10 | 11 | public: 12 | LONG OnTSDataDriver(UINT wParam, LONG lParam); 13 | 14 | CDialogStockDrv(CWnd* pParent = NULL); // standard constructor 15 | virtual ~CDialogStockDrv(); 16 | 17 | // Dialog Data 18 | enum { IDD = IDD_DIALOG_STOCKDRV }; 19 | 20 | protected: 21 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 22 | 23 | DECLARE_MESSAGE_MAP() 24 | public: 25 | virtual BOOL OnInitDialog(); 26 | CMdUserApi* m_pUserApi; 27 | afx_msg void OnClose(); 28 | }; 29 | -------------------------------------------------------------------------------- /apis/TongShi_Quote/MdUserApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/TongShi_Quote/MdUserApi.h -------------------------------------------------------------------------------- /apis/TongShi_Quote/Stockdrv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/TongShi_Quote/Stockdrv.h -------------------------------------------------------------------------------- /apis/TongShi_Quote/TongShi_Quote.h: -------------------------------------------------------------------------------- 1 | // TongShi_Quote.h : main header file for the TongShi_Quote DLL 2 | // 3 | 4 | #pragma once 5 | 6 | #ifndef __AFXWIN_H__ 7 | #error "include 'stdafx.h' before including this file for PCH" 8 | #endif 9 | 10 | #include "resource.h" // main symbols 11 | 12 | // CTongShi_QuoteApp 13 | // See TongShi_Quote.cpp for the implementation of this class 14 | // 15 | 16 | class CTongShi_QuoteApp : public CWinApp 17 | { 18 | public: 19 | CTongShi_QuoteApp(); 20 | 21 | // Overrides 22 | public: 23 | virtual BOOL InitInstance(); 24 | 25 | DECLARE_MESSAGE_MAP() 26 | }; 27 | -------------------------------------------------------------------------------- /apis/TongShi_Quote/TongShi_Quote.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/TongShi_Quote/TongShi_Quote.rc -------------------------------------------------------------------------------- /apis/TongShi_Quote/TypeConvert.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/TongShi_Quote/TypeConvert.cpp -------------------------------------------------------------------------------- /apis/TongShi_Quote/TypeConvert.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Stockdrv.h" 5 | #include "../../include/ApiStruct.h" 6 | 7 | ExchangeType Market_2_ExchangeType(WORD In); 8 | char* Market_2_ExchangeID(WORD In); 9 | char* OldSymbol_2_NewSymbol(char* In, WORD In2); 10 | 11 | -------------------------------------------------------------------------------- /apis/TongShi_Quote/res/TongShi_Quote.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/TongShi_Quote/res/TongShi_Quote.rc2 -------------------------------------------------------------------------------- /apis/TongShi_Quote/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/TongShi_Quote/resource.h -------------------------------------------------------------------------------- /apis/TongShi_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // TongShi_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | 8 | -------------------------------------------------------------------------------- /apis/TongShi_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | 5 | #pragma once 6 | 7 | #ifndef VC_EXTRALEAN 8 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 9 | #endif 10 | 11 | #include "targetver.h" 12 | 13 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 14 | 15 | #include // MFC core and standard components 16 | #include // MFC extensions 17 | 18 | #ifndef _AFX_NO_OLE_SUPPORT 19 | #include // MFC OLE classes 20 | #include // MFC OLE dialog classes 21 | #include // MFC Automation classes 22 | #endif // _AFX_NO_OLE_SUPPORT 23 | 24 | #ifndef _AFX_NO_DB_SUPPORT 25 | #include // MFC ODBC database classes 26 | #endif // _AFX_NO_DB_SUPPORT 27 | 28 | #ifndef _AFX_NO_DAO_SUPPORT 29 | #include // MFC DAO database classes 30 | #endif // _AFX_NO_DAO_SUPPORT 31 | 32 | #ifndef _AFX_NO_OLE_SUPPORT 33 | #include // MFC support for Internet Explorer 4 Common Controls 34 | #endif 35 | #ifndef _AFX_NO_AFXCMN_SUPPORT 36 | #include // MFC support for Windows Common Controls 37 | #endif // _AFX_NO_AFXCMN_SUPPORT 38 | #include -------------------------------------------------------------------------------- /apis/TongShi_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/UFX_Trade/O32/TypeConvert_o32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "../../../include/ApiStruct.h" 5 | 6 | #include "ufx_enum_o32.h" 7 | #include "ufx_struct_o32.h" 8 | 9 | p_entrust_direction OrderSide_2_entrust_direction(OrderSide In); 10 | p_entrust_direction OrderSide_2_entrust_direction_HG(OrderSide In); 11 | OrderSide entrust_direction_2_OrderSide(_entrust_direction In); 12 | OpenCloseType entrust_direction_2_OpenCloseType(_entrust_direction In); 13 | 14 | _futures_direction OpenCloseType_2_futures_direction(OpenCloseType In); 15 | OpenCloseType futures_direction_2_OpenCloseType(_futures_direction In); 16 | _close_direction OpenCloseType_2_close_direction(OpenCloseType In); 17 | 18 | OrderStatus entrust_state_2_OrderStatus(_entrust_state In); 19 | ExecType entrust_state_2_ExecType(_entrust_state In); 20 | 21 | ExchangeType market_no_2_ExchangeType(_market_no In); 22 | BusinessType market_no_2_BusinessType(_market_no In); 23 | 24 | PositionSide position_flag_2_PositionSide(_position_flag In); 25 | 26 | void OrderField_2_REQ_QHWT_91004(RSP_DL_10001* pRspUserLogin, OrderField* pIn, REQ_QHWT_91004* pOut); 27 | void OrderField_2_REQ_PTMMWT_91001(RSP_DL_10001* pRspUserLogin, OrderField* pIn, REQ_PTMMWT_91001* pOut); 28 | 29 | 30 | 31 | const char* risk_operation_2_String(_risk_operation In); 32 | -------------------------------------------------------------------------------- /apis/UFX_Trade/OrderMap.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/UFX_Trade/OrderMap.h -------------------------------------------------------------------------------- /apis/UFX_Trade/UFX_Recv.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/UFX_Trade/UFX_Recv.dat -------------------------------------------------------------------------------- /apis/UFX_Trade/UFX日志_上午盘休时撤单.txt: -------------------------------------------------------------------------------- 1 | 记录集:1/2 2 | 第1/1条记录: 3 | 【整数】 ErrorCode = 0 4 | 【字串】 ErrorMsg = 5 | 【字串】 MsgDetail = 6 | 【整数】 DataCount = 1 7 | 8 | 9 | 记录集:2/2 10 | 第1/1条记录: 11 | 【整数】 entrust_no = 298804 12 | 【字串】 market_no = 9 13 | 【字串】 stock_code = c1805 14 | 【字串】 success_flag = 1 15 | 【字串】 fail_cause = 16 | 17 | 18 | 记录行数: 1 19 | 列行数: 15 20 | msgtype: [d] 21 | market_no: [9] 22 | operator_no: [6001] 23 | business_date: [20180226] 24 | business_time: [] 25 | batch_no: [227333] 26 | entrust_no: [298813] 27 | cancel_entrust_no: [298804] 28 | entrust_status: [a] 29 | entrust_state: [a] 30 | extsystem_id: [1609701] 31 | third_reff: [] 32 | revoke_cause: [] 33 | market_no: [9] 34 | stock_code: [c1805] -------------------------------------------------------------------------------- /apis/UFX_Trade/UFX日志_订阅失败.txt: -------------------------------------------------------------------------------- 1 | 开始订阅 2 | 记录行数: 1 3 | 列行数: 5 4 | error_no: [-1] 5 | ErrorCode: [-1] 6 | ErrorMsg: [-1] 7 | MsgDetail: [订阅投顾与登录投顾不符] 8 | DataCount: [0] 9 | SubscribeTopic info:[-123] 业务权限校验失败 -------------------------------------------------------------------------------- /apis/UFX_Trade/UFX日志_证券数量不对.txt: -------------------------------------------------------------------------------- 1 | 记录集:1/2 2 | 第1/1条记录: 3 | 【整数】 ErrorCode = 3000 4 | 【字串】 ErrorMsg = 证券内码[600000SS]证券变动方向=1:委托数量必须为买卖单位100的整数倍 5 | 【字串】 MsgDetail = 6 | 【整数】 DataCount = 1 7 | 8 | 9 | 记录集:2/2 10 | 第1/1条记录: 11 | 【整数】 batch_no = 0 12 | 【整数】 entrust_no = 0 13 | 【整数】 extsystem_id = 2133004 14 | 【整数】 entrust_fail_code = 99 15 | 【字串】 fail_cause = 证券内码[600000SS]证券变动方向=1:委托数量必须为买卖单位100的整数倍 16 | 【整数】 risk_serial_no = 299069 -------------------------------------------------------------------------------- /apis/UFX_Trade/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/UFX_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // UFX_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/UFX_Trade/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/UFX_Trade/stdafx.h -------------------------------------------------------------------------------- /apis/UFX_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/UFX_Trade/开发说明.txt: -------------------------------------------------------------------------------- 1 | 1. 没有提供类似于CTP的OrderRef的功能,只好参照Tdx的设计方法,先使用LocalID,再使用ID 2 | 2. LocalID是自动生成的,将填写于extsystem_id,ID是柜台传回的entrust_no 3 | 3. 股票、期货、期权等需要分别处理 4 | 4. 撤单一定要使用entrust_no,否则报错,导致流程也出问题。 5 | 5. 在订阅的回报中,不要使用extsystem_id,因为如果挂单很久才成交,第二次登录时extsystem_id会重复。 6 | 7 | 下单,下单成功,下单失败,如风控问题,或交易所问题。 8 | 撤单,撤单成功,撤单失败。 9 | 成交,部分成交再撤单。 10 | 11 | 1. 撤单时使用entrust_no,不要使用包ID,在第二次启动时想用包ID时会重复 12 | 2. 先等期货测试完了再测股票 13 | 3. 先换期货,先交易一次,成功了再加到两次,没有问题就换5个,最后全换。 14 | 15 | 16 | 1.测试稳定性 17 | 2.测试股票 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /apis/Wind_Quote/MdUserApi.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/Wind_Quote/MdUserApi.cpp -------------------------------------------------------------------------------- /apis/Wind_Quote/MdUserApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/Wind_Quote/MdUserApi.h -------------------------------------------------------------------------------- /apis/Wind_Quote/Wind_Quote.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/Wind_Quote/Wind_Quote.rc -------------------------------------------------------------------------------- /apis/Wind_Quote/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /apis/Wind_Quote/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/Wind_Quote/resource.h -------------------------------------------------------------------------------- /apis/Wind_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // Wind_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/Wind_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /apis/Wind_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/XTP/Quote/MdUserApi.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/XTP/Quote/MdUserApi.cpp -------------------------------------------------------------------------------- /apis/XTP/Quote/MdUserApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/XTP/Quote/MdUserApi.h -------------------------------------------------------------------------------- /apis/XTP/Trade/TraderApi.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/XTP/Trade/TraderApi.cpp -------------------------------------------------------------------------------- /apis/XTP/Trade/TraderApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/apis/XTP/Trade/TraderApi.h -------------------------------------------------------------------------------- /apis/XTP/TypeConvert.h: -------------------------------------------------------------------------------- 1 | #ifndef TYPE_CONVERT_H_ 2 | #define TYPE_CONVERT_H_ 3 | 4 | struct TradeField; 5 | 6 | const char* XTPExchangeType_2_Str(int xtp_exchange_type); 7 | const char* XTPMarketType_2_Str(int xtp_market_type); 8 | 9 | int Str_2_XTPExchangeType(const char *exchange_str); 10 | int Str_2_XTPMarketType(const char *market_str); 11 | 12 | int OrderDir_XTP_2_XAPI(int xtp_side); 13 | int OrderDir_XAPI_2_XTP(int side); 14 | 15 | int PositionDir_XTP_2_XAPI(int flag); 16 | int PositionDir_XAPI_2_XTP(int flag); 17 | 18 | int OrderType_XTP_2_XAPI(int flag); 19 | int OrderType_XAPI_2_XTP(int flag); 20 | 21 | int OpenClose_XTP_2_XAPI(int flag); 22 | int OpenClose_XAPI_2_XTP(int flag); 23 | 24 | int OrderStatus_XTP_2_XAPI(int flag); 25 | int OrderStatus_XAPI_2_XTP(int flag); 26 | 27 | int TradeField_2_PositionSide(TradeField* pIn); 28 | 29 | #endif -------------------------------------------------------------------------------- /apis/XTP_Quote/Include.h: -------------------------------------------------------------------------------- 1 | #ifndef XTP_QUOTE_INCLUDE_H_ 2 | #define XTP_QUOTE_INCLUDE_H_ 3 | 4 | #define API_VERSION "1.1.18.13" 5 | #define API_NAME "XTP" 6 | #define DLL_PUBLIC_KEY "" 7 | 8 | #include "../../include/CrossPlatform.h" 9 | #include "../../include/ApiStruct.h" 10 | #include "../../include/XTP/xtp_api_data_type.h" 11 | #include "../../include/XTP/xquote_api_struct.h" 12 | #include "../../include/XTP/xtp_quote_api.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /apis/XTP_Quote/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_CTP_Quote.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/XTP_Quote/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined 24 | -------------------------------------------------------------------------------- /apis/XTP_Quote/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /apis/XTP_Trade/Include.h: -------------------------------------------------------------------------------- 1 | #ifndef XTP_TRADE_INCLUDE_H_ 2 | #define XTP_TRADE_INCLUDE_H_ 3 | 4 | #define API_VERSION "1.1.18.13" 5 | #define API_NAME "XTP" 6 | #define DLL_PUBLIC_KEY "" 7 | 8 | #include "../../include/CrossPlatform.h" 9 | #include "../../include/ApiStruct.h" 10 | #include "../../include/XTP/xtp_api_data_type.h" 11 | #include "../../include/XTP/xtp_trader_api.h" 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /apis/XTP_Trade/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_CTP_Trade.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /apis/XTP_Trade/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined 24 | -------------------------------------------------------------------------------- /apis/XTP_Trade/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | md build 2 | cd build 3 | cmake .. -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir build 3 | cd build 4 | cmake .. 5 | make -------------------------------------------------------------------------------- /clearBin.bat: -------------------------------------------------------------------------------- 1 | cd bin 2 | del *.exp /S /Q 3 | del *.ilk /S /Q 4 | del *.pdb /S /Q 5 | del *.lib /S /Q 6 | 7 | 8 | -------------------------------------------------------------------------------- /common/License/README.md: -------------------------------------------------------------------------------- 1 | # License授权模块使用说明 2 | 3 | ## 项目目的 4 | 此开源项目为了鼓励更多的开发人员参与到项目中,商业化部分功能或服务是一条可行的途径。 5 | 如果要进行商业化开发,授权功能必不可少。开发人员自己开发授权模块要耗费不少时间,所以这里直接提供一个示例。
6 | 开发人员只要在自己的代码中嵌入api和部分函数即可。 7 | 同时我们还开源了授权网站的代码www,开发者可以自己部署在服务器上进行授权的分发。 8 | 9 | ## 原理与过程 10 | * 客户端:分发的授权文件、分发的签名文件、api中嵌入公钥。 11 | * api利用公钥检查明文与签名是否正确 12 | * 在签名正确的前提下,比较明文中的记录与当前交易环境是否匹配 13 | * 服务器:签名生成工具、私钥。 14 | * 调整好客户提交的授权并生成文件 15 | * 使用工具和私钥生成签名文件 16 | 17 | ## 编译 18 | AllCppProjects中将License项目启用,编译报randpool.h找不到。 19 | 到include目录下解压cryptopp.zip到当前文件夹,lib目录下解压cryptlib_vs2015.zip到当前文件夹。 20 | 再次编译可以生成License.exe,这就是由api开发人员使用的生成公私钥和签名的工具。 21 | 22 | 23 | ## 在项目中使用 24 | 在自己的项目中添加License.h和License.cpp等文件,参考CTP中的使用方法 25 | 使用License.exe生成公私钥,将公钥复制到原代码中编译进去,私钥要自己好好保存。 26 | 后期将利用它进行授权的生成。 27 | -------------------------------------------------------------------------------- /common/License/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // License.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /common/License/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | 13 | 14 | 15 | // TODO: reference additional headers your program requires here 16 | // BOOLEAN与asn.h中的冲突,不得不将asn.h中的改了,希望有人帮忙解决这个问题 17 | // 已经解决,移动到这就可以了 18 | #include 19 | #include 20 | #pragma comment(lib, "IPHLPAPI.lib") 21 | -------------------------------------------------------------------------------- /common/License/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /common/www/CheckSignin.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /common/www/ConvertCode.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/common/www/ConvertCode.vbs -------------------------------------------------------------------------------- /common/www/EnumFun.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /common/www/Home.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 主页 10 | 11 | 12 | 当前用户: 当前IP: 退出 关于我们 13 |
14 |

用户信息

15 | 查看/修改个人信息,修改密码 16 |
17 |

产品信息

18 | 查看产品列表,下载与本授权系统配套的DLL 19 |
20 |

授权信息

21 | 查看授权列表,添加授权 22 | = 2) {?> 23 |
24 |

审核管理

25 | 审核用户 26 | 27 | 28 |
29 |

管理员专区

30 | 审核用户 31 | 查看审核人员列表 32 | 注册用户 33 | 切换用户ID 34 | 35 | 36 | -------------------------------------------------------------------------------- /common/www/JSON.php: -------------------------------------------------------------------------------- 1 | 1000) { 15 | die('possible deep recursion attack'); 16 | } 17 | foreach ($array as $key => $value) { 18 | if (is_array($value)) { 19 | arrayRecursive($array[$key], $function, $apply_to_keys_also); 20 | } else { 21 | $array[$key] = $function($value); 22 | } 23 | 24 | if ($apply_to_keys_also && is_string($key)) { 25 | $new_key = $function($key); 26 | if ($new_key != $key) { 27 | $array[$new_key] = $array[$key]; 28 | unset($array[$key]); 29 | } 30 | } 31 | } 32 | $recursive_counter--; 33 | } 34 | 35 | /************************************************************** 36 | * 37 | * 将数组转换为JSON字符串(兼容中文) 38 | * @param array $array 要转换的数组 39 | * @return string 转换得到的json字符串 40 | * @access public 41 | * 42 | *************************************************************/ 43 | function JSON($array) { 44 | arrayRecursive($array, 'urlencode', true); 45 | $json = json_encode($array); 46 | return urldecode($json); 47 | } 48 | ?> -------------------------------------------------------------------------------- /common/www/License.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/common/www/License.exe -------------------------------------------------------------------------------- /common/www/Logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /common/www/ProductInfoListView.php: -------------------------------------------------------------------------------- 1 | query( 8 | 'SELECT * FROM ProductInfo '); 9 | if (PEAR::isError($result)) { 10 | die("{'Error':'".$result->getMessage()."'}"); 11 | } 12 | ?> 13 | 14 | 15 | 产品信息列表 16 | 17 | 18 |

如想登记自己开发的组件,请与管理员联系 关于我们

19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | fetchRow()) 28 | { 29 | echo ""; 30 | echo ""; 31 | echo ""; 32 | echo ""; 33 | echo ""; 34 | } 35 | ?> 36 |
ID产品名介绍页
".$row[strtolower('ID')]."".$row[strtolower('Name')]."查看并下载
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /common/www/Signin.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 登录 10 | 11 | 12 |
13 | 14 |

用户名:

15 |

密码:

16 |

17 |
18 | 注册"; 22 | } 23 | ?> 24 | 25 | 26 | -------------------------------------------------------------------------------- /common/www/Signin_admin.php: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 管理员登录 14 | 15 | 16 |
17 | 18 |

用户名:

19 |

密码:

20 |

21 |
22 | 注册"; 26 | } 27 | ?> 28 | 29 | 30 | -------------------------------------------------------------------------------- /common/www/Signup.php: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 注册 9 | 10 | 11 | 12 | 22 | 23 |
24 | 25 |

用户名

26 |

密码

27 |

密码2再次输入密码

28 |

29 |
30 | 31 | -------------------------------------------------------------------------------- /common/www/SwitchUserID.php: -------------------------------------------------------------------------------- 1 | 20 | 21 | 22 | 23 | 24 | 主页 25 | 26 | 27 | 28 |
29 |

这个功能只对管理员开放,用于切换到某个用户上看授权设置是否正确,或对账号信息进行修改

30 |

UserID

31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /common/www/User2ListView.php: -------------------------------------------------------------------------------- 1 | query( 8 | 'SELECT * FROM Product_User2 ORDER BY Product'); 9 | if (PEAR::isError($result)) { 10 | die("{'Error':'".$result->getMessage()."'}"); 11 | } 12 | ?> 13 | 14 | 15 | 16 | 17 | 审核人员列表 18 | 19 | 20 | 21 |

只是给管理员核对使用,由于一般很少有改动,所以直接编辑数据库即可。

22 |

如果要给某个用户添加审核功能,还需要改用户信息表的Right,2=,否则审核员是看不到可审核列表的

23 | 24 | 25 | 26 | 27 | 28 | 29 | fetchRow()) 32 | { 33 | echo ""; 34 | echo ""; 35 | echo ""; 36 | echo ""; 37 | echo ""; 38 | } 39 | ?> 40 |
IDProductUser2
".$row[strtolower('ID')]."".$row[strtolower('Product')]."".$row[strtolower('User2')]."
41 | 42 | 43 | -------------------------------------------------------------------------------- /common/www/aboutus.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 关于 6 | 7 | 8 | 联系我们
9 | QQ:
10 | Email:
11 | 12 | -------------------------------------------------------------------------------- /common/www/config.php: -------------------------------------------------------------------------------- 1 | getMessage()."'}"); 25 | } 26 | $mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC); 27 | $mdb2->exec("SET NAMES 'utf8'"); 28 | 29 | //================================================= 30 | 31 | 32 | // 这两个参数用于生成授权使用,需要检查授权是否可用 33 | $ExePath = "D:\AppServ\www\License.exe"; 34 | $VbsPath = "D:\AppServ\www\ConvertCode.vbs"; 35 | //密钥目录一定不能在网页目录下,不然就被人下载 36 | $PrivateKeyDir = "D:\AppServ\keys"; 37 | 38 | // 是否开放公众注册 39 | $OpenSignup = true; 40 | 41 | // 未处理的授权条目上限 42 | $PendingLicenseCount = 5; 43 | 44 | // 首页,如果改动了首页文件,此处也可能需要改变 45 | // 目前在Session.php和SwitchUserID.php中出现 46 | $Homepage = "Home.php"; 47 | 48 | ?> -------------------------------------------------------------------------------- /common/www/products/CTP_Trade_x86/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 介绍 6 | 7 | 8 |

软件介绍:

9 |

软件下载:

10 |

软件安装:

11 |

售前咨询人员:

12 |

售后支持服务:

13 |

价格:

14 | 15 | -------------------------------------------------------------------------------- /common/www/安装方法.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/common/www/安装方法.txt -------------------------------------------------------------------------------- /common/www/开发计划.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/common/www/开发计划.txt -------------------------------------------------------------------------------- /common/www/表结构.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/common/www/表结构.txt -------------------------------------------------------------------------------- /example/cpp/CTP/example_ctp.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/example/cpp/CTP/example_ctp.cpp -------------------------------------------------------------------------------- /example/cpp/XTP/example_xtp.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/example/cpp/XTP/example_xtp.cpp -------------------------------------------------------------------------------- /include/ATP/ThostFtdcMdApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/ATP/ThostFtdcMdApi.h -------------------------------------------------------------------------------- /include/ATP/ThostFtdcTraderApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/ATP/ThostFtdcTraderApi.h -------------------------------------------------------------------------------- /include/ATP/ThostFtdcUserApiDataType.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/ATP/ThostFtdcUserApiDataType.h -------------------------------------------------------------------------------- /include/ATP/ThostFtdcUserApiStruct.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/ATP/ThostFtdcUserApiStruct.h -------------------------------------------------------------------------------- /include/ATP/error.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /include/ATP/error.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/ATP/error.xml -------------------------------------------------------------------------------- /include/ATP/md5.txt: -------------------------------------------------------------------------------- 1 | 2 | thostmduserapi.dll 8085ea01db7df188e2444ef1fdb787b7 3 | thosttraderapi.dll d2c1c2981445fa2bcc741a0de2d15d9a 4 | -------------------------------------------------------------------------------- /include/ApiHeader.def: -------------------------------------------------------------------------------- 1 | ;LIBRARY ApiHeader 2 | EXPORTS 3 | XRequest @1 -------------------------------------------------------------------------------- /include/ApiHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef _API_HEADER_H_ 2 | #define _API_HEADER_H_ 3 | 4 | #include "CrossPlatform.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | //用于分隔输入的合列表,与前置机地址列表,所以不能出现“:”一类的 10 | #define _QUANTBOX_SEPS_ ";" 11 | 12 | DLL_PUBLIC void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | // 长度不够时,后面会填0,但长度超出会写出界 18 | #define SAFE_STRNCPY(x,y) if(y) strncpy_s(x, y, sizeof(x));x[sizeof(x)-1]=0; 19 | #define SAFE_STRNCAT(x,y) if(y) strncat_s(x, y, sizeof(x));x[sizeof(x)-1]=0; 20 | // 有循环问题,不能乱用,比如abc%s,结果将变成abcabc 21 | #define SAFE_SNPRINTF(x, ...) _snprintf_s(x,sizeof(x),##__VA_ARGS__);x[sizeof(x)-1]=0; 22 | 23 | #endif//end of _API_HEADER_H_ 24 | -------------------------------------------------------------------------------- /include/CSubscribeManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CSubscribeManager.cpp -------------------------------------------------------------------------------- /include/CSubscribeManager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CSubscribeManager.h -------------------------------------------------------------------------------- /include/CSubscribeManager1.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CSubscribeManager1.h -------------------------------------------------------------------------------- /include/CSubscribeManager2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CSubscribeManager2.cpp -------------------------------------------------------------------------------- /include/CSubscribeManager2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CSubscribeManager2.h -------------------------------------------------------------------------------- /include/CSyntheticCalculate_DepthMarketDataNField.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CSyntheticCalculate_DepthMarketDataNField.h -------------------------------------------------------------------------------- /include/CTPZQ/ZQThostFtdcMdApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTPZQ/ZQThostFtdcMdApi.h -------------------------------------------------------------------------------- /include/CTPZQ/ZQThostFtdcTraderApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTPZQ/ZQThostFtdcTraderApi.h -------------------------------------------------------------------------------- /include/CTPZQ/ZQThostFtdcUserApiDataType.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTPZQ/ZQThostFtdcUserApiDataType.h -------------------------------------------------------------------------------- /include/CTPZQ/ZQThostFtdcUserApiStruct.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTPZQ/ZQThostFtdcUserApiStruct.h -------------------------------------------------------------------------------- /include/CTPZQ/error.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /include/CTPZQ/error.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTPZQ/error.xml -------------------------------------------------------------------------------- /include/CTPZQ/linux64/请so文件添加lib前缀.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTPZQ/linux64/请so文件添加lib前缀.txt -------------------------------------------------------------------------------- /include/CTPZQ/version.txt: -------------------------------------------------------------------------------- 1 | 20151104 支持个股期权和股票 -------------------------------------------------------------------------------- /include/CTPZQ/win64/请复制dll与lib文件.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTPZQ/win64/请复制dll与lib文件.txt -------------------------------------------------------------------------------- /include/CTP_SE/ThostFtdcMdApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SE/ThostFtdcMdApi.h -------------------------------------------------------------------------------- /include/CTP_SE/ThostFtdcTraderApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SE/ThostFtdcTraderApi.h -------------------------------------------------------------------------------- /include/CTP_SE/ThostFtdcUserApiDataType.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SE/ThostFtdcUserApiDataType.h -------------------------------------------------------------------------------- /include/CTP_SE/ThostFtdcUserApiStruct.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SE/ThostFtdcUserApiStruct.h -------------------------------------------------------------------------------- /include/CTP_SE/error.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /include/CTP_SE/error.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SE/error.xml -------------------------------------------------------------------------------- /include/CTP_SE/linux64/请so文件添加lib前缀.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SE/linux64/请so文件添加lib前缀.txt -------------------------------------------------------------------------------- /include/CTP_SE/win64/请复制dll与lib文件.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SE/win64/请复制dll与lib文件.txt -------------------------------------------------------------------------------- /include/CTP_SOPT_SE/ThostFtdcMdApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SOPT_SE/ThostFtdcMdApi.h -------------------------------------------------------------------------------- /include/CTP_SOPT_SE/ThostFtdcTraderApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SOPT_SE/ThostFtdcTraderApi.h -------------------------------------------------------------------------------- /include/CTP_SOPT_SE/ThostFtdcUserApiDataType.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SOPT_SE/ThostFtdcUserApiDataType.h -------------------------------------------------------------------------------- /include/CTP_SOPT_SE/ThostFtdcUserApiStruct.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SOPT_SE/ThostFtdcUserApiStruct.h -------------------------------------------------------------------------------- /include/CTP_SOPT_SE/error.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /include/CTP_SOPT_SE/error.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SOPT_SE/error.xml -------------------------------------------------------------------------------- /include/CTP_SOPT_SE/linux64/请so文件添加lib前缀.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SOPT_SE/linux64/请so文件添加lib前缀.txt -------------------------------------------------------------------------------- /include/CTP_SOPT_SE/win64/请复制dll与lib文件.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/CTP_SOPT_SE/win64/请复制dll与lib文件.txt -------------------------------------------------------------------------------- /include/ChinaStock.h: -------------------------------------------------------------------------------- 1 | #ifndef _CHINA_STOCK_H_ 2 | #define _CHINA_STOCK_H_ 3 | 4 | #include "../include/ApiStruct.h" 5 | 6 | // 上海证券交易所证券代码分配规则 7 | // http://wenku.baidu.com/link?url=fhnAW62VTXqHTn8p9xlyXKa_oDIfR2xIxBF3y_fryeoFnz7MFbeWJbMLx4n1H61ERFnhr6PtaxF_j01x8iIT0wArZzrBtABRysi-KEpBa9S 8 | 9 | // 深圳证券交易所证券代码编码方案 10 | // http://wenku.baidu.com/view/e41fba85ec3a87c24028c416.html 11 | 12 | 13 | InstrumentType InstrumentID_2_InstrumentType_SSE(int In); 14 | InstrumentType InstrumentID_2_InstrumentType_SZSE(int In); 15 | InstrumentType InstrumentID_2_InstrumentType_NEEQ(int In); 16 | PriceType InstrumentID_2_PriceTick_SSE(int In); 17 | PriceType InstrumentID_2_PriceTick_SZSE(int In); 18 | PriceType InstrumentID_2_PriceTick_NEEQ(int In); 19 | #endif -------------------------------------------------------------------------------- /include/CrossPlatform.h: -------------------------------------------------------------------------------- 1 | #ifndef _CROSS_PLATFORM_H_ 2 | #define _CROSS_PLATFORM_H_ 3 | 4 | #if defined _WIN32 || defined __CYGWIN__ 5 | #ifdef BUILDING_DLL 6 | #ifdef __GNUC__ 7 | #define DLL_PUBLIC __attribute__ ((dllexport)) 8 | #else 9 | #define DLL_PUBLIC __declspec(dllexport) // Note: actually gcc seems to also supports this syntax. 10 | #endif 11 | #else 12 | #ifdef __GNUC__ 13 | #define DLL_PUBLIC __attribute__ ((dllimport)) 14 | #else 15 | #define DLL_PUBLIC __declspec(dllimport) // Note: actually gcc seems to also supports this syntax. 16 | #endif 17 | #endif 18 | #define DLL_LOCAL 19 | #else 20 | #if __GNUC__ >= 4 21 | #define DLL_PUBLIC __attribute__ ((visibility ("default"))) 22 | #define DLL_LOCAL __attribute__ ((visibility ("hidden"))) 23 | #else 24 | #define DLL_PUBLIC 25 | #define DLL_LOCAL 26 | #endif 27 | 28 | #endif 29 | 30 | #ifdef BUILDING_QUEUE_DLL 31 | #define QUEUE_DLL_PUBLIC DLL_PUBLIC 32 | #else 33 | #define QUEUE_DLL_PUBLIC 34 | #endif 35 | 36 | #ifndef _WIN32 37 | 38 | #define MAX_PATH 1024 39 | // #define min(x, y) ((x) < (y) ? (x) : (y)) 40 | #ifndef __stdcall 41 | #define __stdcall 42 | #endif 43 | 44 | #endif 45 | 46 | #endif // _CROSS_PLATFORM_H_ 47 | -------------------------------------------------------------------------------- /include/IDGenerator.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "IDGenerator.h" 3 | #include 4 | #include 5 | #include 6 | 7 | CIDGenerator::CIDGenerator() 8 | { 9 | m_id = 0; 10 | memset(m_IDString, 0, sizeof(OrderIDType)); 11 | memset(m_Prefix, 0, sizeof(OrderIDType)); 12 | } 13 | 14 | CIDGenerator::~CIDGenerator() 15 | { 16 | } 17 | 18 | void CIDGenerator::SetPrefix(const char* prefix) 19 | { 20 | strncpy(m_Prefix, prefix, 32); 21 | } 22 | 23 | unsigned int CIDGenerator::GetID() 24 | { 25 | return ++m_id; 26 | } 27 | 28 | unsigned int CIDGenerator::GetTimeID() 29 | { 30 | time_t lt; 31 | lt = time(nullptr); 32 | struct tm *ptr; 33 | ptr = localtime(<); 34 | // 1970年开始移动到2015年开始 35 | // long 其实是无符号int,所以*10000会溢出 36 | // *1000 在当天下单数超过1000时才会影响前面的秒 37 | // 如果快速的重复登录,出现第一次已经下到1000笔,第二次登录时在1秒后又下,才会出现ID重复 38 | unsigned int x = ((ptr->tm_wday * 24 + ptr->tm_hour) * 450 + (ptr->tm_min * 60 + ptr->tm_sec)) * 100 + GetID(); 39 | return x; 40 | } 41 | 42 | const char* CIDGenerator::GetIDString() 43 | { 44 | snprintf(m_IDString, sizeof(m_IDString), "%s:%ld", m_Prefix, ++m_id); 45 | return m_IDString; 46 | } 47 | -------------------------------------------------------------------------------- /include/IDGenerator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/IDGenerator.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSCosApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSCosApi.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSMdApiEx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSMdApiEx.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSOptionApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSOptionApi.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSPrdApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSPrdApi.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSTraderApiEx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSTraderApiEx.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSUserApiDataTypeEx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSUserApiDataTypeEx.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSUserApiStructEx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSUserApiStructEx.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSVocApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSVocApi.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSVocApiDataType.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSVocApiDataType.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSVocApiStruct.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSVocApiStruct.h -------------------------------------------------------------------------------- /include/Kingstar/IncEx/KSVocMdApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/IncEx/KSVocMdApi.h -------------------------------------------------------------------------------- /include/Kingstar/inc/KSMarketDataAPI.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/inc/KSMarketDataAPI.h -------------------------------------------------------------------------------- /include/Kingstar/inc/KSTradeAPI.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Kingstar/inc/KSTradeAPI.h -------------------------------------------------------------------------------- /include/Kingstar/version.txt: -------------------------------------------------------------------------------- 1 | 20150813 -------------------------------------------------------------------------------- /include/LTS_v2/SecurityFtdcMdApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/LTS_v2/SecurityFtdcMdApi.h -------------------------------------------------------------------------------- /include/LTS_v2/SecurityFtdcQueryApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/LTS_v2/SecurityFtdcQueryApi.h -------------------------------------------------------------------------------- /include/LTS_v2/SecurityFtdcTraderApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/LTS_v2/SecurityFtdcTraderApi.h -------------------------------------------------------------------------------- /include/LTS_v2/SecurityFtdcUserApiDataType.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/LTS_v2/SecurityFtdcUserApiDataType.h -------------------------------------------------------------------------------- /include/LTS_v2/SecurityFtdcUserApiStruct.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/LTS_v2/SecurityFtdcUserApiStruct.h -------------------------------------------------------------------------------- /include/LTS_v2/linux64/请文件名添加lib前缀.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/LTS_v2/linux64/请文件名添加lib前缀.txt -------------------------------------------------------------------------------- /include/LTS_v2/version.txt: -------------------------------------------------------------------------------- 1 | 20150925 -------------------------------------------------------------------------------- /include/REM/EesTraderErr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/REM/EesTraderErr.h -------------------------------------------------------------------------------- /include/REM/linux64/请so文件添加lib前缀.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/REM/linux64/请so文件添加lib前缀.txt -------------------------------------------------------------------------------- /include/REM/win64/请复制dll与lib文件.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/REM/win64/请复制dll与lib文件.txt -------------------------------------------------------------------------------- /include/Sgit/SgitFtdcMdApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Sgit/SgitFtdcMdApi.h -------------------------------------------------------------------------------- /include/Sgit/SgitFtdcTraderApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Sgit/SgitFtdcTraderApi.h -------------------------------------------------------------------------------- /include/Sgit/SgitFtdcUserApiDataType.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Sgit/SgitFtdcUserApiDataType.h -------------------------------------------------------------------------------- /include/Sgit/SgitFtdcUserApiStruct.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Sgit/SgitFtdcUserApiStruct.h -------------------------------------------------------------------------------- /include/Sgit/linux64/请so文件添加lib前缀.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Sgit/linux64/请so文件添加lib前缀.txt -------------------------------------------------------------------------------- /include/Sgit/win64/请复制dll与lib文件.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Sgit/win64/请复制dll与lib文件.txt -------------------------------------------------------------------------------- /include/Tap/TapAPIError.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Tap/TapAPIError.h -------------------------------------------------------------------------------- /include/UFX/data_def.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/UFX/data_def.h -------------------------------------------------------------------------------- /include/UFX/t2sdk_interface.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/UFX/t2sdk_interface.h -------------------------------------------------------------------------------- /include/UFX/win32/license_hundsun.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/UFX/win32/license_hundsun.dat -------------------------------------------------------------------------------- /include/UFX/win32/t2sdk.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/UFX/win32/t2sdk.ini -------------------------------------------------------------------------------- /include/UFX/win32/请复制dll与lib文件.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/UFX/win32/请复制dll与lib文件.txt -------------------------------------------------------------------------------- /include/Wind/WAPIWrapperCpp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/Wind/WAPIWrapperCpp.h -------------------------------------------------------------------------------- /include/XApiC.def: -------------------------------------------------------------------------------- 1 | ;LIBRARY XApiC 2 | EXPORTS 3 | X_LoadLib @1 4 | X_GetLastError @2 5 | X_GetFunction @3 6 | X_FreeLib @4 7 | 8 | X_GetApiTypes @5 9 | X_GetApiVersion @6 10 | X_GetApiName @7 11 | 12 | X_Create @8 13 | X_Register @9 14 | X_Connect @10 15 | X_Disconnect @11 16 | 17 | X_Subscribe @12 18 | X_Unsubscribe @13 19 | 20 | X_SubscribeQuote @14 21 | X_UnsubscribeQuote @15 22 | 23 | X_ReqQuery @16 24 | 25 | X_SendOrder @17 26 | X_CancelOrder @18 27 | X_SendQuote @19 28 | X_CancelQuote @20 -------------------------------------------------------------------------------- /include/XTP/changelist.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/XTP/changelist.txt -------------------------------------------------------------------------------- /include/XTP/linux64/请so文件添加lib前缀.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/XTP/linux64/请so文件添加lib前缀.txt -------------------------------------------------------------------------------- /include/XTP/macosx/libxtpquoteapi.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/XTP/macosx/libxtpquoteapi.dylib -------------------------------------------------------------------------------- /include/XTP/macosx/libxtptraderapi.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/XTP/macosx/libxtptraderapi.dylib -------------------------------------------------------------------------------- /include/XTP/win64/请复制dll与lib文件.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/XTP/win64/请复制dll与lib文件.txt -------------------------------------------------------------------------------- /include/XTP/xoms_api_fund_struct.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////// 2 | ///@author 中泰证券股份有限公司 3 | ///@file xoms_api_fund_struct.h 4 | ///@brief 定义资金划拨相关结构体类型 5 | ///////////////////////////////////////////////////////////////////////// 6 | #ifndef XOMS_API_FUND_STRUCT_H_ 7 | #define XOMS_API_FUND_STRUCT_H_ 8 | 9 | #include "xtp_api_data_type.h" 10 | #include "xoms_api_struct.h" 11 | #include "xtp_api_struct_common.h" 12 | 13 | #pragma pack(8) 14 | 15 | #define XTP_ACCOUNT_PASSWORD_LEN 64 16 | 17 | ///////////////////////////////////////////////////////////////////////// 18 | ///用户资金请求 19 | ///////////////////////////////////////////////////////////////////////// 20 | struct XTPFundTransferReq 21 | { 22 | ///资金内转编号,无需用户填写,类似于xtp_id 23 | uint64_t serial_id; 24 | ///资金账户代码 25 | char fund_account[XTP_ACCOUNT_NAME_LEN]; 26 | ///资金账户密码 27 | char password[XTP_ACCOUNT_PASSWORD_LEN]; 28 | ///金额 29 | double amount; 30 | ///内转类型 31 | XTP_FUND_TRANSFER_TYPE transfer_type; 32 | 33 | }; 34 | 35 | ///////////////////////////////////////////////////////////////////////// 36 | ///用户资金划转请求的响应-复用资金通知结构体 37 | ///////////////////////////////////////////////////////////////////////// 38 | typedef struct XTPFundTransferNotice XTPFundTransferAck ; 39 | 40 | #pragma pack() 41 | 42 | #endif -------------------------------------------------------------------------------- /include/XTP/xtp_api_struct.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////// 2 | ///@author 中泰证券股份有限公司 3 | ///@file xtp_api_struct.h 4 | ///@brief 定义业务数据结构 5 | ///////////////////////////////////////////////////////////////////////// 6 | #ifndef _XTP_API_STRUCT_H_ 7 | #define _XTP_API_STRUCT_H_ 8 | 9 | #include "xtp_api_struct_common.h" 10 | #include "xquote_api_struct.h" 11 | #include "xoms_api_struct.h" 12 | #include "xoms_api_fund_struct.h" 13 | 14 | #endif // !_XTP_API_STRUCT_H_ 15 | 16 | -------------------------------------------------------------------------------- /include/XTP/xtp_api_struct_common.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////// 2 | ///@author 中泰证券股份有限公司 3 | ///@file xtp_api_struct_common.h 4 | ///@brief 定义业务公共数据结构 5 | ///////////////////////////////////////////////////////////////////////// 6 | 7 | #ifndef _XTP_API_STRUCT_COMMON_H_ 8 | #define _XTP_API_STRUCT_COMMON_H_ 9 | 10 | #if defined(_MSC_VER) && _MSC_VER<1600 11 | typedef signed char int8_t; 12 | typedef short int16_t; 13 | typedef int int32_t; 14 | typedef long long int64_t; 15 | typedef unsigned char uint8_t; 16 | typedef unsigned short uint16_t; 17 | typedef unsigned int uint32_t; 18 | typedef unsigned long long uint64_t; 19 | #else 20 | #include 21 | #endif 22 | 23 | #include "xtp_api_data_type.h" 24 | 25 | #pragma pack(8) 26 | 27 | ///错误信息的字符串长度 28 | #define XTP_ERR_MSG_LEN 124 29 | ///响应信息 30 | typedef struct XTPRspInfoStruct 31 | { 32 | ///错误代码 33 | int32_t error_id; 34 | ///错误信息 35 | char error_msg[XTP_ERR_MSG_LEN]; 36 | } XTPRI; 37 | 38 | #pragma pack() 39 | 40 | #endif // !_XTP_API_STRUCT_COMMON_H_ 41 | -------------------------------------------------------------------------------- /include/cryptopp.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/cryptopp.zip -------------------------------------------------------------------------------- /include/inirw.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 文件:inirw.h 3 | * 版本:1.0 4 | * 作者:taoyuanmin@gmail.com 5 | * 6 | * 说明:ini配置文件读写 7 | * 1、支持;和#注释符号,支持行尾注释。 8 | * 2、支持带引号'或"成对匹配的字符串,提取时自动去引号。引号中可带其它引号或;#注释符。 9 | * 3、支持无section或空section(名称为空)。 10 | * 4、支持10、16、8进制数,0x开头为16进制数,0开头为8进制。 11 | * 5、支持section、key或=号前后带空格。 12 | * 6、支持\n、\r、\r\n或\n\r换行格式。 13 | * 7、不区分section、key大小写,但写入时以新串为准,并保持其大小写。 14 | * 8、新增数据时,若section存在则在该节最后一个有效数据后添加,否则在文件尾部添加。 15 | * 9、支持指定key所在整行删除,即删除该键值,包括注释。 16 | * 10、可自动跳过格式错误行,修改时仍然保留。 17 | * 11、修改时保留原注释:包括整行注释、行尾注释(包括前面空格)。 18 | * 12、修改时保留原空行。以上三点主要是尽量保留原格式。 19 | */ 20 | 21 | 22 | #ifndef _INI_RW_H_ 23 | #define _INI_RW_H_ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | //加载ini文件至内存 30 | int iniFileLoad(const char *filename); 31 | //释放ini文件所占资源 32 | void iniFileFree(); 33 | 34 | //获取字符串,不带引号 35 | int iniGetString(const char *section, const char *key, char *value, int size, const char *defvalue); 36 | //获取整数值 37 | int iniGetInt(const char *section, const char *key, int defvalue); 38 | //获取浮点数 39 | double iniGetDouble(const char *section, const char *key, double defvalue); 40 | 41 | //设置字符串:若value为NULL,则删除该key所在行,包括注释 42 | int iniSetString(const char *section, const char *key, const char *value,bool quote = true); 43 | //设置整数值:base取值10、16、8,分别表示10、16、8进制,缺省为10进制 44 | int iniSetInt(const char *section, const char *key, int value, int base); 45 | 46 | // 以下是用于加载字符串后用于别的用途,因为它所有的写入操作都是写文件 47 | // 不满足我需要给它添加字符串或加密的需求 48 | const char* GetBuffer(); 49 | int GetBufferLen(); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/queue/ArrayLockFreeQueue.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARRAYLOCKFREEQUEUE_H___ 2 | #define _ARRAYLOCKFREEQUEUE_H___ 3 | 4 | #include 5 | 6 | #ifdef _WIN64 7 | #define QUEUE_INT int64_t 8 | #else 9 | #define QUEUE_INT unsigned long 10 | #endif 11 | 12 | #define ARRAY_LOCK_FREE_Q_DEFAULT_SIZE 65535 // 2^16 13 | 14 | template 15 | class ArrayLockFreeQueue 16 | { 17 | public: 18 | 19 | ArrayLockFreeQueue(); 20 | virtual ~ArrayLockFreeQueue(); 21 | 22 | QUEUE_INT size(); 23 | 24 | bool enqueue(const ELEM_T &a_data); 25 | 26 | bool dequeue(ELEM_T &a_data); 27 | 28 | bool try_dequeue(ELEM_T &a_data); 29 | 30 | private: 31 | 32 | ELEM_T m_thequeue[Q_SIZE]; 33 | 34 | volatile QUEUE_INT m_count; 35 | volatile QUEUE_INT m_writeIndex; 36 | 37 | volatile QUEUE_INT m_readIndex; 38 | 39 | volatile QUEUE_INT m_maximumReadIndex; 40 | 41 | inline QUEUE_INT countToIndex(QUEUE_INT a_count); 42 | }; 43 | 44 | #include "ArrayLockFreeQueueImp.h" 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/queue/atom_opt.h: -------------------------------------------------------------------------------- 1 | #ifndef _ATOM_OPT_H___ 2 | #define _ATOM_OPT_H___ 3 | 4 | #ifdef __GNUC__ 5 | #define CAS(a_ptr, a_oldVal, a_newVal) __sync_bool_compare_and_swap(a_ptr, a_oldVal, a_newVal) 6 | #define AtomicAdd(a_ptr,a_count) __sync_fetch_and_add (a_ptr, a_count) 7 | #define AtomicSub(a_ptr,a_count) __sync_fetch_and_sub (a_ptr, a_count) 8 | #include // sched_yield() 9 | #else 10 | 11 | #include 12 | #ifdef _WIN64 13 | #define CAS(a_ptr, a_oldVal, a_newVal) (a_oldVal == InterlockedCompareExchange64(a_ptr, a_newVal, a_oldVal)) 14 | #define sched_yield() SwitchToThread() 15 | #define AtomicAdd(a_ptr, num) InterlockedIncrement64(a_ptr) 16 | #define AtomicSub(a_ptr, num) InterlockedDecrement64(a_ptr) 17 | #else 18 | #define CAS(a_ptr, a_oldVal, a_newVal) (a_oldVal == InterlockedCompareExchange(a_ptr, a_newVal, a_oldVal)) 19 | #define sched_yield() SwitchToThread() 20 | #define AtomicAdd(a_ptr, num) InterlockedIncrement(a_ptr) 21 | #define AtomicSub(a_ptr, num) InterlockedDecrement(a_ptr) 22 | #endif 23 | 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | //#include "targetver.h" 9 | // 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | //// Windows Header Files: 12 | //#include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #if defined _WIN32 || WIN32 || _WINDOWS 16 | #include "targetver.h" 17 | 18 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 19 | // Windows Header Files: 20 | #include 21 | #else 22 | 23 | #endif // defined -------------------------------------------------------------------------------- /include/switch_string.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | typedef std::uint64_t hash_t; 4 | 5 | constexpr hash_t prime = 0x100000001B3ull; 6 | constexpr hash_t basis = 0xCBF29CE484222325ull; 7 | 8 | hash_t hash_(char const* str) 9 | { 10 | hash_t ret{basis}; 11 | 12 | while(*str){ 13 | ret ^= *str; 14 | ret *= prime; 15 | str++; 16 | } 17 | 18 | return ret; 19 | } 20 | 21 | constexpr hash_t hash_compile_time(char const* str, hash_t last_value = basis) 22 | { 23 | return *str ? hash_compile_time(str+1, (*str ^ last_value) * prime) : last_value; 24 | } 25 | 26 | constexpr unsigned long long operator "" _hash(char const* p, size_t) 27 | { 28 | return hash_compile_time(p); 29 | } 30 | 31 | //void simple_switch(char const* str) 32 | //{ 33 | // using namespace std; 34 | // switch(hash_(str)){ 35 | // case "first"_hash: 36 | // cout << "1st one" << endl; 37 | // break; 38 | // case "second"_hash: 39 | // cout << "2nd one" << endl; 40 | // break; 41 | // case "third"_hash: 42 | // cout << "3rd one" << endl; 43 | // break; 44 | // default: 45 | // cout << "Default..." << endl; 46 | // } 47 | //} -------------------------------------------------------------------------------- /include/synthetic/CSyntheticConfig.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/synthetic/CSyntheticConfig.h -------------------------------------------------------------------------------- /include/synthetic/CSyntheticInfos.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/synthetic/CSyntheticInfos.h -------------------------------------------------------------------------------- /include/synthetic/CSyntheticManager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/include/synthetic/CSyntheticManager.h -------------------------------------------------------------------------------- /languages/CPP/XAPI_CPP/XAPI_CPP.cpp: -------------------------------------------------------------------------------- 1 | // QuantBox_XAPI.cpp : Defines the exported functions for the DLL application. 2 | // 3 | 4 | #include "stdafx.h" 5 | 6 | 7 | -------------------------------------------------------------------------------- /languages/CPP/XAPI_CPP/XApiCpp.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "../../../include/XApiCpp.h" 3 | 4 | #include "XApiImpl.h" 5 | 6 | CXApi::CXApi() 7 | { 8 | } 9 | 10 | CXApi::~CXApi() 11 | { 12 | } 13 | 14 | CXApi* CXApi::CreateApi(const char* libPath) 15 | { 16 | return new CXApiImpl(libPath); 17 | } 18 | -------------------------------------------------------------------------------- /languages/CPP/XAPI_CPP/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /languages/CPP/XAPI_CPP/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // QuantBox_XAPI.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /languages/CPP/XAPI_CPP/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #if defined _WIN32 || WIN32 || _WINDOWS 9 | #include "targetver.h" 10 | 11 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 12 | // Windows Header Files: 13 | #include 14 | 15 | #else 16 | 17 | #endif // defined 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /languages/CPP/XAPI_CPP/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_COM/COM/IClassFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace XAPI.COM 5 | { 6 | // Interface IClassFactory is here to provide a C# definition of the 7 | // COM IClassFactory interface. 8 | [ 9 | ComImport, // This interface originated from COM. 10 | ComVisible(false), // It is not hard to imagine that this interface must not be exposed to COM. 11 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown), // Indicate that this interface is not IDispatch-based. 12 | Guid("00000001-0000-0000-C000-000000000046") // This GUID is the actual GUID of IClassFactory. 13 | ] 14 | public interface IClassFactory 15 | { 16 | void CreateInstance(IntPtr pUnkOuter, ref Guid riid, out IntPtr ppvObject); 17 | void LockServer(bool fLock); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_COM/COM/IXApi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace XAPI.COM 5 | { 6 | [ComVisible(true)] 7 | [Guid("DBCAEFA9-4337-47B8-9B47-66070604CE2C")] 8 | public interface IXApi 9 | { 10 | [DispId(1)] 11 | void SetLibPath(string LibPath); 12 | 13 | 14 | [DispId(10)] 15 | void Connect(string szServerPath, string szUserPath, string szPath); 16 | [DispId(11)] 17 | void Disconnect(); 18 | 19 | [DispId(20)] 20 | void Subscribe(string szInstrument, string szExchange); 21 | [DispId(21)] 22 | void Unsubscribe(string szInstrument, string szExchange); 23 | 24 | [DispId(31)] 25 | void NewOrder(); 26 | [DispId(32)] 27 | void SetOrder(string key, object value); 28 | [DispId(33)] 29 | string SendOrder(); 30 | [DispId(34)] 31 | string CancelOrder(string id); 32 | 33 | [DispId(40)] 34 | void NewQuery(); 35 | [DispId(41)] 36 | void SetQuery(string key, object value); 37 | [DispId(42)] 38 | void ReqQuery(string type); 39 | [DispId(50)] 40 | QueueData TryDequeue(); 41 | 42 | [DispId(60)] 43 | void GCCollect(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_COM/XAPI.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/CSharp/XAPI_COM/XAPI.snk -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/Callback/XApi.HistoricalData.cs: -------------------------------------------------------------------------------- 1 | using XAPI; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | 8 | namespace XAPI.Callback 9 | { 10 | public partial class XApi 11 | { 12 | public DelegateOnRspQryHistoricalTicks OnRspQryHistoricalTicks { get; set; } 13 | public DelegateOnRspQryHistoricalBars OnRspQryHistoricalBars { get; set; } 14 | 15 | private void _OnRspQryHistoricalTicks(IntPtr ptr1, int size1, IntPtr ptr2, int size2, double double1) 16 | { 17 | if (OnRspQryHistoricalTicks == null) 18 | return; 19 | 20 | HistoricalDataRequestField obj = PInvokeUtility.GetObjectFromIntPtr(ptr2); 21 | 22 | OnRspQryHistoricalTicks(this, ptr1, size1,ref obj, size2, double1 != 0); 23 | } 24 | private void _OnRspQryHistoricalBars(IntPtr ptr1, int size1, IntPtr ptr2, int size2, double double1) 25 | { 26 | if (OnRspQryHistoricalBars == null) 27 | return; 28 | 29 | HistoricalDataRequestField obj = PInvokeUtility.GetObjectFromIntPtr(ptr2); 30 | 31 | OnRspQryHistoricalBars(this, ptr1, size1,ref obj, size2, double1 != 0); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/Callback/XApi.Instrument.cs: -------------------------------------------------------------------------------- 1 | using XAPI; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | 8 | 9 | namespace XAPI.Callback 10 | { 11 | public partial class XApi 12 | { 13 | public DelegateOnRspQryInstrument OnRspQryInstrument 14 | { 15 | get { return OnRspQryInstrument_; } 16 | set { OnRspQryInstrument_ = value; } 17 | } 18 | private DelegateOnRspQryInstrument OnRspQryInstrument_; 19 | 20 | 21 | private void _OnRspQryInstrument(IntPtr ptr1,int size1, double double1) 22 | { 23 | if (OnRspQryInstrument_ == null) 24 | return; 25 | 26 | InstrumentField obj = PInvokeUtility.GetObjectFromIntPtr(ptr1); 27 | 28 | OnRspQryInstrument_(this, ref obj, size1, double1 != 0); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/IObjectSafety.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace XAPI 8 | { 9 | /// 10 | /// Import the IObjectSaftety COM Interface. 11 | /// See http://msdn.microsoft.com/en-us/library/aa768224(VS.85).aspx 12 | /// 13 | [ComImport] 14 | [Guid("CB5BDC81-93C1-11CF-8F20-00805F2CD064")] // This is the only Guid that cannot be modifed in this file 15 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 16 | interface IObjectSafety 17 | { 18 | [PreserveSig] 19 | int GetInterfaceSafetyOptions(ref Guid riid, out int pdwSupportedOptions, out int pdwEnabledOptions); 20 | 21 | [PreserveSig] 22 | int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionSetMask, int dwEnabledOptions); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/IXApi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | 8 | namespace XAPI 9 | { 10 | [ComVisible(false)] 11 | public interface IXApi:IXSpi, IDisposable 12 | { 13 | ApiType GetApiTypes { get; } 14 | string GetApiName { get; } 15 | string GetApiVersion { get; } 16 | 17 | bool IsConnected { get; } 18 | void Connect(string szServerPath, string szUserPath, string szPath); 19 | void Disconnect(); 20 | 21 | void ReqQuery(QueryType type, ReqQueryField query); 22 | 23 | void Subscribe(string szInstrument, string szExchange); 24 | void Unsubscribe(string szInstrument, string szExchange); 25 | 26 | void SubscribeQuote(string szInstrument, string szExchange); 27 | void UnsubscribeQuote(string szInstrument, string szExchange); 28 | 29 | string SendOrder(OrderField[] orders); 30 | string CancelOrder(string[] szId); 31 | string SendQuote(QuoteField quote); 32 | string CancelQuote(string szId); 33 | 34 | RspUserLoginField UserLogin { get; set; } 35 | 36 | object Log { get; set; } 37 | 38 | int ReconnectInterval { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/InvokeBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | 8 | namespace XAPI 9 | { 10 | [ComVisible(false)] 11 | public class InvokeBase 12 | { 13 | protected IntPtr hLib = IntPtr.Zero; 14 | public virtual Delegate Invoke(String APIName, Type t) 15 | { 16 | return null; 17 | } 18 | 19 | public virtual void Dispose() 20 | { 21 | 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/PositionFieldEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | 8 | namespace XAPI 9 | { 10 | [ComVisible(false)] 11 | public class PositionFieldEx 12 | { 13 | public string Symbol { get; private set; } 14 | public string Instrument { get; private set; } 15 | public string Exchange { get; private set; } 16 | 17 | public PositionField Long { get; private set; } 18 | public PositionField Short { get; private set; } 19 | 20 | public PositionFieldEx() 21 | { 22 | Long = new PositionField(); 23 | Short = new PositionField(); 24 | } 25 | 26 | public void AddPosition(PositionField position) 27 | { 28 | Symbol = position.Symbol; 29 | Instrument = position.InstrumentID; 30 | Exchange = position.ExchangeID; 31 | 32 | if (position.Side == PositionSide.Long) 33 | { 34 | Long = position; 35 | } 36 | else 37 | { 38 | Short = position; 39 | } 40 | } 41 | 42 | public double Qty 43 | { 44 | get { return Long.Position - Short.Position; } 45 | } 46 | public double LongQty 47 | { 48 | get { return Long.Position; } 49 | } 50 | public double ShortQty 51 | { 52 | get { return Short.Position; } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/QueryType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | 8 | namespace XAPI 9 | { 10 | public enum QueryType : byte 11 | { 12 | ReqQryInstrument = 32, 13 | ReqQryTradingAccount, 14 | ReqQryInvestorPosition, 15 | 16 | ReqQryOrder, 17 | ReqQryTrade, 18 | ReqQryQuote, 19 | 20 | ReqQryInstrumentCommissionRate, 21 | ReqQryInstrumentMarginRate, 22 | ReqQrySettlementInfo, 23 | ReqQryInvestor, 24 | 25 | ReqQryHistoricalTicks, 26 | ReqQryHistoricalBars, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/RequestType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | namespace XAPI 8 | { 9 | public enum RequestType:byte 10 | { 11 | GetApiTypes = 0, 12 | GetApiVersion, 13 | GetApiName, 14 | 15 | Create, // 创建 16 | Release, // 销毁 17 | Register, // 注册回调 18 | 19 | Connect, // 开始/连接 20 | Disconnect, // 停止/断开 21 | GetStatus, 22 | 23 | Clear, // 清理 24 | Process, // 处理 25 | 26 | Subscribe, // 订阅 27 | Unsubscribe, // 取消订阅 28 | 29 | SubscribeQuote, // 订阅应价 30 | UnsubscribeQuote, // 取消应价 31 | 32 | ReqOrderInsert, 33 | ReqQuoteInsert, 34 | ReqOrderAction, 35 | ReqQuoteAction, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/ResponseType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | namespace XAPI 8 | { 9 | public enum ResponseType : byte 10 | { 11 | OnConnectionStatus = 64, 12 | OnRtnError, 13 | OnLog, 14 | 15 | OnRtnDepthMarketData, 16 | OnRspQryInstrument, 17 | OnRspQryTradingAccount, 18 | OnRspQryInvestorPosition, 19 | OnRspQrySettlementInfo, 20 | 21 | OnRspQryOrder, 22 | OnRspQryTrade, 23 | OnRspQryQuote, 24 | 25 | OnRtnOrder, 26 | OnRtnTrade, 27 | OnRtnQuote, 28 | 29 | OnRtnQuoteRequest, 30 | 31 | OnRspQryHistoricalTicks, 32 | OnRspQryHistoricalBars, 33 | OnRspQryInvestor, 34 | OnRtnInstrumentStatus, 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/XAPI_CSharp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | false 6 | Exe 7 | XAPI.Program 8 | 9 | 10 | 11 | true 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /languages/CSharp/XAPI_CSharp/XApiHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace XAPI 8 | { 9 | public class XApiHelper 10 | { 11 | public static IXApi CreateInstance(string typeName = "XAPI.Callback.XApi, XAPI_CSharp", string c_dll_path = "") 12 | { 13 | //Type type = Type.GetType("XAPI.Callback.XApi, XAPI_CSharp"); 14 | //var api = (IXApi)Activator.CreateInstance(type, @"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\x86\CTP\CTP_Trade_x86.dll"); 15 | //return api; 16 | Type type = Type.GetType(typeName); 17 | if (type == null) 18 | return null; 19 | IXApi api = null; 20 | if (string.IsNullOrEmpty(c_dll_path)) 21 | { 22 | api = (IXApi)Activator.CreateInstance(type); 23 | } 24 | else 25 | { 26 | api = (IXApi)Activator.CreateInstance(type, c_dll_path); 27 | } 28 | return api; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /languages/Java/README.md: -------------------------------------------------------------------------------- 1 | # XAPI的Java接口 2 | 3 | ## 目的 4 | 提供Java接口供程序调用 5 | 6 | ## 设计思路 7 | * 直接调用XAPI的C版本接口,所有使用方法与C接口完全一样 8 | * 使用JNA技术,采用了JNAerator进行转换(感谢绿茶提供示例和指导) 9 | * jnaerator-0.12-shaded.jar和jna-4.2.1.jar文件都很大,不适合放在github中,请自行下载 10 | 11 | ## 如何转换C接口为Java接口 12 | 1. 在2013年时CTP接口的多个文件可以直转成需要的库,而如今测试多次只能先手工将h文件合并 13 | 2. 新建一个XAPI.h文件,先复制XApiC.h中的内容到XAPI.h中,然后将对应的include用对应的文件内容来替换,直到XAPI.h中完全没有include. 14 | 3. 到jnaerator上下载最新版的jar并放到当前目录,注意,请下载jnaerator-X.XX-shaded.jar这个文件大小最大的版本。
15 | 项目路径:[https://github.com/nativelibs4java/JNAerator/releases](https://github.com/nativelibs4java/JNAerator/releases)
16 | 快速下载:[http://search.maven.org/#search%7Cga%7C1%7Cjnaerator](http://search.maven.org/#search%7Cga%7C1%7Cjnaerator) 17 | 4. 复制C接口的XAPI_CPP.dll到工程目录并改名成XAPI.dll 18 | 5. 可能要修改jnaerator.bat中相应jar文件名 19 | 6. 运行jnaerator.bat生成对应的目录或文件 20 | 21 | ## 如何使用 22 | 1. 下载JNA到工程目录.
23 | 项目路径:[https://github.com/java-native-access/jna](https://github.com/java-native-access/jna)
24 | 快速下载:[https://maven.java.net/content/repositories/releases/net/java/dev/jna/jna/](https://maven.java.net/content/repositories/releases/net/java/dev/jna/jna/) 25 | 2. 复制XAPI.jar和XAPI.dll到工程目录 26 | 3. XApiWrapper示例,修改账号等进行测试 27 | 28 | -------------------------------------------------------------------------------- /languages/Java/XAPI.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/Java/XAPI.jar -------------------------------------------------------------------------------- /languages/Java/jnaerator.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set dst=XAPI.jar 3 | set dll=*.dll 4 | set inc=*.h 5 | set sdk=XAPI 6 | set rt=JNA 7 | java -jar jnaerator-0.12-shaded.jar -jar %dst% -library %sdk% -runtime %rt% %dll% %inc% -mode Jar -noMangling -------------------------------------------------------------------------------- /languages/MATLAB/COM/BuyLimit.m: -------------------------------------------------------------------------------- 1 | function OrderRef = BuyLimit(td,Instrument,Qty,Price) 2 | 3 | td.NewOrder(); 4 | td.SetOrder('InstrumentID',Instrument); 5 | td.SetOrder('ExchangeID',''); 6 | td.SetOrder('Type','Limit'); 7 | td.SetOrder('Side','Buy'); 8 | td.SetOrder('Qty',Qty); 9 | td.SetOrder('Price',Price); 10 | td.SetOrder('OpenClose','Open'); 11 | td.SetOrder('HedgeFlag','Speculation'); 12 | 13 | OrderRef = td.SendOrder(); 14 | 15 | end 16 | -------------------------------------------------------------------------------- /languages/MATLAB/COM/CTP_Connect.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/CTP_Connect.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/CancelOrders.m: -------------------------------------------------------------------------------- 1 | function CancelOrders(td, tbl) 2 | 3 | [m,n] = size(tbl); 4 | 5 | for i=1:m 6 | if tbl.LeavesQty(i) > 0 7 | td.CancelOrder(tbl.id{i}) 8 | end 9 | end 10 | 11 | end -------------------------------------------------------------------------------- /languages/MATLAB/COM/OnMdConnectionStatus.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/OnMdConnectionStatus.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/OnRspQryInstrument.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/OnRspQryInstrument.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/OnRspQryInvestorPosition.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/OnRspQryInvestorPosition.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/OnRspQryOrder.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/OnRspQryOrder.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/OnRspQrySettlementInfo.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/OnRspQrySettlementInfo.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/OnRspQryTradingAccount.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/OnRspQryTradingAccount.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/OnRtnDepthMarketData.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/OnRtnDepthMarketData.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/OnRtnOrder.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/OnRtnOrder.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/OnTdConnectionStatus.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/OnTdConnectionStatus.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/ReqQryInstrument.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/ReqQryInstrument.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/ReqQryInvestorPosition.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/ReqQryInvestorPosition.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/ReqQryOrder.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/ReqQryOrder.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/ReqQrySettlementInfo.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/ReqQrySettlementInfo.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/ReqQryTradingAccount.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/ReqQryTradingAccount.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/SellLimit.m: -------------------------------------------------------------------------------- 1 | function OrderRef = SellLimit(td,Instrument,Qty,Price) 2 | 3 | td.NewOrder(); 4 | td.SetOrder('InstrumentID',Instrument); 5 | td.SetOrder('ExchangeID',''); 6 | td.SetOrder('Type','Limit'); 7 | td.SetOrder('Side','Sell'); 8 | td.SetOrder('Qty',Qty); 9 | td.SetOrder('Price',Price); 10 | td.SetOrder('OpenClose','Close'); 11 | td.SetOrder('HedgeFlag','Speculation'); 12 | 13 | OrderRef = td.SendOrder(); 14 | 15 | end 16 | -------------------------------------------------------------------------------- /languages/MATLAB/COM/SetWait.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/SetWait.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/Wait.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/Wait.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/mycallbacks.m: -------------------------------------------------------------------------------- 1 | %% Combine Event Handlers as MATLAB Local Functions 2 | function a = mycallbacks(str) 3 | a = str2func(str); 4 | 5 | %% 6 | function global_dispatcher(varargin) 7 | global api; 8 | api.dispatcher(varargin); -------------------------------------------------------------------------------- /languages/MATLAB/COM/object_2_table.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/object_2_table.m -------------------------------------------------------------------------------- /languages/MATLAB/COM/test_CTP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/COM/test_CTP.m -------------------------------------------------------------------------------- /languages/MATLAB/DotNET/BuyLimit.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/DotNET/BuyLimit.m -------------------------------------------------------------------------------- /languages/MATLAB/DotNET/KSInterB2C.lkc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/DotNET/KSInterB2C.lkc -------------------------------------------------------------------------------- /languages/MATLAB/DotNET/NLog.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/DotNET/NLog.dll -------------------------------------------------------------------------------- /languages/MATLAB/DotNET/OnMdConnectionStatus.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/DotNET/OnMdConnectionStatus.m -------------------------------------------------------------------------------- /languages/MATLAB/DotNET/OnRtnDepthMarketData.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/DotNET/OnRtnDepthMarketData.m -------------------------------------------------------------------------------- /languages/MATLAB/DotNET/OnRtnOrder.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/DotNET/OnRtnOrder.m -------------------------------------------------------------------------------- /languages/MATLAB/DotNET/OnTdConnectionStatus.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/DotNET/OnTdConnectionStatus.m -------------------------------------------------------------------------------- /languages/MATLAB/DotNET/test_CTP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/DotNET/test_CTP.m -------------------------------------------------------------------------------- /languages/MATLAB/DotNET/test_Kingstar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/MATLAB/DotNET/test_Kingstar.m -------------------------------------------------------------------------------- /languages/MATLAB/README.md: -------------------------------------------------------------------------------- 1 | # MATLAB接口 2 | 3 | 目标是能用MATLAB也进行交易,已经测试通过。能接收行情,能下单,能撤单。
4 | 用户要使用时应当要在MATLAB中对一些API进行封装,否则用起来太麻烦。
5 | 后期考虑模仿Trading Toolbox的调用方式
6 | 指定要加载的库即可使用对应版本的API 7 | 8 | 9 | ## .NET版接口 10 | MATLAB版本与API版本必需完全一样,例如CTP为32位,则MATLAB也得32位。MATLAB调用.NET的机制有问题,可能在长期运行后崩溃。 11 | 12 | ### 原理 13 | 1. MATLAB支持调用.NET库 14 | 2. MATLAB支持.NET标准签名的事件 15 | 3. 有兴趣的可参考[http://www.ariszheng.com/?p=1883](http://www.ariszheng.com/?p=1883) 16 | 17 | ### 使用 18 | 1. 确保自己安装的是32位MATLAB 19 | 2. 打开test.m,编辑开头的路径为本机的实际路径 20 | 3. 由于登录下单都写在了一个m文件中了,一次性的执行由于登录是要时间的,还没有登录完成就下单会失败。故请按代码一块块执行。 21 | 4. 需要在目录下有XAPI的各个库的文件夹 22 | 5. 根据报的错,采用不同的处理方案 23 | 24 | ## COM版接口 25 | 有进程外与进程内两种模式,进程内模式也必须是都是32位或64位。进程外没有限制可以64位调用32位。 26 | 27 | ### 原理 28 | 以进程外方式调用COM组件,实现跨进程的调用 29 | 30 | ## 使用 31 | 1. 64位或32位MATLAB都可以 32 | 2. 注册组件 33 | 2. 打开test.m,编辑自己的地址与账号 34 | 3. 由于登录下单都写在了一个m文件中了,一次性的执行由于登录是要时间的,还没有登录完成就下单会失败。故请按代码一块块执行。 35 | 4. 需要在目录下有XAPI的各个库的文件夹 36 | 5. 根据报的错,采用不同的处理方案 37 | 6. 看是否启动了进程 38 | 6. 如果是报win32的错误,那就执行一下clear_InprocServer32.reg 39 | 40 | ## 其它 41 | 1. Kingstar的接口需要提供一个证书,但证书只能在exe当前目录下,所以在登录时,脚本会输出实际运行matlab.exe的路径,必须将证书复制到此目录下才能用。 -------------------------------------------------------------------------------- /languages/Python/README.md: -------------------------------------------------------------------------------- 1 | # Python版XAPI行情交易接口 2 | 3 | ## 工作原理 4 | 通过Python ctypes调用XAPI_CPP_x86.dll,通过它来调用其它的C封装的接口。 5 | 例如针对CTP的thosttraderapi.dll,我们开发一个C封装——CTP_Trade_x86.dll, 6 | 由XAPI_CPP_x86.dll来调用CTP_Trade_x86.dll。 7 | 其实也可以通过ctypes直接调用CTP_Trade_x86.dll,只是当前没有这样设计,后期有时间再可以改。 8 | 9 | ## 安装使用 10 | 0. 目前项目是在Python2.7/3.5 Win32位下进行的开发,欢迎在Linux等平台下测试反馈和贡献代码 11 | 1. 整个项目涉及到C/C++,高手可以参考对应的项目的说明文档进行自行编译。Win64位用户也得自行编译 12 | 2. 对于初学者,建议直接使用我们专为OpenQuant插件C#项目发布的安装包 13 | 3. 此安装包一般通过QQ群或论坛进行分发 14 | 4. 运行安装包中的批处理后实际上是为OpenQuant复制了一些文件到指定目录下。Python用户将直接利用这些文件,减少部署的麻烦 15 | 16 | ## 测试 17 | 1. 通过前一节提到的安装包复制指定文件后 18 | 2. 编辑test_xapi.py,设置所需要调用的库dll,如CTP或Tdx 19 | 3. 编辑连接的参数,不同的库参数可能不同,需要查找对应的手册或示例 20 | 4. 编辑用户名和密码,以及其它准备工作 21 | 5. 编辑MyXSpi.py文件,根据需要添加和设置回调的响应函数,需要的响应函数请从XSpi.py中复制 22 | 6. 运行test_xapi.py 23 | 24 | ## 调试 25 | 1. 由于XAPI底层另有一个线程通过回调的方法向Python通知事件,所以这些回调函数都无法直接下断点 26 | 2. 通过 http://stackoverflow.com/questions/34299082/not-working-python-breakpoints-in-c-thread-in-pycharm-or-eclipsepydev 介绍的方法可以在回调函中断点 27 | 3. 运行安装pip install pydevd,在需要下断点的文件加入import pydevd 28 | 4. 在要下断点的地方加上pydevd.settrace(suspend=True, trace_only_current_thread=True)即可 29 | 5. 对于运行过程中忽然崩溃退出,问题可能出在C层,需要用VS启动Python.exe和.py进行C层代码的调试 30 | 31 | ## 感谢 32 | 本项目参考学习了 https://github.com/jasonweiyi/xapi_python/tree/master/Python 感谢他们所做的工作 33 | 34 | ## 新测试项目 35 | - 新建了test_ctp_api.py/test_tdx_api.py,主要功能是编辑target_position.csv文件,确定目标仓位是多少。启动后通过1至6等几个步骤,快速的将当前持仓调整为目标持仓。 36 | - 此测试的功能适用于交易频率比低的团队,例如每天交易一两次的。 37 | - 已经在期货上测试通过,股票已经完成,还没有严格测试 38 | - 对于上海的先平今还是先平昨,对于股指是先锁仓再平仓,没有细化,后期可以再改进 39 | - 股票部分 40 | 41 | -------------------------------------------------------------------------------- /languages/Python/config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # https://stackoverflow.com/questions/38987/how-to-merge-two-python-dictionaries-in-a-single- 5 | 6 | 7 | def deepupdate(original, update): 8 | """ 9 | Recursively update a dict. 10 | Subdict's won't be overwritten but also updated. 11 | """ 12 | for key, value in original.items(): 13 | if key not in update: 14 | update[key] = value 15 | elif isinstance(value, dict): 16 | deepupdate(value, update[key]) 17 | return update 18 | 19 | 20 | import config_default 21 | 22 | configs = config_default.configs 23 | 24 | try: 25 | import config_override 26 | 27 | configs = deepupdate(configs, config_override.configs) 28 | except ImportError: 29 | pass 30 | -------------------------------------------------------------------------------- /languages/Python/config_default.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | configs = { 4 | 'root_dir': r'd:' + '\\test_ctp', 5 | 'md': { 6 | 'Address': br'tcp://218.202.237.33:10012', 7 | 'BrokerID': b'9999', 8 | 'UserID': b'654321', 9 | 'Password': b'123456', 10 | }, 11 | 'td': { 12 | 'Address': br'tcp://180.168.146.187:10000', 13 | 'BrokerID': b'9999', 14 | 'UserID': b'654321', 15 | 'Password': b'123456', 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /languages/Python/config_override.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | configs = { 4 | 'md': { 5 | 'UserID': b'037505', 6 | 'Password': b'123456', 7 | }, 8 | 'td': { 9 | 'UserID': b'095064', 10 | 'Password': b'123456', 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /languages/Python/fix_stock_table.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """ 4 | 由于股票的输入数据可能有SH/SZ,需要删除 5 | """ 6 | import os 7 | import pandas as pd 8 | 9 | # 从当前config_tdx类中加载配置文件 10 | import config_tdx as config 11 | 12 | input_file = os.path.join(config.configs['root_dir'], 'BIG_20170930.csv') 13 | output_file = os.path.join(config.configs['root_dir'], 'BIG_20170930_out.csv') 14 | df = pd.read_csv(input_file, dtype={'Symbol': str, 'InstrumentID': str}, quotechar='\'', encoding='utf-8-sig') 15 | df['Symbol'] = df['Symbol'].str[0:6] 16 | df['InstrumentID'] = df['InstrumentID'].str[0:6] 17 | df.to_csv(output_file, index=None) 18 | 19 | 20 | input_file = os.path.join(config.configs['root_dir'], 'SMALL_20170930.csv') 21 | output_file = os.path.join(config.configs['root_dir'], 'SMALL_20170930_out.csv') 22 | df = pd.read_csv(input_file, dtype={'Symbol': str, 'InstrumentID': str}, quotechar='\'', encoding='utf-8-sig') 23 | df['Symbol'] = df['Symbol'].str[0:6] 24 | df['InstrumentID'] = df['InstrumentID'].str[0:6] 25 | df.to_csv(output_file, index=None) 26 | 27 | -------------------------------------------------------------------------------- /languages/Python/runme.bat: -------------------------------------------------------------------------------- 1 | python.exe test_ctp_api.py 2 | pause -------------------------------------------------------------------------------- /languages/Python/runme_auto1.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/Python/runme_auto1.bat -------------------------------------------------------------------------------- /languages/Python/runme_auto2.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/Python/runme_auto2.bat -------------------------------------------------------------------------------- /languages/Python/runme_auto3.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/Python/runme_auto3.bat -------------------------------------------------------------------------------- /languages/Python/test_ctp/某用户/config_ctp.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import sys 4 | 5 | sys.path.append(r'D:\Users\Kan\Documents\GitHub\XAPI3\languages\Python') 6 | 7 | # 解决Python 3.6的pandas不支持中文路径的问题 8 | print(sys.getfilesystemencoding()) # 查看修改前的 9 | try: 10 | sys._enablelegacywindowsfsencoding() # 修改 11 | print(sys.getfilesystemencoding()) # 查看修改后的 12 | except: 13 | pass 14 | 15 | from test_ctp_api import main 16 | 17 | configs = { 18 | 'root_dir': r'D:\Users\Kan\Documents\GitHub\XAPI3\languages\Python\test_ctp\某用户', 19 | 'md': { 20 | 'Address': br'tcp://180.168.146.187:10110', 21 | 'BrokerID': b'9999', 22 | 'UserID': b'654321', 23 | 'Password': b'123456', 24 | }, 25 | 'td': { 26 | 'Address': br'tcp://180.168.146.187:10100', 27 | 'BrokerID': b'9999', 28 | 'AppID': b'8500342533', 29 | 'AuthCode': b'0000000000000000', 30 | 'UserID': b'14078611', 31 | 'Password': b'123456', 32 | }, 33 | } 34 | 35 | if __name__ == '__main__': 36 | main(configs) 37 | -------------------------------------------------------------------------------- /languages/Python/test_ctp/某用户/incremental_position.csv: -------------------------------------------------------------------------------- 1 | Symbol,InstrumentID,HedgeFlag,Side,Position 2 | i1709,i1709,0,1,8 3 | i1709,i1709,0,-1,4 4 | rb1710,rb1710,0,1,3 5 | rb1710,rb1710,0,-1,6 6 | -------------------------------------------------------------------------------- /languages/Python/test_ctp/某用户/portfolio_1.csv: -------------------------------------------------------------------------------- 1 | Symbol,InstrumentID,HedgeFlag,Side,Position 2 | i1709,i1709,0,1,8 3 | i1709,i1709,0,-1,4 4 | rb2011,rb2011,0,1,3 5 | rb2011,rb2011,0,-1,6 6 | -------------------------------------------------------------------------------- /languages/Python/test_ctp/某用户/portfolio_2.csv: -------------------------------------------------------------------------------- 1 | Symbol,InstrumentID,HedgeFlag,Side,Position 2 | i1709,i1709,0,1,8 3 | i1709,i1709,0,-1,4 4 | rb1710,rb1710,0,1,3 5 | rb1710,rb1710,0,-1,6 6 | -------------------------------------------------------------------------------- /languages/Python/test_ctp/某用户/portfolio_3.csv: -------------------------------------------------------------------------------- 1 | Symbol,InstrumentID,HedgeFlag,Side,Position 2 | i1709,i1709,0,1,8 3 | i1709,i1709,0,-1,4 4 | rb1710,rb1710,0,1,3 5 | rb1710,rb1710,0,-1,6 6 | -------------------------------------------------------------------------------- /languages/Python/test_ctp/某用户/runme.bat: -------------------------------------------------------------------------------- 1 | PATH d:\Users\Kan\Anaconda3;d:\Users\Kan\Anaconda3\Scripts;d:\Users\Kan\Anaconda3\Library\bin;%PATH% 2 | python.exe %~dp0\config_ctp.py 3 | pause -------------------------------------------------------------------------------- /languages/Python/test_ctp/某用户/runme_auto.bat: -------------------------------------------------------------------------------- 1 | PATH d:\Users\Kan\Anaconda3;d:\Users\Kan\Anaconda3\Scripts;d:\Users\Kan\Anaconda3\Library\bin;%PATH% 2 | python.exe %~dp0\config_ctp.py --input=7 3 | pause -------------------------------------------------------------------------------- /languages/Python/test_ctp/某用户/target_position.csv: -------------------------------------------------------------------------------- 1 | Symbol,InstrumentID,HedgeFlag,Side,Position,InstrumentName 2 | i1709.,i1709,0,1,5.0, 3 | i1709.,i1709,0,-1,0.0, 4 | rb2101.,rb2101,0,1,0.0, 5 | rb2101.,rb2101,0,-1,6.0, 6 | -------------------------------------------------------------------------------- /languages/Python/test_ctp_sopt/某用户/config_ctp.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import sys 4 | 5 | sys.path.append(r'D:\Users\Kan\Documents\GitHub\XAPI3\languages\Python') 6 | 7 | # 解决Python 3.6的pandas不支持中文路径的问题 8 | print(sys.getfilesystemencoding()) # 查看修改前的 9 | try: 10 | sys._enablelegacywindowsfsencoding() # 修改 11 | print(sys.getfilesystemencoding()) # 查看修改后的 12 | except: 13 | pass 14 | 15 | from test_ctp_sopt_api import main 16 | 17 | configs = { 18 | 'root_dir': r'D:\Users\Kan\Documents\GitHub\XAPI3\languages\Python\test_ctp_sopt\某用户', 19 | 'md': { 20 | 'Address': br'tcp://124.74.247.142:18213', 21 | 'BrokerID': b'2001', 22 | 'UserID': b'00000020781', 23 | 'Password': b'123456', 24 | }, 25 | 'td': { 26 | 'Address': br'tcp://124.74.247.142:18205', 27 | 'BrokerID': b'2001', 28 | 'AppID': b'1.3.0', 29 | 'AuthCode': b'EG9FWWGUYV2U292T', 30 | 'UserID': b'00000020781', 31 | 'Password': b'123456', 32 | }, 33 | } 34 | 35 | if __name__ == '__main__': 36 | main(configs) 37 | -------------------------------------------------------------------------------- /languages/Python/xapi/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # 如何编写兼容代码 5 | # http://blog.csdn.net/dingyuduan/article/details/42457595 6 | 7 | from .XEnum import * 8 | from .XQueueEnum import * 9 | from .XStruct import * 10 | from .XApi import * 11 | from .XSpi import * 12 | 13 | -------------------------------------------------------------------------------- /languages/Python/流程说明.txt: -------------------------------------------------------------------------------- 1 | 11: target_position <= p1+p2+p3 2 | 12: target_position <= memory_position 3 | 13: target_position <= target_position + incremental 4 | 5 | 1: load target_position 6 | 2: memory_position <= real_position 7 | 8 | 11:内部对冲 9 | 13:不对冲 10 | 11 | 13不小心做了多次,重复累加了怎么办,其实我只想做一次? 12 | 2->12从实盘中取 或 11从几个组合中合并都可以,然后再做一次13 13 | 14 | 如果几个p1+p2+p3其实记录的是我的加仓信息,我想在实盘持仓上加上这些加仓怎么办? 15 | 11写入到target_position,将target_position打开保存到incremental,2->12保存一下实盘,13将实盘与加仓进行混合 16 | 17 | 18 | 11 - 12 - 13 19 | | 20 | 1 2 -------------------------------------------------------------------------------- /languages/Server/README.md: -------------------------------------------------------------------------------- 1 | ## XAPI行情交易网关接口 2 | 3 | 本项目使用了以下项目实现基本功能 4 | 1. Flask-SocketIO 5 | 2. XAPI Python版接口 6 | 7 | ## 安装与使用 8 | 1. 解压`QuantBox统一接口完整版_v0.9.8.8.zip` 9 | 2. 执行其中的`X1.复制bin和System32目录_需右键以管理员身份运行.bat`,自动将CTP等库文件安装到默认目录下 10 | 3. 配置`config.py` 中的服务器地址与账号,可以根据需要配置只连接行情或交易 11 | 4. 运行`python xapi_sio_server.py`即启动了服务,等待客户端连接 12 | 5. 访问http://127.0.0.1:5000可以在浏览器中登录并测试下单撤单 13 | 6. 如果有些库没有安装,可以参考requirements.txt使用pip进行安装,一定要安装eventlet 14 | 15 | ## 工作原理 16 | 1. Flask Web服务等待客户端的接入后初始化CTP API,自动连接CTP柜台 17 | 2. 行情调用流程:Python->XAPI_CPP_x64.dll->CTP_Quote_x64.dll->thostmduserapi.dll 18 | 3. 交易调用流程:Python->XAPI_CPP_x64.dll->CTP_Trade_x64.dll->thosttradeapi.dll 19 | 4. 收到订阅请求后,开始调用api,然后收到的行情转发 20 | 5. 交易接口与行情接口相同 21 | 22 | ## 已知问题 23 | 1. 单用户版,只支持一个用户 24 | 2. 没有提供历史数据功能 -------------------------------------------------------------------------------- /languages/Server/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/Server/__init__.py -------------------------------------------------------------------------------- /languages/Server/app/__init__.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | from flask_socketio import SocketIO 3 | 4 | socketio = SocketIO() 5 | 6 | 7 | def create_app(debug=False): 8 | """Create an application.""" 9 | app = Flask(__name__) 10 | app.debug = debug 11 | app.config['SECRET_KEY'] = 'gjr39dkjn344_!67#' 12 | 13 | from .main import main as main_blueprint 14 | app.register_blueprint(main_blueprint) 15 | 16 | socketio.init_app(app) 17 | 18 | from .api.events import XApiNamespace 19 | socketio.on_namespace(XApiNamespace('/api')) 20 | return app 21 | 22 | # from app.api.api import config_md, config_td 23 | # 24 | # md, td = config_md(), config_td() 25 | # 26 | # from app.socketio_queue import EmitQueue 27 | # 28 | # mq = EmitQueue(socketio) 29 | -------------------------------------------------------------------------------- /languages/Server/app/api/__init__.py: -------------------------------------------------------------------------------- 1 | from . import spi, events 2 | import config 3 | -------------------------------------------------------------------------------- /languages/Server/app/main/__init__.py: -------------------------------------------------------------------------------- 1 | from flask import Blueprint 2 | 3 | main = Blueprint('main', __name__) 4 | 5 | from . import routes, events 6 | -------------------------------------------------------------------------------- /languages/Server/app/main/events.py: -------------------------------------------------------------------------------- 1 | from flask import session 2 | from flask_socketio import emit, join_room, leave_room 3 | from .. import socketio 4 | 5 | from threading import Lock 6 | 7 | thread = None 8 | thread_lock = Lock() 9 | 10 | 11 | @socketio.on('joined', namespace='/chat') 12 | def joined(message): 13 | """Sent by clients when they enter a room. 14 | A status message is broadcast to all people in the room.""" 15 | room = session.get('room') 16 | join_room(room) 17 | emit('status', {'msg': session.get('name') + ' has entered the room.'}, room=room) 18 | 19 | 20 | @socketio.on('text', namespace='/chat') 21 | def text(message): 22 | """Sent by a client when the user entered a new message. 23 | The message is sent to all people in the room.""" 24 | room = session.get('room') 25 | emit('message', {'msg': session.get('name') + ':' + message['msg']}, room=room) 26 | 27 | 28 | @socketio.on('left', namespace='/chat') 29 | def left(message): 30 | """Sent by clients when they leave a room. 31 | A status message is broadcast to all people in the room.""" 32 | room = session.get('room') 33 | leave_room(room) 34 | emit('status', {'msg': session.get('name') + ' has left the room.'}, room=room) 35 | -------------------------------------------------------------------------------- /languages/Server/app/main/forms.py: -------------------------------------------------------------------------------- 1 | from flask_wtf import FlaskForm 2 | from wtforms.fields import StringField, SubmitField 3 | from wtforms.validators import InputRequired 4 | 5 | 6 | class LoginForm(FlaskForm): 7 | """Accepts a nickname and a room.""" 8 | name = StringField('Name', validators=[InputRequired()]) 9 | room = StringField('Room', validators=[InputRequired()]) 10 | submit = SubmitField('Enter Chatroom') 11 | -------------------------------------------------------------------------------- /languages/Server/app/main/routes.py: -------------------------------------------------------------------------------- 1 | from flask import session, redirect, url_for, render_template, request 2 | from . import main 3 | from .forms import LoginForm 4 | 5 | 6 | @main.route('/', methods=['GET', 'POST']) 7 | def index(): 8 | """Login form to enter a room.""" 9 | form = LoginForm() 10 | if form.validate_on_submit(): 11 | session['name'] = form.name.data 12 | session['room'] = form.room.data 13 | return redirect(url_for('.chat')) 14 | elif request.method == 'GET': 15 | form.name.data = session.get('name', '') 16 | form.room.data = session.get('room', '') 17 | return render_template('index.html', form=form) 18 | 19 | 20 | @main.route('/chat') 21 | def chat(): 22 | """Chat room. The user's name and room must be stored in 23 | the session.""" 24 | name = session.get('name', '') 25 | room = session.get('room', '') 26 | if name == '' or room == '': 27 | return redirect(url_for('.index')) 28 | return render_template('chat.html', name=name, room=room) 29 | -------------------------------------------------------------------------------- /languages/Server/app/socketio_queue.py: -------------------------------------------------------------------------------- 1 | import queue 2 | 3 | from threading import Lock 4 | 5 | 6 | def background_thread(self): 7 | self.background_thread() 8 | 9 | 10 | class EmitQueue(object): 11 | def __init__(self, sio): 12 | self._queue = queue.Queue() 13 | self._socketio = sio 14 | self._thread = None 15 | self.thread_lock = Lock() 16 | 17 | def emit(self, event, *args, **kwargs): 18 | self._queue.put((event, args, kwargs)) 19 | 20 | def on_connect(self): 21 | """ 22 | 必须与socketio.on在同一线程中,所以不得不写在收到connect事件中处理 23 | :return: 24 | """ 25 | with self.thread_lock: 26 | if self._thread is None: 27 | self._thread = self._socketio.start_background_task(background_thread, self) 28 | 29 | def background_thread(self): 30 | while True: 31 | if self._queue.empty(): 32 | self._socketio.sleep(0.1) 33 | else: 34 | t = self._queue.get() 35 | self._socketio.emit(t[0], *t[1], **t[2]) 36 | -------------------------------------------------------------------------------- /languages/Server/app/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Flask-SocketIO-Chat 4 | 5 | 6 |

Flask-SocketIO-Chat

7 |

本项目只是一个简单的XAPI的行情测试页,输入任意信息进入即可

8 |
9 | {{ form.hidden_tag() }} 10 | {{ form.name.label }}: {{ form.name() }} {% for error in form.name.errors %}{{ error }}{% endfor %}
11 | {{ form.room.label }}: {{ form.room() }} {% for error in form.room.errors %}{{ error }}{% endfor %}
12 | {{ form.submit() }} 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /languages/Server/logging.yaml: -------------------------------------------------------------------------------- 1 | version: 1 2 | disable_existing_loggers: False 3 | formatters: 4 | simple: 5 | format: "%(asctime)s - %(name)s - %(filename)s - %(levelname)s - %(message)s" 6 | # %(asctime)s:%(filename)s[line:%(lineno)d] %(levelname)s %(message)s 7 | 8 | handlers: 9 | console: 10 | class: logging.StreamHandler 11 | level: INFO 12 | formatter: simple 13 | stream: ext://sys.stdout 14 | 15 | info_file_handler: 16 | class: logging.handlers.RotatingFileHandler 17 | level: INFO 18 | formatter: simple 19 | filename: info.log 20 | maxBytes: 10485760 # 10MB 21 | backupCount: 20 22 | encoding: utf8 23 | 24 | error_file_handler: 25 | class: logging.handlers.RotatingFileHandler 26 | level: ERROR 27 | formatter: simple 28 | filename: errors.log 29 | maxBytes: 10485760 # 10MB 30 | backupCount: 20 31 | encoding: utf8 32 | 33 | loggers: 34 | my_module: 35 | level: ERROR 36 | handlers: [console] 37 | propagate: no 38 | 39 | root: 40 | level: INFO 41 | handlers: [console, info_file_handler, error_file_handler] -------------------------------------------------------------------------------- /languages/Server/requirements.txt: -------------------------------------------------------------------------------- 1 | click 2 | eventlet 3 | Flask 4 | Flask-SocketIO 5 | Flask-WTF 6 | greenlet 7 | itsdangerous 8 | Jinja2 9 | MarkupSafe 10 | python-engineio 11 | python-socketio 12 | six 13 | Werkzeug 14 | WTForms 15 | -------------------------------------------------------------------------------- /languages/Server/setup_logging.py: -------------------------------------------------------------------------------- 1 | import logging.config 2 | import os 3 | import yaml 4 | 5 | 6 | def setup_logging(default_path='logging.yaml', default_level=logging.INFO): 7 | """ 8 | Setup logging configuration 9 | """ 10 | path = default_path 11 | if os.path.exists(path): 12 | with open(path, 'rt') as f: 13 | config = yaml.load(f.read(), Loader=yaml.SafeLoader) 14 | logging.config.dictConfig(config) 15 | else: 16 | logging.basicConfig(level=default_level) 17 | print('the input path doesn\'t exist') 18 | 19 | 20 | if '__main__' == __name__: 21 | setup_logging(default_path='logging.yaml') 22 | # 默认拿到root的logger 23 | logger = logging.getLogger() 24 | logging.info('jhaha', exc_info=True) 25 | -------------------------------------------------------------------------------- /languages/Server/test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/languages/Server/test.txt -------------------------------------------------------------------------------- /languages/Server/xapi_sio_server.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | import sys 3 | 4 | sys.path.append(r'../Python') 5 | 6 | 7 | from app import create_app, socketio 8 | 9 | app = create_app(debug=True) 10 | 11 | if __name__ == '__main__': 12 | socketio.run(app, host='0.0.0.0', port=5000) 13 | -------------------------------------------------------------------------------- /languages/Server/xapi_td_downloader.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | import sys 3 | 4 | sys.path.append(r'../Python') 5 | 6 | import argparse 7 | 8 | from td_spi import * 9 | 10 | if __name__ == '__main__': 11 | parser = argparse.ArgumentParser() 12 | parser.add_argument('--user', '-u', default='abc', help='用户名') 13 | parser.add_argument('--password', '-p', default='123456', help='密码') 14 | 15 | args = parser.parse_args() 16 | print(args.user) 17 | print(args.password) 18 | 19 | # 准备账号 20 | td = config_td() 21 | td.UserInfo.UserID = b'654321' 22 | td.UserInfo.Password = b'123456' 23 | td.UserInfo.UserID = bytes(args.user, encoding='utf-8') 24 | td.UserInfo.Password = bytes(args.password, encoding='utf-8') 25 | 26 | spi = td_spi() 27 | spi.set_api(td) 28 | init_td(td) 29 | td.register_spi(spi) 30 | if not td.is_connected(): 31 | td.connect() 32 | 33 | input("查持仓") 34 | query = ReqQueryField() 35 | td.req_query(QueryType.ReqQryInvestorPosition, query) 36 | 37 | input("查委托") 38 | query = ReqQueryField() 39 | td.req_query(QueryType.ReqQryOrder, query) 40 | 41 | input("查成交") 42 | query = ReqQueryField() 43 | td.req_query(QueryType.ReqQryTrade, query) 44 | 45 | while True: 46 | input("查结算单") 47 | print("当前交易日", spi.TradingDay) 48 | date = input('请输入结算日:') 49 | query = ReqQueryField() 50 | query.DateStart = int(date) # 20200110 51 | td.req_query(QueryType.ReqQrySettlementInfo, query) 52 | 53 | input("结束") 54 | -------------------------------------------------------------------------------- /tests/COM/TEST.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tests/COM/TEST.vbs -------------------------------------------------------------------------------- /tests/COM/TEST2.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tests/COM/TEST2.vbs -------------------------------------------------------------------------------- /tests/COM/TEST_JS.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tests/COM/TEST_JS.htm -------------------------------------------------------------------------------- /tests/COM/reg/RegCOM_exe.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tests/COM/reg/RegCOM_exe.bat -------------------------------------------------------------------------------- /tests/COM/reg/clear_InprocServer32.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tests/COM/reg/clear_InprocServer32.reg -------------------------------------------------------------------------------- /tests/COM/reg/clear_LocalServer32.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tests/COM/reg/clear_LocalServer32.reg -------------------------------------------------------------------------------- /tests/COM/wscript.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tests/COM/wscript.exe -------------------------------------------------------------------------------- /tests/COM/注册COM组件的方法.txt: -------------------------------------------------------------------------------- 1 | 1.将reg目录下x64 x86 clear_InprocServer32.reg clear_InprocServer32.reg RegCOM_exe.bat 复制到与XAPI_CSharp.exe同目录 2 | 2.以管理员方式运行RegCOM_exe.bat即可 3 | 3.本项目支持进程内和进程外,如果想64位程序下加载32位只能进程外 4 | 4.部分平台可能出现优先使用进程内 5 | 5.根据自己的需求看是否要运行clear_InprocServer32.reg 6 | 6.在Excel中开发工具->Visual Basic->工具->引用->XAPI_CSharp。 7 | 7.如何使用,可以参考TEST_Tdx.xlsm -------------------------------------------------------------------------------- /tests/CPP/CPP_TEST.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /tests/CPP/Makefile: -------------------------------------------------------------------------------- 1 | DEPS=../../languages/CPP/XAPI_CPP/XApiImpl.o \ 2 | ../../languages/CPP/XAPI_CPP/XApiCpp.o \ 3 | ../../languages/CPP/XAPI_CPP/XApiC.o 4 | 5 | DEPS+=../../include/toolkit.o \ 6 | ../../include/ApiProcess.o 7 | ALL = CPP_TEST 8 | 9 | include ../../Makefile.global 10 | 11 | LFLAGS=-Wl,-rpath,\$$ORIGIN \ 12 | -ldl \ 13 | -L../../apis/CTP -lQuantBox_CTP_Quote -lQuantBox_CTP_Trade \ 14 | -L../../common/Queue -lQueue 15 | 16 | CPP_TEST: CPP_TEST.o $(DEPS) 17 | $(CXX) $(IFLAGS) $(CFLAGS) $(LFLAGS) -o $@ $^ 18 | 19 | empty_test: empty_test.cpp $(DEPS) 20 | $(CXX) $(IFLAGS) $(CFLAGS) $(LFLAGS) -o $@ $^ 21 | 22 | -------------------------------------------------------------------------------- /tests/CPP/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // CPP_TEST.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /tests/CPP/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #if defined _WIN32 || WIN32 || _WINDOWS 9 | #include "targetver.h" 10 | 11 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 12 | // Windows Header Files: 13 | #include 14 | #include 15 | 16 | #else 17 | 18 | #endif // defined 19 | 20 | #include 21 | 22 | 23 | 24 | 25 | // TODO: reference additional headers your program requires here 26 | -------------------------------------------------------------------------------- /tests/CPP/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /tools/FakeAPI/FakeAPI.cpp: -------------------------------------------------------------------------------- 1 | // FakeAPI.cpp : Defines the exported functions for the DLL application. 2 | // 3 | 4 | #include "stdafx.h" 5 | 6 | void ShowMessageBox(char* buf) 7 | { 8 | if (OpenClipboard(NULL)) 9 | { 10 | int len = strlen(buf) + 1; 11 | 12 | HGLOBAL hmem = GlobalAlloc(GHND, len); 13 | char *pmem = (char*)GlobalLock(hmem); 14 | 15 | EmptyClipboard(); 16 | strcpy(pmem, buf); 17 | SetClipboardData(CF_TEXT, hmem); 18 | CloseClipboard(); 19 | GlobalFree(hmem); 20 | } 21 | 22 | MessageBoxA(nullptr, buf, "", MB_OK); 23 | } 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tools/FakeAPI/FakeAPI.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tools/FakeAPI/FakeAPI.rc -------------------------------------------------------------------------------- /tools/FakeAPI/README.md: -------------------------------------------------------------------------------- 1 | # FakeAPI伪造官方API 2 | 3 | ## 介绍 4 | 现在很多API都需要填写授权码才能登录,但这个授权码一般都已经硬编码或加密在了客户端当中,而申请授权码可能因为政策原因很难通过,所以获取已经授权的客户端中的授权码成了一些用户的需求。 5 | 6 | ## 原理 7 | 伪造一个dll,然后替换客户端中官方的dll,当客户端运行时调用伪造的dll时,转入的参数就有我们需要的信息。由于官方都会公布头文件,所以伪造dll变得相当简单。 8 | 9 | ## 使用方法 10 | 1. 先确定客户端是用的什么API,比如快期CTP、盈佳LTS 11 | 2. 打开AllCppProjects.sln解决方案,找到tools/FakeAPI。设置项目属性的Target Name。如CTP用thosttraderapi,LTS用securitytraderapi,注意没有带“.dll” 12 | 3. 由于本人在一个项目中同时集成了CTP和LTS的伪接口,所以编译一次,直接改名dll也能用 13 | 4. 备份原客户端中的dll,然后将生成的dll覆盖过去 14 | 5. 运行客户端并登录,会弹出一些你所想要的信息 15 | 6. 取到后,再换回原来的dll 16 | 17 | ## 自行伪造其它API 18 | 1. 添加一个cpp 19 | 2. 添加对应的头文件 20 | 3. 参考头文件的方式,在cpp开头添加合适的define进行函数或类的导出 21 | 4. 从官方从文件中复制对应的Api类定义到cpp中,修改成继承于这个类,然后把所有的函数先都实现成一个空函数,按情况构造一些假的返回值。参考代码已经提供的CTP与LTS的示列即可 22 | 5. 对于有些API如通视接口,由于导出函数名命问题,你可以在export.def中添加。 23 | 24 | ## 穿透式 25 | 1. FakeAPI设置项目属性的Target Name为`thosttraderapi_se` 26 | 2. 由于同一项目中`CTP`与`CTP_SE`两个项目的导出函数重复,无法直接编译,所以目前先将`ThostFtdcTraderApi.cpp`移除,只保留了`ThostFtdcTraderApi_SE.cpp`,如果还想使用老版本,反过来操作即可。 27 | 28 | 29 | -------------------------------------------------------------------------------- /tools/FakeAPI/SecurityFtdcTraderApi.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tools/FakeAPI/SecurityFtdcTraderApi.cpp -------------------------------------------------------------------------------- /tools/FakeAPI/StockDrv.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include 3 | #include "StockDrv.h" 4 | 5 | 6 | int WINAPI Stock_Init(HWND hWnd, UINT Msg, int nWorkMode) 7 | { 8 | return 0; 9 | } 10 | 11 | int WINAPI Stock_Quit(HWND hWnd) 12 | { 13 | return 0; 14 | } -------------------------------------------------------------------------------- /tools/FakeAPI/StockDrv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantBox/XAPI3/86b8a61a664bd3bc8bb0305fa73484d28ea8ed95/tools/FakeAPI/StockDrv.h -------------------------------------------------------------------------------- /tools/FakeAPI/ZQThostFtdcTraderApi.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define ISLIB 4 | #define LIB_TRADER_API_EXPORT 5 | 6 | #include 7 | #include "../../include/CTPZQ/ZQThostFtdcTraderApi.h" 8 | -------------------------------------------------------------------------------- /tools/FakeAPI/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /tools/FakeAPI/export.def: -------------------------------------------------------------------------------- 1 | LIBRARY 2 | EXPORTS 3 | Stock_Init 4 | Stock_Quit -------------------------------------------------------------------------------- /tools/FakeAPI/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by FakeAPI.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /tools/FakeAPI/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // FakeAPI.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /tools/FakeAPI/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | void ShowMessageBox(char* buf); -------------------------------------------------------------------------------- /tools/FakeAPI/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | --------------------------------------------------------------------------------