diff --git a/.gitignore b/.gitignore index 78b49ee..6831b23 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +# cmake +/build + +# vim +*.swp + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. @@ -70,6 +76,7 @@ ipch/ *.opensdf *.sdf *.cachefile +*.opendb # Visual Studio profiler *.psess @@ -126,7 +133,7 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings +# TODO: Comment the next line if you want to checkin your web deploy settings # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj @@ -229,3 +236,13 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk + +# Linux objects +# *.so +*.o + +# Misc files +*.userprefs + +# VSCode files +.vscode diff --git a/AllCppProjects.sln b/AllCppProjects.sln new file mode 100644 index 0000000..80f205c --- /dev/null +++ b/AllCppProjects.sln @@ -0,0 +1,402 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2020 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "apis", "apis", "{78740AE4-CA39-4892-B262-7FC77BF31E3A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CTP_Quote", "apis\CTP_Quote\CTP_Quote.vcxproj", "{919B914D-6840-453E-9201-8619E63AD0E1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CTP_Trade", "apis\CTP_Trade\CTP_Trade.vcxproj", "{9FBB0318-E21C-4B7C-A258-98E6A3860B35}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Kingstar_Quote", "apis\Kingstar_Quote\Kingstar_Quote.vcxproj", "{199071F1-5059-4883-BA49-6A9922A71ADD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Kingstar_Trade", "apis\Kingstar_Trade\Kingstar_Trade.vcxproj", "{70015722-8252-4944-AE20-16A88B583CEE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LTS_Query_v2", "apis\LTS_Query_v2\LTS_Query_v2.vcxproj", "{51D11C21-C4A7-4F07-9658-B8BA223684B8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LTS_Quote_v2", "apis\LTS_Quote_v2\LTS_Quote_v2.vcxproj", "{D4387736-0623-4442-A4AC-AF79239F9419}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LTS_Trade_v2", "apis\LTS_Trade_v2\LTS_Trade_v2.vcxproj", "{683AECBB-89EB-4692-99C5-A527853326D4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tdx_Trade", "apis\Tdx_Trade\Tdx_Trade.vcxproj", "{01D3F1DE-99B3-4D41-97C3-F4680CDB980B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TongShi_Quote", "apis\TongShi_Quote\TongShi_Quote.vcxproj", "{372C0D5E-ED93-4335-849C-65494AE8A17D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "common", "common", "{463A606E-275B-4F7B-B46D-B5E0E0C9FBFF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "License", "common\License\License.vcxproj", "{D3231052-575C-4D58-BA38-2C01B10BF205}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{8B1A6E55-6AB5-4875-8EC0-97E86BF42714}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{EA89FD2A-C740-4401-84E8-3BFEB57B1D5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FakeAPI", "tools\FakeAPI\FakeAPI.vcxproj", "{358586C9-A4B8-43E4-8376-59C68F0F6211}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CPP_TEST", "tests\CPP\CPP_TEST.vcxproj", "{C77ADBF7-E610-4E57-BE4D-C122FC5BE611}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "languages", "languages", "{DFA0F44C-82C0-4772-B71F-51D3DDE00F16}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XAPI_CPP", "languages\CPP\XAPI_CPP\XAPI_CPP.vcxproj", "{39599EFE-428F-408F-BF4F-BF462E37C5E8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CPP", "CPP", "{E883D8BF-3E2E-4899-B490-7346465B2555}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CPP", "CPP", "{A67F001E-0B1B-4BE2-90BB-243F8648B5EF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UFX_Trade", "apis\UFX_Trade\UFX_Trade.vcxproj", "{26C43947-9E7A-4B55-8A6D-A0F5222612AA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wind_Quote", "apis\Wind_Quote\Wind_Quote.vcxproj", "{7B30B57A-6E59-482E-A8A8-5E2D978EA991}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sgit_Quote", "apis\Sgit_Quote\Sgit_Quote.vcxproj", "{62BD7F43-395B-4A1E-84AC-64135ECF371D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sgit_Trade", "apis\Sgit_Trade\Sgit_Trade.vcxproj", "{B8C6E4A3-3345-4C46-91B2-198EB9D292DB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CTP_SOPT_Trade", "apis\CTP_SOPT_Trade\CTP_SOPT_Trade.vcxproj", "{ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ATP_Quote", "apis\ATP_Quote\ATP_Quote.vcxproj", "{3F2DB224-C53A-4983-B77D-0629D3ABDD80}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ATP_Trade", "apis\ATP_Trade\ATP_Trade.vcxproj", "{6D0E7A00-CCBE-4103-80A7-42A980BF43E0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CTPZQ_Quote", "apis\CTPZQ_Quote\CTPZQ_Quote.vcxproj", "{891F3DF0-72F6-404A-AF4A-85F1A640AB82}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CTPZQ_Trade", "apis\CTPZQ_Trade\CTPZQ_Trade.vcxproj", "{5307B252-E992-4907-9C15-4BC5BD746F4C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Debug64|Win32 = Debug64|Win32 + Debug64|x64 = Debug64|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + Release64|Win32 = Release64|Win32 + Release64|x64 = Release64|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|Win32.ActiveCfg = Debug|Win32 + {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|Win32.Build.0 = Debug|Win32 + {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|x64.ActiveCfg = Debug|Win32 + {919B914D-6840-453E-9201-8619E63AD0E1}.Debug64|Win32.ActiveCfg = Debug64|x64 + {919B914D-6840-453E-9201-8619E63AD0E1}.Debug64|x64.ActiveCfg = Debug64|x64 + {919B914D-6840-453E-9201-8619E63AD0E1}.Release|Win32.ActiveCfg = Release|Win32 + {919B914D-6840-453E-9201-8619E63AD0E1}.Release|Win32.Build.0 = Release|Win32 + {919B914D-6840-453E-9201-8619E63AD0E1}.Release|x64.ActiveCfg = Release|Win32 + {919B914D-6840-453E-9201-8619E63AD0E1}.Release64|Win32.ActiveCfg = Release64|x64 + {919B914D-6840-453E-9201-8619E63AD0E1}.Release64|x64.ActiveCfg = Release64|x64 + {919B914D-6840-453E-9201-8619E63AD0E1}.Release64|x64.Build.0 = Release64|x64 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|Win32.ActiveCfg = Debug|Win32 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|Win32.Build.0 = Debug|Win32 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|x64.ActiveCfg = Debug|Win32 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|Win32.ActiveCfg = Debug64|x64 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|x64.ActiveCfg = Debug64|x64 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|x64.Build.0 = Debug64|x64 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|Win32.ActiveCfg = Release|Win32 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|Win32.Build.0 = Release|Win32 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|x64.ActiveCfg = Release|Win32 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release64|Win32.ActiveCfg = Release64|x64 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release64|x64.ActiveCfg = Release64|x64 + {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release64|x64.Build.0 = Release64|x64 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug|Win32.ActiveCfg = Debug|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug|Win32.Build.0 = Debug|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug|x64.ActiveCfg = Debug|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug64|Win32.ActiveCfg = Debug|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug64|Win32.Build.0 = Debug|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug64|x64.ActiveCfg = Debug|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Release|Win32.ActiveCfg = Release|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Release|Win32.Build.0 = Release|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Release|x64.ActiveCfg = Release|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Release64|Win32.ActiveCfg = Release|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Release64|Win32.Build.0 = Release|Win32 + {199071F1-5059-4883-BA49-6A9922A71ADD}.Release64|x64.ActiveCfg = Release|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Debug|Win32.ActiveCfg = Debug|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Debug|Win32.Build.0 = Debug|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Debug|x64.ActiveCfg = Debug|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Debug64|Win32.ActiveCfg = Debug|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Debug64|Win32.Build.0 = Debug|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Debug64|x64.ActiveCfg = Debug|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Release|Win32.ActiveCfg = Release|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Release|Win32.Build.0 = Release|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Release|x64.ActiveCfg = Release|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Release64|Win32.ActiveCfg = Release|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Release64|Win32.Build.0 = Release|Win32 + {70015722-8252-4944-AE20-16A88B583CEE}.Release64|x64.ActiveCfg = Release|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug|Win32.ActiveCfg = Debug|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug|Win32.Build.0 = Debug|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug|x64.ActiveCfg = Debug|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug64|Win32.ActiveCfg = Debug|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug64|Win32.Build.0 = Debug|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug64|x64.ActiveCfg = Debug|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release|Win32.ActiveCfg = Release|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release|Win32.Build.0 = Release|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release|x64.ActiveCfg = Release|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release64|Win32.ActiveCfg = Release|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release64|Win32.Build.0 = Release|Win32 + {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release64|x64.ActiveCfg = Release|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|Win32.ActiveCfg = Debug|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|Win32.Build.0 = Debug|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|x64.ActiveCfg = Debug|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|Win32.ActiveCfg = Debug|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|Win32.Build.0 = Debug|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|x64.ActiveCfg = Debug|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Release|Win32.ActiveCfg = Release|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Release|Win32.Build.0 = Release|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Release|x64.ActiveCfg = Release|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Release64|Win32.ActiveCfg = Release|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Release64|Win32.Build.0 = Release|Win32 + {D4387736-0623-4442-A4AC-AF79239F9419}.Release64|x64.ActiveCfg = Release|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|Win32.ActiveCfg = Debug|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|Win32.Build.0 = Debug|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|x64.ActiveCfg = Debug|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|Win32.ActiveCfg = Debug|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|Win32.Build.0 = Debug|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|x64.ActiveCfg = Debug|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Release|Win32.ActiveCfg = Release|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Release|Win32.Build.0 = Release|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Release|x64.ActiveCfg = Release|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Release64|Win32.ActiveCfg = Release|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Release64|Win32.Build.0 = Release|Win32 + {683AECBB-89EB-4692-99C5-A527853326D4}.Release64|x64.ActiveCfg = Release|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug|Win32.ActiveCfg = Debug|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug|Win32.Build.0 = Debug|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug|x64.ActiveCfg = Debug|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug64|Win32.ActiveCfg = Debug|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug64|Win32.Build.0 = Debug|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug64|x64.ActiveCfg = Debug|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release|Win32.ActiveCfg = Release|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release|Win32.Build.0 = Release|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release|x64.ActiveCfg = Release|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release64|Win32.ActiveCfg = Release|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release64|Win32.Build.0 = Release|Win32 + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release64|x64.ActiveCfg = Release|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug|Win32.ActiveCfg = Debug|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug|Win32.Build.0 = Debug|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug|x64.ActiveCfg = Debug|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug64|Win32.ActiveCfg = Debug|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug64|Win32.Build.0 = Debug|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug64|x64.ActiveCfg = Debug|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release|Win32.ActiveCfg = Release|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release|Win32.Build.0 = Release|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release|x64.ActiveCfg = Release|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release64|Win32.ActiveCfg = Release|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release64|Win32.Build.0 = Release|Win32 + {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release64|x64.ActiveCfg = Release|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Debug|Win32.ActiveCfg = Debug|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Debug|Win32.Build.0 = Debug|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Debug|x64.ActiveCfg = Debug|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Debug64|Win32.ActiveCfg = Debug|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Debug64|Win32.Build.0 = Debug|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Debug64|x64.ActiveCfg = Debug|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Release|Win32.ActiveCfg = Release|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Release|Win32.Build.0 = Release|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Release|x64.ActiveCfg = Release|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Release64|Win32.ActiveCfg = Release|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Release64|Win32.Build.0 = Release|Win32 + {D3231052-575C-4D58-BA38-2C01B10BF205}.Release64|x64.ActiveCfg = Release|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug|Win32.ActiveCfg = Debug|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug|Win32.Build.0 = Debug|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug|x64.ActiveCfg = Debug|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug64|Win32.ActiveCfg = Debug|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug64|Win32.Build.0 = Debug|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug64|x64.ActiveCfg = Debug|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release|Win32.ActiveCfg = Release|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release|Win32.Build.0 = Release|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release|x64.ActiveCfg = Release|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release64|Win32.ActiveCfg = Release64|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release64|Win32.Build.0 = Release64|Win32 + {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release64|x64.ActiveCfg = Release64|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug|Win32.ActiveCfg = Debug|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug|Win32.Build.0 = Debug|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug|x64.ActiveCfg = Debug|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug64|Win32.ActiveCfg = Debug|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug64|Win32.Build.0 = Debug|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug64|x64.ActiveCfg = Debug|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|Win32.ActiveCfg = Release|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|Win32.Build.0 = Release|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|x64.ActiveCfg = Release|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release64|Win32.ActiveCfg = Release|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release64|Win32.Build.0 = Release|Win32 + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release64|x64.ActiveCfg = Release|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug|Win32.ActiveCfg = Debug|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug|Win32.Build.0 = Debug|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug|x64.ActiveCfg = Debug|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|Win32.ActiveCfg = Debug|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|Win32.Build.0 = Debug|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|x64.ActiveCfg = Debug|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|x64.Build.0 = Debug|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release|Win32.ActiveCfg = Release|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release|Win32.Build.0 = Release|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release|x64.ActiveCfg = Release|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release64|Win32.ActiveCfg = Release|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release64|Win32.Build.0 = Release|Win32 + {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release64|x64.ActiveCfg = Release|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Debug|Win32.ActiveCfg = Debug|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Debug|Win32.Build.0 = Debug|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Debug|x64.ActiveCfg = Debug|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Debug64|Win32.ActiveCfg = Debug|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Debug64|Win32.Build.0 = Debug|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Debug64|x64.ActiveCfg = Debug|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Release|Win32.ActiveCfg = Release|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Release|Win32.Build.0 = Release|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Release|x64.ActiveCfg = Release|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Release64|Win32.ActiveCfg = Release|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Release64|Win32.Build.0 = Release|Win32 + {26C43947-9E7A-4B55-8A6D-A0F5222612AA}.Release64|x64.ActiveCfg = Release|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Debug|Win32.ActiveCfg = Debug|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Debug|Win32.Build.0 = Debug|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Debug|x64.ActiveCfg = Debug|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Debug64|Win32.ActiveCfg = Debug|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Debug64|Win32.Build.0 = Debug|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Debug64|x64.ActiveCfg = Release|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Debug64|x64.Build.0 = Release|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Release|Win32.ActiveCfg = Release|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Release|Win32.Build.0 = Release|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Release|x64.ActiveCfg = Release|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Release64|Win32.ActiveCfg = Release|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Release64|Win32.Build.0 = Release|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Release64|x64.ActiveCfg = Release|Win32 + {7B30B57A-6E59-482E-A8A8-5E2D978EA991}.Release64|x64.Build.0 = Release|Win32 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Debug|Win32.ActiveCfg = Debug|Win32 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Debug|Win32.Build.0 = Debug|Win32 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Debug|x64.ActiveCfg = Debug|x64 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Debug|x64.Build.0 = Debug|x64 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Debug64|Win32.ActiveCfg = Debug|Win32 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Debug64|Win32.Build.0 = Debug|Win32 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Debug64|x64.ActiveCfg = Debug|x64 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Debug64|x64.Build.0 = Debug|x64 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Release|Win32.ActiveCfg = Release|Win32 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Release|Win32.Build.0 = Release|Win32 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Release|x64.ActiveCfg = Release|x64 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Release|x64.Build.0 = Release|x64 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Release64|Win32.ActiveCfg = Release|Win32 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Release64|Win32.Build.0 = Release|Win32 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Release64|x64.ActiveCfg = Release|x64 + {62BD7F43-395B-4A1E-84AC-64135ECF371D}.Release64|x64.Build.0 = Release|x64 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Debug|Win32.ActiveCfg = Debug|Win32 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Debug|Win32.Build.0 = Debug|Win32 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Debug|x64.ActiveCfg = Debug|x64 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Debug|x64.Build.0 = Debug|x64 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Debug64|Win32.ActiveCfg = Debug|Win32 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Debug64|Win32.Build.0 = Debug|Win32 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Debug64|x64.ActiveCfg = Debug|x64 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Debug64|x64.Build.0 = Debug|x64 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Release|Win32.ActiveCfg = Release|Win32 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Release|Win32.Build.0 = Release|Win32 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Release|x64.ActiveCfg = Release|x64 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Release|x64.Build.0 = Release|x64 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Release64|Win32.ActiveCfg = Release|Win32 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Release64|Win32.Build.0 = Release|Win32 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Release64|x64.ActiveCfg = Release|x64 + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB}.Release64|x64.Build.0 = Release|x64 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Debug|Win32.ActiveCfg = Debug|Win32 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Debug|Win32.Build.0 = Debug|Win32 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Debug|x64.ActiveCfg = Debug|x64 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Debug|x64.Build.0 = Debug|x64 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Debug64|Win32.ActiveCfg = Debug|Win32 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Debug64|Win32.Build.0 = Debug|Win32 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Debug64|x64.ActiveCfg = Debug|x64 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Release|Win32.ActiveCfg = Release|Win32 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Release|Win32.Build.0 = Release|Win32 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Release|x64.ActiveCfg = Release|x64 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Release|x64.Build.0 = Release|x64 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Release64|Win32.ActiveCfg = Release|Win32 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Release64|Win32.Build.0 = Release|Win32 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Release64|x64.ActiveCfg = Release|x64 + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A}.Release64|x64.Build.0 = Release|x64 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Debug|Win32.ActiveCfg = Debug|Win32 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Debug|Win32.Build.0 = Debug|Win32 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Debug|x64.ActiveCfg = Debug|x64 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Debug|x64.Build.0 = Debug|x64 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Debug64|Win32.ActiveCfg = Debug|Win32 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Debug64|Win32.Build.0 = Debug|Win32 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Debug64|x64.ActiveCfg = Debug|x64 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Debug64|x64.Build.0 = Debug|x64 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Release|Win32.ActiveCfg = Release|Win32 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Release|Win32.Build.0 = Release|Win32 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Release|x64.ActiveCfg = Release|x64 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Release|x64.Build.0 = Release|x64 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Release64|Win32.ActiveCfg = Release|Win32 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Release64|Win32.Build.0 = Release|Win32 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Release64|x64.ActiveCfg = Release|x64 + {3F2DB224-C53A-4983-B77D-0629D3ABDD80}.Release64|x64.Build.0 = Release|x64 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Debug|Win32.ActiveCfg = Debug|Win32 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Debug|Win32.Build.0 = Debug|Win32 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Debug|x64.ActiveCfg = Debug|x64 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Debug|x64.Build.0 = Debug|x64 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Debug64|Win32.ActiveCfg = Debug|Win32 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Debug64|Win32.Build.0 = Debug|Win32 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Debug64|x64.ActiveCfg = Debug|x64 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Debug64|x64.Build.0 = Debug|x64 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Release|Win32.ActiveCfg = Release|Win32 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Release|Win32.Build.0 = Release|Win32 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Release|x64.ActiveCfg = Release|x64 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Release|x64.Build.0 = Release|x64 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Release64|Win32.ActiveCfg = Release|Win32 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Release64|Win32.Build.0 = Release|Win32 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Release64|x64.ActiveCfg = Release|x64 + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0}.Release64|x64.Build.0 = Release|x64 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Debug|Win32.ActiveCfg = Debug|Win32 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Debug|Win32.Build.0 = Debug|Win32 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Debug|x64.ActiveCfg = Debug|x64 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Debug|x64.Build.0 = Debug|x64 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Debug64|Win32.ActiveCfg = Debug|Win32 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Debug64|Win32.Build.0 = Debug|Win32 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Debug64|x64.ActiveCfg = Debug|x64 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Debug64|x64.Build.0 = Debug|x64 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Release|Win32.ActiveCfg = Release|Win32 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Release|Win32.Build.0 = Release|Win32 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Release|x64.ActiveCfg = Release|x64 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Release|x64.Build.0 = Release|x64 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Release64|Win32.ActiveCfg = Release|Win32 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Release64|Win32.Build.0 = Release|Win32 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Release64|x64.ActiveCfg = Release|x64 + {891F3DF0-72F6-404A-AF4A-85F1A640AB82}.Release64|x64.Build.0 = Release|x64 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Debug|Win32.ActiveCfg = Debug|Win32 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Debug|Win32.Build.0 = Debug|Win32 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Debug|x64.ActiveCfg = Debug|x64 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Debug|x64.Build.0 = Debug|x64 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Debug64|Win32.ActiveCfg = Debug|Win32 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Debug64|Win32.Build.0 = Debug|Win32 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Debug64|x64.ActiveCfg = Debug|x64 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Debug64|x64.Build.0 = Debug|x64 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Release|Win32.ActiveCfg = Release|Win32 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Release|Win32.Build.0 = Release|Win32 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Release|x64.ActiveCfg = Release|x64 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Release|x64.Build.0 = Release|x64 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Release64|Win32.ActiveCfg = Release|Win32 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Release64|Win32.Build.0 = Release|Win32 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Release64|x64.ActiveCfg = Release|x64 + {5307B252-E992-4907-9C15-4BC5BD746F4C}.Release64|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {919B914D-6840-453E-9201-8619E63AD0E1} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {9FBB0318-E21C-4B7C-A258-98E6A3860B35} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {199071F1-5059-4883-BA49-6A9922A71ADD} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {70015722-8252-4944-AE20-16A88B583CEE} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {51D11C21-C4A7-4F07-9658-B8BA223684B8} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {D4387736-0623-4442-A4AC-AF79239F9419} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {683AECBB-89EB-4692-99C5-A527853326D4} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {01D3F1DE-99B3-4D41-97C3-F4680CDB980B} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {372C0D5E-ED93-4335-849C-65494AE8A17D} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {D3231052-575C-4D58-BA38-2C01B10BF205} = {463A606E-275B-4F7B-B46D-B5E0E0C9FBFF} + {358586C9-A4B8-43E4-8376-59C68F0F6211} = {EA89FD2A-C740-4401-84E8-3BFEB57B1D5A} + {C77ADBF7-E610-4E57-BE4D-C122FC5BE611} = {A67F001E-0B1B-4BE2-90BB-243F8648B5EF} + {39599EFE-428F-408F-BF4F-BF462E37C5E8} = {E883D8BF-3E2E-4899-B490-7346465B2555} + {E883D8BF-3E2E-4899-B490-7346465B2555} = {DFA0F44C-82C0-4772-B71F-51D3DDE00F16} + {A67F001E-0B1B-4BE2-90BB-243F8648B5EF} = {8B1A6E55-6AB5-4875-8EC0-97E86BF42714} + {26C43947-9E7A-4B55-8A6D-A0F5222612AA} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {7B30B57A-6E59-482E-A8A8-5E2D978EA991} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {62BD7F43-395B-4A1E-84AC-64135ECF371D} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {3F2DB224-C53A-4983-B77D-0629D3ABDD80} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {6D0E7A00-CCBE-4103-80A7-42A980BF43E0} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {891F3DF0-72F6-404A-AF4A-85F1A640AB82} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + {5307B252-E992-4907-9C15-4BC5BD746F4C} = {78740AE4-CA39-4892-B262-7FC77BF31E3A} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BC308C7B-3CB5-40F4-9D92-8FE557122BDB} + EndGlobalSection +EndGlobal diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..18397ed --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,778 @@ +cmake_minimum_required(VERSION 3.6.3) +project(XAPI2) + +# set compile parameter +if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -fpermissive -rdynamic -std=c++11") +elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Wno-missing-field-initializers") + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) +elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS=1 -D_UNICODE -DUNICODE) +endif() + +# set output dir +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# for vim plugin - YCM +if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +endif() + +# set use folder in vs +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +# thread +find_package(Threads) + +# include and link directories +link_directories( + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} +) + +# add XAPI_CPP +file(GLOB_RECURSE XAPI_CPP_h ${CMAKE_CURRENT_LIST_DIR}/languages/CPP/XAPI_CPP/*.h) +file(GLOB_RECURSE XAPI_CPP_cpp ${CMAKE_CURRENT_LIST_DIR}/languages/CPP/XAPI_CPP/*.cpp) +list(FILTER XAPI_CPP_cpp EXCLUDE REGEX ".*dllmain.cpp") +if (WIN32) + add_library(XAPI_CPP SHARED + ${XAPI_CPP_h} + ${XAPI_CPP_cpp} + ${CMAKE_CURRENT_LIST_DIR}/include/XApiC.h + ${CMAKE_CURRENT_LIST_DIR}/include/XApiCpp.h + ${CMAKE_CURRENT_LIST_DIR}/include/CrossPlatform.h + ) + set_target_properties(XAPI_CPP + PROPERTIES + FOLDER "languages/CPP" + OUTPUT_NAME XAPI_CPP_$(PlatformTarget) + ) +else() + add_library(XAPI_CPP SHARED + ${XAPI_CPP_cpp} + ) +endif() +target_link_libraries(XAPI_CPP + ${CMAKE_THREAD_LIBS_INIT} + ${CMAKE_DL_LIBS} +) +target_compile_definitions(XAPI_CPP + PRIVATE BUILDING_DLL + PUBLIC XAPI_CPP_EXPORTS +) + +# get common files +set(common_h + ${CMAKE_CURRENT_LIST_DIR}/include/toolkit.h + ${CMAKE_CURRENT_LIST_DIR}/include/inirw.h + ${CMAKE_CURRENT_LIST_DIR}/include/ChinaStock.h + ${CMAKE_CURRENT_LIST_DIR}/include/IDGenerator.h + ${CMAKE_CURRENT_LIST_DIR}/include/ApiProcess.h +) +set(common_cpp + ${CMAKE_CURRENT_LIST_DIR}/include/toolkit.cpp + ${CMAKE_CURRENT_LIST_DIR}/include/inirw.cpp + ${CMAKE_CURRENT_LIST_DIR}/include/ChinaStock.cpp + ${CMAKE_CURRENT_LIST_DIR}/include/IDGenerator.cpp + ${CMAKE_CURRENT_LIST_DIR}/include/ApiProcess.cpp +) +set(common_quote_h + ${CMAKE_CURRENT_LIST_DIR}/include/CSubscribeManager.h + ${CMAKE_CURRENT_LIST_DIR}/include/CSubscribeManager1.h + ${CMAKE_CURRENT_LIST_DIR}/include/CSubscribeManager2.h + ${CMAKE_CURRENT_LIST_DIR}/include/CSyntheticCalculate_DepthMarketDataNField.h +) +set(common_quote_cpp + ${CMAKE_CURRENT_LIST_DIR}/include/CSubscribeManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/include/CSubscribeManager1.cpp + ${CMAKE_CURRENT_LIST_DIR}/include/CSubscribeManager2.cpp + ${CMAKE_CURRENT_LIST_DIR}/include/CSyntheticCalculate_DepthMarketDataNField.cpp +) +file(GLOB synthetic_h ${CMAKE_CURRENT_LIST_DIR}/include/synthetic/*.h) +file(GLOB synthetic_cpp ${CMAKE_CURRENT_LIST_DIR}/include/synthetic/*.cpp) + +# functions +function(move_into_filter filter files) + foreach(FILE ${files}) + # Get the directory of the source file + get_filename_component(PARENT_DIR "${FILE}" DIRECTORY) + + # Remove common directory prefix to make the group + string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "" GROUP "${PARENT_DIR}") + + # Make sure we are using windows slashes + string(REPLACE "/" "\\" GROUP "${GROUP}") + + source_group("${filter}" FILES "${FILE}") + endforeach() +endfunction(move_into_filter) + +function(add_quote name folders) + set(src_files "") + set(h_files "") + foreach(folder ${folders}) + file(GLOB tmp_h ${folder}/*.h) + file(GLOB tmp_cpp ${folder}/*.cpp) + list(APPEND h_files ${tmp_h}) + list(APPEND src_files ${tmp_cpp}) + endforeach(folder) + + list(FILTER src_files EXCLUDE REGEX ".*dllmain.cpp") + + if (WIN32) + add_library(${name} SHARED + ${h_files} + ${src_files} + ${common_h} + ${common_cpp} + ${common_quote_h} + ${common_quote_cpp} + ${synthetic_h} + ${synthetic_cpp} + ) + move_into_filter(common "${common_h}") + move_into_filter(common "${common_cpp}") + move_into_filter(common_quote "${common_quote_h}") + move_into_filter(common_quote "${common_quote_cpp}") + move_into_filter(synthetic "${synthetic_h}") + move_into_filter(synthetic "${synthetic_cpp}") + else() + add_library(${name} SHARED + ${src_files} + ${common_cpp} + ${common_quote_cpp} + ${synthetic_cpp} + ) + endif() + + target_include_directories(${name} PRIVATE + ${folders} + ) + target_compile_definitions(${name} + PRIVATE USE_CMAKE BUILDING_DLL + ) + if (WIN32) + set_target_properties(${name} + PROPERTIES + FOLDER "apis" + OUTPUT_NAME ${name}_$(PlatformTarget) + ) + endif() +endfunction(add_quote) + +function(add_trade name folders) + set(src_files "") + set(h_files "") + foreach(folder ${folders}) + file(GLOB tmp_h ${folder}/*.h) + file(GLOB tmp_cpp ${folder}/*.cpp) + list(APPEND h_files ${tmp_h}) + list(APPEND src_files ${tmp_cpp}) + endforeach(folder) + + list(FILTER src_files EXCLUDE REGEX ".*dllmain.cpp") + + if (WIN32) + add_library(${name} SHARED + ${h_files} + ${src_files} + ${common_h} + ${common_cpp} + ${synthetic_h} + ${synthetic_cpp} + ) + move_into_filter(common "${common_h}") + move_into_filter(common "${common_cpp}") + move_into_filter(synthetic "${synthetic_h}") + move_into_filter(synthetic "${synthetic_cpp}") + else() + add_library(${name} SHARED + ${src_files} + ${common_cpp} + ${synthetic_cpp} + ) + endif() + + target_include_directories(${name} PRIVATE + ${folders} + ) + target_compile_definitions(${name} + PRIVATE USE_CMAKE BUILDING_DLL + ) + if (WIN32) + set_target_properties(${name} + PROPERTIES + FOLDER "apis" + OUTPUT_NAME ${name}_$(PlatformTarget) + ) + endif() +endfunction(add_trade) + +function(add_apis name cpp_files h_files) + list(FILTER cpp_files EXCLUDE REGEX ".*dllmain.cpp") + + if (WIN32) + add_library(${name} SHARED + ${h_files} + ${cpp_files} + ${common_h} + ${common_cpp} + ${common_quote_h} + ${common_quote_cpp} + ${synthetic_h} + ${synthetic_cpp} + ) + move_into_filter(common "${common_h}") + move_into_filter(common "${common_cpp}") + move_into_filter(common_quote "${common_quote_h}") + move_into_filter(common_quote "${common_quote_cpp}") + move_into_filter(synthetic "${synthetic_h}") + move_into_filter(synthetic "${synthetic_cpp}") + else() + add_library(${name} SHARED + ${cpp_files} + ${common_cpp} + ${common_quote_cpp} + ${synthetic_cpp} + ) + endif() + + target_compile_definitions(${name} + PRIVATE USE_CMAKE BUILDING_DLL + ) + if (WIN32) + set_target_properties(${name} + PROPERTIES + FOLDER "apis" + OUTPUT_NAME ${name}_$(PlatformTarget) + ) + endif() +endfunction(add_apis) + +# add CTP Quote +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP/Quote) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP_Quote) +add_quote(CTP_Quote "${folder}") +if (WIN32) + if (CMAKE_CL_64) + ADD_CUSTOM_COMMAND(TARGET CTP_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/win64/thostmduserapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/win64/thostmduserapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + else() + ADD_CUSTOM_COMMAND(TARGET CTP_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/win32/thostmduserapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/win32/thostmduserapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +else() + ADD_CUSTOM_COMMAND(TARGET CTP_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/linux64/libthostmduserapi.so ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + ) +endif() +target_link_libraries(CTP_Quote + thostmduserapi +) + +# add CTP Trade +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP/Trade) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP_Trade) +add_trade(CTP_Trade "${folder}") +if (WIN32) + if (CMAKE_CL_64) + ADD_CUSTOM_COMMAND(TARGET CTP_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/win64/thosttraderapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/win64/thosttraderapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + else() + ADD_CUSTOM_COMMAND(TARGET CTP_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/win32/thosttraderapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/win32/thosttraderapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +else() + ADD_CUSTOM_COMMAND(TARGET CTP_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTP/linux64/libthosttraderapi.so ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + ) +endif() +target_link_libraries(CTP_Trade + thosttraderapi +) + +# add XTP Quote +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/XTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/XTP/Quote) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/XTP_Quote) +add_quote(XTP_Quote "${folder}") +if (WIN32) + if (CMAKE_CL_64) + ADD_CUSTOM_COMMAND(TARGET XTP_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/win64/xtpquoteapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/win64/xtpquoteapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + else() + ADD_CUSTOM_COMMAND(TARGET XTP_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/win32/xtpquoteapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/win32/xtpquoteapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +else() + ADD_CUSTOM_COMMAND(TARGET XTP_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/linux64/libxtpquoteapi.so ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + ) +endif() +target_link_libraries(XTP_Quote + xtpquoteapi +) +target_compile_definitions(XTP_Quote + PRIVATE USE_CMAKE BUILDING_DLL ISLIB +) + +# add XTP Trade +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/XTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/XTP/Trade) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/XTP_Trade) +add_trade(XTP_Trade "${folder}") +if (WIN32) + if (CMAKE_CL_64) + ADD_CUSTOM_COMMAND(TARGET XTP_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/win64/xtptraderapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/win64/xtptraderapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + else() + ADD_CUSTOM_COMMAND(TARGET XTP_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/win32/xtptraderapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/win32/xtptraderapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +else() + ADD_CUSTOM_COMMAND(TARGET XTP_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/XTP/linux64/libxtptraderapi.so ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + ) +endif() +target_link_libraries(XTP_Trade + xtptraderapi +) + +if (WIN32) + +# add CTP Spot Trade +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP/Trade) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP_SOPT_Trade) +add_trade(CTP_SPOT_Trade "${folder}") +target_link_libraries(CTP_SPOT_Trade + thosttraderapi +) +add_dependencies(CTP_SPOT_Trade + CTP_Trade +) + +# add CTPZQ Quote +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP/Quote) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTPZQ_Quote) +add_quote(CTPZQ_Quote "${folder}") +if (WIN32) + if (CMAKE_CL_64) + ADD_CUSTOM_COMMAND(TARGET CTPZQ_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTPZQ/win64/zqthostmdapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTPZQ/win64/zqthostmdapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + else() + ADD_CUSTOM_COMMAND(TARGET CTPZQ_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTPZQ/win32/zqthostmdapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTPZQ/win32/zqthostmdapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(CTPZQ_Quote + zqthostmdapi +) + +# add CTPZQ Trade +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP/Trade) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTPZQ_Trade) +add_trade(CTPZQ_Trade "${folder}") +if (WIN32) + if (CMAKE_CL_64) + ADD_CUSTOM_COMMAND(TARGET CTPZQ_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTPZQ/win64/zqthosttraderapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTPZQ/win64/zqthosttraderapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + else() + ADD_CUSTOM_COMMAND(TARGET CTPZQ_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTPZQ/win32/zqthosttraderapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/CTPZQ/win32/zqthosttraderapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(CTPZQ_Trade + zqthosttraderapi +) + +# add Kingstar Quote +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP/Quote) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/Kingstar_Quote) +add_quote(Kingstar_Quote "${folder}") +if (WIN32) + if (CMAKE_CL_64) +# ADD_CUSTOM_COMMAND(TARGET Kingstar_Quote +# PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Kingstar/win64/KSMarketDataAPI.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Kingstar/win64/KSMarketDataAPI.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ +# ) + else() + ADD_CUSTOM_COMMAND(TARGET Kingstar_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Kingstar/win32/KSMarketDataAPI.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Kingstar/win32/KSMarketDataAPI.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(Kingstar_Quote + KSMarketDataAPI +) + +# add Kingstar Trade +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP/Trade) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/Kingstar_Trade) +add_trade(Kingstar_Trade "${folder}") +if (WIN32) + if (CMAKE_CL_64) +# ADD_CUSTOM_COMMAND(TARGET Kingstar_Trade +# PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Kingstar/win64/KSTradeAPI.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Kingstar/win64/KSTradeAPI.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ +# ) + else() + ADD_CUSTOM_COMMAND(TARGET Kingstar_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Kingstar/win32/KSTradeAPI.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Kingstar/win32/KSTradeAPI.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(Kingstar_Trade + KSTradeAPI +) + +# add LTS Quote v2 +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/LTS_Quote_v2) +add_quote(LTS_Quote_v2 "${folder}") +if (WIN32) + if (CMAKE_CL_64) +# ADD_CUSTOM_COMMAND(TARGET LTS_Quote_v2 +# PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win64/securitymduserapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win64/securitymduserapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ +# ) + else() + ADD_CUSTOM_COMMAND(TARGET LTS_Quote_v2 + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win32/securitymduserapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win32/securitymduserapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(LTS_Quote_v2 + securitymduserapi +) + +# add LTS Query v2 +set(folder "") +# list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/LTS_Query_v2) +file(GLOB LTS_Query_cpp ${CMAKE_CURRENT_LIST_DIR}/apis/LTS_Query_v2/*.cpp) +file(GLOB LTS_Query_h ${CMAKE_CURRENT_LIST_DIR}/apis/LTS_Query_v2/*.h) +list(APPEND LTS_Query_cpp ${CMAKE_CURRENT_LIST_DIR}/apis/LTS_Trade_v2/TypeConvert.cpp) +list(APPEND LTS_Query_h ${CMAKE_CURRENT_LIST_DIR}/apis/LTS_Trade_v2/TypeConvert.h) +add_apis(LTS_Query_v2 "${LTS_Query_cpp}" "${LTS_Query_h}") +if (WIN32) + if (CMAKE_CL_64) +# ADD_CUSTOM_COMMAND(TARGET LTS_Query_v2 +# PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win64/securityqueryapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win64/securityqueryapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ +# ) + else() + ADD_CUSTOM_COMMAND(TARGET LTS_Query_v2 + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win32/securityqueryapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win32/securityqueryapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(LTS_Query_v2 + securityqueryapi +) +target_include_directories(LTS_Query_v2 PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/apis/LTS_Query_v2 +) + +# add LTS Trade v2 +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/LTS_Trade_v2) +add_trade(LTS_Trade_v2 "${folder}") +if (WIN32) + if (CMAKE_CL_64) +# ADD_CUSTOM_COMMAND(TARGET LTS_Trade_v2 +# PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win64/securitytraderapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win64/securitytraderapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ +# ) + else() + ADD_CUSTOM_COMMAND(TARGET LTS_Trade_v2 + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win32/securitytraderapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/LTS_v2/win32/securitytraderapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(LTS_Trade_v2 + securitytraderapi +) + +# add Sgit Quote +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP/Quote) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/Sgit_Quote) +add_quote(Sgit_Quote "${folder}") +if (WIN32) + if (CMAKE_CL_64) +# ADD_CUSTOM_COMMAND(TARGET Sgit_Quote +# PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Sgit/win64/sgitquotapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Sgit/win64/sgitquotapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ +# ) + else() + ADD_CUSTOM_COMMAND(TARGET Sgit_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Sgit/win32/sgitquotapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Sgit/win32/sgitquotapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(Sgit_Quote + sgitquotapi +) + +# add Sgit Trade +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/CTP/Trade) +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/Sgit_Trade) +add_trade(Sgit_Trade "${folder}") +if (WIN32) + if (CMAKE_CL_64) +# ADD_CUSTOM_COMMAND(TARGET Sgit_Trade +# PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Sgit/win64/sgittradeapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Sgit/win64/sgittradeapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ +# ) + else() + ADD_CUSTOM_COMMAND(TARGET Sgit_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Sgit/win32/sgittradeapi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Sgit/win32/sgittradeapi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(Sgit_Trade + sgittradeapi +) + +# add Tdx Trade +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/Tdx_Trade) +add_quote(Tdx_Trade "${folder}") +if (WIN32) + if (CMAKE_CL_64) +# ADD_CUSTOM_COMMAND(TARGET Tdx_Trade +# PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Tdx/win64/TdxApi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Tdx/win64/TdxApi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ +# ) + else() + ADD_CUSTOM_COMMAND(TARGET Tdx_Trade + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Tdx/win32/TdxApi.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Tdx/win32/TdxApi.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(Tdx_Trade + TdxApi +) + + +# add Wind Quote +set(folder "") +list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/Wind_Quote) +add_quote(Wind_Quote "${folder}") +if (WIN32) + if (CMAKE_CL_64) + ADD_CUSTOM_COMMAND(TARGET Wind_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Wind/win64/WAPIWrapperCpp.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Wind/win64/WAPIWrapperCpp.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + else() + ADD_CUSTOM_COMMAND(TARGET Wind_Quote + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Wind/win32/WAPIWrapperCpp.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/include/Wind/win32/WAPIWrapperCpp.lib ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$(Configuration)/ + ) + endif() +endif() +target_link_libraries(Wind_Quote + WAPIWrapperCpp +) + +# add FakeAPI +file(GLOB FAKE_API_H ${CMAKE_CURRENT_LIST_DIR}/tools/FakeAPI/*.h) +file(GLOB FAKE_API_CPP ${CMAKE_CURRENT_LIST_DIR}/tools/FakeAPI/*.cpp) +list(FILTER FAKE_API_CPP EXCLUDE REGEX ".*dllmain.cpp") +if (WIN32) +add_library(FakeAPI SHARED + ${FAKE_API_H} + ${FAKE_API_CPP} + ${CMAKE_CURRENT_LIST_DIR}/tools/FakeAPI/export.def +) +else() +add_library(FakeAPI SHARED + ${FAKE_API_CPP} +) +endif() +set_target_properties(FakeAPI + PROPERTIES + FOLDER "tools" +) + +# # add Tongshi Quote +# set(folder "") +# list(APPEND folder ${CMAKE_CURRENT_LIST_DIR}/apis/Tongshi_Quote) +# add_quote(Tongshi_Quote "${folder}") + +# add Cpp Test +file(GLOB CPP_TEST_H ${CMAKE_CURRENT_LIST_DIR}/tests/CPP/*.h) +file(GLOB CPP_TEST_CPP ${CMAKE_CURRENT_LIST_DIR}/tests/CPP/*.cpp) +if (WIN32) +add_executable(CPP_TEST + ${CPP_TEST_H} + ${CPP_TEST_CPP} +) +set_target_properties(CPP_TEST + PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(OutDir)" +) +else() +add_executable(CPP_TEST + ${CPP_TEST_CPP} +) +endif() +target_compile_definitions(CPP_TEST + PRIVATE USE_CMAKE +) +add_dependencies(CPP_TEST + XAPI_CPP + CTP_Quote + CTP_Trade +) +target_link_libraries(CPP_TEST + XAPI_CPP +) +set_target_properties(CPP_TEST + PROPERTIES + FOLDER "tests/CPP" +) + +endif(WIN32) + +# add cpp examples +add_executable(ExampleCTP ${CMAKE_CURRENT_LIST_DIR}/example/cpp/CTP/example_ctp.cpp) +target_link_libraries(ExampleCTP XAPI_CPP) +target_compile_definitions(ExampleCTP PRIVATE USE_CMAKE) +add_dependencies(ExampleCTP + XAPI_CPP + CTP_Quote + CTP_Trade +) + +add_executable(ExampleXTP ${CMAKE_CURRENT_LIST_DIR}/example/cpp/XTP/example_xtp.cpp) +target_link_libraries(ExampleXTP XAPI_CPP) +target_compile_definitions(ExampleXTP PRIVATE USE_CMAKE) +add_dependencies(ExampleXTP + XAPI_CPP + XTP_Quote + XTP_Trade +) + +set_target_properties(ExampleCTP ExampleXTP + PROPERTIES + FOLDER "example/CPP" +) diff --git a/CopyApiDll.bat b/CopyApiDll.bat new file mode 100644 index 0000000..5167290 --- /dev/null +++ b/CopyApiDll.bat @@ -0,0 +1,31 @@ +REM 32位调试版 +xcopy "include\Tdx\win32\*.*" "bin\Debug\x86\Tdx" /Y +xcopy "include\CTP\win32\*.dll" "bin\Debug\x86\CTP" /Y +xcopy "include\Kingstar\win32\*.*" "bin\Debug\x86\Kingstar" /Y +xcopy "include\LTS_v2\win32\*.dll" "bin\Debug\x86\LTS_v2" /Y +xcopy "include\UFX\win32\*.*" "bin\Debug\x86\UFX" /Y +xcopy "include\Wind\win32\*.dll" "bin\Debug\x86\Wind" /Y +xcopy "include\Sgit\win32\*.dll" "bin\Debug\x86\Sgit" /Y +xcopy "include\CTP_SOPT\win32\*.dll" "bin\Debug\x86\CTP_SOPT" /Y +xcopy "include\ATP\win32\*.dll" "bin\Debug\x86\ATP" /Y +xcopy "include\CTPZQ\win32\*.dll" "bin\Debug\x86\CTPZQ" /Y + +REM 32位发布版 +xcopy "include\Tdx\win32\*.*" "bin\Release\x86\Tdx" /Y +xcopy "include\CTP\win32\*.dll" "bin\Release\x86\CTP" /Y +xcopy "include\Kingstar\win32\*.*" "bin\Release\x86\Kingstar" /Y +xcopy "include\LTS_v2\win32\*.dll" "bin\Release\x86\LTS_v2" /Y +xcopy "include\UFX\win32\*.*" "bin\Release\x86\UFX" /Y +xcopy "include\Wind\win32\*.dll" "bin\Release\x86\Wind" /Y +xcopy "include\Sgit\win32\*.dll" "bin\Release\x86\Sgit" /Y +xcopy "include\CTP_SOPT\win32\*.dll" "bin\Release\x86\CTP_SOPT" /Y +xcopy "include\ATP\win32\*.dll" "bin\Release\x86\ATP" /Y +xcopy "include\CTPZQ\win32\*.dll" "bin\Release\x86\CTPZQ" /Y + +REM 64位调试版 +xcopy "include\CTP\win64\*.dll" "bin\Debug64\x64\CTP" /Y + +REM 64位发布版 +xcopy "include\CTP\win64\*.dll" "bin\Release64\x64\CTP" /Y + +pause \ No newline at end of file diff --git a/FakeAPI/FakeAPI.cpp b/FakeAPI/FakeAPI.cpp deleted file mode 100644 index d4ebbe0..0000000 --- a/FakeAPI/FakeAPI.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// FakeAPI.cpp : Defines the exported functions for the DLL application. -// - -#include "stdafx.h" - - diff --git a/FakeAPI/ThostFtdcTraderApi.cpp b/FakeAPI/ThostFtdcTraderApi.cpp deleted file mode 100644 index 04deb8d..0000000 --- a/FakeAPI/ThostFtdcTraderApi.cpp +++ /dev/null @@ -1,339 +0,0 @@ -#include "stdafx.h" - -#define ISLIB -#define LIB_TRADER_API_EXPORT - -#include -#include "../include/CTP/ThostFtdcTraderApi.h" - -class MyClassCTP :public CThostFtdcTraderApi -{ -public: - ///TraderApi - ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ - ///@return UserApi - static CThostFtdcTraderApi *CreateFtdcTraderApi(const char *pszFlowPath = ""); - - ///ȡAPIİ汾Ϣ - ///@retrun ȡİ汾 - static const char *GetApiVersion(); - - ///ɾӿڶ - ///@remark ʹñӿڶʱ,øúɾӿڶ - virtual void Release(){} - - ///ʼ - ///@remark ʼл,ֻеú,ӿڲſʼ - virtual void Init() - { - m_pSpi->OnFrontConnected(); - } - - ///ȴӿ߳̽ - ///@return ߳˳ - virtual int Join(){ return 0; } - - ///ȡǰ - ///@retrun ȡĽ - ///@remark ֻе¼ɹ,ܵõȷĽ - virtual const char *GetTradingDay(){ return 0; } - - ///עǰûַ - ///@param pszFrontAddressǰûַ - ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 - ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš - virtual void RegisterFront(char *pszFrontAddress){} - - ///עַַ - ///@param pszNsAddressַַ - ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 - ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš - ///@remark RegisterNameServerRegisterFront - virtual void RegisterNameServer(char *pszNsAddress){} - - ///עַûϢ - ///@param pFensUserInfoûϢ - virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo){} - - ///עصӿ - ///@param pSpi Իصӿʵ - virtual void RegisterSpi(CThostFtdcTraderSpi *pSpi) - { - m_pSpi = pSpi; - } - - ///˽ - ///@param nResumeType ˽شʽ - /// THOST_TERT_RESTART:ӱտʼش - /// THOST_TERT_RESUME:ϴյ - /// THOST_TERT_QUICK:ֻ͵¼˽ - ///@remark ÷ҪInitǰá򲻻յ˽ݡ - virtual void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType){} - - ///Ĺ - ///@param nResumeType شʽ - /// THOST_TERT_RESTART:ӱտʼش - /// THOST_TERT_RESUME:ϴյ - /// THOST_TERT_QUICK:ֻ͵¼󹫹 - ///@remark ÷ҪInitǰá򲻻յݡ - virtual void SubscribePublicTopic(THOST_TE_RESUME_TYPE nResumeType){} - - ///ͻ֤ - virtual int ReqAuthenticate(CThostFtdcReqAuthenticateField *pReqAuthenticateField, int nRequestID) - { - char buf[512] = { 0 }; - sprintf(buf, "UserProductInfo:%s\nAuthCode:%s\nѾƵ", - pReqAuthenticateField->UserProductInfo, - pReqAuthenticateField->AuthCode); - - if (OpenClipboard(NULL)) - { - int len = strlen(buf) + 1; - - HGLOBAL hmem = GlobalAlloc(GHND, len); - char *pmem = (char*)GlobalLock(hmem); - - EmptyClipboard(); - strcpy(pmem, buf); - SetClipboardData(CF_TEXT, hmem); - CloseClipboard(); - GlobalFree(hmem); - } - - MessageBoxA(nullptr, buf, "", MB_OK); - - return 0; - } - - ///û¼ - virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) - { - char buf[512] = { 0 }; - sprintf(buf, "UserID:%s\nPassword:%s\nUserProductInfo:%s\nѾƵ", - pReqUserLoginField->UserID, - pReqUserLoginField->Password, - pReqUserLoginField->UserProductInfo); - - if (OpenClipboard(NULL)) - { - int len = strlen(buf) + 1; - - HGLOBAL hmem = GlobalAlloc(GHND, len); - char *pmem = (char*)GlobalLock(hmem); - - EmptyClipboard(); - strcpy(pmem, buf); - SetClipboardData(CF_TEXT, hmem); - CloseClipboard(); - GlobalFree(hmem); - } - - MessageBoxA(nullptr, buf, "", MB_OK); - - return 0; - } - - - ///dz - virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID){ return 0; } - - ///û - virtual int ReqUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, int nRequestID){ return 0; } - - ///ʽ˻ - virtual int ReqTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, int nRequestID){ return 0; } - - ///¼ - virtual int ReqOrderInsert(CThostFtdcInputOrderField *pInputOrder, int nRequestID){ return 0; } - - ///Ԥ¼ - virtual int ReqParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, int nRequestID){ return 0; } - - ///Ԥ񳷵¼ - virtual int ReqParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, int nRequestID){ return 0; } - - /// - virtual int ReqOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, int nRequestID){ return 0; } - - ///ѯ󱨵 - virtual int ReqQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, int nRequestID){ return 0; } - - ///Ͷ߽ȷ - virtual int ReqSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, int nRequestID){ return 0; } - - ///ɾԤ - virtual int ReqRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, int nRequestID){ return 0; } - - ///ɾԤ񳷵 - virtual int ReqRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, int nRequestID){ return 0; } - - ///ִ¼ - virtual int ReqExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, int nRequestID){ return 0; } - - ///ִ - virtual int ReqExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, int nRequestID){ return 0; } - - ///ѯ¼ - virtual int ReqForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, int nRequestID){ return 0; } - - ///¼ - virtual int ReqQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, int nRequestID){ return 0; } - - ///۲ - virtual int ReqQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, int nRequestID){ return 0; } - - /// - virtual int ReqLockInsert(CThostFtdcInputLockField *pInputLock, int nRequestID){ return 0; } - - ///¼ - virtual int ReqCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, int nRequestID){ return 0; } - - ///ѯ - virtual int ReqQryOrder(CThostFtdcQryOrderField *pQryOrder, int nRequestID){ return 0; } - - ///ѯɽ - virtual int ReqQryTrade(CThostFtdcQryTradeField *pQryTrade, int nRequestID){ return 0; } - - ///ѯͶֲ߳ - virtual int ReqQryInvestorPosition(CThostFtdcQryInvestorPositionField *pQryInvestorPosition, int nRequestID){ return 0; } - - ///ѯʽ˻ - virtual int ReqQryTradingAccount(CThostFtdcQryTradingAccountField *pQryTradingAccount, int nRequestID){ return 0; } - - ///ѯͶ - virtual int ReqQryInvestor(CThostFtdcQryInvestorField *pQryInvestor, int nRequestID){ return 0; } - - ///ѯױ - virtual int ReqQryTradingCode(CThostFtdcQryTradingCodeField *pQryTradingCode, int nRequestID){ return 0; } - - ///ѯԼ֤ - virtual int ReqQryInstrumentMarginRate(CThostFtdcQryInstrumentMarginRateField *pQryInstrumentMarginRate, int nRequestID){ return 0; } - - ///ѯԼ - virtual int ReqQryInstrumentCommissionRate(CThostFtdcQryInstrumentCommissionRateField *pQryInstrumentCommissionRate, int nRequestID){ return 0; } - - ///ѯ - virtual int ReqQryExchange(CThostFtdcQryExchangeField *pQryExchange, int nRequestID){ return 0; } - - ///ѯƷ - virtual int ReqQryProduct(CThostFtdcQryProductField *pQryProduct, int nRequestID){ return 0; } - - ///ѯԼ - virtual int ReqQryInstrument(CThostFtdcQryInstrumentField *pQryInstrument, int nRequestID){ return 0; } - - ///ѯ - virtual int ReqQryDepthMarketData(CThostFtdcQryDepthMarketDataField *pQryDepthMarketData, int nRequestID){ return 0; } - - ///ѯͶ߽ - virtual int ReqQrySettlementInfo(CThostFtdcQrySettlementInfoField *pQrySettlementInfo, int nRequestID){ return 0; } - - ///ѯת - virtual int ReqQryTransferBank(CThostFtdcQryTransferBankField *pQryTransferBank, int nRequestID){ return 0; } - - ///ѯͶֲ߳ϸ - virtual int ReqQryInvestorPositionDetail(CThostFtdcQryInvestorPositionDetailField *pQryInvestorPositionDetail, int nRequestID){ return 0; } - - ///ѯͻ֪ͨ - virtual int ReqQryNotice(CThostFtdcQryNoticeField *pQryNotice, int nRequestID){ return 0; } - - ///ѯϢȷ - virtual int ReqQrySettlementInfoConfirm(CThostFtdcQrySettlementInfoConfirmField *pQrySettlementInfoConfirm, int nRequestID){ return 0; } - - ///ѯͶֲ߳ϸ - virtual int ReqQryInvestorPositionCombineDetail(CThostFtdcQryInvestorPositionCombineDetailField *pQryInvestorPositionCombineDetail, int nRequestID){ return 0; } - - ///ѯ֤ϵͳ͹˾ʽ˻Կ - virtual int ReqQryCFMMCTradingAccountKey(CThostFtdcQryCFMMCTradingAccountKeyField *pQryCFMMCTradingAccountKey, int nRequestID){ return 0; } - - ///ѯֵ۵Ϣ - virtual int ReqQryEWarrantOffset(CThostFtdcQryEWarrantOffsetField *pQryEWarrantOffset, int nRequestID){ return 0; } - - ///ѯͶƷ/Ʒֱ֤ - virtual int ReqQryInvestorProductGroupMargin(CThostFtdcQryInvestorProductGroupMarginField *pQryInvestorProductGroupMargin, int nRequestID){ return 0; } - - ///ѯ֤ - virtual int ReqQryExchangeMarginRate(CThostFtdcQryExchangeMarginRateField *pQryExchangeMarginRate, int nRequestID){ return 0; } - - ///ѯ֤ - virtual int ReqQryExchangeMarginRateAdjust(CThostFtdcQryExchangeMarginRateAdjustField *pQryExchangeMarginRateAdjust, int nRequestID){ return 0; } - - ///ѯ - virtual int ReqQryExchangeRate(CThostFtdcQryExchangeRateField *pQryExchangeRate, int nRequestID){ return 0; } - - ///ѯԱȨ - virtual int ReqQrySecAgentACIDMap(CThostFtdcQrySecAgentACIDMapField *pQrySecAgentACIDMap, int nRequestID){ return 0; } - - ///ѯƷۻ - virtual int ReqQryProductExchRate(CThostFtdcQryProductExchRateField *pQryProductExchRate, int nRequestID){ return 0; } - - ///ѯȨ׳ɱ - virtual int ReqQryOptionInstrTradeCost(CThostFtdcQryOptionInstrTradeCostField *pQryOptionInstrTradeCost, int nRequestID){ return 0; } - - ///ѯȨԼ - virtual int ReqQryOptionInstrCommRate(CThostFtdcQryOptionInstrCommRateField *pQryOptionInstrCommRate, int nRequestID){ return 0; } - - ///ѯִ - virtual int ReqQryExecOrder(CThostFtdcQryExecOrderField *pQryExecOrder, int nRequestID){ return 0; } - - ///ѯѯ - virtual int ReqQryForQuote(CThostFtdcQryForQuoteField *pQryForQuote, int nRequestID){ return 0; } - - ///ѯ - virtual int ReqQryQuote(CThostFtdcQryQuoteField *pQryQuote, int nRequestID){ return 0; } - - ///ѯ - virtual int ReqQryLock(CThostFtdcQryLockField *pQryLock, int nRequestID){ return 0; } - - ///ѯ֤ȯλ - virtual int ReqQryLockPosition(CThostFtdcQryLockPositionField *pQryLockPosition, int nRequestID){ return 0; } - - ///ѯϺԼȫϵ - virtual int ReqQryCombInstrumentGuard(CThostFtdcQryCombInstrumentGuardField *pQryCombInstrumentGuard, int nRequestID){ return 0; } - - ///ѯ - virtual int ReqQryCombAction(CThostFtdcQryCombActionField *pQryCombAction, int nRequestID){ return 0; } - - ///ѯתˮ - virtual int ReqQryTransferSerial(CThostFtdcQryTransferSerialField *pQryTransferSerial, int nRequestID){ return 0; } - - ///ѯǩԼϵ - virtual int ReqQryAccountregister(CThostFtdcQryAccountregisterField *pQryAccountregister, int nRequestID){ return 0; } - - ///ѯǩԼ - virtual int ReqQryContractBank(CThostFtdcQryContractBankField *pQryContractBank, int nRequestID){ return 0; } - - ///ѯԤ - virtual int ReqQryParkedOrder(CThostFtdcQryParkedOrderField *pQryParkedOrder, int nRequestID){ return 0; } - - ///ѯԤ񳷵 - virtual int ReqQryParkedOrderAction(CThostFtdcQryParkedOrderActionField *pQryParkedOrderAction, int nRequestID){ return 0; } - - ///ѯ֪ͨ - virtual int ReqQryTradingNotice(CThostFtdcQryTradingNoticeField *pQryTradingNotice, int nRequestID){ return 0; } - - ///ѯ͹˾ײ - virtual int ReqQryBrokerTradingParams(CThostFtdcQryBrokerTradingParamsField *pQryBrokerTradingParams, int nRequestID){ return 0; } - - ///ѯ͹˾㷨 - virtual int ReqQryBrokerTradingAlgos(CThostFtdcQryBrokerTradingAlgosField *pQryBrokerTradingAlgos, int nRequestID){ return 0; } - - ///ѯû - virtual int ReqQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, int nRequestID){ return 0; } - - ///ڻʽתڻ - virtual int ReqFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID){ return 0; } - - ///ڻڻʽת - virtual int ReqFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID){ return 0; } - - ///ڻѯ - virtual int ReqQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, int nRequestID){ return 0; } - -private: - CThostFtdcTraderSpi *m_pSpi; -}; - -CThostFtdcTraderApi *CThostFtdcTraderApi::CreateFtdcTraderApi(const char *pszFlowPath) -{ - return new MyClassCTP(); -} diff --git a/FakeAPI/instruments.dat b/FakeAPI/instruments.dat deleted file mode 100644 index f74a262..0000000 Binary files a/FakeAPI/instruments.dat and /dev/null differ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..7a4ba3e --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1 @@ +BSD License \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2518b24 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +all: + $(MAKE) -C common/Queue all + $(MAKE) -C apis/CTP all + $(MAKE) -C tests/CPP all + +clean: + $(MAKE) -C common/Queue clean + $(MAKE) -C apis/CTP clean + $(MAKE) -C tests/CPP clean + diff --git a/Makefile.global b/Makefile.global new file mode 100644 index 0000000..c15f865 --- /dev/null +++ b/Makefile.global @@ -0,0 +1,11 @@ +CXX=clang++ +IFLAGS=-I../../ -I../../include/ -I../ -I./ +CFLAGS=$(IFLAGS)-std=c++11 -O3 -fPIC -pthread -Bsymbol + +all: $(ALL) + +%.o: %.cpp + $(CXX) $(CFLAGS) -c $^ -o $@ + +clean: + rm -rf *.so *.o $(DEPS) diff --git a/QuantBox_CTP_Quote/MdUserApi.cpp b/QuantBox_CTP_Quote/MdUserApi.cpp deleted file mode 100644 index dbe8738..0000000 --- a/QuantBox_CTP_Quote/MdUserApi.cpp +++ /dev/null @@ -1,651 +0,0 @@ -#include "stdafx.h" -#include "MdUserApi.h" -#include "../include/QueueEnum.h" - -#include "../include/ApiHeader.h" -#include "../include/ApiStruct.h" - -#include "../include/toolkit.h" -#include "../include/ApiProcess.h" -#include "../QuantBox_CTP_Trade/TypeConvert.h" - -#include "../QuantBox_Queue/MsgQueue.h" -#ifdef _REMOTE -#include "../QuantBox_Queue/RemoteQueue.h" -#endif - -#include -#include - -#include -#include -using namespace std; - -void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - // 由内部调用,不用检查是否为空 - CMdUserApi* pApi = (CMdUserApi*)pApi2; - pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - return nullptr; -} - -CMdUserApi::CMdUserApi(void) -{ - m_pApi = nullptr; - m_lRequestID = 0; - m_nSleep = 1; - - // 自己维护两个消息队列 - m_msgQueue = new CMsgQueue(); - m_msgQueue_Query = new CMsgQueue(); - - m_msgQueue_Query->Register((void*)Query, this); - m_msgQueue_Query->StartThread(); - - //m_msgQueue->m_bDirectOutput = true; - - m_remoteQueue = nullptr; -} - -CMdUserApi::~CMdUserApi(void) -{ - Disconnect(); -} - -void CMdUserApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - int iRet = 0; - switch (type) - { - case E_Init: - iRet = _Init(); - break; - case E_ReqUserLoginField: - iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - default: - break; - } - - if (0 == iRet) - { - //返回成功,填加到已发送池 - m_nSleep = 1; - } - else - { - m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - //失败,按4的幂进行延时,但不超过1s - m_nSleep *= 4; - m_nSleep %= 1023; - } - this_thread::sleep_for(chrono::milliseconds(m_nSleep)); -} - -void CMdUserApi::Register(void* pCallback,void* pClass) -{ - m_pClass = pClass; - if (m_msgQueue == nullptr) - return; - - m_msgQueue_Query->Register((void*)Query,this); - m_msgQueue->Register(pCallback,this); - if (pCallback) - { - m_msgQueue_Query->StartThread(); - m_msgQueue->StartThread(); - } - else - { - m_msgQueue_Query->StopThread(); - m_msgQueue->StopThread(); - } -} - -ConfigInfoField* CMdUserApi::Config(ConfigInfoField* pConfigInfo) -{ - return nullptr; -} - -bool CMdUserApi::IsErrorRspInfo(const char* szSource, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); - if(bRet) - { - ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); - - pField->RawErrorID = pRspInfo->ErrorID; - strcpy(pField->Text, pRspInfo->ErrorMsg); - strcpy(pField->Source, szSource); - - m_msgQueue->Input_NoCopy(ResponeType::OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); - } - return bRet; -} - -bool CMdUserApi::IsErrorRspInfo(CThostFtdcRspInfoField *pRspInfo) -{ - bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); - - return bRet; -} - -void CMdUserApi::Connect(const string& szPath, - ServerInfoField* pServerInfo, - UserInfoField* pUserInfo, - int count) -{ - m_szPath = szPath; - memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); - memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_Init, m_msgQueue_Query, this, 0, 0, - nullptr, 0, nullptr, 0, nullptr, 0); - -#ifdef _REMOTE - // 将收到的行情通过ZeroMQ发送出去 - if (strlen(m_ServerInfo.ExtendInformation) > 0) - { - m_remoteQueue = new CRemoteQueue(m_ServerInfo.ExtendInformation); - m_remoteQueue->StartThread(); - } -#endif -} - -int CMdUserApi::_Init() -{ - char *pszPath = new char[m_szPath.length() + 1024]; - srand((unsigned int)time(NULL)); - sprintf(pszPath, "%s/%s/%s/Md/%d/", m_szPath.c_str(), m_ServerInfo.BrokerID, m_UserInfo.UserID, rand()); - makedirs(pszPath); - - m_pApi = CThostFtdcMdApi::CreateFtdcMdApi(pszPath, m_ServerInfo.IsUsingUdp, m_ServerInfo.IsMulticast); - delete[] pszPath; - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - if (m_pApi) - { - m_pApi->RegisterSpi(this); - - //添加地址 - size_t len = strlen(m_ServerInfo.Address) + 1; - char* buf = new char[len]; - strncpy(buf, m_ServerInfo.Address, len); - - char* token = strtok(buf, _QUANTBOX_SEPS_); - while (token) - { - if (strlen(token)>0) - { - m_pApi->RegisterFront(token); - } - token = strtok(NULL, _QUANTBOX_SEPS_); - } - delete[] buf; - - //初始化连接 - m_pApi->Init(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); - } - - return 0; -} - -void CMdUserApi::ReqUserLogin() -{ - CThostFtdcReqUserLoginField* pBody = (CThostFtdcReqUserLoginField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcReqUserLoginField)); - - strncpy(pBody->BrokerID, m_ServerInfo.BrokerID, sizeof(TThostFtdcBrokerIDType)); - strncpy(pBody->UserID, m_UserInfo.UserID, sizeof(TThostFtdcInvestorIDType)); - strncpy(pBody->Password, m_UserInfo.Password, sizeof(TThostFtdcPasswordType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CThostFtdcReqUserLoginField), nullptr, 0, nullptr, 0); -} - -int CMdUserApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); - return m_pApi->ReqUserLogin((CThostFtdcReqUserLoginField*)ptr1, ++m_lRequestID); -} - -void CMdUserApi::Disconnect() -{ - // 清理查询队列 - if (m_msgQueue_Query) - { - m_msgQueue_Query->StopThread(); - m_msgQueue_Query->Register(nullptr,nullptr); - m_msgQueue_Query->Clear(); - delete m_msgQueue_Query; - m_msgQueue_Query = nullptr; - } - - if(m_pApi) - { - m_pApi->RegisterSpi(NULL); - m_pApi->Release(); - m_pApi = NULL; - - // 全清理,只留最后一个 - m_msgQueue->Clear(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); - // 主动触发 - m_msgQueue->Process(); - } - - // 清理响应队列 - if (m_msgQueue) - { - m_msgQueue->StopThread(); - m_msgQueue->Register(nullptr,nullptr); - m_msgQueue->Clear(); - delete m_msgQueue; - m_msgQueue = nullptr; - } - - // 清理队列 - if (m_remoteQueue) - { - m_remoteQueue->StopThread(); - m_remoteQueue->Register(nullptr, nullptr); - m_remoteQueue->Clear(); - delete m_remoteQueue; - m_remoteQueue = nullptr; - } -} - - -void CMdUserApi::Subscribe(const string& szInstrumentIDs, const string& szExchageID) -{ - if(nullptr == m_pApi) - return; - - vector vct; - set st; - - lock_guard cl(m_csMapInstrumentIDs); - char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, 1, m_setInstrumentIDs); - - if(vct.size()>0) - { - //转成字符串数组 - char** pArray = new char*[vct.size()]; - for (size_t j = 0; jSubscribeMarketData(pArray,(int)vct.size()); - - delete[] pArray; - } - delete[] pBuf; -} - -void CMdUserApi::Subscribe(const set& instrumentIDs, const string& szExchageID) -{ - if(nullptr == m_pApi) - return; - - string szInstrumentIDs; - for(set::iterator i=instrumentIDs.begin();i!=instrumentIDs.end();++i) - { - szInstrumentIDs.append(*i); - szInstrumentIDs.append(";"); - } - - if (szInstrumentIDs.length()>1) - { - Subscribe(szInstrumentIDs, szExchageID); - } -} - -void CMdUserApi::Unsubscribe(const string& szInstrumentIDs, const string& szExchageID) -{ - if(nullptr == m_pApi) - return; - - vector vct; - set st; - - lock_guard cl(m_csMapInstrumentIDs); - char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, -1, m_setInstrumentIDs); - - if(vct.size()>0) - { - //转成字符串数组 - char** pArray = new char*[vct.size()]; - for (size_t j = 0; jUnSubscribeMarketData(pArray,(int)vct.size()); - - delete[] pArray; - } - delete[] pBuf; -} - -void CMdUserApi::SubscribeQuote(const string& szInstrumentIDs, const string& szExchageID) -{ - if (nullptr == m_pApi) - return; - - vector vct; - set st; - - lock_guard cl(m_csMapQuoteInstrumentIDs); - char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, 1, m_setQuoteInstrumentIDs); - - if (vct.size()>0) - { - //转成字符串数组 - char** pArray = new char*[vct.size()]; - for (size_t j = 0; jSubscribeForQuoteRsp(pArray, (int)vct.size()); - - delete[] pArray; - } - delete[] pBuf; -} - -void CMdUserApi::SubscribeQuote(const set& instrumentIDs, const string& szExchageID) -{ - if (nullptr == m_pApi) - return; - - string szInstrumentIDs; - for (set::iterator i = instrumentIDs.begin(); i != instrumentIDs.end(); ++i) - { - szInstrumentIDs.append(*i); - szInstrumentIDs.append(";"); - } - - if (szInstrumentIDs.length()>1) - { - SubscribeQuote(szInstrumentIDs, szExchageID); - } -} - -void CMdUserApi::UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchageID) -{ - if (nullptr == m_pApi) - return; - - vector vct; - set st; - - lock_guard cl(m_csMapQuoteInstrumentIDs); - char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, -1, m_setQuoteInstrumentIDs); - - if (vct.size()>0) - { - //转成字符串数组 - char** pArray = new char*[vct.size()]; - for (size_t j = 0; jUnSubscribeForQuoteRsp(pArray, (int)vct.size()); - - delete[] pArray; - } - delete[] pBuf; -} - -void CMdUserApi::OnFrontConnected() -{ - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - //连接成功后自动请求登录 - ReqUserLogin(); -} - -void CMdUserApi::OnFrontDisconnected(int nReason) -{ - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - //连接失败返回的信息是拼接而成,主要是为了统一输出 - pField->RawErrorID = nReason; - GetOnFrontDisconnectedMsg(nReason, pField->Text); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); -} - -void CMdUserApi::OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - - if (!IsErrorRspInfo(pRspInfo) - &&pRspUserLogin) - { - pField->TradingDay = GetDate(pRspUserLogin->TradingDay); - pField->LoginTime = GetTime(pRspUserLogin->LoginTime); - m_TradingDay = pField->TradingDay; - - sprintf(pField->SessionID, "%d:%d", pRspUserLogin->FrontID, pRspUserLogin->SessionID); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - //有可能断线了,本处是断线重连后重新订阅 - set mapOld = m_setInstrumentIDs;//记下上次订阅的合约 - //Unsubscribe(mapOld);//由于已经断线了,没有必要再取消订阅 - Subscribe(mapOld,"");//订阅 - - //有可能断线了,本处是断线重连后重新订阅 - mapOld = m_setQuoteInstrumentIDs;//记下上次订阅的合约 - SubscribeQuote(mapOld, "");//订阅 - } - else - { - pField->RawErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - } -} - -void CMdUserApi::OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - IsErrorRspInfo("OnRspError", pRspInfo, nRequestID, bIsLast); -} - -void CMdUserApi::OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - //在模拟平台可能这个函数不会触发,所以要自己维护一张已经订阅的合约列表 - if(!IsErrorRspInfo("OnRspSubMarketData",pRspInfo,nRequestID,bIsLast) - &&pSpecificInstrument) - { - lock_guard cl(m_csMapInstrumentIDs); - - m_setInstrumentIDs.insert(pSpecificInstrument->InstrumentID); - } -} - -void CMdUserApi::OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - //模拟平台可能这个函数不会触发 - if(!IsErrorRspInfo("OnRspUnSubMarketData",pRspInfo,nRequestID,bIsLast) - &&pSpecificInstrument) - { - lock_guard cl(m_csMapInstrumentIDs); - - m_setInstrumentIDs.erase(pSpecificInstrument->InstrumentID); - } -} - -//行情回调,得保证此函数尽快返回 -void CMdUserApi::OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) -{ - //for (int i = 0; i < 50; ++i) - //{ - // // 测试平台穿越速度,用完后需要注释掉 - // WriteLog("CTP:OnRtnDepthMarketData:%s %f %s.%03d", pDepthMarketData->InstrumentID, pDepthMarketData->LastPrice, pDepthMarketData->UpdateTime, pDepthMarketData->UpdateMillisec); - - DepthMarketDataNField* pField = (DepthMarketDataNField*)m_msgQueue->new_block(sizeof(DepthMarketDataNField)+sizeof(DepthField)* 10); - - strcpy(pField->InstrumentID, pDepthMarketData->InstrumentID); - pField->Exchange = TThostFtdcExchangeIDType_2_ExchangeType(pDepthMarketData->ExchangeID); - - sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pDepthMarketData->ExchangeID); - - // 交易时间 - switch (pField->Exchange) - { - case ExchangeType::ExchangeType_DCE: - GetExchangeTime_DCE(pDepthMarketData->TradingDay, pDepthMarketData->ActionDay, pDepthMarketData->UpdateTime - , &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec); - break; - case ExchangeType::ExchangeType_CZCE: - GetExchangeTime_CZCE(m_TradingDay, pDepthMarketData->TradingDay, pDepthMarketData->ActionDay, pDepthMarketData->UpdateTime - , &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec); - break; - case ExchangeType::ExchangeType_Undefined: - GetExchangeTime_Undefined(m_TradingDay, pDepthMarketData->TradingDay, pDepthMarketData->ActionDay, pDepthMarketData->UpdateTime - , &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec); - break; - default: - GetExchangeTime(pDepthMarketData->TradingDay, pDepthMarketData->ActionDay, pDepthMarketData->UpdateTime - , &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec); - break; - } - - pField->UpdateMillisec = pDepthMarketData->UpdateMillisec; - - pField->LastPrice = pDepthMarketData->LastPrice == DBL_MAX ? 0 : pDepthMarketData->LastPrice; - pField->Volume = pDepthMarketData->Volume; - pField->Turnover = pDepthMarketData->Turnover; - pField->OpenInterest = pDepthMarketData->OpenInterest; - pField->AveragePrice = pDepthMarketData->AveragePrice; - - if (pDepthMarketData->OpenPrice != DBL_MAX) - { - pField->OpenPrice = pDepthMarketData->OpenPrice; - pField->HighestPrice = pDepthMarketData->HighestPrice; - pField->LowestPrice = pDepthMarketData->LowestPrice; - } - else - { - pField->OpenPrice = 0; - pField->HighestPrice = 0; - pField->LowestPrice = 0; - } - pField->SettlementPrice = pDepthMarketData->SettlementPrice != DBL_MAX ? pDepthMarketData->SettlementPrice : 0; - - pField->UpperLimitPrice = pDepthMarketData->UpperLimitPrice; - pField->LowerLimitPrice = pDepthMarketData->LowerLimitPrice; - pField->PreClosePrice = pDepthMarketData->PreClosePrice; - pField->PreSettlementPrice = pDepthMarketData->PreSettlementPrice; - pField->PreOpenInterest = pDepthMarketData->PreOpenInterest; - - InitBidAsk(pField); - - do - { - if (pDepthMarketData->BidVolume1 == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice1, pDepthMarketData->BidVolume1, 0); - - if (pDepthMarketData->BidVolume2 == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice2, pDepthMarketData->BidVolume2, 0); - - if (pDepthMarketData->BidVolume3 == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice3, pDepthMarketData->BidVolume3, 0); - - if (pDepthMarketData->BidVolume4 == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice4, pDepthMarketData->BidVolume4, 0); - - if (pDepthMarketData->BidVolume5 == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice5, pDepthMarketData->BidVolume5, 0); - } while (false); - - do - { - if (pDepthMarketData->AskVolume1 == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice1, pDepthMarketData->AskVolume1, 0); - - if (pDepthMarketData->AskVolume2 == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice2, pDepthMarketData->AskVolume2, 0); - - if (pDepthMarketData->AskVolume3 == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice3, pDepthMarketData->AskVolume3, 0); - - if (pDepthMarketData->AskVolume4 == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice4, pDepthMarketData->AskVolume4, 0); - - if (pDepthMarketData->AskVolume5 == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice5, pDepthMarketData->AskVolume5, 0); - } while (false); - - // 这两个队列先头循序不要搞混,有删除功能的语句要放在后面 - // 如果放前面,会导致远程收到乱码 -#ifdef _REMOTE - if (m_remoteQueue) - { - m_remoteQueue->Input_Copy(ResponeType::OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); - } -#endif - - m_msgQueue->Input_NoCopy(ResponeType::OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); - // 要关注一下其内的 - //} -} - -void CMdUserApi::OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo("OnRspSubForQuoteRsp",pRspInfo, nRequestID, bIsLast) - && pSpecificInstrument) - { - lock_guard cl(m_csMapQuoteInstrumentIDs); - - m_setQuoteInstrumentIDs.insert(pSpecificInstrument->InstrumentID); - } -} - -void CMdUserApi::OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo("OnRspUnSubForQuoteRsp",pRspInfo, nRequestID, bIsLast) - && pSpecificInstrument) - { - lock_guard cl(m_csMapQuoteInstrumentIDs); - - m_setQuoteInstrumentIDs.erase(pSpecificInstrument->InstrumentID); - } -} - -void CMdUserApi::OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) -{ - // 上期技术的人说,上海中金走的交易接口,大商,郑商走行情,所以这个地方后期可能要改 - QuoteRequestField* pField = (QuoteRequestField*)m_msgQueue->new_block(sizeof(QuoteRequestField)); - - pField->TradingDay = GetDate(pForQuoteRsp->TradingDay); - pField->QuoteTime = GetDate(pForQuoteRsp->ForQuoteTime); - strcpy(pField->Symbol, pForQuoteRsp->InstrumentID); - strcpy(pField->InstrumentID, pForQuoteRsp->InstrumentID); - strcpy(pField->ExchangeID, pForQuoteRsp->ExchangeID); - sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pField->ExchangeID); - strcpy(pField->QuoteID, pForQuoteRsp->ForQuoteSysID); - - m_msgQueue->Input_NoCopy(ResponeType::OnRtnQuoteRequest, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteRequestField), nullptr, 0, nullptr, 0); -} diff --git a/QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj b/QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj deleted file mode 100644 index 4cf345a..0000000 --- a/QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj +++ /dev/null @@ -1,274 +0,0 @@ - - - - - Debug64 - Win32 - - - Debug64 - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {919B914D-6840-453E-9201-8619E63AD0E1} - Win32Proj - QuantBox_CTP_Quote - - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - false - v120 - true - Unicode - - - DynamicLibrary - false - v120 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP\x86 - - - true - - - true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP - - - true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP\x64 - - - false - - - false - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_CTP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Cdecl - ..\include\ZeroMQ\libzmq\include;..\include\ZeroMQ\czmq\include;%(AdditionalIncludeDirectories) - - - Windows - true - ..\include\ApiHeader.def - - - xcopy "$(TargetPath)" "$(SolutionDir)XAPI\CTP\x86\" /Y -xcopy "$(SolutionDir)include\CTP\win32\*.dll" "$(SolutionDir)XAPI\CTP\x86\" /Y - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_CTP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - ..\include\ApiHeader.def - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_CTP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - ..\include\ApiHeader.def - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_CTP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - ..\include\ApiHeader.def - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_CTP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - ..\include\ApiHeader.def - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_CTP_QUOTE_EXPORTS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - QuantBox_CTP_Quote.def - - - - - - - - - - - - - - - - - Use - Use - Use - Use - - - - false - false - false - false - Use - Use - Use - Use - false - false - - - - - - - Use - Use - Use - Use - - - Use - Use - Use - Use - - - Create - Create - Create - Create - Create - Create - - - - - - \ No newline at end of file diff --git a/QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj b/QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj deleted file mode 100644 index fa3fed2..0000000 --- a/QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj +++ /dev/null @@ -1,277 +0,0 @@ - - - - - Debug64 - Win32 - - - Debug64 - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {9FBB0318-E21C-4B7C-A258-98E6A3860B35} - Win32Proj - QuantBox_CTP_Trade - - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - false - v120 - true - Unicode - - - DynamicLibrary - false - v120 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP\x86 - - - true - - - true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP - - - true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP\x64 - - - false - - - false - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - ..\include\ApiHeader.def - - - xcopy "$(TargetPath)" "$(SolutionDir)XAPI\CTP\x86\" /Y -xcopy "$(SolutionDir)include\CTP\win32\*.dll" "$(SolutionDir)XAPI\CTP\x86\" /Y - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - ..\include\ApiHeader.def - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - ..\include\ApiHeader.def - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - ..\include\ApiHeader.def - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - ..\include\ApiHeader.def - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_CTP_TRADE_EXPORTS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - QuantBox_CTP_Trade.def - - - - - - - - - - - - - - - - - Use - Use - Use - Use - - - false - false - false - false - Use - Use - Use - Use - false - false - - - - - - - Use - Use - Use - Use - - - Create - Create - Create - Create - Create - Create - - - Use - Use - Use - Use - - - Use - Use - Use - Use - - - - - - \ No newline at end of file diff --git a/QuantBox_LTS_Query_v2/QueryApi.cpp b/QuantBox_LTS_Query_v2/QueryApi.cpp deleted file mode 100644 index f4f70b5..0000000 --- a/QuantBox_LTS_Query_v2/QueryApi.cpp +++ /dev/null @@ -1,1186 +0,0 @@ -#include "stdafx.h" -#include "QueryApi.h" - -#include "../include/QueueEnum.h" -#include "../include/QueueHeader.h" - -#include "../include/ApiHeader.h" -#include "../include/ApiStruct.h" - -#include "../include/toolkit.h" - -#include "../QuantBox_Queue/MsgQueue.h" - -// õ뽻ͬһת -#include "../QuantBox_LTS_Trade_v2/TypeConvert.h" - -#include -#include - -void* __stdcall Query_Q(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - // ڲãüǷΪ - CQueryApi* pApi = (CQueryApi*)pApi2; - pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - return nullptr; -} - -void CQueryApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - int iRet = 0; - switch (type) - { - case E_Init: - iRet = _Init(); - break; - case E_ReqUserLoginField: - iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_QryTradingAccountField: - iRet = _ReqQryTradingAccount(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_QryInvestorPositionField: - iRet = _ReqQryInvestorPosition(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_QryInstrumentField: - iRet = _ReqQryInstrument(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_QryInvestorField: - iRet = _ReqQryInvestor(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_QryOrderField: - iRet = _ReqQryOrder(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_QryTradeField: - iRet = _ReqQryTrade(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_AuthRandCodeField: - iRet = _ReqFetchAuthRandCode(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - default: - break; - } - - if (0 == iRet) - { - //سɹӵѷͳ - m_nSleep = 1; - } - else - { - m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - //ʧܣ4ݽʱ1s - m_nSleep *= 4; - m_nSleep %= 1023; - } - this_thread::sleep_for(chrono::milliseconds(m_nSleep)); -} - -void CQueryApi::Register(void* pCallback, void* pClass) -{ - m_pClass = pClass; - if (m_msgQueue == nullptr) - return; - - m_msgQueue_Query->Register((void*)Query_Q, this); - m_msgQueue->Register(pCallback, this); - if (pCallback) - { - m_msgQueue_Query->StartThread(); - m_msgQueue->StartThread(); - } - else - { - m_msgQueue_Query->StopThread(); - m_msgQueue->StopThread(); - } -} - -CQueryApi::CQueryApi(void) -{ - m_pApi = nullptr; - m_lRequestID = 0; - m_nSleep = 1; - - // ԼάϢ - m_msgQueue = new CMsgQueue(); - m_msgQueue_Query = new CMsgQueue(); - - m_msgQueue_Query->Register((void*)Query_Q, this); - m_msgQueue_Query->StartThread(); -} - - -CQueryApi::~CQueryApi(void) -{ - Disconnect(); -} - -bool CQueryApi::IsErrorRspInfo(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); - if (bRet) - { - ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); - - pField->RawErrorID = pRspInfo->ErrorID; - strcpy(pField->Text, pRspInfo->ErrorMsg); - - m_msgQueue->Input_NoCopy(ResponeType::OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); - } - return bRet; -} - -bool CQueryApi::IsErrorRspInfo(CSecurityFtdcRspInfoField *pRspInfo) -{ - bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); - - return bRet; -} - -void CQueryApi::Connect(const string& szPath, - ServerInfoField* pServerInfo, - UserInfoField* pUserInfo) -{ - m_szPath = szPath; - memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); - memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_Init, m_msgQueue_Query, this, 0, 0, - nullptr, 0, nullptr, 0, nullptr, 0); -} - -int CQueryApi::_Init() -{ - char *pszPath = new char[m_szPath.length() + 1024]; - srand((unsigned int)time(nullptr)); - sprintf(pszPath, "%s/%s/%s/Td/%d/", m_szPath.c_str(), m_ServerInfo.BrokerID, m_UserInfo.UserID, rand()); - makedirs(pszPath); - - m_pApi = CSecurityFtdcQueryApi::CreateFtdcQueryApi(pszPath); - delete[] pszPath; - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - if (m_pApi) - { - m_pApi->RegisterSpi(this); - - //ӵַ - size_t len = strlen(m_ServerInfo.Address) + 1; - char* buf = new char[len]; - strncpy(buf, m_ServerInfo.Address, len); - - char* token = strtok(buf, _QUANTBOX_SEPS_); - while (token) - { - if (strlen(token)>0) - { - m_pApi->RegisterFront(token); - } - token = strtok(nullptr, _QUANTBOX_SEPS_); - } - delete[] buf; - - //if (m_ServerInfo.PublicTopicResumeTypeSubscribePublicTopic((SECURITY_TE_RESUME_TYPE)m_ServerInfo.PublicTopicResumeType); - //if (m_ServerInfo.PrivateTopicResumeTypeSubscribePrivateTopic((SECURITY_TE_RESUME_TYPE)m_ServerInfo.PrivateTopicResumeType); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); - //ʼ - m_pApi->Init(); - } - - return 0; -} - -void CQueryApi::Disconnect() -{ - if (m_msgQueue_Query) - { - m_msgQueue_Query->StopThread(); - m_msgQueue_Query->Register(nullptr, nullptr); - m_msgQueue_Query->Clear(); - delete m_msgQueue_Query; - m_msgQueue_Query = nullptr; - } - - if (m_pApi) - { - m_pApi->RegisterSpi(nullptr); - m_pApi->Release(); - m_pApi = nullptr; - - // ȫֻһ - m_msgQueue->Clear(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); - // - m_msgQueue->Process(); - } - - if (m_msgQueue) - { - m_msgQueue->StopThread(); - m_msgQueue->Register(nullptr, nullptr); - m_msgQueue->Clear(); - delete m_msgQueue; - m_msgQueue = nullptr; - } - - m_lRequestID = 0;//߳ѾֹͣûбҪԭӲ - - Clear(); -} - -void CQueryApi::Clear() -{ - for (unordered_map::iterator it = m_id_platform_order.begin(); it != m_id_platform_order.end(); ++it) - delete it->second; - m_id_platform_order.clear(); - - for (unordered_map::iterator it = m_id_api_order.begin(); it != m_id_api_order.end(); ++it) - delete it->second; - m_id_api_order.clear(); - - //for (unordered_map::iterator it = m_id_platform_quote.begin(); it != m_id_platform_quote.end(); ++it) - // delete it->second; - //m_id_platform_quote.clear(); - - //for (unordered_map::iterator it = m_id_api_quote.begin(); it != m_id_api_quote.end(); ++it) - // delete it->second; - //m_id_api_quote.clear(); - - for (unordered_map::iterator it = m_id_platform_position.begin(); it != m_id_platform_position.end(); ++it) - delete it->second; - m_id_platform_position.clear(); -} - -void CQueryApi::OnFrontConnected() -{ - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - //ReqUserLogin(); - ReqFetchAuthRandCode(); -} - -void CQueryApi::OnFrontDisconnected(int nReason) -{ - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - - //ʧܷصϢƴӶɣҪΪͳһ - pField->RawErrorID = nReason; - GetOnFrontDisconnectedMsg(nReason, pField->Text); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); -} - -void CQueryApi::ReqFetchAuthRandCode() -{ - CSecurityFtdcAuthRandCodeField* pBody = (CSecurityFtdcAuthRandCodeField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcAuthRandCodeField)); - - strncpy(pBody->RandCode, "", sizeof(TSecurityFtdcAuthCodeType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_AuthRandCodeField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcAuthRandCodeField), nullptr, 0, nullptr, 0); -} - -int CQueryApi::_ReqFetchAuthRandCode(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorizing, 0, nullptr, 0, nullptr, 0, nullptr, 0); - return m_pApi->ReqFetchAuthRandCode((CSecurityFtdcAuthRandCodeField*)ptr1, ++m_lRequestID); -} - -void CQueryApi::OnRspFetchAuthRandCode(CSecurityFtdcAuthRandCodeField *pAuthRandCode, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - - if (!IsErrorRspInfo(pRspInfo) - && pAuthRandCode) - { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorized, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - - ReqUserLogin(pAuthRandCode->RandCode); - } - else - { - pField->RawErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - } -} - -void CQueryApi::ReqUserLogin(TSecurityFtdcAuthCodeType RandCode) -{ - CSecurityFtdcReqUserLoginField* pBody = (CSecurityFtdcReqUserLoginField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcReqUserLoginField)); - - strncpy(pBody->BrokerID, m_ServerInfo.BrokerID, sizeof(TSecurityFtdcBrokerIDType)); - strncpy(pBody->UserID, m_UserInfo.UserID, sizeof(TSecurityFtdcInvestorIDType)); - strncpy(pBody->Password, m_UserInfo.Password, sizeof(TSecurityFtdcPasswordType)); - strncpy(pBody->UserProductInfo, m_ServerInfo.UserProductInfo, sizeof(TSecurityFtdcProductInfoType)); - strncpy(pBody->AuthCode, m_ServerInfo.AuthCode, sizeof(TSecurityFtdcAuthCodeType)); - strncpy(pBody->RandCode, RandCode, sizeof(TSecurityFtdcAuthCodeType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcReqUserLoginField), nullptr, 0, nullptr, 0); -} - -int CQueryApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); - return m_pApi->ReqUserLogin((CSecurityFtdcReqUserLoginField*)ptr1, ++m_lRequestID); -} - -void CQueryApi::OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - - if (!IsErrorRspInfo(pRspInfo) - &&pRspUserLogin) - { - pField->TradingDay = GetDate(pRspUserLogin->TradingDay); - pField->LoginTime = GetTime(pRspUserLogin->LoginTime); - - sprintf(pField->SessionID, "%d:%d", pRspUserLogin->FrontID, pRspUserLogin->SessionID); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - - // µ¼Ϣܻõ - memcpy(&m_RspUserLogin,pRspUserLogin,sizeof(CSecurityFtdcRspUserLoginField)); - m_nMaxOrderRef = atol(pRspUserLogin->MaxOrderRef); - // ԼʱID1ʼܴ0ʼ - m_nMaxOrderRef = m_nMaxOrderRef>1 ? m_nMaxOrderRef : 1; - //ReqSettlementInfoConfirm(); - ReqQryInvestor(); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - if (m_ServerInfo.PrivateTopicResumeType > ResumeType::ResumeType_Restart - && (m_ServerInfo.PrivateTopicResumeTypeRawErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - } -} - -//int CQueryApi::ReqOrderInsert( -// OrderField* pOrder, -// int count, -// OrderIDType* pInOut) -//{ -// int OrderRef = -1; -// if (nullptr == m_pApi) -// return -1; -// -// CSecurityFtdcInputOrderField body = {0}; -// -// strncpy(body.BrokerID, m_RspUserLogin.BrokerID, sizeof(TSecurityFtdcBrokerIDType)); -// strncpy(body.InvestorID, m_RspUserLogin.UserID, sizeof(TSecurityFtdcInvestorIDType)); -// -// body.MinVolume = 1; -// body.ForceCloseReason = SECURITY_FTDC_FCC_NotForceClose; -// body.IsAutoSuspend = 0; -// body.UserForceClose = 0; -// //body.IsSwapOrder = 0; -// -// //Լ -// strncpy(body.InstrumentID, pOrder->InstrumentID, sizeof(TSecurityFtdcInstrumentIDType)); -// strncpy(body.ExchangeID, pOrder->ExchangeID, sizeof(TSecurityFtdcExchangeIDType)); -// // -// body.Direction = OrderSide_2_TSecurityFtdcDirectionType(pOrder->Side); -// //ƽ -// body.CombOffsetFlag[0] = OpenCloseType_2_TSecurityFtdcOffsetFlagType(pOrder->OpenClose); -// //Ͷ -// body.CombHedgeFlag[0] = HedgeFlagType_2_TSecurityFtdcHedgeFlagType(pOrder->HedgeFlag); -// // -// body.VolumeTotalOriginal = (int)pOrder->Qty; -// -// // õһļ۸񣬻ļ۸أ -// //body.LimitPrice = pOrder1->Price; -// sprintf(body.LimitPrice, "%f", pOrder->Price); -// body.StopPrice = pOrder->StopPx; -// -// // ԵڶдеڶΪǽ -// if (count>1) -// { -// body.CombOffsetFlag[1] = OpenCloseType_2_TSecurityFtdcOffsetFlagType(pOrder[1].OpenClose); -// body.CombHedgeFlag[1] = HedgeFlagType_2_TSecurityFtdcHedgeFlagType(pOrder[1].HedgeFlag); -// // Ʋֻ¹ܣûʵ -// //body.IsSwapOrder = (body.CombOffsetFlag[0] != body.CombOffsetFlag[1]); -// } -// -// //۸ -// //body.OrderPriceType = OrderType_2_TSecurityFtdcOrderPriceTypeType(pOrder1->Type); -// -// // м޼ -// switch (pOrder->Type) -// { -// case Market: -// case Stop: -// case MarketOnClose: -// case TrailingStop: -// body.OrderPriceType = SECURITY_FTDC_OPT_BestPrice; -// body.TimeCondition = SECURITY_FTDC_TC_IOC; -// break; -// case Limit: -// case StopLimit: -// case TrailingStopLimit: -// default: -// body.OrderPriceType = SECURITY_FTDC_OPT_LimitPrice; -// body.TimeCondition = SECURITY_FTDC_TC_GFD; -// break; -// } -// -// // IOCFOK -// switch (pOrder->TimeInForce) -// { -// case IOC: -// body.TimeCondition = SECURITY_FTDC_TC_IOC; -// body.VolumeCondition = SECURITY_FTDC_VC_AV; -// break; -// case FOK: -// body.TimeCondition = SECURITY_FTDC_TC_IOC; -// body.VolumeCondition = SECURITY_FTDC_VC_CV; -// //body.MinVolume = body.VolumeTotalOriginal; // ط -// break; -// default: -// body.VolumeCondition = SECURITY_FTDC_VC_AV; -// break; -// } -// -// // -// switch (pOrder->Type) -// { -// case Stop: -// case TrailingStop: -// case StopLimit: -// case TrailingStopLimit: -// // ûвԣ -// body.ContingentCondition = SECURITY_FTDC_CC_Immediately; -// break; -// default: -// body.ContingentCondition = SECURITY_FTDC_CC_Immediately; -// break; -// } -// -// int nRet = 0; -// { -// //ܱ̫죬m_nMaxOrderRefûиıύ -// lock_guard cl(m_csOrderRef); -// -// if (OrderRef < 0) -// { -// nRet = m_nMaxOrderRef; -// ++m_nMaxOrderRef; -// } -// else -// { -// nRet = OrderRef; -// } -// sprintf(body.OrderRef, "%d", nRet); -// -// //浽Уֱӷ -// int n = m_pApi->ReqOrderInsert(&body, ++m_lRequestID); -// if (n < 0) -// { -// nRet = n; -// sprintf(m_orderInsert_Id, "%d", nRet); -// } -// else -// { -// sprintf(m_orderInsert_Id, "%d:%d:%d", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, nRet); -// -// OrderField* pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); -// memcpy(pField, pOrder, sizeof(OrderField)); -// strcpy(pField->ID, m_orderInsert_Id); -// m_id_platform_order.insert(pair(m_orderInsert_Id, pField)); -// } -// strncpy((char*)pInOut, m_orderInsert_Id, sizeof(OrderIDType)); -// } -// -// return nRet; -//} - -//void CQueryApi::OnRspOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -//{ -// OrderIDType orderId = { 0 }; -// if (pInputOrder) -// { -// sprintf(orderId, "%d:%d:%s", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, pInputOrder->OrderRef); -// } -// else -// { -// IsErrorRspInfo(pRspInfo, nRequestID, bIsLast); -// } -// -// unordered_map::iterator it = m_id_platform_order.find(orderId); -// if (it == m_id_platform_order.end()) -// { -// // ûҵӦʾ -// //assert(false); -// } -// else -// { -// // ҵˣҪ״̬ -// // ʹϴε״̬ -// OrderField* pField = it->second; -// strcpy(pField->ID, orderId); -// pField->ExecType = ExecType::ExecRejected; -// pField->Status = OrderStatus::Rejected; -// pField->ErrorID = pRspInfo->ErrorID; -// strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); -// m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); -// } -//} - -//void CQueryApi::OnErrRtnOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo) -//{ -// OrderIDType orderId = { 0 }; -// if (pInputOrder) -// { -// sprintf(orderId, "%d:%d:%s", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, pInputOrder->OrderRef); -// } -// else -// { -// IsErrorRspInfo(pRspInfo, 0, true); -// } -// -// unordered_map::iterator it = m_id_platform_order.find(orderId); -// if (it == m_id_platform_order.end()) -// { -// // ûҵӦʾ -// //assert(false); -// // LTSڿʼʱҲյ˻رﰡ -// } -// else -// { -// // ҵˣҪ״̬ -// // ʹϴε״̬ -// OrderField* pField = it->second; -// strcpy(pField->ID, orderId); -// pField->ExecType = ExecType::ExecRejected; -// pField->Status = OrderStatus::Rejected; -// pField->ErrorID = pRspInfo->ErrorID; -// strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); -// m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); -// } -//} -// -//void CQueryApi::OnRtnTrade(CSecurityFtdcTradeField *pTrade) -//{ -// OnTrade(pTrade,false); -//} - -//int CQueryApi::ReqOrderAction(OrderIDType* szIds, int count, OrderIDType* pOutput) -//{ -// unordered_map::iterator it = m_id_api_order.find(szIds[0]); -// if (it == m_id_api_order.end()) -// { -// sprintf((char*)pOutput, "%d", -100); -// return -100; -// } -// else -// { -// // ҵ˶ -// return ReqOrderAction(it->second, count, pOutput); -// } -//} - -//int CQueryApi::ReqOrderAction(CSecurityFtdcOrderField *pOrder, int count, OrderIDType* pOutput) -//{ -// if (nullptr == m_pApi) -// return 0; -// -// CSecurityFtdcInputOrderActionField body = {0}; -// -// ///͹˾ -// strncpy(body.BrokerID, pOrder->BrokerID,sizeof(TSecurityFtdcBrokerIDType)); -// ///Ͷߴ -// strncpy(body.InvestorID, pOrder->InvestorID,sizeof(TSecurityFtdcInvestorIDType)); -// /// -// strncpy(body.OrderRef, pOrder->OrderRef,sizeof(TSecurityFtdcOrderRefType)); -// ///ǰñ -// body.FrontID = pOrder->FrontID; -// ///Ự -// body.SessionID = pOrder->SessionID; -// /// -// strncpy(body.ExchangeID,pOrder->ExchangeID,sizeof(TSecurityFtdcExchangeIDType)); -// /// -// //strncpy(body.OrderSysID,pOrder->OrderSysID,sizeof(TSecurityFtdcOrderSysIDType)); -// ///־ -// body.ActionFlag = SECURITY_FTDC_AF_Delete; -// ///Լ -// strncpy(body.InstrumentID, pOrder->InstrumentID,sizeof(TSecurityFtdcInstrumentIDType)); -// -// int nRet = m_pApi->ReqOrderAction(&body, ++m_lRequestID); -// if (nRet < 0) -// { -// sprintf(m_orderAction_Id, "%d", nRet); -// } -// else -// { -// memset(m_orderAction_Id, 0, sizeof(OrderIDType)); -// } -// strncpy((char*)pOutput, m_orderAction_Id, sizeof(OrderIDType)); -// -// return nRet; -//} - -//void CQueryApi::OnRspOrderAction(CSecurityFtdcInputOrderActionField *pInputOrderAction, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -//{ -// OrderIDType orderId = { 0 }; -// if (pInputOrderAction) -// { -// sprintf(orderId, "%d:%d:%s", pInputOrderAction->FrontID, pInputOrderAction->SessionID, pInputOrderAction->OrderRef); -// } -// else -// { -// IsErrorRspInfo(pRspInfo, nRequestID, bIsLast); -// } -// -// unordered_map::iterator it = m_id_platform_order.find(orderId); -// if (it == m_id_platform_order.end()) -// { -// // ûҵӦʾ -// //assert(false); -// } -// else -// { -// // ҵˣҪ״̬ -// // ʹϴε״̬ -// OrderField* pField = it->second; -// pField->ExecType = ExecType::ExecCancelReject; -// pField->ErrorID = pRspInfo->ErrorID; -// strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); -// m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); -// } -//} - -//void CQueryApi::OnErrRtnOrderAction(CSecurityFtdcOrderActionField *pOrderAction, CSecurityFtdcRspInfoField *pRspInfo) -//{ -// OrderIDType orderId = { 0 }; -// if (pOrderAction) -// { -// sprintf(orderId, "%d:%d:%s", pOrderAction->FrontID, pOrderAction->SessionID, pOrderAction->OrderRef); -// } -// else -// { -// IsErrorRspInfo(pRspInfo, 0, true); -// } -// -// unordered_map::iterator it = m_id_platform_order.find(orderId); -// if (it == m_id_platform_order.end()) -// { -// // ûҵӦʾ -// //assert(false); -// } -// else -// { -// // ҵˣҪ״̬ -// // ʹϴε״̬ -// OrderField* pField = it->second; -// pField->ExecType = ExecType::ExecCancelReject; -// pField->ErrorID = pRspInfo->ErrorID; -// strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); -// m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); -// } -//} - -//void CQueryApi::OnRtnOrder(CSecurityFtdcOrderField *pOrder) -//{ -// OnOrder(pOrder,false); -//} - -void CQueryApi::ReqQryTradingAccount() -{ - CSecurityFtdcQryTradingAccountField* pBody = (CSecurityFtdcQryTradingAccountField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcQryTradingAccountField)); - - strcpy(pBody->BrokerID, m_RspUserLogin.BrokerID); - strcpy(pBody->InvestorID, m_RspUserLogin.UserID); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_QryTradingAccountField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcQryTradingAccountField), nullptr, 0, nullptr, 0); -} - -int CQueryApi::_ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - return m_pApi->ReqQryTradingAccount((CSecurityFtdcQryTradingAccountField*)ptr1, ++m_lRequestID); -} - -void CQueryApi::OnRspQryTradingAccount(CSecurityFtdcTradingAccountField *pTradingAccount, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) - { - if (pTradingAccount) - { - AccountField* pField = (AccountField*)m_msgQueue->new_block(sizeof(AccountField)); - - strcpy(pField->AccountID, pTradingAccount->AccountID); - pField->PreBalance = pTradingAccount->PreBalance; - pField->CurrMargin = pTradingAccount->CurrMargin; - //pField->CloseProfit = pTradingAccount->CloseProfit; - //pField->PositionProfit = pTradingAccount->PositionProfit; - pField->Balance = pTradingAccount->Balance; - pField->Available = pTradingAccount->Available; - pField->Deposit = pTradingAccount->Deposit; - pField->Withdraw = pTradingAccount->Withdraw; - pField->FrozenTransferFee = pTradingAccount->FrozenTransferFee; - pField->FrozenStampTax = pTradingAccount->FrozenStampTax; - pField->FrozenCommission = pTradingAccount->FrozenCommission; - pField->FrozenCash = pTradingAccount->FrozenCash; - pField->TransferFee = pTradingAccount->TransferFee; - pField->StampTax = pTradingAccount->StampTax; - pField->Commission = pTradingAccount->Commission; - pField->CashIn = pTradingAccount->CashIn; - - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryTradingAccount, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(AccountField), nullptr, 0, nullptr, 0); - } - else - { - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryTradingAccount, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); - } - } -} - -void CQueryApi::ReqQryInvestorPosition(const string& szInstrumentId, const string& szExchange) -{ - CSecurityFtdcQryInvestorPositionField* pBody = (CSecurityFtdcQryInvestorPositionField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcQryInvestorPositionField)); - - strcpy(pBody->BrokerID, m_RspUserLogin.BrokerID); - strcpy(pBody->InvestorID, m_RspUserLogin.UserID); - strncpy(pBody->InstrumentID, szInstrumentId.c_str(), sizeof(TSecurityFtdcInstrumentIDType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_QryInvestorPositionField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcQryInvestorPositionField), nullptr, 0, nullptr, 0); -} - -int CQueryApi::_ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - return m_pApi->ReqQryInvestorPosition((CSecurityFtdcQryInvestorPositionField*)ptr1, ++m_lRequestID); -} - -// ծعֲNetҹൽLongУֱӴӳɽзֹ鵽Net -// пƽͶͶǿ -void CQueryApi::OnRspQryInvestorPosition(CSecurityFtdcInvestorPositionField *pInvestorPosition, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) - { - if (pInvestorPosition) - { - PositionIDType positionId = { 0 }; - sprintf(positionId, "%s:%s:%d:%d", - pInvestorPosition->InstrumentID, pInvestorPosition->ExchangeID, - TSecurityFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection), TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pInvestorPosition->HedgeFlag)); - - PositionField* pField = nullptr; - unordered_map::iterator it = m_id_platform_position.find(positionId); - if (it == m_id_platform_position.end()) - { - pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); - - sprintf(pField->Symbol, "%s.%s", pInvestorPosition->InstrumentID, pInvestorPosition->ExchangeID); - strcpy(pField->InstrumentID, pInvestorPosition->InstrumentID); - strcpy(pField->ExchangeID, pInvestorPosition->ExchangeID); - pField->Side = TSecurityFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection); - pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pInvestorPosition->HedgeFlag); - - m_id_platform_position.insert(pair(positionId, pField)); - } - else - { - pField = it->second; - } - - pField->Position = pInvestorPosition->Position; - pField->TodayPosition = pInvestorPosition->TodayPosition; - pField->HistoryPosition = pInvestorPosition->YdPosition; - - // ռȫٱ֪ͨһ - if (bIsLast) - { - int cnt = 0; - int count = m_id_platform_position.size(); - for (unordered_map::iterator iter = m_id_platform_position.begin(); iter != m_id_platform_position.end(); iter++) - { - ++cnt; - m_msgQueue->Input_Copy(ResponeType::OnRspQryInvestorPosition, m_msgQueue, m_pClass, cnt == count, 0, iter->second, sizeof(PositionField), nullptr, 0, nullptr, 0); - } - } - } - } -} - -void CQueryApi::ReqQryInstrument(const string& szInstrumentId, const string& szExchange) -{ - CSecurityFtdcQryInstrumentField* pBody = (CSecurityFtdcQryInstrumentField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcQryInstrumentField)); - - strncpy(pBody->InstrumentID, szInstrumentId.c_str(), sizeof(TSecurityFtdcInstrumentIDType)); - strncpy(pBody->ExchangeID, szExchange.c_str(), sizeof(TSecurityFtdcExchangeIDType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_QryInstrumentField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcQryInstrumentField), nullptr, 0, nullptr, 0); -} - -int CQueryApi::_ReqQryInstrument(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - return m_pApi->ReqQryInstrument((CSecurityFtdcQryInstrumentField*)ptr1, ++m_lRequestID); -} - -void CQueryApi::OnRspQryInstrument(CSecurityFtdcInstrumentField *pInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) - { - if (pInstrument) - { - InstrumentField* pField = (InstrumentField*)m_msgQueue->new_block(sizeof(InstrumentField)); - - strncpy(pField->InstrumentID, pInstrument->InstrumentID, sizeof(InstrumentIDType)); - strncpy(pField->ExchangeID, pInstrument->ExchangeID, sizeof(ExchangeIDType)); - - sprintf(pField->Symbol,"%s.%s",pInstrument->InstrumentID,pInstrument->ExchangeID); - sprintf(pField->InstrumentName, "%s(%s)", pInstrument->ExchangeInstID, pInstrument->InstrumentName); - strncpy(pField->ProductID, pInstrument->ProductID, sizeof(InstrumentIDType)); - - //strncpy(pField->InstrumentName, pInstrument->InstrumentName, sizeof(InstrumentNameType)); - pField->Type = CSecurityFtdcInstrumentField_2_InstrumentType(pInstrument); - pField->VolumeMultiple = pInstrument->VolumeMultiple; - pField->PriceTick = CSecurityFtdcInstrumentField_2_PriceTick(pInstrument); - pField->ExpireDate = GetDate(pInstrument->ExpireDate); - pField->OptionsType = CSecurityFtdcInstrumentField_2_PutCall(pInstrument); - pField->StrikePrice = pInstrument->ExecPrice; - - - // Ȩı - if (strlen(pInstrument->InstrumentID) == 8) - { - strncpy(pField->UnderlyingInstrID, pInstrument->ExchangeInstID, 6); - sprintf(&pField->UnderlyingInstrID[6], ".%s", pInstrument->ExchangeID); - } - - - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InstrumentField), nullptr, 0, nullptr, 0); - } - else - { - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); - } - } -} -// -//void CTraderApi::ReqQryInstrumentCommissionRate(const string& szInstrumentId) -//{ -// if (nullptr == m_pApi) -// return; -// -// SRequest* pRequest = MakeRequestBuf(E_QryInstrumentCommissionRateField); -// if (nullptr == pRequest) -// return; -// -// CSecurityFtdcQryInstrumentCommissionRateField& body = pRequest->QryInstrumentCommissionRateField; -// -// strncpy(body.BrokerID, m_RspUserLogin.BrokerID,sizeof(TSecurityFtdcBrokerIDType)); -// strncpy(body.InvestorID, m_RspUserLogin.UserID,sizeof(TSecurityFtdcInvestorIDType)); -// strncpy(body.InstrumentID,szInstrumentId.c_str(),sizeof(TSecurityFtdcInstrumentIDType)); -// -// AddToSendQueue(pRequest); -//} -// -//void CTraderApi::OnRspQryInstrumentCommissionRate(CSecurityFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -//{ -// //if(m_msgQueue) -// // m_msgQueue->Input_OnRspQryInstrumentCommissionRate(this,pInstrumentCommissionRate,pRspInfo,nRequestID,bIsLast); -// -// if (bIsLast) -// ReleaseRequestMapBuf(nRequestID); -//} - -void CQueryApi::OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - IsErrorRspInfo(pRspInfo, nRequestID, bIsLast); -} - -void CQueryApi::ReqQryOrder() -{ - CSecurityFtdcQryOrderField* pBody = (CSecurityFtdcQryOrderField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcQryOrderField)); - - strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID, sizeof(TSecurityFtdcBrokerIDType)); - strncpy(pBody->InvestorID, m_RspUserLogin.UserID, sizeof(TSecurityFtdcInvestorIDType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_QryOrderField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcQryOrderField), nullptr, 0, nullptr, 0); -} - -int CQueryApi::_ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - return m_pApi->ReqQryOrder((CSecurityFtdcQryOrderField*)ptr1, ++m_lRequestID); -} - -void CQueryApi::OnOrder(CSecurityFtdcOrderField *pOrder, bool bFromQry) -{ - if (nullptr == pOrder) - return; - - OrderIDType orderId = { 0 }; - sprintf(orderId, "%d:%d:%s", pOrder->FrontID, pOrder->SessionID, pOrder->OrderRef); - OrderIDType orderSydId = { 0 }; - - { - // ԭʼϢڳ - - unordered_map::iterator it = m_id_api_order.find(orderId); - if (it == m_id_api_order.end()) - { - // Ҳ˶ʾµ - CSecurityFtdcOrderField* pField = new CSecurityFtdcOrderField(); - memcpy(pField, pOrder, sizeof(CSecurityFtdcOrderField)); - m_id_api_order.insert(pair(orderId, pField)); - } - else - { - // ҵ˶ - // ҪٸƱһε״ֻ̬Ҫһεڳɣ£ñȽ - CSecurityFtdcOrderField* pField = it->second; - memcpy(pField, pOrder, sizeof(CSecurityFtdcOrderField)); - } - - // SysIDڶɽر붩 - sprintf(orderSydId, "%s:%s", pOrder->ExchangeID, pOrder->OrderSysID); - m_sysId_orderId.insert(pair(orderSydId, orderId)); - } - - { - // APIĶתԼĽṹ - - OrderField* pField = nullptr; - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) - { - // ʱϢûУҲӦĵӣҪOrderĻָ - pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); - - strcpy(pField->ID, orderId); - strcpy(pField->InstrumentID, pOrder->InstrumentID); - strcpy(pField->ExchangeID, pOrder->ExchangeID); - pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pOrder->CombHedgeFlag[0]); - pField->Side = TSecurityFtdcDirectionType_2_OrderSide(pOrder->Direction); - pField->Price = atof(pOrder->LimitPrice); - pField->StopPx = pOrder->StopPrice; - strncpy(pField->Text, pOrder->StatusMsg, sizeof(Char256Type)); - pField->OpenClose = TSecurityFtdcOffsetFlagType_2_OpenCloseType(pOrder->CombOffsetFlag[0]); - pField->Status = CSecurityFtdcOrderField_2_OrderStatus(pOrder); - pField->Qty = pOrder->VolumeTotalOriginal; - pField->Type = CSecurityFtdcOrderField_2_OrderType(pOrder); - pField->TimeInForce = CSecurityFtdcOrderField_2_TimeInForce(pOrder); - pField->ExecType = ExecType::ExecType_New; - strcpy(pField->OrderID, pOrder->OrderSysID); - - - // ӵmapУߵĶȡʧʱ֪ͨ - m_id_platform_order.insert(pair(orderId, pField)); - } - else - { - pField = it->second; - strcpy(pField->ID, orderId); - pField->LeavesQty = pOrder->VolumeTotal; - pField->Price = atof(pOrder->LimitPrice); - pField->Status = CSecurityFtdcOrderField_2_OrderStatus(pOrder); - pField->ExecType = CSecurityFtdcOrderField_2_ExecType(pOrder); - strcpy(pField->OrderID, pOrder->OrderSysID); - strncpy(pField->Text, pOrder->StatusMsg, sizeof(Char256Type)); - } - - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); - } -} - -void CQueryApi::OnRspQryOrder(CSecurityFtdcOrderField *pOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) - { - OnOrder(pOrder, true); - } -} - -void CQueryApi::ReqQryTrade() -{ - CSecurityFtdcQryTradeField* pBody = (CSecurityFtdcQryTradeField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcQryTradeField)); - - strcpy(pBody->BrokerID, m_RspUserLogin.BrokerID); - strcpy(pBody->InvestorID, m_RspUserLogin.UserID); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_QryTradeField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcQryTradeField), nullptr, 0, nullptr, 0); -} - -int CQueryApi::_ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - return m_pApi->ReqQryTrade((CSecurityFtdcQryTradeField*)ptr1, ++m_lRequestID); -} - -void CQueryApi::OnTrade(CSecurityFtdcTradeField *pTrade, bool bFromQry) -{ - if (nullptr == pTrade) - return; - - TradeField* pField = (TradeField*)m_msgQueue->new_block(sizeof(TradeField)); - - strcpy(pField->InstrumentID, pTrade->InstrumentID); - strcpy(pField->ExchangeID, pTrade->ExchangeID); - pField->Side = TSecurityFtdcDirectionType_2_OrderSide(pTrade->Direction); - pField->Qty = pTrade->Volume; - pField->Price = atof(pTrade->Price); - pField->OpenClose = TSecurityFtdcOffsetFlagType_2_OpenCloseType(pTrade->OffsetFlag); - pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pTrade->HedgeFlag); - pField->Commission = 0;//TODOԺҪ - pField->Time = GetTime(pTrade->TradeTime); - strcpy(pField->TradeID, pTrade->TradeID); - - OrderIDType orderSysId = { 0 }; - sprintf(orderSysId, "%s:%s", pTrade->ExchangeID, pTrade->OrderSysID); - unordered_map::iterator it = m_sysId_orderId.find(orderSysId); - if (it == m_sysId_orderId.end()) - { - // ˳ɽҲӦı - //assert(false); - } - else - { - // ҵӦı - strcpy(pField->ID, it->second.c_str()); - - m_msgQueue->Input_Copy(ResponeType::OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); - - unordered_map::iterator it2 = m_id_platform_order.find(it->second); - if (it2 == m_id_platform_order.end()) - { - // ˳ɽҲӦı - //assert(false); - } - else - { - // ¶״̬ - // ǷҪ֪ͨӿ - } - - OnTrade(pField, bFromQry); - } -} - -void CQueryApi::OnTrade(TradeField *pTrade, bool bFromQry) -{ - PositionIDType positionId = { 0 }; - sprintf(positionId, "%s:%s:%d:%d", - pTrade->InstrumentID, pTrade->ExchangeID, TradeField_2_PositionSide(pTrade), pTrade->HedgeFlag); - - PositionField* pField = nullptr; - unordered_map::iterator it = m_id_platform_position.find(positionId); - if (it == m_id_platform_position.end()) - { - pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); - - sprintf(pField->Symbol, "%s.%s", pTrade->InstrumentID, pTrade->ExchangeID); - strcpy(pField->InstrumentID, pTrade->InstrumentID); - strcpy(pField->ExchangeID, pTrade->ExchangeID); - pField->Side = TradeField_2_PositionSide(pTrade); - pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pTrade->HedgeFlag); - - m_id_platform_position.insert(pair(positionId, pField)); - } - else - { - pField = it->second; - } - - if (pTrade->Side == OrderSide::OrderSide_Buy) - { - pField->Position += pTrade->Qty; - pField->TodayPosition += pTrade->Qty; - } - else - { - pField->Position -= pTrade->Qty; - if (pTrade->OpenClose == OpenCloseType::OpenCloseType_CloseToday) - { - pField->TodayPosition -= pTrade->Qty; - } - else - { - pField->HistoryPosition -= pTrade->Qty; - // ıɸӽ쿪ʼ - if (pField->HistoryPosition<0) - { - pField->TodayPosition += pField->HistoryPosition; - pField->HistoryPosition = 0; - } - } - - // ֱ²ѯ - if (pField->Position < 0 || pField->TodayPosition < 0 || pField->HistoryPosition < 0) - { - ReqQryInvestorPosition("", ""); - return; - } - } - - m_msgQueue->Input_Copy(ResponeType::OnRspQryInvestorPosition, m_msgQueue, m_pClass, false, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); -} - -void CQueryApi::OnRspQryTrade(CSecurityFtdcTradeField *pTrade, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) - { - OnTrade(pTrade,true); - } -} - -void CQueryApi::ReqQryInvestor() -{ - CSecurityFtdcQryInvestorField* pBody = (CSecurityFtdcQryInvestorField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcQryInvestorField)); - - strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID, sizeof(TSecurityFtdcBrokerIDType)); - strncpy(pBody->InvestorID, m_RspUserLogin.UserID, sizeof(TSecurityFtdcInvestorIDType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_QryInvestorField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcQryInvestorField), nullptr, 0, nullptr, 0); -} - -int CQueryApi::_ReqQryInvestor(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - return m_pApi->ReqQryInvestor((CSecurityFtdcQryInvestorField*)ptr1, ++m_lRequestID); -} - -void CQueryApi::OnRspQryInvestor(CSecurityFtdcInvestorField *pInvestor, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) - { - if (pInvestor) - { - memcpy(&m_Investor, pInvestor, sizeof(CSecurityFtdcInvestorField)); - - InvestorField* pField = (InvestorField*)m_msgQueue->new_block(sizeof(InvestorField)); - - strcpy(pField->BrokerID, pInvestor->BrokerID); - strcpy(pField->InvestorID, pInvestor->InvestorID); - strcpy(pField->InvestorName, pInvestor->InvestorName); - strcpy(pField->IdentifiedCardNo, pInvestor->IdentifiedCardNo); - pField->IdentifiedCardType = TSecurityFtdcIdCardTypeType_2_IdCardType(pInvestor->IdentifiedCardType); - - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInvestor, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InvestorField), nullptr, 0, nullptr, 0); - } - else - { - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInvestor, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); - } - } -} diff --git a/QuantBox_LTS_Query_v2/TraderApi.cpp b/QuantBox_LTS_Query_v2/TraderApi.cpp deleted file mode 100644 index 809c7cb..0000000 --- a/QuantBox_LTS_Query_v2/TraderApi.cpp +++ /dev/null @@ -1,899 +0,0 @@ -#include "stdafx.h" -#include "TraderApi.h" - -#include "../include/QueueEnum.h" -#include "../include/QueueHeader.h" - -#include "../include/ApiHeader.h" -#include "../include/ApiStruct.h" - -#include "../include/toolkit.h" - -#include "../QuantBox_Queue/MsgQueue.h" - -#include "TypeConvert.h" - -#include -#include - -void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - // 由内部调用,不用检查是否为空 - CTraderApi* pApi = (CTraderApi*)pApi2; - pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - return nullptr; -} - -void CTraderApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - int iRet = 0; - switch (type) - { - case E_Init: - iRet = _Init(); - break; - case E_ReqUserLoginField: - iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_AuthRandCodeField: - iRet = _ReqFetchAuthRandCode(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - //case E_QryTradingAccountField: - // iRet = _ReqQryTradingAccount(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryInvestorPositionField: - // iRet = _ReqQryInvestorPosition(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryInstrumentField: - // iRet = _ReqQryInstrument(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryInvestorField: - // iRet = _ReqQryInvestor(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryOrderField: - // iRet = _ReqQryOrder(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryTradeField: - // iRet = _ReqQryTrade(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - default: - break; - } - - if (0 == iRet) - { - //返回成功,填加到已发送池 - m_nSleep = 1; - } - else - { - m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - //失败,按4的幂进行延时,但不超过1s - m_nSleep *= 4; - m_nSleep %= 1023; - } - this_thread::sleep_for(chrono::milliseconds(m_nSleep)); -} - -void CTraderApi::Register(void* pCallback, void* pClass) -{ - m_pClass = pClass; - if (m_msgQueue == nullptr) - return; - - m_msgQueue_Query->Register((void*)Query, this); - m_msgQueue->Register(pCallback, this); - if (pCallback) - { - m_msgQueue_Query->StartThread(); - m_msgQueue->StartThread(); - } - else - { - m_msgQueue_Query->StopThread(); - m_msgQueue->StopThread(); - } -} - -CTraderApi::CTraderApi(void) -{ - m_pApi = nullptr; - m_lRequestID = 0; - m_nSleep = 1; - - // 自己维护两个消息队列 - m_msgQueue = new CMsgQueue(); - m_msgQueue_Query = new CMsgQueue(); - - m_msgQueue_Query->Register((void*)Query, this); - m_msgQueue_Query->StartThread(); -} - - -CTraderApi::~CTraderApi(void) -{ - Disconnect(); -} - -bool CTraderApi::IsErrorRspInfo(const char* szSource, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); - if (bRet) - { - ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); - - pField->ErrorID = pRspInfo->ErrorID; - strcpy(pField->ErrorMsg, pRspInfo->ErrorMsg); - strcpy(pField->Source, szSource); - - m_msgQueue->Input_NoCopy(ResponeType::OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); - } - return bRet; -} - -bool CTraderApi::IsErrorRspInfo(CSecurityFtdcRspInfoField *pRspInfo) -{ - bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); - - return bRet; -} - -void CTraderApi::Connect(const string& szPath, - ServerInfoField* pServerInfo, - UserInfoField* pUserInfo) -{ - m_szPath = szPath; - memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); - memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_Init, m_msgQueue_Query, this, 0, 0, - nullptr, 0, nullptr, 0, nullptr, 0); -} - -int CTraderApi::_Init() -{ - char *pszPath = new char[m_szPath.length() + 1024]; - srand((unsigned int)time(nullptr)); - sprintf(pszPath, "%s/%s/%s/Td/%d/", m_szPath.c_str(), m_ServerInfo.BrokerID, m_UserInfo.UserID, rand()); - makedirs(pszPath); - - m_pApi = CSecurityFtdcTraderApi::CreateFtdcTraderApi(pszPath); - delete[] pszPath; - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - if (m_pApi) - { - m_pApi->RegisterSpi(this); - - //添加地址 - size_t len = strlen(m_ServerInfo.Address) + 1; - char* buf = new char[len]; - strncpy(buf, m_ServerInfo.Address, len); - - char* token = strtok(buf, _QUANTBOX_SEPS_); - while (token) - { - if (strlen(token)>0) - { - m_pApi->RegisterFront(token); - } - token = strtok(nullptr, _QUANTBOX_SEPS_); - } - delete[] buf; - - if (m_ServerInfo.PublicTopicResumeTypeSubscribePublicTopic((SECURITY_TE_RESUME_TYPE)m_ServerInfo.PublicTopicResumeType); - if (m_ServerInfo.PrivateTopicResumeTypeSubscribePrivateTopic((SECURITY_TE_RESUME_TYPE)m_ServerInfo.PrivateTopicResumeType); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); - //初始化连接 - m_pApi->Init(); - } - - return 0; -} - -void CTraderApi::Disconnect() -{ - if (m_msgQueue_Query) - { - m_msgQueue_Query->StopThread(); - m_msgQueue_Query->Register(nullptr, nullptr); - m_msgQueue_Query->Clear(); - delete m_msgQueue_Query; - m_msgQueue_Query = nullptr; - } - - if (m_pApi) - { - m_pApi->RegisterSpi(nullptr); - m_pApi->Release(); - m_pApi = nullptr; - - // 全清理,只留最后一个 - m_msgQueue->Clear(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); - // 主动触发 - m_msgQueue->Process(); - } - - if (m_msgQueue) - { - m_msgQueue->StopThread(); - m_msgQueue->Register(nullptr, nullptr); - m_msgQueue->Clear(); - delete m_msgQueue; - m_msgQueue = nullptr; - } - - m_lRequestID = 0;//由于线程已经停止,没有必要用原子操作了 - - Clear(); -} - -void CTraderApi::Clear() -{ - for (unordered_map::iterator it = m_id_platform_order.begin(); it != m_id_platform_order.end(); ++it) - delete it->second; - m_id_platform_order.clear(); - - for (unordered_map::iterator it = m_id_api_order.begin(); it != m_id_api_order.end(); ++it) - delete it->second; - m_id_api_order.clear(); - - //for (unordered_map::iterator it = m_id_platform_quote.begin(); it != m_id_platform_quote.end(); ++it) - // delete it->second; - //m_id_platform_quote.clear(); - - //for (unordered_map::iterator it = m_id_api_quote.begin(); it != m_id_api_quote.end(); ++it) - // delete it->second; - //m_id_api_quote.clear(); - - for (unordered_map::iterator it = m_id_platform_position.begin(); it != m_id_platform_position.end(); ++it) - delete it->second; - m_id_platform_position.clear(); -} - -void CTraderApi::OnFrontConnected() -{ - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - //ReqUserLogin(); - ReqFetchAuthRandCode(); -} - -void CTraderApi::OnFrontDisconnected(int nReason) -{ - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - - //连接失败返回的信息是拼接而成,主要是为了统一输出 - pField->ErrorID = nReason; - GetOnFrontDisconnectedMsg(nReason, pField->ErrorMsg); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); -} - -void CTraderApi::ReqFetchAuthRandCode() -{ - CSecurityFtdcAuthRandCodeField* pBody = (CSecurityFtdcAuthRandCodeField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcAuthRandCodeField)); - - strncpy(pBody->RandCode, "", sizeof(TSecurityFtdcAuthCodeType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_AuthRandCodeField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcAuthRandCodeField), nullptr, 0, nullptr, 0); -} - -int CTraderApi::_ReqFetchAuthRandCode(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Authorizing, 0, nullptr, 0, nullptr, 0, nullptr, 0); - return m_pApi->ReqFetchAuthRandCode((CSecurityFtdcAuthRandCodeField*)ptr1, ++m_lRequestID); -} - -void CTraderApi::OnRspFetchAuthRandCode(CSecurityFtdcAuthRandCodeField *pAuthRandCode, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - - if (!IsErrorRspInfo(pRspInfo) - && pAuthRandCode) - { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Authorized, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - - ReqUserLogin(pAuthRandCode->RandCode); - } - else - { - pField->ErrorID = pRspInfo->ErrorID; - strncpy(pField->ErrorMsg, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - } -} - -void CTraderApi::ReqUserLogin(TSecurityFtdcAuthCodeType RandCode) -{ - CSecurityFtdcReqUserLoginField* pBody = (CSecurityFtdcReqUserLoginField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcReqUserLoginField)); - - strncpy(pBody->BrokerID, m_ServerInfo.BrokerID, sizeof(TSecurityFtdcBrokerIDType)); - strncpy(pBody->UserID, m_UserInfo.UserID, sizeof(TSecurityFtdcInvestorIDType)); - strncpy(pBody->Password, m_UserInfo.Password, sizeof(TSecurityFtdcPasswordType)); - strncpy(pBody->UserProductInfo, m_ServerInfo.UserProductInfo, sizeof(TSecurityFtdcProductInfoType)); - strncpy(pBody->AuthCode, m_ServerInfo.AuthCode, sizeof(TSecurityFtdcAuthCodeType)); - strncpy(pBody->RandCode, RandCode, sizeof(TSecurityFtdcAuthCodeType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, - pBody, sizeof(CSecurityFtdcReqUserLoginField), nullptr, 0, nullptr, 0); -} - -int CTraderApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); - return m_pApi->ReqUserLogin((CSecurityFtdcReqUserLoginField*)ptr1, ++m_lRequestID); -} - -void CTraderApi::OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - - if (!IsErrorRspInfo(pRspInfo) - &&pRspUserLogin) - { - pField->TradingDay = GetDate(pRspUserLogin->TradingDay); - pField->LoginTime = GetTime(pRspUserLogin->LoginTime); - - sprintf(pField->SessionID, "%d:%d", pRspUserLogin->FrontID, pRspUserLogin->SessionID); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - - // 记下登录信息,可能会用到 - memcpy(&m_RspUserLogin,pRspUserLogin,sizeof(CSecurityFtdcRspUserLoginField)); - m_nMaxOrderRef = atol(pRspUserLogin->MaxOrderRef); - // 自己发单时ID从1开始,不能从0开始 - m_nMaxOrderRef = m_nMaxOrderRef>1 ? m_nMaxOrderRef : 1; - //ReqSettlementInfoConfirm(); - //ReqQryInvestor(); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - if (m_ServerInfo.PrivateTopicResumeType > ResumeType::Restart - && (m_ServerInfo.PrivateTopicResumeTypeErrorID = pRspInfo->ErrorID; - strncpy(pField->ErrorMsg, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - } -} - -int CTraderApi::ReqOrderInsert( - OrderField* pOrder, - int count, - OrderIDType* pInOut) -{ - int OrderRef = -1; - if (nullptr == m_pApi) - return -1; - - CSecurityFtdcInputOrderField body = {0}; - - strncpy(body.BrokerID, m_RspUserLogin.BrokerID, sizeof(TSecurityFtdcBrokerIDType)); - strncpy(body.InvestorID, m_RspUserLogin.UserID, sizeof(TSecurityFtdcInvestorIDType)); - - body.MinVolume = 1; - body.ForceCloseReason = SECURITY_FTDC_FCC_NotForceClose; - body.IsAutoSuspend = 0; - body.UserForceClose = 0; - //body.IsSwapOrder = 0; - - //合约 - strncpy(body.InstrumentID, pOrder->InstrumentID, sizeof(TSecurityFtdcInstrumentIDType)); - strncpy(body.ExchangeID, pOrder->ExchangeID, sizeof(TSecurityFtdcExchangeIDType)); - //买卖 - body.Direction = OrderSide_2_TSecurityFtdcDirectionType(pOrder->Side); - //开平 - body.CombOffsetFlag[0] = OpenCloseType_2_TSecurityFtdcOffsetFlagType(pOrder->OpenClose); - //投保 - body.CombHedgeFlag[0] = HedgeFlagType_2_TSecurityFtdcHedgeFlagType(pOrder->HedgeFlag); - //数量 - body.VolumeTotalOriginal = (int)pOrder->Qty; - - // 对于套利单,是用第一个参数的价格,还是用两个参数的价格差呢? - //body.LimitPrice = pOrder1->Price; - sprintf(body.LimitPrice, "%f", pOrder->Price); - body.StopPrice = pOrder->StopPx; - - // 针对第二个进行处理,如果有第二个参数,认为是交易所套利单 - if (count>1) - { - body.CombOffsetFlag[1] = OpenCloseType_2_TSecurityFtdcOffsetFlagType(pOrder[1].OpenClose); - body.CombHedgeFlag[1] = HedgeFlagType_2_TSecurityFtdcHedgeFlagType(pOrder[1].HedgeFlag); - // 交易所的移仓换月功能,没有实测过 - //body.IsSwapOrder = (body.CombOffsetFlag[0] != body.CombOffsetFlag[1]); - } - - //价格 - //body.OrderPriceType = OrderType_2_TSecurityFtdcOrderPriceTypeType(pOrder1->Type); - - // 市价与限价 - switch (pOrder->Type) - { - case Market: - case Stop: - case MarketOnClose: - case TrailingStop: - body.OrderPriceType = SECURITY_FTDC_OPT_BestPrice; - body.TimeCondition = SECURITY_FTDC_TC_IOC; - break; - case Limit: - case StopLimit: - case TrailingStopLimit: - default: - body.OrderPriceType = SECURITY_FTDC_OPT_LimitPrice; - body.TimeCondition = SECURITY_FTDC_TC_GFD; - break; - } - - // IOC与FOK - switch (pOrder->TimeInForce) - { - case IOC: - body.TimeCondition = SECURITY_FTDC_TC_IOC; - body.VolumeCondition = SECURITY_FTDC_VC_AV; - break; - case FOK: - body.TimeCondition = SECURITY_FTDC_TC_IOC; - body.VolumeCondition = SECURITY_FTDC_VC_CV; - //body.MinVolume = body.VolumeTotalOriginal; // 这个地方必须加吗? - break; - default: - body.VolumeCondition = SECURITY_FTDC_VC_AV; - break; - } - - // 条件单 - switch (pOrder->Type) - { - case Stop: - case TrailingStop: - case StopLimit: - case TrailingStopLimit: - // 条件单没有测试,先留空 - body.ContingentCondition = SECURITY_FTDC_CC_Immediately; - break; - default: - body.ContingentCondition = SECURITY_FTDC_CC_Immediately; - break; - } - - int nRet = 0; - { - //可能报单太快,m_nMaxOrderRef还没有改变就提交了 - lock_guard cl(m_csOrderRef); - - if (OrderRef < 0) - { - nRet = m_nMaxOrderRef; - ++m_nMaxOrderRef; - } - else - { - nRet = OrderRef; - } - sprintf(body.OrderRef, "%d", nRet); - - //不保存到队列,而是直接发送 - int n = m_pApi->ReqOrderInsert(&body, ++m_lRequestID); - if (n < 0) - { - nRet = n; - sprintf(m_orderInsert_Id, "%d", nRet); - } - else - { - sprintf(m_orderInsert_Id, "%d:%d:%d", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, nRet); - - OrderField* pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); - memcpy(pField, pOrder, sizeof(OrderField)); - strcpy(pField->ID, m_orderInsert_Id); - strcpy(pField->LocalID, pField->ID); - m_id_platform_order.insert(pair(m_orderInsert_Id, pField)); - } - strncpy((char*)pInOut, m_orderInsert_Id, sizeof(OrderIDType)); - } - - return nRet; -} - -void CTraderApi::OnRspOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - OrderIDType orderId = { 0 }; - if (pInputOrder) - { - sprintf(orderId, "%d:%d:%s", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, pInputOrder->OrderRef); - } - else - { - IsErrorRspInfo("OnRspOrderInsert", pRspInfo, nRequestID, bIsLast); - } - - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) - { - // 没找到?不应当,这表示出错了 - //assert(false); - } - else - { - // 找到了,要更新状态 - // 得使用上次的状态 - OrderField* pField = it->second; - strcpy(pField->ID, orderId); - strcpy(pField->LocalID, pField->ID); - pField->ExecType = ExecType::ExecRejected; - pField->Status = OrderStatus::Rejected; - pField->ErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); - } -} - -void CTraderApi::OnErrRtnOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo) -{ - OrderIDType orderId = { 0 }; - if (pInputOrder) - { - sprintf(orderId, "%d:%d:%s", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, pInputOrder->OrderRef); - } - else - { - IsErrorRspInfo("OnErrRtnOrderInsert", pRspInfo, 0, true); - } - - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) - { - // 没找到?不应当,这表示出错了 - //assert(false); - // LTS在开始连接时也会收到此回报,无语啊 - } - else - { - // 找到了,要更新状态 - // 得使用上次的状态 - OrderField* pField = it->second; - strcpy(pField->ID, orderId); - strcpy(pField->LocalID, pField->ID); - pField->ExecType = ExecType::ExecRejected; - pField->Status = OrderStatus::Rejected; - pField->ErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); - } -} - -void CTraderApi::OnRtnTrade(CSecurityFtdcTradeField *pTrade) -{ - OnTrade(pTrade,false); -} - -int CTraderApi::ReqOrderAction(OrderIDType* szIds, int count, OrderIDType* pOutput) -{ - unordered_map::iterator it = m_id_api_order.find(szIds[0]); - if (it == m_id_api_order.end()) - { - sprintf((char*)pOutput, "%d", -100); - return -100; - } - else - { - // 找到了订单 - return ReqOrderAction(it->second, count, pOutput); - } -} - -int CTraderApi::ReqOrderAction(CSecurityFtdcOrderField *pOrder, int count, OrderIDType* pOutput) -{ - if (nullptr == m_pApi) - return 0; - - CSecurityFtdcInputOrderActionField body = {0}; - - ///经纪公司代码 - strncpy(body.BrokerID, pOrder->BrokerID,sizeof(TSecurityFtdcBrokerIDType)); - ///投资者代码 - strncpy(body.InvestorID, pOrder->InvestorID,sizeof(TSecurityFtdcInvestorIDType)); - ///报单引用 - strncpy(body.OrderRef, pOrder->OrderRef,sizeof(TSecurityFtdcOrderRefType)); - ///前置编号 - body.FrontID = pOrder->FrontID; - ///会话编号 - body.SessionID = pOrder->SessionID; - ///交易所代码 - strncpy(body.ExchangeID,pOrder->ExchangeID,sizeof(TSecurityFtdcExchangeIDType)); - ///报单编号 - //strncpy(body.OrderSysID,pOrder->OrderSysID,sizeof(TSecurityFtdcOrderSysIDType)); - ///操作标志 - body.ActionFlag = SECURITY_FTDC_AF_Delete; - ///合约代码 - strncpy(body.InstrumentID, pOrder->InstrumentID,sizeof(TSecurityFtdcInstrumentIDType)); - - int nRet = m_pApi->ReqOrderAction(&body, ++m_lRequestID); - if (nRet < 0) - { - sprintf(m_orderAction_Id, "%d", nRet); - } - else - { - memset(m_orderAction_Id, 0, sizeof(OrderIDType)); - } - strncpy((char*)pOutput, m_orderAction_Id, sizeof(OrderIDType)); - - return nRet; -} - -void CTraderApi::OnRspOrderAction(CSecurityFtdcInputOrderActionField *pInputOrderAction, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - OrderIDType orderId = { 0 }; - if (pInputOrderAction) - { - sprintf(orderId, "%d:%d:%s", pInputOrderAction->FrontID, pInputOrderAction->SessionID, pInputOrderAction->OrderRef); - } - else - { - IsErrorRspInfo("OnRspOrderAction", pRspInfo, nRequestID, bIsLast); - } - - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) - { - // 没找到?不应当,这表示出错了 - //assert(false); - } - else - { - // 找到了,要更新状态 - // 得使用上次的状态 - OrderField* pField = it->second; - pField->ExecType = ExecType::ExecCancelReject; - pField->ErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); - } -} - -void CTraderApi::OnErrRtnOrderAction(CSecurityFtdcOrderActionField *pOrderAction, CSecurityFtdcRspInfoField *pRspInfo) -{ - OrderIDType orderId = { 0 }; - if (pOrderAction) - { - sprintf(orderId, "%d:%d:%s", pOrderAction->FrontID, pOrderAction->SessionID, pOrderAction->OrderRef); - } - else - { - IsErrorRspInfo("OnErrRtnOrderAction", pRspInfo, 0, true); - } - - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) - { - // 没找到?不应当,这表示出错了 - //assert(false); - } - else - { - // 找到了,要更新状态 - // 得使用上次的状态 - OrderField* pField = it->second; - pField->ExecType = ExecType::ExecCancelReject; - pField->ErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); - } -} - -void CTraderApi::OnRtnOrder(CSecurityFtdcOrderField *pOrder) -{ - OnOrder(pOrder,false); -} - -void CTraderApi::OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - IsErrorRspInfo("OnRspError", pRspInfo, nRequestID, bIsLast); -} - -void CTraderApi::OnOrder(CSecurityFtdcOrderField *pOrder, bool bFromQry) -{ - if (nullptr == pOrder) - return; - - OrderIDType orderId = { 0 }; - sprintf(orderId, "%d:%d:%s", pOrder->FrontID, pOrder->SessionID, pOrder->OrderRef); - OrderIDType orderSydId = { 0 }; - - { - // 保存原始订单信息,用于撤单 - - unordered_map::iterator it = m_id_api_order.find(orderId); - if (it == m_id_api_order.end()) - { - // 找不到此订单,表示是新单 - CSecurityFtdcOrderField* pField = new CSecurityFtdcOrderField(); - memcpy(pField, pOrder, sizeof(CSecurityFtdcOrderField)); - m_id_api_order.insert(pair(orderId, pField)); - } - else - { - // 找到了订单 - // 需要再复制保存最后一次的状态,还是只要第一次的用于撤单即可?记下,这样最后好比较 - CSecurityFtdcOrderField* pField = it->second; - memcpy(pField, pOrder, sizeof(CSecurityFtdcOrderField)); - } - - // 保存SysID用于定义成交回报与订单 - sprintf(orderSydId, "%s:%s", pOrder->ExchangeID, pOrder->OrderSysID); - m_sysId_orderId.insert(pair(orderSydId, orderId)); - } - - { - // 从API的订单转换成自己的结构体 - - OrderField* pField = nullptr; - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) - { - // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 - pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); - - strcpy(pField->ID, orderId); - strcpy(pField->LocalID, pField->ID); - strcpy(pField->InstrumentID, pOrder->InstrumentID); - strcpy(pField->ExchangeID, pOrder->ExchangeID); - pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pOrder->CombHedgeFlag[0]); - pField->Side = TSecurityFtdcDirectionType_2_OrderSide(pOrder->Direction); - pField->Price = atof(pOrder->LimitPrice); - pField->StopPx = pOrder->StopPrice; - strncpy(pField->Text, pOrder->StatusMsg, sizeof(ErrorMsgType)); - pField->OpenClose = TSecurityFtdcOffsetFlagType_2_OpenCloseType(pOrder->CombOffsetFlag[0]); - pField->Status = CSecurityFtdcOrderField_2_OrderStatus(pOrder); - pField->Qty = pOrder->VolumeTotalOriginal; - pField->Type = CSecurityFtdcOrderField_2_OrderType(pOrder); - pField->TimeInForce = CSecurityFtdcOrderField_2_TimeInForce(pOrder); - pField->ExecType = ExecType::ExecNew; - strcpy(pField->OrderID, pOrder->OrderSysID); - - - // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 - m_id_platform_order.insert(pair(orderId, pField)); - } - else - { - pField = it->second; - strcpy(pField->ID, orderId); - strcpy(pField->LocalID, pField->ID); - pField->LeavesQty = pOrder->VolumeTotal; - pField->Price = atof(pOrder->LimitPrice); - pField->Status = CSecurityFtdcOrderField_2_OrderStatus(pOrder); - pField->ExecType = CSecurityFtdcOrderField_2_ExecType(pOrder); - strcpy(pField->OrderID, pOrder->OrderSysID); - strncpy(pField->Text, pOrder->StatusMsg, sizeof(ErrorMsgType)); - } - - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); - } -} - -void CTraderApi::OnTrade(CSecurityFtdcTradeField *pTrade, bool bFromQry) -{ - if (nullptr == pTrade) - return; - - TradeField* pField = (TradeField*)m_msgQueue->new_block(sizeof(TradeField)); - - strcpy(pField->InstrumentID, pTrade->InstrumentID); - strcpy(pField->ExchangeID, pTrade->ExchangeID); - pField->Side = TSecurityFtdcDirectionType_2_OrderSide(pTrade->Direction); - pField->Qty = pTrade->Volume; - pField->Price = atof(pTrade->Price); - pField->OpenClose = TSecurityFtdcOffsetFlagType_2_OpenCloseType(pTrade->OffsetFlag); - pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pTrade->HedgeFlag); - pField->Commission = 0;//TODO收续费以后要计算出来 - pField->Time = GetTime(pTrade->TradeTime); - strcpy(pField->TradeID, pTrade->TradeID); - - OrderIDType orderSysId = { 0 }; - sprintf(orderSysId, "%s:%s", pTrade->ExchangeID, pTrade->OrderSysID); - unordered_map::iterator it = m_sysId_orderId.find(orderSysId); - if (it == m_sysId_orderId.end()) - { - // 此成交找不到对应的报单 - //assert(false); - } - else - { - // 找到对应的报单 - strcpy(pField->ID, it->second.c_str()); - - m_msgQueue->Input_Copy(ResponeType::OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); - - unordered_map::iterator it2 = m_id_platform_order.find(it->second); - if (it2 == m_id_platform_order.end()) - { - // 此成交找不到对应的报单 - //assert(false); - } - else - { - // 更新订单的状态 - // 是否要通知接口 - } - - OnTrade(pField, bFromQry); - } -} - -void CTraderApi::OnTrade(TradeField *pTrade, bool bFromQry) -{ - PositionIDType positionId = { 0 }; - sprintf(positionId, "%s:%s:%d:%d", - pTrade->InstrumentID, pTrade->ExchangeID, TradeField_2_PositionSide(pTrade), pTrade->HedgeFlag); - - PositionField* pField = nullptr; - unordered_map::iterator it = m_id_platform_position.find(positionId); - if (it == m_id_platform_position.end()) - { - pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); - - sprintf(pField->Symbol, "%s.%s", pTrade->InstrumentID, pTrade->ExchangeID); - strcpy(pField->InstrumentID, pTrade->InstrumentID); - strcpy(pField->ExchangeID, pTrade->ExchangeID); - pField->Side = TradeField_2_PositionSide(pTrade); - pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pTrade->HedgeFlag); - - m_id_platform_position.insert(pair(positionId, pField)); - } - else - { - pField = it->second; - } - - if (pTrade->Side == OrderSide::Buy) - { - pField->Position += pTrade->Qty; - pField->TdPosition += pTrade->Qty; - } - else - { - pField->Position -= pTrade->Qty; - if (pTrade->OpenClose == OpenCloseType::CloseToday) - { - pField->TdPosition -= pTrade->Qty; - } - else - { - pField->YdPosition -= pTrade->Qty; - // 如果昨天的被减成负数,从今天开始继续减 - if (pField->YdPosition<0) - { - pField->TdPosition += pField->YdPosition; - pField->YdPosition = 0; - } - } - - // 计算错误,直接重新查询 - //if (pField->Position < 0 || pField->TdPosition < 0 || pField->YdPosition < 0) - //{ - // ReqQryInvestorPosition("", ""); - // return; - //} - } - - m_msgQueue->Input_Copy(ResponeType::OnRspQryInvestorPosition, m_msgQueue, m_pClass, false, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); -} \ No newline at end of file diff --git a/QuantBox_LTS_Query_v2/TraderApi.h b/QuantBox_LTS_Query_v2/TraderApi.h deleted file mode 100644 index 1b64f01..0000000 --- a/QuantBox_LTS_Query_v2/TraderApi.h +++ /dev/null @@ -1,218 +0,0 @@ -#pragma once - -#include "../include/LTS_v2/SecurityFtdcTraderApi.h" -#include "../include/ApiStruct.h" - -#ifdef _WIN64 -#pragma comment(lib, "../include/LTS_v2/win64/securitytraderapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x64.lib") -#else -#pragma comment(lib, "../include/LTS_v2/win32/securitytraderapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -class CMsgQueue; - -class CTraderApi : - public CSecurityFtdcTraderSpi -{ - //请求数据包类型 - enum RequestType - { - E_Init, - - E_ReqAuthenticateField, - E_ReqUserLoginField, - E_SettlementInfoConfirmField, - - E_QryInvestorField, - - E_QryInstrumentField, - E_InputOrderField, - E_InputOrderActionField, - E_InputQuoteField, - E_InputQuoteActionField, - E_QryTradingAccountField, - E_QryInvestorPositionField, - E_QryInvestorPositionDetailField, - E_QryInstrumentCommissionRateField, - E_QryInstrumentMarginRateField, - E_QryDepthMarketDataField, - E_QrySettlementInfoField, - E_QryOrderField, - E_QryTradeField, - - E_AuthRandCodeField, - }; - -public: - CTraderApi(void); - virtual ~CTraderApi(void); - - void Register(void* pCallback, void* pClass); - - void Connect(const string& szPath, - ServerInfoField* pServerInfo, - UserInfoField* pUserInfo); - void Disconnect(); - - int ReqOrderInsert( - OrderField* pOrder, - int count, - OrderIDType* pInOut); - - int ReqOrderAction(OrderIDType* szIds, int count, OrderIDType* pOutput); - int ReqOrderAction(CSecurityFtdcOrderField *pOrder, int count, OrderIDType* pOutput); - - int ReqQuoteInsert( - int QuoteRef, - OrderField* pOrderAsk, - OrderField* pOrderBid); - - //int ReqQuoteAction(CSecurityFtdcQuoteField *pQuote); - //int ReqQuoteAction(const string& szId); - - //void ReqQryTradingAccount(); - //void ReqQryInvestorPosition(const string& szInstrumentId, const string& szExchange); - //void ReqQryInvestorPositionDetail(const string& szInstrumentId); - //void ReqQryInstrument(const string& szInstrumentId, const string& szExchange); - //void ReqQryInstrumentCommissionRate(const string& szInstrumentId); - //void ReqQryInstrumentMarginRate(const string& szInstrumentId, TSecurityFtdcHedgeFlagType HedgeFlag = SECURITY_FTDC_HF_Speculation); - //void ReqQryDepthMarketData(const string& szInstrumentId); - //void ReqQrySettlementInfo(const string& szTradingDay); - - //void ReqQryOrder(); - //void ReqQryTrade(); - - //void ReqQryInvestor(); - -private: - friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - void QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - void Clear(); - - int _Init(); - - void ReqUserLogin(TSecurityFtdcAuthCodeType RandCode); - int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - void ReqFetchAuthRandCode(); - int _ReqFetchAuthRandCode(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - //int _ReqQryInstrument(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - //int _ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - //int _ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - //int _ReqQryInvestor(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - //int _ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - //int _ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - //int _ReqQryQuote(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - void OnOrder(CSecurityFtdcOrderField *pOrder, bool bFromQry); - void OnTrade(CSecurityFtdcTradeField *pTrade, bool bFromQry); - void OnTrade(TradeField *pTrade, bool bFromQry); - - //检查是否出错 - bool IsErrorRspInfo(const char* szSource, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);//向消息队列输出信息 - bool IsErrorRspInfo(CSecurityFtdcRspInfoField *pRspInfo);//不输出信息 - - //连接 - virtual void OnFrontConnected(); - virtual void OnFrontDisconnected(int nReason); - - //认证 - virtual void OnRspFetchAuthRandCode(CSecurityFtdcAuthRandCodeField *pAuthRandCode, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - virtual void OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspSettlementInfoConfirm(CSecurityFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspQryInvestor(CSecurityFtdcInvestorField *pInvestor, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - //下单 - virtual void OnRspOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - virtual void OnErrRtnOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo); - - //撤单 - virtual void OnRspOrderAction(CSecurityFtdcInputOrderActionField *pInputOrderAction, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - virtual void OnErrRtnOrderAction(CSecurityFtdcOrderActionField *pOrderAction, CSecurityFtdcRspInfoField *pRspInfo); - - //报单回报 - //virtual void OnRspQryOrder(CSecurityFtdcOrderField *pOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - virtual void OnRtnOrder(CSecurityFtdcOrderField *pOrder); - - //成交回报 - //virtual void OnRspQryTrade(CSecurityFtdcTradeField *pTrade, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - virtual void OnRtnTrade(CSecurityFtdcTradeField *pTrade); - - //报价录入 - //virtual void OnRspQuoteInsert(CSecurityFtdcInputQuoteField *pInputQuote, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnErrRtnQuoteInsert(CSecurityFtdcInputQuoteField *pInputQuote, CSecurityFtdcRspInfoField *pRspInfo); - //virtual void OnRtnQuote(CSecurityFtdcQuoteField *pQuote); - - //报价撤单 - //virtual void OnRspQuoteAction(CSecurityFtdcInputQuoteActionField *pInputQuoteAction, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnErrRtnQuoteAction(CSecurityFtdcQuoteActionField *pQuoteAction, CSecurityFtdcRspInfoField *pRspInfo); - - //仓位 - //virtual void OnRspQryInvestorPosition(CSecurityFtdcInvestorPositionField *pInvestorPosition, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspQryInvestorPositionDetail(CSecurityFtdcInvestorPositionDetailField *pInvestorPositionDetail, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspQryInvestorPositionCombineDetail(CSecurityFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; - - //资金 - //virtual void OnRspQryTradingAccount(CSecurityFtdcTradingAccountField *pTradingAccount, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - //合约、手续费 - //virtual void OnRspQryInstrument(CSecurityFtdcInstrumentField *pInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspQryInstrumentMarginRate(CSecurityFtdcInstrumentMarginRateField *pInstrumentMarginRate, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspQryInstrumentCommissionRate(CSecurityFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - //查询行情响应 - //virtual void OnRspQryDepthMarketData(CSecurityFtdcDepthMarketDataField *pDepthMarketData, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - //请求查询投资者结算结果响应 - //virtual void OnRspQrySettlementInfo(CSecurityFtdcSettlementInfoField *pSettlementInfo, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - //其它 - virtual void OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRtnInstrumentStatus(CSecurityFtdcInstrumentStatusField *pInstrumentStatus); - -private: - atomic m_lRequestID; //请求ID,得保持自增 - - CSecurityFtdcRspUserLoginField m_RspUserLogin; //返回的登录成功响应,目前利用此内成员进行报单所属区分 - CSecurityFtdcInvestorField m_Investor; - - OrderIDType m_orderInsert_Id; - OrderIDType m_orderAction_Id; - - mutex m_csOrderRef; - int m_nMaxOrderRef; //报单引用,用于区分报单,保持自增 - - CSecurityFtdcTraderApi* m_pApi; //交易API - - string m_szPath; //生成配置文件的路径 - ServerInfoField m_ServerInfo; - UserInfoField m_UserInfo; - int m_nSleep; - - unordered_map m_id_platform_order; - unordered_map m_id_api_order; - unordered_map m_sysId_orderId; - - unordered_map m_id_platform_position; - - CMsgQueue* m_msgQueue; //消息队列指针 - CMsgQueue* m_msgQueue_Query; - void* m_pClass; -}; - diff --git a/QuantBox_LTS_Query_v2/main.cpp b/QuantBox_LTS_Query_v2/main.cpp deleted file mode 100644 index a10d50f..0000000 --- a/QuantBox_LTS_Query_v2/main.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "stdafx.h" -#include "../include/ApiHeader.h" -#include "../include/QueueEnum.h" -#include "QueryApi.h" - -inline CQueryApi* GetApi(void* pApi) -{ - return static_cast(pApi); -} - -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) -{ - RequestType rt = (RequestType)type; - switch (rt) - { - case GetApiType: - return (void*)(ApiType::ApiType_Query | ApiType::ApiType_Instrument); - case GetApiVersion: - return (void*)"0.1.0.20151116"; - case GetApiName: - return (void*)"LTS2"; - case Create: - return new CQueryApi(); - default: - break; - } - - if (pApi1 == nullptr) - { - return nullptr; - } - - CQueryApi* pApi = GetApi(pApi1); - - switch (rt) - { - case Release: - delete pApi; - return nullptr; - case Register: - pApi->Register(ptr1, ptr2); - break; - case Connect: - pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2); - break; - case Disconnect: - pApi->Disconnect(); - break; - case ReqQryInstrument: - pApi->ReqQryInstrument((const char*)ptr1, (const char*)ptr2); - break; - case ReqQryTradingAccount: - pApi->ReqQryTradingAccount(); - break; - case ReqQryInvestorPosition: - pApi->ReqQryInvestorPosition((const char*)ptr1, (const char*)ptr2); - break; - //case ReqQrySettlementInfo: - // pApi->ReqQrySettlementInfo((const char*)ptr1); - // break; - //case ReqOrderInsert: - // return (void*)pApi->ReqOrderInsert((OrderField*)ptr1, size1, (OrderIDType*)ptr2); - // //case ReqQuoteInsert: - // // return (void*)pApi->ReqQuoteInsert((int)double1, (OrderField*)ptr1, (OrderField*)ptr2); - //case ReqOrderAction: - // return (void*)pApi->ReqOrderAction((OrderIDType*)ptr1, size1, (OrderIDType*)ptr2); - // break; - default: - break; - } - - return pApi1; -} diff --git a/QuantBox_Queue/MsgQueue.cpp b/QuantBox_Queue/MsgQueue.cpp deleted file mode 100644 index 50df4a4..0000000 --- a/QuantBox_Queue/MsgQueue.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include "stdafx.h" -#include "MsgQueue.h" - -CMsgQueue::CMsgQueue()//:m_queue(1024) -{ - m_hThread = nullptr; - m_bRunning = false; - m_bDirectOutput = false; - - //回调函数地址指针 - m_fnOnRespone = nullptr; -} - -void CMsgQueue::Clear() -{ - ResponeItem* pItem = nullptr; - //清空队列 - while (m_queue.try_dequeue(pItem)) - { - if (pItem->bNeedDelete) - { - delete[] pItem->ptr1; - delete[] pItem->ptr2; - delete[] pItem->ptr3; - } - delete pItem; - } -} - -bool CMsgQueue::Process() -{ - ResponeItem* pItem = nullptr; - if (m_queue.try_dequeue(pItem)) - { - Output(pItem); - if (pItem->bNeedDelete) - { - // 删除的是数组,目前是自己模块创建的自己删 - delete[] pItem->ptr1; - delete[] pItem->ptr2; - delete[] pItem->ptr3; - } - delete pItem; - return true; - } - return false; -} - -void CMsgQueue::Output(ResponeItem* pItem) -{ - try - { - if (m_fnOnRespone) - (*m_fnOnRespone)(pItem->type, pItem->pApi1, pItem->pApi2, pItem->double1, pItem->double2, pItem->ptr1, pItem->size1, pItem->ptr2, pItem->size2, pItem->ptr3, pItem->size3); - } - catch (...) - { - m_fnOnRespone = nullptr; - } -} - -void CMsgQueue::StartThread() -{ - if(nullptr == m_hThread) - { - m_bRunning = true; - m_hThread = new thread(ProcessThread,this); - } -} - -void CMsgQueue::StopThread() -{ - m_bRunning = false; - this_thread::sleep_for(chrono::milliseconds(1)); - m_cv.notify_all(); - this_thread::sleep_for(chrono::milliseconds(1)); - lock_guard cl(m_mtx_del); - if(m_hThread) - { - //m_cv.notify_all(); - m_hThread->join(); - delete m_hThread; - m_hThread = nullptr; - } -} - - -void CMsgQueue::RunInThread() -{ - while (m_bRunning) - { - if (Process()) - { - } - else - { - // 空闲时等1ms,如果立即有事件过来就晚了1ms - //this_thread::sleep_for(chrono::milliseconds(1)); - - // 空闲时过来等1ms,没等到就回去再试 - // 如过正好等到了,就立即去试,应当会快一点吧? - unique_lock lck(m_mtx); - m_cv.wait_for(lck, std::chrono::seconds(1), [this]{return m_bRunning == false; }); - } - } - - // 清理线程 - m_hThread = nullptr; - m_bRunning = false; -} - -ConfigInfoField* CMsgQueue::Config(ConfigInfoField* pConfigInfo) -{ - return nullptr; -} diff --git a/QuantBox_Queue/MsgQueue.h b/QuantBox_Queue/MsgQueue.h deleted file mode 100644 index c528364..0000000 --- a/QuantBox_Queue/MsgQueue.h +++ /dev/null @@ -1,234 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include "../include/CrossPlatform.h" - -#include "../include/QueueHeader.h" -#include "../include/QueueStruct.h" -#include "../include/ApiStruct.h" - -//#include "readerwriterqueue.h" -//#include "concurrentqueue.h" -#include "ArrayLockFreeQueue.h" - - -using namespace std; -//using namespace moodycamel; - -#pragma warning(push) -#pragma warning(disable:4251) - -class DLL_PUBLIC CMsgQueue -{ -public: - bool m_bDirectOutput; - - CMsgQueue(); - virtual ~CMsgQueue() - { - StopThread(); - Clear(); - } - -public: - //清空队列 - void Clear(); - - //可以由外部发起,顺序处理队列触发回调函数 - bool Process(); - - //由内部启动线程,内部主动调用Process触发回调 - void StartThread(); - void StopThread(); - - //将外部的函数地址注册到队列 - void Register(void* pCallback,void* pClass) - { - m_fnOnRespone = (fnOnRespone)pCallback; - // 目前没啥用,只是为了与行情和交易的接口统一 - m_pClass = pClass; - } - - ConfigInfoField* Config(ConfigInfoField* pConfigInfo); - - void* new_block(int size) - { - // 下次改用内存池 - void* p = new char[size]; - if (p == nullptr) - return nullptr; - - memset(p, 0, size); - return p; - } - - void delete_block(void* p) - { - if (p != nullptr) - delete[] p; - } - - // 直接发送,不入队列 - void* Input_Output(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) - { - try - { - if (m_fnOnRespone) - return (*m_fnOnRespone)(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - } - catch (...) - { - m_fnOnRespone = nullptr; - } - return nullptr; - } - - // 对输入的数据做了一次复制,主要是为了解决转过来的指针可能失效的问题。 - // 比如说STL中的指针跨线程指向的地址就无效了。所以从map中取的OrderField等都是做了次复制 - void Input_Copy(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) - { - if (m_bDirectOutput) - { - Input_Output(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - delete_block(ptr1); - delete_block(ptr2); - delete_block(ptr3); - return; - } - ResponeItem* pItem = new ResponeItem; - memset(pItem, 0, sizeof(ResponeItem)); - pItem->bNeedDelete = true; - - pItem->type = type; - - pItem->pApi1 = pApi1; - pItem->pApi2 = pApi2; - - pItem->double1 = double1; - pItem->double2 = double2; - - if (ptr1 && size1) - { - pItem->size1 = size1; - pItem->ptr1 = new char[size1]; - memcpy(pItem->ptr1, ptr1, size1); - } - - if (ptr2 && size2) - { - pItem->size2 = size2; - pItem->ptr2 = new char[size2]; - memcpy(pItem->ptr2, ptr2, size2); - } - - if (ptr3 && size3) - { - pItem->size3 = size3; - pItem->ptr3 = new char[size3]; - memcpy(pItem->ptr3, ptr3, size3); - } - - m_queue.enqueue(pItem); - // 将Sleep改成用条件变量 - m_cv.notify_all(); - } - - // 对于过来的指针不做复制,直接使用 - // 由于是跨DLL进行操作,由另一个DLL创建的内存块交给此队列进行处理时delete可能实现有变化导致出错 - // 所以必须是由此DLL new出来的内存块交给另一DLL修改返回后,再由此DLL delete,所以提前用到new_block - void Input_NoCopy(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) - { - if (m_bDirectOutput) - { - Input_Output(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - delete_block(ptr1); - delete_block(ptr2); - delete_block(ptr3); - return; - } - ResponeItem* pItem = new ResponeItem; - pItem->bNeedDelete = true; - - pItem->type = type; - - pItem->pApi1 = pApi1; - pItem->pApi2 = pApi2; - - pItem->double1 = double1; - pItem->double2 = double2; - - pItem->ptr1 = ptr1; - pItem->size1 = size1; - pItem->ptr2 = ptr2; - pItem->size2 = size2; - pItem->ptr3 = ptr3; - pItem->size3 = size3; - - m_queue.enqueue(pItem); - // 将Sleep改成用条件变量 - m_cv.notify_all(); - } - - // 不做拷贝也不做delete,这种必须由其它DLL进行delete - void Input_NoCopy_NoDelete(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) - { - if (m_bDirectOutput) - { - Input_Output(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - return; - } - ResponeItem* pItem = new ResponeItem; - pItem->bNeedDelete = false; - - pItem->type = type; - - pItem->pApi1 = pApi1; - pItem->pApi2 = pApi2; - - pItem->double1 = double1; - pItem->double2 = double2; - - pItem->ptr1 = ptr1; - pItem->size1 = size1; - pItem->ptr2 = ptr2; - pItem->size2 = size2; - pItem->ptr3 = ptr3; - pItem->size3 = size3; - - m_queue.enqueue(pItem); - // 将Sleep改成用条件变量 - m_cv.notify_all(); - } - -protected: - virtual void RunInThread(); - virtual void Output(ResponeItem* pItem); - -private: - static void ProcessThread(CMsgQueue* lpParam) - { - if (lpParam) - lpParam->RunInThread(); - } -protected: - //volatile bool m_bRunning; - atomic_bool m_bRunning; - mutex m_mtx; - mutex m_mtx_del; - condition_variable m_cv; - thread* m_hThread; - -private: - // ConcurrentQueue m_queue; - ArrayLockFreeQueue m_queue; - - fnOnRespone m_fnOnRespone; - void* m_pClass; -}; - -#pragma warning(pop) \ No newline at end of file diff --git a/QuantBox_Queue/QuantBox_Queue.cbp b/QuantBox_Queue/QuantBox_Queue.cbp deleted file mode 100644 index a80f25b..0000000 --- a/QuantBox_Queue/QuantBox_Queue.cbp +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - diff --git a/QuantBox_Queue/QuantBox_Queue.depend b/QuantBox_Queue/QuantBox_Queue.depend deleted file mode 100644 index a0d9c64..0000000 --- a/QuantBox_Queue/QuantBox_Queue.depend +++ /dev/null @@ -1,307 +0,0 @@ -# depslib dependency file v1.0 -1413520148 source:/home/hetao/works/QuantBox_X/QuantBox_Queue/main.cpp - "MsgQueue.h" - "../include/QueueHeader.h" - "../include/ApiHeader.h" - -1413530855 /home/hetao/works/QuantBox_X/QuantBox_Queue/MsgQueue.h - - - - "../include/QueueHeader.h" - "../include/QueueStruct.h" - "readerwriterqueue.h" - -1413530528 /home/hetao/works/QuantBox_X/include/QueueHeader.h - -1409657702 /home/hetao/works/QuantBox_X/QuantBox_Queue/readerwriterqueue.h - "atomicops.h" - - - - - - - -1409657702 /home/hetao/works/QuantBox_X/QuantBox_Queue/atomicops.h - - - - - - - -1413453249 /home/hetao/works/QuantBox_X/include/ApiHeader.h - -1413453085 source:/home/hetao/works/QuantBox_X/QuantBox_Queue/MsgQueue.cpp - "MsgQueue.h" - -1413530669 /home/hetao/works/QuantBox_X/include/QueueStruct.h - -1418803816 source:/home/hetao/works/QuantBox_XAPI/QuantBox_Queue/main.cpp - "stdafx.h" - "MsgQueue.h" - "../include/QueueHeader.h" - "../include/QueueEnum.h" - "../include/QueueStruct.h" - "../include/ApiHeader.h" - -1418803759 /home/hetao/works/QuantBox_XAPI/QuantBox_Queue/MsgQueue.h - - - - - "../include/QueueHeader.h" - "../include/QueueStruct.h" - "readerwriterqueue.h" - -1418803756 /home/hetao/works/QuantBox_XAPI/include/QueueHeader.h - "../include/CrossPlatform.h" - -1418803758 /home/hetao/works/QuantBox_XAPI/include/QueueStruct.h - -1418803759 /home/hetao/works/QuantBox_XAPI/QuantBox_Queue/readerwriterqueue.h - "atomicops.h" - - - - - - - -1418803759 /home/hetao/works/QuantBox_XAPI/QuantBox_Queue/atomicops.h - - - - - - - -1418803757 /home/hetao/works/QuantBox_XAPI/include/QueueEnum.h - -1418803758 /home/hetao/works/QuantBox_XAPI/include/ApiHeader.h - "../include/CrossPlatform.h" - -1418803759 source:/home/hetao/works/QuantBox_XAPI/QuantBox_Queue/MsgQueue.cpp - "stdafx.h" - "MsgQueue.h" - -1418803759 /home/hetao/works/QuantBox_XAPI/QuantBox_Queue/stdafx.h - "targetver.h" - - -1418803759 /home/hetao/works/QuantBox_XAPI/QuantBox_Queue/targetver.h - - -1418803756 /home/hetao/works/QuantBox_XAPI/include/CrossPlatform.h - -1423400763 source:/home/mep/dev/broker/dev/QuantBox_XAPI/QuantBox_Queue/main.cpp - "stdafx.h" - "MsgQueue.h" - "../include/QueueHeader.h" - "../include/QueueEnum.h" - "../include/QueueStruct.h" - "../include/ApiHeader.h" - -1422933327 /home/mep/dev/broker/dev/QuantBox_XAPI/QuantBox_Queue/stdafx.h - "targetver.h" - - -1422933327 /home/mep/dev/broker/dev/QuantBox_XAPI/QuantBox_Queue/targetver.h - - -1423400763 /home/mep/dev/broker/dev/QuantBox_XAPI/QuantBox_Queue/MsgQueue.h - - - - - "../include/CrossPlatform.h" - "../include/QueueHeader.h" - "../include/QueueStruct.h" - "readerwriterqueue.h" - -1422933327 /home/mep/dev/broker/dev/QuantBox_XAPI/include/CrossPlatform.h - -1422933328 /home/mep/dev/broker/dev/QuantBox_XAPI/include/QueueHeader.h - "../include/CrossPlatform.h" - -1423400763 /home/mep/dev/broker/dev/QuantBox_XAPI/include/QueueStruct.h - -1422933327 /home/mep/dev/broker/dev/QuantBox_XAPI/QuantBox_Queue/readerwriterqueue.h - "atomicops.h" - - - - - - - -1422933327 /home/mep/dev/broker/dev/QuantBox_XAPI/QuantBox_Queue/atomicops.h - - - - - - - -1423106129 /home/mep/dev/broker/dev/QuantBox_XAPI/include/QueueEnum.h - -1422933327 /home/mep/dev/broker/dev/QuantBox_XAPI/include/ApiHeader.h - "../include/CrossPlatform.h" - -1423400762 source:/home/mep/dev/broker/dev/QuantBox_XAPI/QuantBox_Queue/MsgQueue.cpp - "stdafx.h" - "MsgQueue.h" - -1428715466 source:/home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_Queue/main.cpp - "stdafx.h" - "MsgQueue.h" - "../include/QueueHeader.h" - "../include/QueueEnum.h" - "../include/QueueStruct.h" - "../include/ApiHeader.h" - "../include/ApiStruct.h" - -1426762120 /home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_Queue/stdafx.h - "targetver.h" - - -1426762120 /home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_Queue/targetver.h - - -1430095642 /home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_Queue/MsgQueue.h - - - - - "../include/CrossPlatform.h" - "../include/QueueHeader.h" - "../include/QueueStruct.h" - "../include/ApiStruct.h" - "concurrentqueue.h" - -1426762121 /home/mep/dev/broker/oss/QuantBox_XAPI/include/CrossPlatform.h - -1426762122 /home/mep/dev/broker/oss/QuantBox_XAPI/include/QueueHeader.h - "../include/CrossPlatform.h" - -1426762122 /home/mep/dev/broker/oss/QuantBox_XAPI/include/QueueStruct.h - -1426762120 /home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_Queue/readerwriterqueue.h - "atomicops.h" - - - - - - - -1426762120 /home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_Queue/atomicops.h - - - - - - - -1426762573 /home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_Queue/concurrentqueue.h - "relacy/relacy_std.hpp" - "relacy_shims.h" - - - - - - - - - - - - "internal/concurrentqueue_internal_debug.h" - -1430095642 /home/mep/dev/broker/oss/QuantBox_XAPI/include/QueueEnum.h - -1426762120 /home/mep/dev/broker/oss/QuantBox_XAPI/include/ApiHeader.h - "../include/CrossPlatform.h" - -1428715466 source:/home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_Queue/MsgQueue.cpp - "stdafx.h" - "MsgQueue.h" - -1428847651 source:/home/mep/dev/broker/QuantBox_XAPI/QuantBox_Queue/main.cpp - "stdafx.h" - "MsgQueue.h" - "../include/QueueHeader.h" - "../include/QueueEnum.h" - "../include/QueueStruct.h" - "../include/ApiHeader.h" - "../include/ApiStruct.h" - -1427744516 /home/mep/dev/broker/QuantBox_XAPI/QuantBox_Queue/stdafx.h - "targetver.h" - - -1427744516 /home/mep/dev/broker/QuantBox_XAPI/QuantBox_Queue/targetver.h - - -1431172315 /home/mep/dev/broker/QuantBox_XAPI/QuantBox_Queue/MsgQueue.h - - - - - - "../include/CrossPlatform.h" - "../include/QueueHeader.h" - "../include/QueueStruct.h" - "../include/ApiStruct.h" - "concurrentqueue.h" - -1427744516 /home/mep/dev/broker/QuantBox_XAPI/include/CrossPlatform.h - -1427744517 /home/mep/dev/broker/QuantBox_XAPI/include/QueueHeader.h - "../include/CrossPlatform.h" - -1427744517 /home/mep/dev/broker/QuantBox_XAPI/include/QueueStruct.h - -1430664196 /home/mep/dev/broker/QuantBox_XAPI/include/ApiStruct.h - "ApiDataType.h" - "ApiEnum.h" - -1428847651 /home/mep/dev/broker/QuantBox_XAPI/include/ApiDataType.h - -1430664196 /home/mep/dev/broker/QuantBox_XAPI/include/ApiEnum.h - -1427744516 /home/mep/dev/broker/QuantBox_XAPI/QuantBox_Queue/concurrentqueue.h - "relacy/relacy_std.hpp" - "relacy_shims.h" - - - - - - - - - - - - "internal/concurrentqueue_internal_debug.h" - -1430046462 /home/mep/dev/broker/QuantBox_XAPI/include/QueueEnum.h - -1427744516 /home/mep/dev/broker/QuantBox_XAPI/include/ApiHeader.h - "../include/CrossPlatform.h" - -1428847651 source:/home/mep/dev/broker/QuantBox_XAPI/QuantBox_Queue/MsgQueue.cpp - "stdafx.h" - "MsgQueue.h" - -1430808448 /home/mep/dev/broker/oss/QuantBox_XAPI/include/ApiStruct.h - "ApiDataType.h" - "ApiEnum.h" - -1428715466 /home/mep/dev/broker/oss/QuantBox_XAPI/include/ApiDataType.h - -1430808448 /home/mep/dev/broker/oss/QuantBox_XAPI/include/ApiEnum.h - diff --git a/QuantBox_Queue/QuantBox_Queue.vcxproj.filters b/QuantBox_Queue/QuantBox_Queue.vcxproj.filters deleted file mode 100644 index f77e535..0000000 --- a/QuantBox_Queue/QuantBox_Queue.vcxproj.filters +++ /dev/null @@ -1,69 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {7326792e-9027-4aff-bfd3-1035b5f2d27f} - - - - - - - - Header Files - - - Header Files - - - Header Files - - - include - - - include - - - include - - - include - - - include - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/QuantBox_Queue/RemoteQueue.cpp b/QuantBox_Queue/RemoteQueue.cpp deleted file mode 100644 index 83456d0..0000000 --- a/QuantBox_Queue/RemoteQueue.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "stdafx.h" -#include "RemoteQueue.h" - - -CRemoteQueue::CRemoteQueue(char* address) :CMsgQueue() -{ - m_pubisher = nullptr; - - strncpy(m_Address, address, sizeof(m_Address)); -#ifdef _REMOTE - m_ctx = nullptr; -#endif -} - - -CRemoteQueue::~CRemoteQueue() -{ -} - - -void CRemoteQueue::RunInThread() -{ -#ifdef _REMOTE - m_ctx = zctx_new(); - m_pubisher = zsocket_new(m_ctx, ZMQ_PUB); - int port = zsocket_bind(m_pubisher, m_Address); -#endif - - while (m_bRunning) - { - if (Process()) - { - } - else - { - // ʱ1ms,¼1ms - //this_thread::sleep_for(chrono::milliseconds(1)); - - // ʱ1ms,ûȵͻȥ - // õȵˣȥԣӦһ? - unique_lock lck(m_mtx); - m_cv.wait_for(lck, std::chrono::seconds(1)); - } - } - -#ifdef _REMOTE - if (m_ctx) - { - zctx_destroy(&m_ctx); - m_ctx = nullptr; - } -#endif - // ߳ - m_hThread = nullptr; - m_bRunning = false; -} - -void CRemoteQueue::Output(ResponeItem* pItem) -{ -#ifdef _REMOTE - // - if (pItem->ptr1 && pItem->size1>0) - { - int ret = zsocket_sendmem(m_pubisher, pItem->ptr1, pItem->size1, ZFRAME_DONTWAIT); - } -#endif - return; -} \ No newline at end of file diff --git a/QuantBox_Queue/RemoteQueue.h b/QuantBox_Queue/RemoteQueue.h deleted file mode 100644 index 759288a..0000000 --- a/QuantBox_Queue/RemoteQueue.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once -#include "MsgQueue.h" - -// ҪzmqczmqĿ¼Additional Include Directories -#ifdef _REMOTE -#include "zmq.h" -#include "czmq.h" - -#ifdef _WIN64 -#else -#pragma comment(lib, "../include/ZeroMQ/x86/czmq.lib") -#endif - -#endif - - - -class DLL_PUBLIC CRemoteQueue : - public CMsgQueue -{ -public: - CRemoteQueue(char* address); - ~CRemoteQueue(); - -protected: - virtual void RunInThread(); - virtual void Output(ResponeItem* pItem); - -private: - - void* m_pubisher; - - char m_Address[1024]; -#ifdef _REMOTE - zctx_t* m_ctx; -#endif -}; - diff --git a/QuantBox_Queue/atomicops.h b/QuantBox_Queue/atomicops.h deleted file mode 100644 index aadd472..0000000 --- a/QuantBox_Queue/atomicops.h +++ /dev/null @@ -1,276 +0,0 @@ -// ©2013 Cameron Desrochers. -// Distributed under the simplified BSD license (see the license file that -// should have come with this header). - -#pragma once - -// Provides portable (VC++2010+, Intel ICC 13, GCC 4.7+, and anything C++11 compliant) implementation -// of low-level memory barriers, plus a few semi-portable utility macros (for inlining and alignment). -// Also has a basic atomic type (limited to hardware-supported atomics with no memory ordering guarantees). -// Uses the AE_* prefix for macros (historical reasons), and the "moodycamel" namespace for symbols. - -#include - - -// Platform detection -#if defined(__INTEL_COMPILER) -#define AE_ICC -#elif defined(_MSC_VER) -#define AE_VCPP -#elif defined(__GNUC__) -#define AE_GCC -#endif - -#if defined(_M_IA64) || defined(__ia64__) -#define AE_ARCH_IA64 -#elif defined(_WIN64) || defined(__amd64__) || defined(_M_X64) || defined(__x86_64__) -#define AE_ARCH_X64 -#elif defined(_M_IX86) || defined(__i386__) -#define AE_ARCH_X86 -#elif defined(_M_PPC) || defined(__powerpc__) -#define AE_ARCH_PPC -#else -#define AE_ARCH_UNKNOWN -#endif - - -// AE_UNUSED -#define AE_UNUSED(x) ((void)x) - - -// AE_FORCEINLINE -#if defined(AE_VCPP) || defined(AE_ICC) -#define AE_FORCEINLINE __forceinline -#elif defined(AE_GCC) -//#define AE_FORCEINLINE __attribute__((always_inline)) -#define AE_FORCEINLINE inline -#else -#define AE_FORCEINLINE inline -#endif - - -// AE_ALIGN -#if defined(AE_VCPP) || defined(AE_ICC) -#define AE_ALIGN(x) __declspec(align(x)) -#elif defined(AE_GCC) -#define AE_ALIGN(x) __attribute__((aligned(x))) -#else -// Assume GCC compliant syntax... -#define AE_ALIGN(x) __attribute__((aligned(x))) -#endif - - -// Portable atomic fences implemented below: - -namespace moodycamel { - -enum memory_order { - memory_order_relaxed, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, - - // memory_order_sync: Forces a full sync: - // #LoadLoad, #LoadStore, #StoreStore, and most significantly, #StoreLoad - memory_order_sync = memory_order_seq_cst -}; - -} // end namespace moodycamel - -#if defined(AE_VCPP) || defined(AE_ICC) -// VS2010 and ICC13 don't support std::atomic_*_fence, implement our own fences - -#include - -#if defined(AE_ARCH_X64) || defined(AE_ARCH_X86) -#define AeFullSync _mm_mfence -#define AeLiteSync _mm_mfence -#elif defined(AE_ARCH_IA64) -#define AeFullSync __mf -#define AeLiteSync __mf -#elif defined(AE_ARCH_PPC) -#include -#define AeFullSync __sync -#define AeLiteSync __lwsync -#endif - - -#ifdef AE_VCPP -#pragma warning(push) -#pragma warning(disable: 4365) // Disable erroneous 'conversion from long to unsigned int, signed/unsigned mismatch' error when using `assert` -#endif - -namespace moodycamel { - -AE_FORCEINLINE void compiler_fence(memory_order order) -{ - switch (order) { - case memory_order_relaxed: break; - case memory_order_acquire: _ReadBarrier(); break; - case memory_order_release: _WriteBarrier(); break; - case memory_order_acq_rel: _ReadWriteBarrier(); break; - case memory_order_seq_cst: _ReadWriteBarrier(); break; - default: assert(false); - } -} - -// x86/x64 have a strong memory model -- all loads and stores have -// acquire and release semantics automatically (so only need compiler -// barriers for those). -#if defined(AE_ARCH_X86) || defined(AE_ARCH_X64) -AE_FORCEINLINE void fence(memory_order order) -{ - switch (order) { - case memory_order_relaxed: break; - case memory_order_acquire: _ReadBarrier(); break; - case memory_order_release: _WriteBarrier(); break; - case memory_order_acq_rel: _ReadWriteBarrier(); break; - case memory_order_seq_cst: - _ReadWriteBarrier(); - AeFullSync(); - _ReadWriteBarrier(); - break; - default: assert(false); - } -} -#else -AE_FORCEINLINE void fence(memory_order order) -{ - // Non-specialized arch, use heavier memory barriers everywhere just in case :-( - switch (order) { - case memory_order_relaxed: - break; - case memory_order_acquire: - _ReadBarrier(); - AeLiteSync(); - _ReadBarrier(); - break; - case memory_order_release: - _WriteBarrier(); - AeLiteSync(); - _WriteBarrier(); - break; - case memory_order_acq_rel: - _ReadWriteBarrier(); - AeLiteSync(); - _ReadWriteBarrier(); - break; - case memory_order_seq_cst: - _ReadWriteBarrier(); - AeFullSync(); - _ReadWriteBarrier(); - break; - default: assert(false); - } -} -#endif -} // end namespace moodycamel -#else -// Use standard library of atomics -#include - -namespace moodycamel { - -AE_FORCEINLINE void compiler_fence(memory_order order) -{ - switch (order) { - case memory_order_relaxed: break; - case memory_order_acquire: std::atomic_signal_fence(std::memory_order_acquire); break; - case memory_order_release: std::atomic_signal_fence(std::memory_order_release); break; - case memory_order_acq_rel: std::atomic_signal_fence(std::memory_order_acq_rel); break; - case memory_order_seq_cst: std::atomic_signal_fence(std::memory_order_seq_cst); break; - default: assert(false); - } -} - -AE_FORCEINLINE void fence(memory_order order) -{ - switch (order) { - case memory_order_relaxed: break; - case memory_order_acquire: std::atomic_thread_fence(std::memory_order_acquire); break; - case memory_order_release: std::atomic_thread_fence(std::memory_order_release); break; - case memory_order_acq_rel: std::atomic_thread_fence(std::memory_order_acq_rel); break; - case memory_order_seq_cst: std::atomic_thread_fence(std::memory_order_seq_cst); break; - default: assert(false); - } -} - -} // end namespace moodycamel - -#endif - - - - -#if !defined(AE_VCPP) || _MSC_VER >= 1700 -#define AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC -#endif - -#ifdef AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC -#include -#endif -#include - -// WARNING: *NOT* A REPLACEMENT FOR std::atomic. READ CAREFULLY: -// Provides basic support for atomic variables -- no memory ordering guarantees are provided. -// The guarantee of atomicity is only made for types that already have atomic load and store guarantees -// at the hardware level -- on most platforms this generally means aligned pointers and integers (only). -namespace moodycamel { -template -class weak_atomic -{ -public: - weak_atomic() { } -#ifdef AE_VCPP -#pragma warning(disable: 4100) // Get rid of (erroneous) 'unreferenced formal parameter' warning -#endif - template weak_atomic(U&& x) : value(std::forward(x)) { } - weak_atomic(weak_atomic const& other) : value(other.value) { } - weak_atomic(weak_atomic&& other) : value(std::move(other.value)) { } -#ifdef AE_VCPP -#pragma warning(default: 4100) -#endif - - AE_FORCEINLINE operator T() const { return load(); } - - -#ifndef AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC - template AE_FORCEINLINE weak_atomic const& operator=(U&& x) { value = std::forward(x); return *this; } - AE_FORCEINLINE weak_atomic const& operator=(weak_atomic const& other) { value = other.value; return *this; } - - AE_FORCEINLINE T load() const { return value; } -#else - template - AE_FORCEINLINE weak_atomic const& operator=(U&& x) - { - value.store(std::forward(x), std::memory_order_relaxed); - return *this; - } - - AE_FORCEINLINE weak_atomic const& operator=(weak_atomic const& other) - { - value.store(other.value.load(std::memory_order_relaxed), std::memory_order_relaxed); - return *this; - } - - AE_FORCEINLINE T load() const { return value.load(std::memory_order_relaxed); } -#endif - - -private: -#ifndef AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC - // No std::atomic support, but still need to circumvent compiler optimizations. - // `volatile` will make memory access slow, but is guaranteed to be reliable. - volatile T value; -#else - std::atomic value; -#endif -}; - -} // end namespace moodycamel - - -#ifdef AE_VCPP -#pragma warning(pop) -#endif diff --git a/QuantBox_Queue/concurrentqueue.h b/QuantBox_Queue/concurrentqueue.h deleted file mode 100644 index 800ba75..0000000 --- a/QuantBox_Queue/concurrentqueue.h +++ /dev/null @@ -1,3479 +0,0 @@ -// Provides a C++11 implementation of a multi-producer, multi-consumer lock-free queue. -// An overview, including benchmark results, is provided here: -// http://moodycamel.com/blog/2014/a-fast-general-purpose-lock-free-queue-for-c++ -// The full design is also described in excruciating detail at: -// http://moodycamel.com/blog/2014/detailed-design-of-a-lock-free-queue - - -// Simplified BSD license: -// Copyright (c) 2013-2015, Cameron Desrochers. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, this list of -// conditions and the following disclaimer in the documentation and/or other materials -// provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -// TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#pragma once - -#if defined(__GNUC__) -// Disable -Wconversion warnings (spuriously triggered when Traits::size_t and -// Traits::index_t are set to < 32 bits, causing integer promotion, causing warnings -// upon assigning any computed values) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" - -#ifdef MCDBGQ_USE_RELACY -#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" -#endif -#endif - -#ifdef MCDBGQ_USE_RELACY -#include "relacy/relacy_std.hpp" -#include "relacy_shims.h" -// We only use malloc/free anyway, and the delete macro messes up `= delete` method declarations. -// We'll override the default trait malloc ourselves without a macro. -#undef new -#undef delete -#undef malloc -#undef free -#else -#include // Requires C++11. Sorry VS2010. -#include -#endif -#include -#include -#include -#include -#include -#include -#include // for CHAR_BIT -#include -#include // for __WINPTHREADS_VERSION if on MinGW-w64 w/ POSIX threading - -// Platform-specific definitions of a numeric thread ID type and an invalid value -#if defined(MCDBGQ_USE_RELACY) -namespace moodycamel { namespace details { - typedef std::uint32_t thread_id_t; - static const thread_id_t invalid_thread_id = 0xFFFFFFFFU; - static const thread_id_t invalid_thread_id2 = 0xFFFFFFFEU; - static inline thread_id_t thread_id() { return rl::thread_index(); } -} } -#elif defined(_WIN32) || defined(__WINDOWS__) || defined(__WIN32__) -// No sense pulling in windows.h in a header, we'll manually declare the function -// we use and rely on backwards-compatibility for this not to break -extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(void); -namespace moodycamel { namespace details { - static_assert(sizeof(unsigned long) == sizeof(std::uint32_t), "Expected size of unsigned long to be 32 bits on Windows"); - typedef std::uint32_t thread_id_t; - static const thread_id_t invalid_thread_id = 0; // See http://blogs.msdn.com/b/oldnewthing/archive/2004/02/23/78395.aspx - static const thread_id_t invalid_thread_id2 = 0xFFFFFFFFU; // Not technically guaranteed to be invalid, but is never used in practice. Note that all Win32 thread IDs are presently multiples of 4. - static inline thread_id_t thread_id() { return static_cast(::GetCurrentThreadId()); } -} } -#else -// Use a nice trick from this answer: http://stackoverflow.com/a/8438730/21475 -// In order to get a numeric thread ID in a platform-independent way, we use a thread-local -// static variable's address as a thread identifier :-) -#if defined(__GNUC__) || defined(__INTEL_COMPILER) -#define MOODYCAMEL_THREADLOCAL __thread -#elif defined(_MSC_VER) -#define MOODYCAMEL_THREADLOCAL __declspec(thread) -#else -// Assume C++11 compliant compiler -#define MOODYCAMEL_THREADLOCAL thread_local -#endif -namespace moodycamel { namespace details { - typedef std::uintptr_t thread_id_t; - static const thread_id_t invalid_thread_id = 0; // Address can't be nullptr - static const thread_id_t invalid_thread_id2 = 1; // Member accesses off a null pointer are also generally invalid. Plus it's not aligned. - static inline thread_id_t thread_id() { static MOODYCAMEL_THREADLOCAL int x; return reinterpret_cast(&x); } -} } -#endif - -// Exceptions -#ifndef MOODYCAMEL_EXCEPTIONS_ENABLED -#if (defined(_MSC_VER) && defined(_CPPUNWIND)) || (defined(__GNUC__) && defined(__EXCEPTIONS)) || (!defined(_MSC_VER) && !defined(__GNUC__)) -#define MOODYCAMEL_EXCEPTIONS_ENABLED -#define MOODYCAMEL_TRY try -#define MOODYCAMEL_CATCH(...) catch(__VA_ARGS__) -#define MOODYCAMEL_RETHROW throw -#else -#define MOODYCAMEL_TRY if (true) -#define MOODYCAMEL_CATCH(...) else if (false) -#define MOODYCAMEL_RETHROW -#endif -#endif - -#ifndef MOODYCAMEL_NOEXCEPT -#if !defined(MOODYCAMEL_EXCEPTIONS_ENABLED) -#define MOODYCAMEL_NOEXCEPT -#define MOODYCAMEL_NOEXCEPT_CTOR(type, valueType, expr) true -#define MOODYCAMEL_NOEXCEPT_ASSIGN(type, valueType, expr) true -#elif defined(_MSC_VER) && defined(_NOEXCEPT) && _MSC_VER < 1900 -#define MOODYCAMEL_NOEXCEPT _NOEXCEPT -#define MOODYCAMEL_NOEXCEPT_CTOR(type, valueType, expr) (std::is_rvalue_reference::value && std::is_move_constructible::value ? std::is_trivially_move_constructible::value || std::is_nothrow_move_constructible::value : std::is_trivially_copy_constructible::value || std::is_nothrow_copy_constructible::value) -#define MOODYCAMEL_NOEXCEPT_ASSIGN(type, valueType, expr) ((std::is_rvalue_reference::value && std::is_move_assignable::value ? std::is_trivially_move_assignable::value || std::is_nothrow_move_assignable::value : std::is_trivially_copy_assignable::value || std::is_nothrow_copy_assignable::value) && MOODYCAMEL_NOEXCEPT_CTOR(type, valueType, expr)) -#else -#define MOODYCAMEL_NOEXCEPT noexcept -#define MOODYCAMEL_NOEXCEPT_CTOR(type, valueType, expr) noexcept(expr) -#define MOODYCAMEL_NOEXCEPT_ASSIGN(type, valueType, expr) noexcept(expr) -#endif -#endif - -#ifndef MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED -#ifdef MCDBGQ_USE_RELACY -#define MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED -#else -//// VS2013 doesn't support `thread_local`, and MinGW-w64 w/ POSIX threading has a crippling bug: http://sourceforge.net/p/mingw-w64/bugs/445 -//// g++ <=4.7 doesn't support thread_local either -//#if (!defined(_MSC_VER) || _MSC_VER >= 1900) && (!defined(__MINGW32__) && !defined(__MINGW64__) || !defined(__WINPTHREADS_VERSION)) && (!defined(__GNUC__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) -//// Assume `thread_local` is fully supported in all other C++11 compilers/runtimes -//#define MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED -//#endif -#endif -#endif - -// Compiler-specific likely/unlikely hints -namespace moodycamel { namespace details { -#if defined(__GNUC__) - inline bool likely(bool x) { return __builtin_expect((x), true); } - inline bool unlikely(bool x) { return __builtin_expect((x), false); } -#else - inline bool likely(bool x) { return x; } - inline bool unlikely(bool x) { return x; } -#endif -} } - -#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG -#include "internal/concurrentqueue_internal_debug.h" -#endif - -namespace moodycamel { -namespace details { - template - struct const_numeric_max { - static_assert(std::is_integral::value, "const_numeric_max can only be used with integers"); - static const T value = std::numeric_limits::is_signed - ? (static_cast(1) << (sizeof(T) * CHAR_BIT - 1)) - static_cast(1) - : static_cast(-1); - }; -} - -// Default traits for the ConcurrentQueue. To change some of the -// traits without re-implementing all of them, inherit from this -// struct and shadow the declarations you wish to be different; -// since the traits are used as a template type parameter, the -// shadowed declarations will be used where defined, and the defaults -// otherwise. -struct ConcurrentQueueDefaultTraits -{ - // General-purpose size type. std::size_t is strongly recommended. - typedef std::size_t size_t; - - // The type used for the enqueue and dequeue indices. Must be at least as - // large as size_t. Should be significantly larger than the number of elements - // you expect to hold at once, especially if you have a high turnover rate; - // for example, on 32-bit x86, if you expect to have over a hundred million - // elements or pump several million elements through your queue in a very - // short space of time, using a 32-bit type *may* trigger a race condition. - // A 64-bit int type is recommended in that case, and in practice will - // prevent a race condition no matter the usage of the queue. Note that - // whether the queue is lock-free with a 64-int type depends on the whether - // std::atomic is lock-free, which is platform-specific. - typedef std::size_t index_t; - - // Internally, all elements are enqueued and dequeued from multi-element - // blocks; this is the smallest controllable unit. If you expect few elements - // but many producers, a smaller block size should be favoured. For few producers - // and/or many elements, a larger block size is preferred. A sane default - // is provided. Must be a power of 2. - static const size_t BLOCK_SIZE = 32; - - // For explicit producers (i.e. when using a producer token), the block is - // checked for being empty by iterating through a list of flags, one per element. - // For large block sizes, this is too inefficient, and switching to an atomic - // counter-based approach is faster. The switch is made for block sizes strictly - // larger than this threshold. - static const size_t EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD = 32; - - // How many full blocks can be expected for a single explicit producer? This should - // reflect that number's maximum for optimal performance. Must be a power of 2. - static const size_t EXPLICIT_INITIAL_INDEX_SIZE = 32; - - // How many full blocks can be expected for a single implicit producer? This should - // reflect that number's maximum for optimal performance. Must be a power of 2. - static const size_t IMPLICIT_INITIAL_INDEX_SIZE = 32; - - // The initial size of the hash table mapping thread IDs to implicit producers. - // Note that the hash is resized every time it becomes half full. - // Must be a power of two, and either 0 or at least 1. If 0, implicit production - // (using the enqueue methods without an explicit producer token) is disabled. - static const size_t INITIAL_IMPLICIT_PRODUCER_HASH_SIZE = 32; - - // Controls the number of items that an explicit consumer (i.e. one with a token) - // must consume before it causes all consumers to rotate and move on to the next - // internal queue. - static const std::uint32_t EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE = 256; - - // The maximum number of elements (inclusive) that can be enqueued to a sub-queue. - // Enqueue operations that would cause this limit to be surpassed will fail. Note - // that this limit is enforced at the block level (for performance reasons), i.e. - // it's rounded up to the nearest block size. - static const size_t MAX_SUBQUEUE_SIZE = details::const_numeric_max::value; - - -#ifndef MCDBGQ_USE_RELACY - // Memory allocation can be customized if needed. - // malloc should return nullptr on failure, and handle alignment like std::malloc. - static inline void* malloc(size_t size) { return std::malloc(size); } - static inline void free(void* ptr) { return std::free(ptr); } -#else - // Debug versions when running under the Relacy race detector (ignore - // these in user code) - static inline void* malloc(size_t size) { return rl::rl_malloc(size, $); } - static inline void free(void* ptr) { return rl::rl_free(ptr, $); } -#endif -}; - - -// When producing or consuming many elements, the most efficient way is to: -// 1) Use one of the bulk-operation methods of the queue with a token -// 2) Failing that, use the bulk-operation methods without a token -// 3) Failing that, create a token and use that with the single-item methods -// 4) Failing that, use the single-parameter methods of the queue -// Having said that, don't create tokens willy-nilly -- ideally there should be -// a maximum of one token per thread (of each kind). -struct ProducerToken; -struct ConsumerToken; - -template class ConcurrentQueue; -class ConcurrentQueueTests; - - -namespace details -{ - struct ConcurrentQueueProducerTypelessBase - { - ConcurrentQueueProducerTypelessBase* next; - std::atomic inactive; - ProducerToken* token; - - ConcurrentQueueProducerTypelessBase() - : inactive(false), token(nullptr) - { - } - }; - - template struct _hash_32_or_64 { - static inline std::uint32_t hash(std::uint32_t h) - { - // MurmurHash3 finalizer -- see https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp - // Since the thread ID is already unique, all we really want to do is propagate that - // uniqueness evenly across all the bits, so that we can use a subset of the bits while - // reducing collisions significantly - h ^= h >> 16; - h *= 0x85ebca6b; - h ^= h >> 13; - h *= 0xc2b2ae35; - return h ^ (h >> 16); - } - }; - template<> struct _hash_32_or_64<1> { - static inline std::uint64_t hash(std::uint64_t h) - { - h ^= h >> 33; - h *= 0xff51afd7ed558ccd; - h ^= h >> 33; - h *= 0xc4ceb9fe1a85ec53; - return h ^ (h >> 33); - } - }; - template struct hash_32_or_64 : public _hash_32_or_64<(size > 4)> { }; - - static inline size_t hash_thread_id(thread_id_t id) - { - static_assert(sizeof(thread_id_t) <= 8, "Expected a platform where thread IDs are at most 64-bit values"); - return static_cast(hash_32_or_64::hash(id)); - } - - template - static inline bool circular_less_than(T a, T b) - { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4554) -#endif - static_assert(std::is_integral::value && !std::numeric_limits::is_signed, "circular_less_than is intended to be used only with unsigned integer types"); - return static_cast(a - b) > static_cast(static_cast(1) << static_cast(sizeof(T) * CHAR_BIT - 1)); -#ifdef _MSC_VER -#pragma warning(pop) -#endif - } - - template - static inline char* align_for(char* ptr) - { - const std::size_t alignment = std::alignment_of::value; - return ptr + (alignment - (reinterpret_cast(ptr) % alignment)) % alignment; - } - - template - static inline T ceil_to_pow_2(T x) - { - static_assert(std::is_integral::value && !std::numeric_limits::is_signed, "ceil_to_pow_2 is intended to be used only with unsigned integer types"); - - // Adapted from http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 - --x; - x |= x >> 1; - x |= x >> 2; - x |= x >> 4; - for (std::size_t i = 1; i < sizeof(T); i <<= 1) { - x |= x >> (i << 3); - } - ++x; - return x; - } - - template - static inline void swap_relaxed(std::atomic& left, std::atomic& right) - { - T temp = std::move(left.load(std::memory_order_relaxed)); - left.store(std::move(right.load(std::memory_order_relaxed)), std::memory_order_relaxed); - right.store(std::move(temp), std::memory_order_relaxed); - } - - template - static inline T const& nomove(T const& x) - { - return x; - } - - template - struct nomove_if - { - template - static inline T const& eval(T const& x) - { - return x; - } - }; - - template<> - struct nomove_if - { - template - static inline auto eval(U&& x) - -> decltype(std::forward(x)) - { - return std::forward(x); - } - }; - - template - static inline auto deref_noexcept(It& it) MOODYCAMEL_NOEXCEPT -> decltype(*it) - { - return *it; - } - -#if defined(APPLE) || !defined(GNUC) || GNUC > 4 || (GNUC == 4 && GNUC_MINOR >= 8) || (clang_major == 3 && clang_minor>=4) - template struct is_trivially_destructible : std::is_trivially_destructible { }; -#else - template struct is_trivially_destructible : std::has_trivial_destructor { }; -#endif - -#ifdef MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED -#ifdef MCDBGQ_USE_RELACY - typedef RelacyThreadExitListener ThreadExitListener; - typedef RelacyThreadExitNotifier ThreadExitNotifier; -#else - struct ThreadExitListener - { - typedef void (*callback_t)(void*); - callback_t callback; - void* userData; - - ThreadExitListener* next; // reserved for use by the ThreadExitNotifier - }; - - - class ThreadExitNotifier - { - public: - static void subscribe(ThreadExitListener* listener) - { - auto& tlsInst = instance(); - listener->next = tlsInst.tail; - tlsInst.tail = listener; - } - - static void unsubscribe(ThreadExitListener* listener) - { - auto& tlsInst = instance(); - ThreadExitListener** prev = &tlsInst.tail; - for (auto ptr = tlsInst.tail; ptr != nullptr; ptr = ptr->next) { - if (ptr == listener) { - *prev = ptr->next; - break; - } - prev = &ptr->next; - } - } - - private: - ThreadExitNotifier() : tail(nullptr) { } - ThreadExitNotifier(ThreadExitNotifier const&) = delete; - ThreadExitNotifier& operator=(ThreadExitNotifier const&) = delete; - - ~ThreadExitNotifier() - { - // This thread is about to exit, let everyone know! - assert(this == &instance() && "If this assert fails, you likely have a buggy compiler! Change the preprocessor conditions such that MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED is no longer defined."); - for (auto ptr = tail; ptr != nullptr; ptr = ptr->next) { - ptr->callback(ptr->userData); - } - } - - // Thread-local - static inline ThreadExitNotifier& instance() - { - static thread_local ThreadExitNotifier notifier; - return notifier; - } - - private: - ThreadExitListener* tail; - }; -#endif -#endif - - template struct static_is_lock_free_num { enum { value = 0 }; }; - template<> struct static_is_lock_free_num { enum { value = ATOMIC_CHAR_LOCK_FREE }; }; - template<> struct static_is_lock_free_num { enum { value = ATOMIC_SHORT_LOCK_FREE }; }; - template<> struct static_is_lock_free_num { enum { value = ATOMIC_INT_LOCK_FREE }; }; - template<> struct static_is_lock_free_num { enum { value = ATOMIC_LONG_LOCK_FREE }; }; - template<> struct static_is_lock_free_num { enum { value = ATOMIC_LLONG_LOCK_FREE }; }; - template struct static_is_lock_free : static_is_lock_free_num::type> { }; - template<> struct static_is_lock_free { enum { value = ATOMIC_BOOL_LOCK_FREE }; }; - template struct static_is_lock_free { enum { value = ATOMIC_POINTER_LOCK_FREE }; }; -} - - -struct ProducerToken -{ - template - explicit ProducerToken(ConcurrentQueue& queue); - - explicit ProducerToken(ProducerToken&& other) MOODYCAMEL_NOEXCEPT - : producer(other.producer) - { - other.producer = nullptr; - if (producer != nullptr) { - producer->token = this; - } - } - - inline ProducerToken& operator=(ProducerToken&& other) MOODYCAMEL_NOEXCEPT - { - swap(other); - return *this; - } - - void swap(ProducerToken& other) MOODYCAMEL_NOEXCEPT - { - std::swap(producer, other.producer); - if (producer != nullptr) { - producer->token = this; - } - if (other.producer != nullptr) { - other.producer->token = &other; - } - } - - // A token is always valid unless: - // 1) Memory allocation failed during construction - // 2) It was moved via the move constructor - // (Note: assignment does a swap, leaving both potentially valid) - // 3) The associated queue was destroyed - // Note that if valid() returns true, that only indicates - // that the token is valid for use with a specific queue, - // but not which one; that's up to the user to track. - inline bool valid() const { return producer != nullptr; } - - ~ProducerToken() - { - if (producer != nullptr) { - producer->token = nullptr; - producer->inactive.store(true, std::memory_order_release); - } - } - - // Disable copying and assignment - ProducerToken(ProducerToken const&) = delete; - ProducerToken& operator=(ProducerToken const&) = delete; - -private: - template friend class ConcurrentQueue; - friend class ConcurrentQueueTests; - -protected: - details::ConcurrentQueueProducerTypelessBase* producer; -}; - - -struct ConsumerToken -{ - template - explicit ConsumerToken(ConcurrentQueue& q); - - explicit ConsumerToken(ConsumerToken&& other) MOODYCAMEL_NOEXCEPT - : initialOffset(other.initialOffset), lastKnownGlobalOffset(other.lastKnownGlobalOffset), itemsConsumedFromCurrent(other.itemsConsumedFromCurrent), currentProducer(other.currentProducer), desiredProducer(other.desiredProducer) - { - } - - inline ConsumerToken& operator=(ConsumerToken&& other) MOODYCAMEL_NOEXCEPT - { - swap(other); - return *this; - } - - void swap(ConsumerToken& other) MOODYCAMEL_NOEXCEPT - { - std::swap(initialOffset, other.initialOffset); - std::swap(lastKnownGlobalOffset, other.lastKnownGlobalOffset); - std::swap(itemsConsumedFromCurrent, other.itemsConsumedFromCurrent); - std::swap(currentProducer, other.currentProducer); - std::swap(desiredProducer, other.desiredProducer); - } - - // Disable copying and assignment - ConsumerToken(ConsumerToken const&) = delete; - ConsumerToken& operator=(ConsumerToken const&) = delete; - -private: - template friend class ConcurrentQueue; - friend class ConcurrentQueueTests; - -private: // but shared with ConcurrentQueue - std::uint32_t initialOffset; - std::uint32_t lastKnownGlobalOffset; - std::uint32_t itemsConsumedFromCurrent; - details::ConcurrentQueueProducerTypelessBase* currentProducer; - details::ConcurrentQueueProducerTypelessBase* desiredProducer; -}; - -// Need to forward-declare this swap because it's in a namespace. -// See http://stackoverflow.com/questions/4492062/why-does-a-c-friend-class-need-a-forward-declaration-only-in-other-namespaces -template -inline void swap(typename ConcurrentQueue::ImplicitProducerKVP& a, typename ConcurrentQueue::ImplicitProducerKVP& b) MOODYCAMEL_NOEXCEPT; - - -template -class ConcurrentQueue -{ -public: - typedef ::moodycamel::ProducerToken producer_token_t; - typedef ::moodycamel::ConsumerToken consumer_token_t; - - typedef typename Traits::index_t index_t; - typedef typename Traits::size_t size_t; - - static const size_t BLOCK_SIZE = static_cast(Traits::BLOCK_SIZE); - static const size_t EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD = static_cast(Traits::EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD); - static const size_t EXPLICIT_INITIAL_INDEX_SIZE = static_cast(Traits::EXPLICIT_INITIAL_INDEX_SIZE); - static const size_t IMPLICIT_INITIAL_INDEX_SIZE = static_cast(Traits::IMPLICIT_INITIAL_INDEX_SIZE); - static const size_t INITIAL_IMPLICIT_PRODUCER_HASH_SIZE = static_cast(Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE); - static const std::uint32_t EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE = static_cast(Traits::EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE); -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4307) // + integral constant overflow (that's what the ternary expression is for!) -#pragma warning(disable: 4309) // static_cast: Truncation of constant value -#endif - static const size_t MAX_SUBQUEUE_SIZE = (details::const_numeric_max::value - static_cast(Traits::MAX_SUBQUEUE_SIZE) < BLOCK_SIZE) ? details::const_numeric_max::value : ((static_cast(Traits::MAX_SUBQUEUE_SIZE) + (BLOCK_SIZE - 1)) / BLOCK_SIZE * BLOCK_SIZE); -#ifdef _MSC_VER -#pragma warning(pop) -#endif - - static_assert(!std::numeric_limits::is_signed && std::is_integral::value, "Traits::size_t must be an unsigned integral type"); - static_assert(!std::numeric_limits::is_signed && std::is_integral::value, "Traits::index_t must be an unsigned integral type"); - static_assert(sizeof(index_t) >= sizeof(size_t), "Traits::index_t must be at least as wide as Traits::size_t"); - static_assert((BLOCK_SIZE > 1) && !(BLOCK_SIZE & (BLOCK_SIZE - 1)), "Traits::BLOCK_SIZE must be a power of 2 (and at least 2)"); - static_assert((EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD > 1) && !(EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD & (EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD - 1)), "Traits::EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD must be a power of 2 (and greater than 1)"); - static_assert((EXPLICIT_INITIAL_INDEX_SIZE > 1) && !(EXPLICIT_INITIAL_INDEX_SIZE & (EXPLICIT_INITIAL_INDEX_SIZE - 1)), "Traits::EXPLICIT_INITIAL_INDEX_SIZE must be a power of 2 (and greater than 1)"); - static_assert((IMPLICIT_INITIAL_INDEX_SIZE > 1) && !(IMPLICIT_INITIAL_INDEX_SIZE & (IMPLICIT_INITIAL_INDEX_SIZE - 1)), "Traits::IMPLICIT_INITIAL_INDEX_SIZE must be a power of 2 (and greater than 1)"); - static_assert((INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) || !(INITIAL_IMPLICIT_PRODUCER_HASH_SIZE & (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE - 1)), "Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE must be a power of 2"); - static_assert(INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0 || INITIAL_IMPLICIT_PRODUCER_HASH_SIZE >= 1, "Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE must be at least 1 (or 0 to disable implicit enqueueing)"); - -public: - // Creates a queue with at least `capacity` element slots; note that the - // actual number of elements that can be inserted without additional memory - // allocation depends on the number of producers and the block size (e.g. if - // the block size is equal to `capacity`, only a single block will be allocated - // up-front, which means only a single producer will be able to enqueue elements - // without an extra allocation -- blocks aren't shared between producers). - // This method is not thread safe -- it is up to the user to ensure that the - // queue is fully constructed before it starts being used by other threads (this - // includes making the memory effects of construction visible, possibly with a - // memory barrier). - explicit ConcurrentQueue(size_t capacity = 6 * BLOCK_SIZE) - : producerListTail(nullptr), - producerCount(0), - initialBlockPoolIndex(0), - nextExplicitConsumerId(0), - globalExplicitConsumerOffset(0) - { - implicitProducerHashResizeInProgress.clear(std::memory_order_relaxed); - populate_initial_implicit_producer_hash(); - populate_initial_block_list(capacity / BLOCK_SIZE + ((capacity & (BLOCK_SIZE - 1)) == 0 ? 0 : 1)); - -#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG - // Track all the producers using a fully-resolved typed list for - // each kind; this makes it possible to debug them starting from - // the root queue object (otherwise wacky casts are needed that - // don't compile in the debugger's expression evaluator). - explicitProducers.store(nullptr, std::memory_order_relaxed); - implicitProducers.store(nullptr, std::memory_order_relaxed); -#endif - } - - // Note: The queue should not be accessed concurrently while it's - // being deleted. It's up to the user to synchronize this. - // This method is not thread safe. - ~ConcurrentQueue() - { - // Destroy producers - auto ptr = producerListTail.load(std::memory_order_relaxed); - while (ptr != nullptr) { - auto next = ptr->next_prod(); - if (ptr->token != nullptr) { - ptr->token->producer = nullptr; - } - destroy(ptr); - ptr = next; - } - - // Destroy implicit producer hash tables - if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE != 0) { - auto hash = implicitProducerHash.load(std::memory_order_relaxed); - while (hash != nullptr) { - auto prev = hash->prev; - if (prev != nullptr) { // The last hash is part of this object and was not allocated dynamically - for (size_t i = 0; i != hash->capacity; ++i) { - hash->entries[i].~ImplicitProducerKVP(); - } - hash->~ImplicitProducerHash(); - Traits::free(hash); - } - hash = prev; - } - } - - // Destroy global free list - auto block = freeList.head_unsafe(); - while (block != nullptr) { - auto next = block->freeListNext.load(std::memory_order_relaxed); - if (block->dynamicallyAllocated) { - destroy(block); - } - block = next; - } - - // Destroy initial free list - destroy_array(initialBlockPool, initialBlockPoolSize); - } - - // Disable copying and copy assignment - ConcurrentQueue(ConcurrentQueue const&) = delete; - ConcurrentQueue& operator=(ConcurrentQueue const&) = delete; - - // Moving is supported, but note that it is *not* a thread-safe operation. - // Nobody can use the queue while it's being moved, and the memory effects - // of that move must be propagated to other threads before they can use it. - // Note: When a queue is moved, its tokens are still valid but can only be - // used with the destination queue (i.e. semantically they are moved along - // with the queue itself). - ConcurrentQueue(ConcurrentQueue&& other) MOODYCAMEL_NOEXCEPT - : producerListTail(other.producerListTail.load(std::memory_order_relaxed)), - producerCount(other.producerCount.load(std::memory_order_relaxed)), - initialBlockPoolIndex(other.initialBlockPoolIndex.load(std::memory_order_relaxed)), - initialBlockPool(other.initialBlockPool), - initialBlockPoolSize(other.initialBlockPoolSize), - freeList(std::move(other.freeList)), - nextExplicitConsumerId(other.nextExplicitConsumerId.load(std::memory_order_relaxed)), - globalExplicitConsumerOffset(other.globalExplicitConsumerOffset.load(std::memory_order_relaxed)) - { - // Move the other one into this, and leave the other one as an empty queue - implicitProducerHashResizeInProgress.clear(std::memory_order_relaxed); - populate_initial_implicit_producer_hash(); - swap_implicit_producer_hashes(other); - - other.producerListTail.store(nullptr, std::memory_order_relaxed); - other.producerCount.store(0, std::memory_order_relaxed); - other.nextExplicitConsumerId.store(0, std::memory_order_relaxed); - other.globalExplicitConsumerOffset.store(0, std::memory_order_relaxed); - -#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG - explicitProducers.store(other.explicitProducers.load(std::memory_order_relaxed), std::memory_order_relaxed); - other.explicitProducers.store(nullptr, std::memory_order_relaxed); - implicitProducers.store(other.implicitProducers.load(std::memory_order_relaxed), std::memory_order_relaxed); - other.implicitProducers.store(nullptr, std::memory_order_relaxed); -#endif - - other.initialBlockPoolIndex.store(0, std::memory_order_relaxed); - other.initialBlockPoolSize = 0; - other.initialBlockPool = nullptr; - - reown_producers(); - } - - inline ConcurrentQueue& operator=(ConcurrentQueue&& other) MOODYCAMEL_NOEXCEPT - { - return swap_internal(other); - } - - // Swaps this queue's state with the other's. Not thread-safe. - // Swapping two queues does not invalidate their tokens, however - // the tokens that were created for one queue must be used with - // only the swapped queue (i.e. the tokens are tied to the - // queue's movable state, not the object itself). - inline void swap(ConcurrentQueue& other) MOODYCAMEL_NOEXCEPT - { - swap_internal(other); - } - -private: - ConcurrentQueue& swap_internal(ConcurrentQueue& other) - { - if (this == &other) { - return *this; - } - - details::swap_relaxed(producerListTail, other.producerListTail); - details::swap_relaxed(producerCount, other.producerCount); - details::swap_relaxed(initialBlockPoolIndex, other.initialBlockPoolIndex); - std::swap(initialBlockPool, other.initialBlockPool); - std::swap(initialBlockPoolSize, other.initialBlockPoolSize); - freeList.swap(other.freeList); - details::swap_relaxed(nextExplicitConsumerId, other.nextExplicitConsumerId); - details::swap_relaxed(globalExplicitConsumerOffset, other.globalExplicitConsumerOffset); - - swap_implicit_producer_hashes(other); - - reown_producers(); - other.reown_producers(); - -#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG - details::swap_relaxed(explicitProducers, other.explicitProducers); - details::swap_relaxed(implicitProducers, other.implicitProducers); -#endif - - return *this; - } - -public: - // Enqueues a single item (by copying it). - // Allocates memory if required. Only fails if memory allocation fails (or implicit - // production is disabled because Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE is 0, - // or Traits::MAX_SUBQUEUE_SIZE has been defined and would be surpassed). - // Thread-safe. - inline bool enqueue(T const& item) - { - if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return false; - return inner_enqueue(item); - } - - // Enqueues a single item (by moving it, if possible). - // Allocates memory if required. Only fails if memory allocation fails (or implicit - // production is disabled because Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE is 0, - // or Traits::MAX_SUBQUEUE_SIZE has been defined and would be surpassed). - // Thread-safe. - inline bool enqueue(T&& item) - { - if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return false; - return inner_enqueue(std::move(item)); - } - - // Enqueues a single item (by copying it) using an explicit producer token. - // Allocates memory if required. Only fails if memory allocation fails (or - // Traits::MAX_SUBQUEUE_SIZE has been defined and would be surpassed). - // Thread-safe. - inline bool enqueue(producer_token_t const& token, T const& item) - { - return inner_enqueue(token, item); - } - - // Enqueues a single item (by moving it, if possible) using an explicit producer token. - // Allocates memory if required. Only fails if memory allocation fails (or - // Traits::MAX_SUBQUEUE_SIZE has been defined and would be surpassed). - // Thread-safe. - inline bool enqueue(producer_token_t const& token, T&& item) - { - return inner_enqueue(token, std::move(item)); - } - - // Enqueues several items. - // Allocates memory if required. Only fails if memory allocation fails (or - // implicit production is disabled because Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE - // is 0, or Traits::MAX_SUBQUEUE_SIZE has been defined and would be surpassed). - // Note: Use std::make_move_iterator if the elements should be moved instead of copied. - // Thread-safe. - template - bool enqueue_bulk(It itemFirst, size_t count) - { - if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return false; - return inner_enqueue_bulk(std::forward(itemFirst), count); - } - - // Enqueues several items using an explicit producer token. - // Allocates memory if required. Only fails if memory allocation fails - // (or Traits::MAX_SUBQUEUE_SIZE has been defined and would be surpassed). - // Note: Use std::make_move_iterator if the elements should be moved - // instead of copied. - // Thread-safe. - template - bool enqueue_bulk(producer_token_t const& token, It itemFirst, size_t count) - { - return inner_enqueue_bulk(token, std::forward(itemFirst), count); - } - - // Enqueues a single item (by copying it). - // Does not allocate memory. Fails if not enough room to enqueue (or implicit - // production is disabled because Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE - // is 0). - // Thread-safe. - inline bool try_enqueue(T const& item) - { - if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return false; - return inner_enqueue(item); - } - - // Enqueues a single item (by moving it, if possible). - // Does not allocate memory (except for one-time implicit producer). - // Fails if not enough room to enqueue (or implicit production is - // disabled because Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE is 0). - // Thread-safe. - inline bool try_enqueue(T&& item) - { - if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return false; - return inner_enqueue(std::move(item)); - } - - // Enqueues a single item (by copying it) using an explicit producer token. - // Does not allocate memory. Fails if not enough room to enqueue. - // Thread-safe. - inline bool try_enqueue(producer_token_t const& token, T const& item) - { - return inner_enqueue(token, item); - } - - // Enqueues a single item (by moving it, if possible) using an explicit producer token. - // Does not allocate memory. Fails if not enough room to enqueue. - // Thread-safe. - inline bool try_enqueue(producer_token_t const& token, T&& item) - { - return inner_enqueue(token, std::move(item)); - } - - // Enqueues several items. - // Does not allocate memory (except for one-time implicit producer). - // Fails if not enough room to enqueue (or implicit production is - // disabled because Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE is 0). - // Note: Use std::make_move_iterator if the elements should be moved - // instead of copied. - // Thread-safe. - template - bool try_enqueue_bulk(It itemFirst, size_t count) - { - if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return false; - return inner_enqueue_bulk(std::forward(itemFirst), count); - } - - // Enqueues several items using an explicit producer token. - // Does not allocate memory. Fails if not enough room to enqueue. - // Note: Use std::make_move_iterator if the elements should be moved - // instead of copied. - // Thread-safe. - template - bool try_enqueue_bulk(producer_token_t const& token, It itemFirst, size_t count) - { - return inner_enqueue_bulk(token, std::forward(itemFirst), count); - } - - - - // Attempts to dequeue from the queue. - // Returns false if all producer streams appeared empty at the time they - // were checked (so, the queue is likely but not guaranteed to be empty). - // Never allocates. Thread-safe. - template - bool try_dequeue(U& item) - { - // Instead of simply trying each producer in turn (which could cause needless contention on the first - // producer), we score them heuristically. - size_t nonEmptyCount = 0; - ProducerBase* best = nullptr; - size_t bestSize = 0; - for (auto ptr = producerListTail.load(std::memory_order_acquire); nonEmptyCount < 3 && ptr != nullptr; ptr = ptr->next_prod()) { - auto size = ptr->size_approx(); - if (size > 0) { - if (size > bestSize) { - bestSize = size; - best = ptr; - } - ++nonEmptyCount; - } - } - - // If there was at least one non-empty queue but it appears empty at the time - // we try to dequeue from it, we need to make sure every queue's been tried - if (nonEmptyCount > 0) { - if (details::likely(best->dequeue(item))) { - return true; - } - for (auto ptr = producerListTail.load(std::memory_order_acquire); ptr != nullptr; ptr = ptr->next_prod()) { - if (ptr != best && ptr->dequeue(item)) { - return true; - } - } - } - return false; - } - - // Attempts to dequeue from the queue. - // Returns false if all producer streams appeared empty at the time they - // were checked (so, the queue is likely but not guaranteed to be empty). - // This differs from the try_dequeue(item) method in that this one does - // not attempt to reduce contention by interleaving the order that producer - // streams are dequeued from. So, using this method can reduce overall throughput - // under contention, but will give more predictable results in single-threaded - // consumer scenarios. - // Never allocates. Thread-safe. - template - bool try_dequeue_non_interleaved(U& item) - { - for (auto ptr = producerListTail.load(std::memory_order_acquire); ptr != nullptr; ptr = ptr->next_prod()) { - if (ptr->dequeue(item)) { - return true; - } - } - return false; - } - - // Attempts to dequeue from the queue using an explicit consumer token. - // Returns false if all producer streams appeared empty at the time they - // were checked (so, the queue is likely but not guaranteed to be empty). - // Never allocates. Thread-safe. - template - bool try_dequeue(consumer_token_t& token, U& item) - { - // The idea is roughly as follows: - // Every 256 items from one producer, make everyone rotate (increase the global offset) -> this means the highest efficiency consumer dictates the rotation speed of everyone else, more or less - // If you see that the global offset has changed, you must reset your consumption counter and move to your designated place - // If there's no items where you're supposed to be, keep moving until you find a producer with some items - // If the global offset has not changed but you've run out of items to consume, move over from your current position until you find an producer with something in it - - if (token.desiredProducer == nullptr || token.lastKnownGlobalOffset != globalExplicitConsumerOffset.load(std::memory_order_relaxed)) { - if (!update_current_producer_after_rotation(token)) { - return false; - } - } - - // If there was at least one non-empty queue but it appears empty at the time - // we try to dequeue from it, we need to make sure every queue's been tried - if (static_cast(token.currentProducer)->dequeue(item)) { - if (++token.itemsConsumedFromCurrent == EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE) { - globalExplicitConsumerOffset.fetch_add(1, std::memory_order_relaxed); - } - return true; - } - - auto tail = producerListTail.load(std::memory_order_acquire); - auto ptr = static_cast(token.currentProducer)->next_prod(); - if (ptr == nullptr) { - ptr = tail; - } - while (ptr != static_cast(token.currentProducer)) { - if (ptr->dequeue(item)) { - token.currentProducer = ptr; - token.itemsConsumedFromCurrent = 1; - return true; - } - ptr = ptr->next_prod(); - if (ptr == nullptr) { - ptr = tail; - } - } - return false; - } - - // Attempts to dequeue several elements from the queue. - // Returns the number of items actually dequeued. - // Returns 0 if all producer streams appeared empty at the time they - // were checked (so, the queue is likely but not guaranteed to be empty). - // Never allocates. Thread-safe. - template - size_t try_dequeue_bulk(It itemFirst, size_t max) - { - size_t count = 0; - for (auto ptr = producerListTail.load(std::memory_order_acquire); ptr != nullptr; ptr = ptr->next_prod()) { - count += ptr->dequeue_bulk(itemFirst, max - count); - if (count == max) { - break; - } - } - return count; - } - - // Attempts to dequeue several elements from the queue using an explicit consumer token. - // Returns the number of items actually dequeued. - // Returns 0 if all producer streams appeared empty at the time they - // were checked (so, the queue is likely but not guaranteed to be empty). - // Never allocates. Thread-safe. - template - size_t try_dequeue_bulk(consumer_token_t& token, It itemFirst, size_t max) - { - if (token.desiredProducer == nullptr || token.lastKnownGlobalOffset != globalExplicitConsumerOffset.load(std::memory_order_relaxed)) { - if (!update_current_producer_after_rotation(token)) { - return false; - } - } - - size_t count = static_cast(token.currentProducer)->dequeue_bulk(itemFirst, max); - if (count == max) { - if ((token.itemsConsumedFromCurrent += static_cast(max)) >= EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE) { - globalExplicitConsumerOffset.fetch_add(1, std::memory_order_relaxed); - } - return max; - } - token.itemsConsumedFromCurrent += static_cast(count); - max -= count; - - auto tail = producerListTail.load(std::memory_order_acquire); - auto ptr = static_cast(token.currentProducer)->next_prod(); - if (ptr == nullptr) { - ptr = tail; - } - while (ptr != static_cast(token.currentProducer)) { - auto dequeued = ptr->dequeue_bulk(itemFirst, max); - count += dequeued; - if (dequeued != 0) { - token.currentProducer = ptr; - token.itemsConsumedFromCurrent = static_cast(dequeued); - } - if (dequeued == max) { - break; - } - max -= dequeued; - ptr = ptr->next_prod(); - if (ptr == nullptr) { - ptr = tail; - } - } - return count; - } - - - - // Attempts to dequeue from a specific producer's inner queue. - // If you happen to know which producer you want to dequeue from, this - // is significantly faster than using the general-case try_dequeue methods. - // Returns false if the producer's queue appeared empty at the time it - // was checked (so, the queue is likely but not guaranteed to be empty). - // Never allocates. Thread-safe. - template - inline bool try_dequeue_from_producer(producer_token_t const& producer, U& item) - { - return static_cast(producer.producer)->dequeue(item); - } - - // Attempts to dequeue several elements from a specific producer's inner queue. - // Returns the number of items actually dequeued. - // If you happen to know which producer you want to dequeue from, this - // is significantly faster than using the general-case try_dequeue methods. - // Returns 0 if the producer's queue appeared empty at the time it - // was checked (so, the queue is likely but not guaranteed to be empty). - // Never allocates. Thread-safe. - template - inline size_t try_dequeue_bulk_from_producer(producer_token_t const& producer, It itemFirst, size_t max) - { - return static_cast(producer.producer)->dequeue_bulk(itemFirst, max); - } - - - // Returns an estimate of the total number of elements currently in the queue. This - // estimate is only accurate if the queue has completely stabilized before it is called - // (i.e. all enqueue and dequeue operations have completed and their memory effects are - // visible on the calling thread, and no further operations start while this method is - // being called). - // Thread-safe. - size_t size_approx() const - { - size_t size = 0; - for (auto ptr = producerListTail.load(std::memory_order_acquire); ptr != nullptr; ptr = ptr->next_prod()) { - size += ptr->size_approx(); - } - return size; - } - - - // Returns true if the underlying atomic variables used by - // the queue are lock-free (they should be on most platforms). - // Thread-safe. - static bool is_lock_free() - { - return - details::static_is_lock_free::value == 2 && - details::static_is_lock_free::value == 2 && - details::static_is_lock_free::value == 2 && - details::static_is_lock_free::value == 2 && - details::static_is_lock_free::value == 2 && - details::static_is_lock_free::value == 2; - } - - -private: - friend struct ProducerToken; - friend struct ConsumerToken; - friend struct ExplicitProducer; - friend class ConcurrentQueueTests; - - enum AllocationMode { CanAlloc, CannotAlloc }; - - - /////////////////////////////// - // Queue methods - /////////////////////////////// - - template - inline bool inner_enqueue(producer_token_t const& token, U&& element) - { - return static_cast(token.producer)->ConcurrentQueue::ExplicitProducer::template enqueue(std::forward(element)); - } - - template - inline bool inner_enqueue(U&& element) - { - auto producer = get_or_add_implicit_producer(); - return producer == nullptr ? false : producer->ConcurrentQueue::ImplicitProducer::template enqueue(std::forward(element)); - } - - template - inline bool inner_enqueue_bulk(producer_token_t const& token, It itemFirst, size_t count) - { - return static_cast(token.producer)->ConcurrentQueue::ExplicitProducer::template enqueue_bulk(std::forward(itemFirst), count); - } - - template - inline bool inner_enqueue_bulk(It itemFirst, size_t count) - { - auto producer = get_or_add_implicit_producer(); - return producer == nullptr ? false : producer->ConcurrentQueue::ImplicitProducer::template enqueue_bulk(std::forward(itemFirst), count); - } - - inline bool update_current_producer_after_rotation(consumer_token_t& token) - { - // Ah, there's been a rotation, figure out where we should be! - auto tail = producerListTail.load(std::memory_order_acquire); - if (token.desiredProducer == nullptr && tail == nullptr) { - return false; - } - auto prodCount = producerCount.load(std::memory_order_relaxed); - auto globalOffset = globalExplicitConsumerOffset.load(std::memory_order_relaxed); - if (details::unlikely(token.desiredProducer == nullptr)) { - // Aha, first time we're dequeueing anything. - // Figure out our local position - // Note: offset is from start, not end, but we're traversing from end -- subtract from count first - std::uint32_t offset = prodCount - 1 - (token.initialOffset % prodCount); - token.desiredProducer = tail; - for (std::uint32_t i = 0; i != offset; ++i) { - token.desiredProducer = static_cast(token.desiredProducer)->next_prod(); - if (token.desiredProducer == nullptr) { - token.desiredProducer = tail; - } - } - } - - std::uint32_t delta = globalOffset - token.lastKnownGlobalOffset; - if (delta >= prodCount) { - delta = delta % prodCount; - } - for (std::uint32_t i = 0; i != delta; ++i) { - token.desiredProducer = static_cast(token.desiredProducer)->next_prod(); - if (token.desiredProducer == nullptr) { - token.desiredProducer = tail; - } - } - - token.lastKnownGlobalOffset = globalOffset; - token.currentProducer = token.desiredProducer; - token.itemsConsumedFromCurrent = 0; - return true; - } - - - /////////////////////////// - // Free list - /////////////////////////// - - template - struct FreeListNode - { - FreeListNode() : freeListRefs(0), freeListNext(nullptr) { } - - std::atomic freeListRefs; - std::atomic freeListNext; - }; - - // A simple CAS-based lock-free free list. Not the fastest thing in the world under heavy contention, but - // simple and correct (assuming nodes are never freed until after the free list is destroyed), and fairly - // speedy under low contention. - template // N must inherit FreeListNode or have the same fields (and initialization of them) - struct FreeList - { - FreeList() : freeListHead(nullptr) { } - FreeList(FreeList&& other) : freeListHead(other.freeListHead.load(std::memory_order_relaxed)) { other.freeListHead.store(nullptr, std::memory_order_relaxed); } - void swap(FreeList& other) { details::swap_relaxed(freeListHead, other.freeListHead); } - - FreeList(FreeList const&) = delete; - FreeList& operator=(FreeList const&) = delete; - - inline void add(N* node) - { -#if MCDBGQ_NOLOCKFREE_FREELIST - debug::DebugLock lock(mutex); -#endif - // We know that the should-be-on-freelist bit is 0 at this point, so it's safe to - // set it using a fetch_add - if (node->freeListRefs.fetch_add(SHOULD_BE_ON_FREELIST, std::memory_order_acq_rel) == 0) { - // Oh look! We were the last ones referencing this node, and we know - // we want to add it to the free list, so let's do it! - add_knowing_refcount_is_zero(node); - } - } - - inline N* try_get() - { -#if MCDBGQ_NOLOCKFREE_FREELIST - debug::DebugLock lock(mutex); -#endif - auto head = freeListHead.load(std::memory_order_acquire); - while (head != nullptr) { - auto prevHead = head; - auto refs = head->freeListRefs.load(std::memory_order_relaxed); - if ((refs & REFS_MASK) == 0 || !head->freeListRefs.compare_exchange_strong(refs, refs + 1, std::memory_order_acquire, std::memory_order_relaxed)) { - head = freeListHead.load(std::memory_order_acquire); - continue; - } - - // Good, reference count has been incremented (it wasn't at zero), which means we can read the - // next and not worry about it changing between now and the time we do the CAS - auto next = head->freeListNext.load(std::memory_order_relaxed); - if (freeListHead.compare_exchange_strong(head, next, std::memory_order_acquire, std::memory_order_relaxed)) { - // Yay, got the node. This means it was on the list, which means shouldBeOnFreeList must be false no - // matter the refcount (because nobody else knows it's been taken off yet, it can't have been put back on). - assert((head->freeListRefs.load(std::memory_order_relaxed) & SHOULD_BE_ON_FREELIST) == 0); - - // Decrease refcount twice, once for our ref, and once for the list's ref - head->freeListRefs.fetch_add(-2, std::memory_order_release); - return head; - } - - // OK, the head must have changed on us, but we still need to decrease the refcount we increased. - // Note that we don't need to release any memory effects, but we do need to ensure that the reference - // count decrement happens-after the CAS on the head. - refs = prevHead->freeListRefs.fetch_add(-1, std::memory_order_acq_rel); - if (refs == SHOULD_BE_ON_FREELIST + 1) { - add_knowing_refcount_is_zero(prevHead); - } - } - - return nullptr; - } - - // Useful for traversing the list when there's no contention (e.g. to destroy remaining nodes) - N* head_unsafe() const { return freeListHead.load(std::memory_order_relaxed); } - - private: - inline void add_knowing_refcount_is_zero(N* node) - { - // Since the refcount is zero, and nobody can increase it once it's zero (except us, and we run - // only one copy of this method per node at a time, i.e. the single thread case), then we know - // we can safely change the next pointer of the node; however, once the refcount is back above - // zero, then other threads could increase it (happens under heavy contention, when the refcount - // goes to zero in between a load and a refcount increment of a node in try_get, then back up to - // something non-zero, then the refcount increment is done by the other thread) -- so, if the CAS - // to add the node to the actual list fails, decrease the refcount and leave the add operation to - // the next thread who puts the refcount back at zero (which could be us, hence the loop). - auto head = freeListHead.load(std::memory_order_relaxed); - while (true) { - node->freeListNext.store(head, std::memory_order_relaxed); - node->freeListRefs.store(1, std::memory_order_release); - if (!freeListHead.compare_exchange_strong(head, node, std::memory_order_release, std::memory_order_relaxed)) { - // Hmm, the add failed, but we can only try again when the refcount goes back to zero - if (node->freeListRefs.fetch_add(SHOULD_BE_ON_FREELIST - 1, std::memory_order_release) == 1) { - continue; - } - } - return; - } - } - - private: - // Implemented like a stack, but where node order doesn't matter (nodes are inserted out of order under contention) - std::atomic freeListHead; - - static const std::uint32_t REFS_MASK = 0x7FFFFFFF; - static const std::uint32_t SHOULD_BE_ON_FREELIST = 0x80000000; - -#if MCDBGQ_NOLOCKFREE_FREELIST - debug::DebugMutex mutex; -#endif - }; - - - /////////////////////////// - // Block - /////////////////////////// - - enum InnerQueueContext { implicit_context = 0, explicit_context = 1 }; - - struct Block - { - Block() - : elementsCompletelyDequeued(0), freeListRefs(0), freeListNext(nullptr), shouldBeOnFreeList(false), dynamicallyAllocated(true) - { -#if MCDBGQ_TRACKMEM - owner = nullptr; -#endif - } - - template - inline bool is_empty() const - { - if (context == explicit_context && BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD) { - // Check flags - for (size_t i = 0; i < BLOCK_SIZE; ++i) { - if (!emptyFlags[i].load(std::memory_order_relaxed)) { - return false; - } - } - - // Aha, empty; make sure we have all other memory effects that happened before the empty flags were set - std::atomic_thread_fence(std::memory_order_acquire); - return true; - } - else { - // Check counter - if (elementsCompletelyDequeued.load(std::memory_order_relaxed) == BLOCK_SIZE) { - std::atomic_thread_fence(std::memory_order_acquire); - return true; - } - assert(elementsCompletelyDequeued.load(std::memory_order_relaxed) <= BLOCK_SIZE); - return false; - } - } - - // Returns true if the block is now empty (does not apply in explicit context) - template - inline bool set_empty(index_t i) - { - if (context == explicit_context && BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD) { - // Set flag - assert(!emptyFlags[BLOCK_SIZE - 1 - static_cast(i & static_cast(BLOCK_SIZE - 1))].load(std::memory_order_relaxed)); - emptyFlags[BLOCK_SIZE - 1 - static_cast(i & static_cast(BLOCK_SIZE - 1))].store(true, std::memory_order_release); - return false; - } - else { - // Increment counter - auto prevVal = elementsCompletelyDequeued.fetch_add(1, std::memory_order_release); - assert(prevVal < BLOCK_SIZE); - return prevVal == BLOCK_SIZE - 1; - } - } - - // Sets multiple contiguous item statuses to 'empty' (assumes no wrapping and count > 0). - // Returns true if the block is now empty (does not apply in explicit context). - template - inline bool set_many_empty(index_t i, size_t count) - { - if (context == explicit_context && BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD) { - // Set flags - std::atomic_thread_fence(std::memory_order_release); - i = BLOCK_SIZE - 1 - static_cast(i & static_cast(BLOCK_SIZE - 1)) - count + 1; - for (size_t j = 0; j != count; ++j) { - assert(!emptyFlags[i + j].load(std::memory_order_relaxed)); - emptyFlags[i + j].store(true, std::memory_order_relaxed); - } - return false; - } - else { - // Increment counter - auto prevVal = elementsCompletelyDequeued.fetch_add(count, std::memory_order_release); - assert(prevVal + count <= BLOCK_SIZE); - return prevVal + count == BLOCK_SIZE; - } - } - - template - inline void set_all_empty() - { - if (context == explicit_context && BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD) { - // Set all flags - for (size_t i = 0; i != BLOCK_SIZE; ++i) { - emptyFlags[i].store(true, std::memory_order_relaxed); - } - } - else { - // Reset counter - elementsCompletelyDequeued.store(BLOCK_SIZE, std::memory_order_relaxed); - } - } - - template - inline void reset_empty() - { - if (context == explicit_context && BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD) { - // Reset flags - for (size_t i = 0; i != BLOCK_SIZE; ++i) { - emptyFlags[i].store(false, std::memory_order_relaxed); - } - } - else { - // Reset counter - elementsCompletelyDequeued.store(0, std::memory_order_relaxed); - } - } - - inline T* operator[](index_t idx) MOODYCAMEL_NOEXCEPT { return reinterpret_cast(elements) + static_cast(idx & static_cast(BLOCK_SIZE - 1)); } - inline T const* operator[](index_t idx) const MOODYCAMEL_NOEXCEPT { return reinterpret_cast(elements) + static_cast(idx & static_cast(BLOCK_SIZE - 1)); } - - public: - Block* next; - std::atomic elementsCompletelyDequeued; - std::atomic emptyFlags[BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD ? BLOCK_SIZE : 1]; - private: - char elements[sizeof(T) * BLOCK_SIZE]; - public: - std::atomic freeListRefs; - std::atomic freeListNext; - std::atomic shouldBeOnFreeList; - bool dynamicallyAllocated; // Perhaps a better name for this would be 'isNotPartOfInitialBlockPool' - -#if MCDBGQ_TRACKMEM - void* owner; -#endif - }; - - -#if MCDBGQ_TRACKMEM -public: - struct MemStats; -private: -#endif - - /////////////////////////// - // Producer base - /////////////////////////// - - struct ProducerBase : public details::ConcurrentQueueProducerTypelessBase - { - ProducerBase(ConcurrentQueue* parent, bool isExplicit) : - tailIndex(0), - headIndex(0), - dequeueOptimisticCount(0), - dequeueOvercommit(0), - tailBlock(nullptr), - isExplicit(isExplicit), - parent(parent) - { - } - - virtual ~ProducerBase() { }; - - template - inline bool dequeue(U& element) - { - if (isExplicit) { - return static_cast(this)->dequeue(element); - } - else { - return static_cast(this)->dequeue(element); - } - } - - template - inline size_t dequeue_bulk(It& itemFirst, size_t max) - { - if (isExplicit) { - return static_cast(this)->dequeue_bulk(itemFirst, max); - } - else { - return static_cast(this)->dequeue_bulk(itemFirst, max); - } - } - - inline ProducerBase* next_prod() const { return static_cast(next); } - - inline size_t size_approx() const - { - auto tail = tailIndex.load(std::memory_order_relaxed); - auto head = headIndex.load(std::memory_order_relaxed); - return details::circular_less_than(head, tail) ? static_cast(tail - head) : 0; - } - - inline index_t getTail() const { return tailIndex.load(std::memory_order_relaxed); } - protected: - std::atomic tailIndex; // Where to enqueue to next - std::atomic headIndex; // Where to dequeue from next - - std::atomic dequeueOptimisticCount; - std::atomic dequeueOvercommit; - - Block* tailBlock; - - public: - bool isExplicit; - ConcurrentQueue* parent; - - protected: -#if MCDBGQ_TRACKMEM - friend struct MemStats; -#endif - }; - - - /////////////////////////// - // Explicit queue - /////////////////////////// - - struct ExplicitProducer : public ProducerBase - { - explicit ExplicitProducer(ConcurrentQueue* parent) : - ProducerBase(parent, true), - blockIndex(nullptr), - pr_blockIndexSlotsUsed(0), - pr_blockIndexSize(EXPLICIT_INITIAL_INDEX_SIZE >> 1), - pr_blockIndexFront(0), - pr_blockIndexEntries(nullptr), - pr_blockIndexRaw(nullptr) - { - size_t poolBasedIndexSize = details::ceil_to_pow_2(parent->initialBlockPoolSize) >> 1; - if (poolBasedIndexSize > pr_blockIndexSize) { - pr_blockIndexSize = poolBasedIndexSize; - } - - new_block_index(0); // This creates an index with double the number of current entries, i.e. EXPLICIT_INITIAL_INDEX_SIZE - } - - ~ExplicitProducer() - { - // Destruct any elements not yet dequeued. - // Since we're in the destructor, we can assume all elements - // are either completely dequeued or completely not (no halfways). - if (this->tailBlock != nullptr) { // Note this means there must be a block index too - // First find the block that's partially dequeued, if any - Block* halfDequeuedBlock = nullptr; - if ((this->headIndex.load(std::memory_order_relaxed) & static_cast(BLOCK_SIZE - 1)) != 0) { - // The head's not on a block boundary, meaning a block somewhere is partially dequeued - // (or the head block is the tail block and was fully dequeued, but the head/tail are still not on a boundary) - size_t i = (pr_blockIndexFront - pr_blockIndexSlotsUsed) & (pr_blockIndexSize - 1); - while (details::circular_less_than(pr_blockIndexEntries[i].base + BLOCK_SIZE, this->headIndex.load(std::memory_order_relaxed))) { - i = (i + 1) & (pr_blockIndexSize - 1); - } - assert(details::circular_less_than(pr_blockIndexEntries[i].base, this->headIndex.load(std::memory_order_relaxed))); - halfDequeuedBlock = pr_blockIndexEntries[i].block; - } - - // Start at the head block (note the first line in the loop gives us the head from the tail on the first iteration) - auto block = this->tailBlock; - do { - block = block->next; - if (block->ConcurrentQueue::Block::template is_empty()) { - continue; - } - - size_t i = 0; // Offset into block - if (block == halfDequeuedBlock) { - i = static_cast(this->headIndex.load(std::memory_order_relaxed) & static_cast(BLOCK_SIZE - 1)); - } - - // Walk through all the items in the block; if this is the tail block, we need to stop when we reach the tail index - auto lastValidIndex = (this->tailIndex.load(std::memory_order_relaxed) & static_cast(BLOCK_SIZE - 1)) == 0 ? BLOCK_SIZE : static_cast(this->tailIndex.load(std::memory_order_relaxed) & static_cast(BLOCK_SIZE - 1)); - while (i != BLOCK_SIZE && (block != this->tailBlock || i != lastValidIndex)) { - (*block)[i++]->~T(); - } - } while (block != this->tailBlock); - } - - // Destroy all blocks that we own - if (this->tailBlock != nullptr) { - auto block = this->tailBlock; - do { - auto next = block->next; - if (block->dynamicallyAllocated) { - destroy(block); - } - block = next; - } while (block != this->tailBlock); - } - - // Destroy the block indices - auto header = static_cast(pr_blockIndexRaw); - while (header != nullptr) { - auto prev = static_cast(header->prev); - header->~BlockIndexHeader(); - Traits::free(header); - header = prev; - } - } - - template - inline bool enqueue(U&& element) - { - index_t currentTailIndex = this->tailIndex.load(std::memory_order_relaxed); - index_t newTailIndex = 1 + currentTailIndex; - if ((currentTailIndex & static_cast(BLOCK_SIZE - 1)) == 0) { - // We reached the end of a block, start a new one - auto startBlock = this->tailBlock; - auto originalBlockIndexSlotsUsed = pr_blockIndexSlotsUsed; - if (this->tailBlock != nullptr && this->tailBlock->next->ConcurrentQueue::Block::template is_empty()) { - // We can re-use the block ahead of us, it's empty! - this->tailBlock = this->tailBlock->next; - this->tailBlock->ConcurrentQueue::Block::template reset_empty(); - - // We'll put the block on the block index (guaranteed to be room since we're conceptually removing the - // last block from it first -- except instead of removing then adding, we can just overwrite). - // Note that there must be a valid block index here, since even if allocation failed in the ctor, - // it would have been re-attempted when adding the first block to the queue; since there is such - // a block, a block index must have been successfully allocated. - } - else { - // Whatever head value we see here is >= the last value we saw here (relatively), - // and <= its current value. Since we have the most recent tail, the head must be - // <= to it. - auto head = this->headIndex.load(std::memory_order_relaxed); - assert(!details::circular_less_than(currentTailIndex, head)); - if (!details::circular_less_than(head, currentTailIndex + BLOCK_SIZE) - || (MAX_SUBQUEUE_SIZE != details::const_numeric_max::value && (MAX_SUBQUEUE_SIZE == 0 || MAX_SUBQUEUE_SIZE - BLOCK_SIZE < currentTailIndex - head))) { - // We can't enqueue in another block because there's not enough leeway -- the - // tail could surpass the head by the time the block fills up! (Or we'll exceed - // the size limit, if the second part of the condition was true.) - return false; - } - // We're going to need a new block; check that the block index has room - if (pr_blockIndexRaw == nullptr || pr_blockIndexSlotsUsed == pr_blockIndexSize) { - // Hmm, the circular block index is already full -- we'll need - // to allocate a new index. Note pr_blockIndexRaw can only be nullptr if - // the initial allocation failed in the constructor. - - if (allocMode == CannotAlloc || !new_block_index(pr_blockIndexSlotsUsed)) { - return false; - } - } - - // Insert a new block in the circular linked list - auto newBlock = this->parent->ConcurrentQueue::template requisition_block(); - if (newBlock == nullptr) { - return false; - } -#if MCDBGQ_TRACKMEM - newBlock->owner = this; -#endif - newBlock->ConcurrentQueue::Block::template reset_empty(); - if (this->tailBlock == nullptr) { - newBlock->next = newBlock; - } - else { - newBlock->next = this->tailBlock->next; - this->tailBlock->next = newBlock; - } - this->tailBlock = newBlock; - ++pr_blockIndexSlotsUsed; - } - - if (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new (nullptr) T(std::forward(element)))) { - // The constructor may throw. We want the element not to appear in the queue in - // that case (without corrupting the queue): - MOODYCAMEL_TRY { - new ((*this->tailBlock)[currentTailIndex]) T(std::forward(element)); - } - MOODYCAMEL_CATCH (...) { - // Revert change to the current block, but leave the new block available - // for next time - pr_blockIndexSlotsUsed = originalBlockIndexSlotsUsed; - this->tailBlock = startBlock == nullptr ? this->tailBlock : startBlock; - MOODYCAMEL_RETHROW; - } - } - else { - (void)startBlock; - (void)originalBlockIndexSlotsUsed; - } - - // Add block to block index - auto& entry = blockIndex.load(std::memory_order_relaxed)->entries[pr_blockIndexFront]; - entry.base = currentTailIndex; - entry.block = this->tailBlock; - blockIndex.load(std::memory_order_relaxed)->front.store(pr_blockIndexFront, std::memory_order_release); - pr_blockIndexFront = (pr_blockIndexFront + 1) & (pr_blockIndexSize - 1); - - if (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new (nullptr) T(std::forward(element)))) { - this->tailIndex.store(newTailIndex, std::memory_order_release); - return true; - } - } - - // Enqueue - new ((*this->tailBlock)[currentTailIndex]) T(std::forward(element)); - - this->tailIndex.store(newTailIndex, std::memory_order_release); - return true; - } - - template - bool dequeue(U& element) - { - auto tail = this->tailIndex.load(std::memory_order_relaxed); - auto overcommit = this->dequeueOvercommit.load(std::memory_order_relaxed); - if (details::circular_less_than(this->dequeueOptimisticCount.load(std::memory_order_relaxed) - overcommit, tail)) { - // Might be something to dequeue, let's give it a try - - // Note that this if is purely for performance purposes in the common case when the queue is - // empty and the values are eventually consistent -- we may enter here spuriously. - - // Note that whatever the values of overcommit and tail are, they are not going to change (unless we - // change them) and must be the same value at this point (inside the if) as when the if condition was - // evaluated. - - // We insert an acquire fence here to synchronize-with the release upon incrementing dequeueOvercommit below. - // This ensures that whatever the value we got loaded into overcommit, the load of dequeueOptisticCount in - // the fetch_add below will result in a value at least as recent as that (and therefore at least as large). - // Note that I believe a compiler (signal) fence here would be sufficient due to the nature of fetch_add (all - // read-modify-write operations are guaranteed to work on the latest value in the modification order), but - // unfortunately that can't be shown to be correct using only the C++11 standard. - // See http://stackoverflow.com/questions/18223161/what-are-the-c11-memory-ordering-guarantees-in-this-corner-case - std::atomic_thread_fence(std::memory_order_acquire); - - // Increment optimistic counter, then check if it went over the boundary - auto myDequeueCount = this->dequeueOptimisticCount.fetch_add(1, std::memory_order_relaxed); - - // Note that since dequeueOvercommit must be <= dequeueOptimisticCount (because dequeueOvercommit is only ever - // incremented after dequeueOptimisticCount -- this is enforced in the `else` block below), and since we now - // have a version of dequeueOptimisticCount that is at least as recent as overcommit (due to the release upon - // incrementing dequeueOvercommit and the acquire above that synchronizes with it), overcommit <= myDequeueCount. - assert(overcommit <= myDequeueCount); - - // Note that we reload tail here in case it changed; it will be the same value as before or greater, since - // this load is sequenced after (happens after) the earlier load above. This is supported by read-read - // coherency (as defined in the standard), explained here: http://en.cppreference.com/w/cpp/atomic/memory_order - tail = this->tailIndex.load(std::memory_order_acquire); - if (details::likely(details::circular_less_than(myDequeueCount - overcommit, tail))) { - // Guaranteed to be at least one element to dequeue! - - // Get the index. Note that since there's guaranteed to be at least one element, this - // will never exceed tail. We need to do an acquire-release fence here since it's possible - // that whatever condition got us to this point was for an earlier enqueued element (that - // we already see the memory effects for), but that by the time we increment somebody else - // has incremented it, and we need to see the memory effects for *that* element, which is - // in such a case is necessarily visible on the thread that incremented it in the first - // place with the more current condition (they must have acquired a tail that is at least - // as recent). - auto index = this->headIndex.fetch_add(1, std::memory_order_acq_rel); - - - // Determine which block the element is in - - auto localBlockIndex = blockIndex.load(std::memory_order_acquire); - auto localBlockIndexHead = localBlockIndex->front.load(std::memory_order_acquire); - - // We need to be careful here about subtracting and dividing because of index wrap-around. - // When an index wraps, we need to preserve the sign of the offset when dividing it by the - // block size (in order to get a correct signed block count offset in all cases): - auto headBase = localBlockIndex->entries[localBlockIndexHead].base; - auto blockBaseIndex = index & ~static_cast(BLOCK_SIZE - 1); - auto offset = static_cast(static_cast::type>(blockBaseIndex - headBase) / BLOCK_SIZE); - auto block = localBlockIndex->entries[(localBlockIndexHead + offset) & (localBlockIndex->size - 1)].block; - - // Dequeue - auto& el = *((*block)[index]); - if (!MOODYCAMEL_NOEXCEPT_ASSIGN(T, T&&, element = std::move(el))) { - // Make sure the element is still fully dequeued and destroyed even if the assignment - // throws - struct Guard { - Block* block; - index_t index; - - ~Guard() - { - (*block)[index]->~T(); - block->ConcurrentQueue::Block::template set_empty(index); - } - } guard = { block, index }; - - element = std::move(el); - } - else { - element = std::move(el); - el.~T(); - block->ConcurrentQueue::Block::template set_empty(index); - } - - return true; - } - else { - // Wasn't anything to dequeue after all; make the effective dequeue count eventually consistent - this->dequeueOvercommit.fetch_add(1, std::memory_order_release); // Release so that the fetch_add on dequeueOptimisticCount is guaranteed to happen before this write - } - } - - return false; - } - - template - bool enqueue_bulk(It itemFirst, size_t count) - { - // First, we need to make sure we have enough room to enqueue all of the elements; - // this means pre-allocating blocks and putting them in the block index (but only if - // all the allocations succeeded). - index_t startTailIndex = this->tailIndex.load(std::memory_order_relaxed); - auto startBlock = this->tailBlock; - auto originalBlockIndexFront = pr_blockIndexFront; - auto originalBlockIndexSlotsUsed = pr_blockIndexSlotsUsed; - - Block* firstAllocatedBlock = nullptr; - - // Figure out how many blocks we'll need to allocate, and do so - size_t blockBaseDiff = ((startTailIndex + count - 1) & ~static_cast(BLOCK_SIZE - 1)) - ((startTailIndex - 1) & ~static_cast(BLOCK_SIZE - 1)); - index_t currentTailIndex = (startTailIndex - 1) & ~static_cast(BLOCK_SIZE - 1); - if (blockBaseDiff > 0) { - // Allocate as many blocks as possible from ahead - while (blockBaseDiff > 0 && this->tailBlock != nullptr && this->tailBlock->next != firstAllocatedBlock && this->tailBlock->next->ConcurrentQueue::Block::template is_empty()) { - blockBaseDiff -= static_cast(BLOCK_SIZE); - currentTailIndex += static_cast(BLOCK_SIZE); - - this->tailBlock = this->tailBlock->next; - firstAllocatedBlock = firstAllocatedBlock == nullptr ? this->tailBlock : firstAllocatedBlock; - - auto& entry = blockIndex.load(std::memory_order_relaxed)->entries[pr_blockIndexFront]; - entry.base = currentTailIndex; - entry.block = this->tailBlock; - pr_blockIndexFront = (pr_blockIndexFront + 1) & (pr_blockIndexSize - 1); - } - - // Now allocate as many blocks as necessary from the block pool - while (blockBaseDiff > 0) { - blockBaseDiff -= static_cast(BLOCK_SIZE); - currentTailIndex += static_cast(BLOCK_SIZE); - - auto head = this->headIndex.load(std::memory_order_relaxed); - assert(!details::circular_less_than(currentTailIndex, head)); - bool full = !details::circular_less_than(head, currentTailIndex + BLOCK_SIZE) || (MAX_SUBQUEUE_SIZE != details::const_numeric_max::value && (MAX_SUBQUEUE_SIZE == 0 || MAX_SUBQUEUE_SIZE - BLOCK_SIZE < currentTailIndex - head)); - if (pr_blockIndexRaw == nullptr || pr_blockIndexSlotsUsed == pr_blockIndexSize || full) { - if (allocMode == CannotAlloc || full || !new_block_index(originalBlockIndexSlotsUsed)) { - // Failed to allocate, undo changes (but keep injected blocks) - pr_blockIndexFront = originalBlockIndexFront; - pr_blockIndexSlotsUsed = originalBlockIndexSlotsUsed; - this->tailBlock = startBlock == nullptr ? firstAllocatedBlock : startBlock; - return false; - } - - // pr_blockIndexFront is updated inside new_block_index, so we need to - // update our fallback value too (since we keep the new index even if we - // later fail) - originalBlockIndexFront = originalBlockIndexSlotsUsed; - } - - // Insert a new block in the circular linked list - auto newBlock = this->parent->ConcurrentQueue::template requisition_block(); - if (newBlock == nullptr) { - pr_blockIndexFront = originalBlockIndexFront; - pr_blockIndexSlotsUsed = originalBlockIndexSlotsUsed; - this->tailBlock = startBlock == nullptr ? firstAllocatedBlock : startBlock; - return false; - } - -#if MCDBGQ_TRACKMEM - newBlock->owner = this; -#endif - newBlock->ConcurrentQueue::Block::template set_all_empty(); - if (this->tailBlock == nullptr) { - newBlock->next = newBlock; - } - else { - newBlock->next = this->tailBlock->next; - this->tailBlock->next = newBlock; - } - this->tailBlock = newBlock; - firstAllocatedBlock = firstAllocatedBlock == nullptr ? this->tailBlock : firstAllocatedBlock; - - ++pr_blockIndexSlotsUsed; - - auto& entry = blockIndex.load(std::memory_order_relaxed)->entries[pr_blockIndexFront]; - entry.base = currentTailIndex; - entry.block = this->tailBlock; - pr_blockIndexFront = (pr_blockIndexFront + 1) & (pr_blockIndexSize - 1); - } - - // Excellent, all allocations succeeded. Reset each block's emptiness before we fill them up, and - // publish the new block index front - auto block = firstAllocatedBlock; - while (true) { - block->ConcurrentQueue::Block::template reset_empty(); - if (block == this->tailBlock) { - break; - } - block = block->next; - } - - if (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (nullptr) T(details::deref_noexcept(itemFirst)))) { - blockIndex.load(std::memory_order_relaxed)->front.store((pr_blockIndexFront - 1) & (pr_blockIndexSize - 1), std::memory_order_release); - } - } - - // Enqueue, one block at a time - index_t newTailIndex = startTailIndex + static_cast(count); - currentTailIndex = startTailIndex; - auto endBlock = this->tailBlock; - this->tailBlock = startBlock; - assert((startTailIndex & static_cast(BLOCK_SIZE - 1)) != 0 || firstAllocatedBlock != nullptr || count == 0); - if ((startTailIndex & static_cast(BLOCK_SIZE - 1)) == 0 && firstAllocatedBlock != nullptr) { - this->tailBlock = firstAllocatedBlock; - } - while (true) { - auto stopIndex = (currentTailIndex & ~static_cast(BLOCK_SIZE - 1)) + static_cast(BLOCK_SIZE); - if (details::circular_less_than(newTailIndex, stopIndex)) { - stopIndex = newTailIndex; - } - if (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (nullptr) T(details::deref_noexcept(itemFirst)))) { - while (currentTailIndex != stopIndex) { - new ((*this->tailBlock)[currentTailIndex++]) T(*itemFirst++); - } - } - else { - MOODYCAMEL_TRY { - while (currentTailIndex != stopIndex) { - // Must use copy constructor even if move constructor is available - // because we may have to revert if there's an exception. - // Sorry about the horrible templated next line, but it was the only way - // to disable moving *at compile time*, which is important because a type - // may only define a (noexcept) move constructor, and so calls to the - // cctor will not compile, even if they are in an if branch that will never - // be executed - new ((*this->tailBlock)[currentTailIndex]) T(details::nomove_if<(bool)!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (nullptr) T(details::deref_noexcept(itemFirst)))>::eval(*itemFirst)); - ++currentTailIndex; - ++itemFirst; - } - } - MOODYCAMEL_CATCH (...) { - // Oh dear, an exception's been thrown -- destroy the elements that - // were enqueued so far and revert the entire bulk operation (we'll keep - // any allocated blocks in our linked list for later, though). - auto constructedStopIndex = currentTailIndex; - auto lastBlockEnqueued = this->tailBlock; - - pr_blockIndexFront = originalBlockIndexFront; - pr_blockIndexSlotsUsed = originalBlockIndexSlotsUsed; - this->tailBlock = startBlock == nullptr ? firstAllocatedBlock : startBlock; - - if (!details::is_trivially_destructible::value) { - auto block = startBlock; - if ((startTailIndex & static_cast(BLOCK_SIZE - 1)) == 0) { - block = firstAllocatedBlock; - } - currentTailIndex = startTailIndex; - while (true) { - auto stopIndex = (currentTailIndex & ~static_cast(BLOCK_SIZE - 1)) + static_cast(BLOCK_SIZE); - if (details::circular_less_than(constructedStopIndex, stopIndex)) { - stopIndex = constructedStopIndex; - } - while (currentTailIndex != stopIndex) { - (*block)[currentTailIndex++]->~T(); - } - if (block == lastBlockEnqueued) { - break; - } - block = block->next; - } - } - MOODYCAMEL_RETHROW; - } - } - - if (this->tailBlock == endBlock) { - assert(currentTailIndex == newTailIndex); - break; - } - this->tailBlock = this->tailBlock->next; - } - - if (!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (nullptr) T(details::deref_noexcept(itemFirst))) && firstAllocatedBlock != nullptr) { - blockIndex.load(std::memory_order_relaxed)->front.store((pr_blockIndexFront - 1) & (pr_blockIndexSize - 1), std::memory_order_release); - } - - this->tailIndex.store(newTailIndex, std::memory_order_release); - return true; - } - - template - size_t dequeue_bulk(It& itemFirst, size_t max) - { - auto tail = this->tailIndex.load(std::memory_order_relaxed); - auto overcommit = this->dequeueOvercommit.load(std::memory_order_relaxed); - auto desiredCount = static_cast(tail - (this->dequeueOptimisticCount.load(std::memory_order_relaxed) - overcommit)); - if (details::circular_less_than(0, desiredCount)) { - desiredCount = desiredCount < max ? desiredCount : max; - std::atomic_thread_fence(std::memory_order_acquire); - - auto myDequeueCount = this->dequeueOptimisticCount.fetch_add(desiredCount, std::memory_order_relaxed); - assert(overcommit <= myDequeueCount); - - tail = this->tailIndex.load(std::memory_order_acquire); - auto actualCount = static_cast(tail - (myDequeueCount - overcommit)); - if (details::circular_less_than(0, actualCount)) { - actualCount = desiredCount < actualCount ? desiredCount : actualCount; - if (actualCount < desiredCount) { - this->dequeueOvercommit.fetch_add(desiredCount - actualCount, std::memory_order_release); - } - - // Get the first index. Note that since there's guaranteed to be at least actualCount elements, this - // will never exceed tail. - auto firstIndex = this->headIndex.fetch_add(actualCount, std::memory_order_acq_rel); - - // Determine which block the first element is in - auto localBlockIndex = blockIndex.load(std::memory_order_acquire); - auto localBlockIndexHead = localBlockIndex->front.load(std::memory_order_acquire); - - auto headBase = localBlockIndex->entries[localBlockIndexHead].base; - auto firstBlockBaseIndex = firstIndex & ~static_cast(BLOCK_SIZE - 1); - auto offset = static_cast(static_cast::type>(firstBlockBaseIndex - headBase) / BLOCK_SIZE); - auto indexIndex = (localBlockIndexHead + offset) & (localBlockIndex->size - 1); - - // Iterate the blocks and dequeue - auto index = firstIndex; - do { - auto firstIndexInBlock = index; - auto endIndex = (index & ~static_cast(BLOCK_SIZE - 1)) + static_cast(BLOCK_SIZE); - endIndex = details::circular_less_than(firstIndex + static_cast(actualCount), endIndex) ? firstIndex + static_cast(actualCount) : endIndex; - auto block = localBlockIndex->entries[indexIndex].block; - if (MOODYCAMEL_NOEXCEPT_ASSIGN(T, T&&, details::deref_noexcept(itemFirst) = std::move((*(*block)[index])))) { - while (index != endIndex) { - auto& el = *((*block)[index]); - *itemFirst++ = std::move(el); - el.~T(); - ++index; - } - } - else { - MOODYCAMEL_TRY { - while (index != endIndex) { - auto& el = *((*block)[index]); - *itemFirst = std::move(el); - ++itemFirst; - el.~T(); - ++index; - } - } - MOODYCAMEL_CATCH (...) { - // It's too late to revert the dequeue, but we can make sure that all - // the dequeued objects are properly destroyed and the block index - // (and empty count) are properly updated before we propagate the exception - do { - block = localBlockIndex->entries[indexIndex].block; - while (index != endIndex) { - (*block)[index++]->~T(); - } - block->ConcurrentQueue::Block::template set_many_empty(firstIndexInBlock, static_cast(endIndex - firstIndexInBlock)); - indexIndex = (indexIndex + 1) & (localBlockIndex->size - 1); - - firstIndexInBlock = index; - endIndex = (index & ~static_cast(BLOCK_SIZE - 1)) + static_cast(BLOCK_SIZE); - endIndex = details::circular_less_than(firstIndex + static_cast(actualCount), endIndex) ? firstIndex + static_cast(actualCount) : endIndex; - } while (index != firstIndex + actualCount); - - MOODYCAMEL_RETHROW; - } - } - block->ConcurrentQueue::Block::template set_many_empty(firstIndexInBlock, static_cast(endIndex - firstIndexInBlock)); - indexIndex = (indexIndex + 1) & (localBlockIndex->size - 1); - } while (index != firstIndex + actualCount); - - return actualCount; - } - else { - // Wasn't anything to dequeue after all; make the effective dequeue count eventually consistent - this->dequeueOvercommit.fetch_add(desiredCount, std::memory_order_release); - } - } - - return 0; - } - - private: - struct BlockIndexEntry - { - index_t base; - Block* block; - }; - - struct BlockIndexHeader - { - size_t size; - std::atomic front; // Current slot (not next, like pr_blockIndexFront) - BlockIndexEntry* entries; - void* prev; - }; - - - bool new_block_index(size_t numberOfFilledSlotsToExpose) - { - auto prevBlockSizeMask = pr_blockIndexSize - 1; - - // Create the new block - pr_blockIndexSize <<= 1; - auto newRawPtr = static_cast(Traits::malloc(sizeof(BlockIndexHeader) + std::alignment_of::value - 1 + sizeof(BlockIndexEntry) * pr_blockIndexSize)); - if (newRawPtr == nullptr) { - pr_blockIndexSize >>= 1; // Reset to allow graceful retry - return false; - } - - auto newBlockIndexEntries = reinterpret_cast(details::align_for(newRawPtr + sizeof(BlockIndexHeader))); - - // Copy in all the old indices, if any - size_t j = 0; - if (pr_blockIndexSlotsUsed != 0) { - auto i = (pr_blockIndexFront - pr_blockIndexSlotsUsed) & prevBlockSizeMask; - do { - newBlockIndexEntries[j++] = pr_blockIndexEntries[i]; - i = (i + 1) & prevBlockSizeMask; - } while (i != pr_blockIndexFront); - } - - // Update everything - auto header = new (newRawPtr) BlockIndexHeader; - header->size = pr_blockIndexSize; - header->front.store(numberOfFilledSlotsToExpose - 1, std::memory_order_relaxed); - header->entries = newBlockIndexEntries; - header->prev = pr_blockIndexRaw; // we link the new block to the old one so we can free it later - - pr_blockIndexFront = j; - pr_blockIndexEntries = newBlockIndexEntries; - pr_blockIndexRaw = newRawPtr; - blockIndex.store(header, std::memory_order_release); - - return true; - } - - private: - std::atomic blockIndex; - - // To be used by producer only -- consumer must use the ones in referenced by blockIndex - size_t pr_blockIndexSlotsUsed; - size_t pr_blockIndexSize; - size_t pr_blockIndexFront; // Next slot (not current) - BlockIndexEntry* pr_blockIndexEntries; - void* pr_blockIndexRaw; - -#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG - public: - ExplicitProducer* nextExplicitProducer; - private: -#endif - -#if MCDBGQ_TRACKMEM - friend struct MemStats; -#endif - }; - - - ////////////////////////////////// - // Implicit queue - ////////////////////////////////// - - struct ImplicitProducer : public ProducerBase - { - ImplicitProducer(ConcurrentQueue* parent) : - ProducerBase(parent, false), - nextBlockIndexCapacity(IMPLICIT_INITIAL_INDEX_SIZE), - blockIndex(nullptr) - { - new_block_index(); - } - - ~ImplicitProducer() - { - // Note that since we're in the destructor we can assume that all enqueue/dequeue operations - // completed already; this means that all undequeued elements are placed contiguously across - // contiguous blocks, and that only the first and last remaining blocks can be only partially - // empty (all other remaining blocks must be completely full). - -#ifdef MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED - // Unregister ourselves for thread termination notification - if (!this->inactive.load(std::memory_order_relaxed)) { - details::ThreadExitNotifier::unsubscribe(&threadExitListener); - } -#endif - - // Destroy all remaining elements! - auto tail = this->tailIndex.load(std::memory_order_relaxed); - auto index = this->headIndex.load(std::memory_order_relaxed); - Block* block = nullptr; - assert(index == tail || details::circular_less_than(index, tail)); - bool forceFreeLastBlock = index != tail; // If we enter the loop, then the last (tail) block will not be freed - while (index != tail) { - if ((index & static_cast(BLOCK_SIZE - 1)) == 0 || block == nullptr) { - if (block != nullptr && block->dynamicallyAllocated) { - // Free the old block - this->parent->destroy(block); - } - - block = get_block_index_entry_for_index(index)->value.load(std::memory_order_relaxed); - } - - ((*block)[index])->~T(); - ++index; - } - // Even if the queue is empty, there's still one block that's not on the free list - // (unless the head index reached the end of it, in which case the tail will be poised - // to create a new block). - if (this->tailBlock != nullptr && (forceFreeLastBlock || (tail & static_cast(BLOCK_SIZE - 1)) != 0) && this->tailBlock->dynamicallyAllocated) { - this->parent->destroy(this->tailBlock); - } - - // Destroy block index - auto localBlockIndex = blockIndex.load(std::memory_order_relaxed); - if (localBlockIndex != nullptr) { - for (size_t i = 0; i != localBlockIndex->capacity; ++i) { - localBlockIndex->index[i]->~BlockIndexEntry(); - } - do { - auto prev = localBlockIndex->prev; - localBlockIndex->~BlockIndexHeader(); - Traits::free(localBlockIndex); - localBlockIndex = prev; - } while (localBlockIndex != nullptr); - } - } - - template - inline bool enqueue(U&& element) - { - index_t currentTailIndex = this->tailIndex.load(std::memory_order_relaxed); - index_t newTailIndex = 1 + currentTailIndex; - if ((currentTailIndex & static_cast(BLOCK_SIZE - 1)) == 0) { - // We reached the end of a block, start a new one - auto head = this->headIndex.load(std::memory_order_relaxed); - assert(!details::circular_less_than(currentTailIndex, head)); - if (!details::circular_less_than(head, currentTailIndex + BLOCK_SIZE) || (MAX_SUBQUEUE_SIZE != details::const_numeric_max::value && (MAX_SUBQUEUE_SIZE == 0 || MAX_SUBQUEUE_SIZE - BLOCK_SIZE < currentTailIndex - head))) { - return false; - } -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX - debug::DebugLock lock(mutex); -#endif - // Find out where we'll be inserting this block in the block index - BlockIndexEntry* idxEntry; - if (!insert_block_index_entry(idxEntry, currentTailIndex)) { - return false; - } - - // Get ahold of a new block - auto newBlock = this->parent->ConcurrentQueue::template requisition_block(); - if (newBlock == nullptr) { - rewind_block_index_tail(); - idxEntry->value.store(nullptr, std::memory_order_relaxed); - return false; - } -#if MCDBGQ_TRACKMEM - newBlock->owner = this; -#endif - newBlock->ConcurrentQueue::Block::template reset_empty(); - - if (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new (nullptr) T(std::forward(element)))) { - // May throw, try to insert now before we publish the fact that we have this new block - MOODYCAMEL_TRY { - new ((*newBlock)[currentTailIndex]) T(std::forward(element)); - } - MOODYCAMEL_CATCH (...) { - rewind_block_index_tail(); - idxEntry->value.store(nullptr, std::memory_order_relaxed); - this->parent->add_block_to_free_list(newBlock); - MOODYCAMEL_RETHROW; - } - } - - // Insert the new block into the index - idxEntry->value.store(newBlock, std::memory_order_relaxed); - - this->tailBlock = newBlock; - - if (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new (nullptr) T(std::forward(element)))) { - this->tailIndex.store(newTailIndex, std::memory_order_release); - return true; - } - } - - // Enqueue - new ((*this->tailBlock)[currentTailIndex]) T(std::forward(element)); - - this->tailIndex.store(newTailIndex, std::memory_order_release); - return true; - } - - template - bool dequeue(U& element) - { - // See ExplicitProducer::dequeue for rationale and explanation - index_t tail = this->tailIndex.load(std::memory_order_relaxed); - index_t overcommit = this->dequeueOvercommit.load(std::memory_order_relaxed); - if (details::circular_less_than(this->dequeueOptimisticCount.load(std::memory_order_relaxed) - overcommit, tail)) { - std::atomic_thread_fence(std::memory_order_acquire); - - index_t myDequeueCount = this->dequeueOptimisticCount.fetch_add(1, std::memory_order_relaxed); - assert(overcommit <= myDequeueCount); - tail = this->tailIndex.load(std::memory_order_acquire); - if (details::likely(details::circular_less_than(myDequeueCount - overcommit, tail))) { - index_t index = this->headIndex.fetch_add(1, std::memory_order_acq_rel); - - // Determine which block the element is in - auto entry = get_block_index_entry_for_index(index); - - // Dequeue - auto block = entry->value.load(std::memory_order_relaxed); - auto& el = *((*block)[index]); - - if (!MOODYCAMEL_NOEXCEPT_ASSIGN(T, T&&, element = std::move(el))) { -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX - // Note: Acquiring the mutex with every dequeue instead of only when a block - // is released is very sub-optimal, but it is, after all, purely debug code. - debug::DebugLock lock(producer->mutex); -#endif - struct Guard { - Block* block; - index_t index; - BlockIndexEntry* entry; - ConcurrentQueue* parent; - - ~Guard() - { - (*block)[index]->~T(); - if (block->ConcurrentQueue::Block::template set_empty(index)) { - entry->value.store(nullptr, std::memory_order_relaxed); - parent->add_block_to_free_list(block); - } - } - } guard = { block, index, entry, this->parent }; - - element = std::move(el); - } - else { - element = std::move(el); - el.~T(); - - if (block->ConcurrentQueue::Block::template set_empty(index)) { - { -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX - debug::DebugLock lock(mutex); -#endif - // Add the block back into the global free pool (and remove from block index) - entry->value.store(nullptr, std::memory_order_relaxed); - } - this->parent->add_block_to_free_list(block); // releases the above store - } - } - - return true; - } - else { - this->dequeueOvercommit.fetch_add(1, std::memory_order_release); - } - } - - return false; - } - - template - bool enqueue_bulk(It itemFirst, size_t count) - { - // First, we need to make sure we have enough room to enqueue all of the elements; - // this means pre-allocating blocks and putting them in the block index (but only if - // all the allocations succeeded). - - // Note that the tailBlock we start off with may not be owned by us any more; - // this happens if it was filled up exactly to the top (setting tailIndex to - // the first index of the next block which is not yet allocated), then dequeued - // completely (putting it on the free list) before we enqueue again. - - index_t startTailIndex = this->tailIndex.load(std::memory_order_relaxed); - auto startBlock = this->tailBlock; - Block* firstAllocatedBlock = nullptr; - auto endBlock = this->tailBlock; - - // Figure out how many blocks we'll need to allocate, and do so - size_t blockBaseDiff = ((startTailIndex + count - 1) & ~static_cast(BLOCK_SIZE - 1)) - ((startTailIndex - 1) & ~static_cast(BLOCK_SIZE - 1)); - index_t currentTailIndex = (startTailIndex - 1) & ~static_cast(BLOCK_SIZE - 1); - if (blockBaseDiff > 0) { -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX - debug::DebugLock lock(mutex); -#endif - do { - blockBaseDiff -= static_cast(BLOCK_SIZE); - currentTailIndex += static_cast(BLOCK_SIZE); - - // Find out where we'll be inserting this block in the block index - BlockIndexEntry* idxEntry; - Block* newBlock; - bool indexInserted = false; - auto head = this->headIndex.load(std::memory_order_relaxed); - assert(!details::circular_less_than(currentTailIndex, head)); - bool full = !details::circular_less_than(head, currentTailIndex + BLOCK_SIZE) || (MAX_SUBQUEUE_SIZE != details::const_numeric_max::value && (MAX_SUBQUEUE_SIZE == 0 || MAX_SUBQUEUE_SIZE - BLOCK_SIZE < currentTailIndex - head)); - if (full || !(indexInserted = insert_block_index_entry(idxEntry, currentTailIndex)) || (newBlock = this->parent->ConcurrentQueue::template requisition_block()) == nullptr) { - // Index allocation or block allocation failed; revert any other allocations - // and index insertions done so far for this operation - if (indexInserted) { - rewind_block_index_tail(); - idxEntry->value.store(nullptr, std::memory_order_relaxed); - } - currentTailIndex = (startTailIndex - 1) & ~static_cast(BLOCK_SIZE - 1); - for (auto block = firstAllocatedBlock; block != nullptr; block = block->next) { - currentTailIndex += static_cast(BLOCK_SIZE); - idxEntry = get_block_index_entry_for_index(currentTailIndex); - idxEntry->value.store(nullptr, std::memory_order_relaxed); - rewind_block_index_tail(); - } - this->parent->add_blocks_to_free_list(firstAllocatedBlock); - this->tailBlock = startBlock; - - return false; - } - -#if MCDBGQ_TRACKMEM - newBlock->owner = this; -#endif - newBlock->ConcurrentQueue::Block::template reset_empty(); - newBlock->next = nullptr; - - // Insert the new block into the index - idxEntry->value.store(newBlock, std::memory_order_relaxed); - - // Store the chain of blocks so that we can undo if later allocations fail, - // and so that we can find the blocks when we do the actual enqueueing - if ((startTailIndex & static_cast(BLOCK_SIZE - 1)) != 0 || firstAllocatedBlock != nullptr) { - assert(this->tailBlock != nullptr); - this->tailBlock->next = newBlock; - } - this->tailBlock = newBlock; - endBlock = newBlock; - firstAllocatedBlock = firstAllocatedBlock == nullptr ? newBlock : firstAllocatedBlock; - } while (blockBaseDiff > 0); - } - - // Enqueue, one block at a time - index_t newTailIndex = startTailIndex + static_cast(count); - currentTailIndex = startTailIndex; - this->tailBlock = startBlock; - assert((startTailIndex & static_cast(BLOCK_SIZE - 1)) != 0 || firstAllocatedBlock != nullptr || count == 0); - if ((startTailIndex & static_cast(BLOCK_SIZE - 1)) == 0 && firstAllocatedBlock != nullptr) { - this->tailBlock = firstAllocatedBlock; - } - while (true) { - auto stopIndex = (currentTailIndex & ~static_cast(BLOCK_SIZE - 1)) + static_cast(BLOCK_SIZE); - if (details::circular_less_than(newTailIndex, stopIndex)) { - stopIndex = newTailIndex; - } - if (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (nullptr) T(details::deref_noexcept(itemFirst)))) { - while (currentTailIndex != stopIndex) { - new ((*this->tailBlock)[currentTailIndex++]) T(*itemFirst++); - } - } - else { - MOODYCAMEL_TRY { - while (currentTailIndex != stopIndex) { - new ((*this->tailBlock)[currentTailIndex]) T(details::nomove_if<(bool)!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (nullptr) T(details::deref_noexcept(itemFirst)))>::eval(*itemFirst)); - ++currentTailIndex; - ++itemFirst; - } - } - MOODYCAMEL_CATCH (...) { - auto constructedStopIndex = currentTailIndex; - auto lastBlockEnqueued = this->tailBlock; - - if (!details::is_trivially_destructible::value) { - auto block = startBlock; - if ((startTailIndex & static_cast(BLOCK_SIZE - 1)) == 0) { - block = firstAllocatedBlock; - } - currentTailIndex = startTailIndex; - while (true) { - auto stopIndex = (currentTailIndex & ~static_cast(BLOCK_SIZE - 1)) + static_cast(BLOCK_SIZE); - if (details::circular_less_than(constructedStopIndex, stopIndex)) { - stopIndex = constructedStopIndex; - } - while (currentTailIndex != stopIndex) { - (*block)[currentTailIndex++]->~T(); - } - if (block == lastBlockEnqueued) { - break; - } - block = block->next; - } - } - - currentTailIndex = (startTailIndex - 1) & ~static_cast(BLOCK_SIZE - 1); - for (auto block = firstAllocatedBlock; block != nullptr; block = block->next) { - currentTailIndex += static_cast(BLOCK_SIZE); - auto idxEntry = get_block_index_entry_for_index(currentTailIndex); - idxEntry->value.store(nullptr, std::memory_order_relaxed); - rewind_block_index_tail(); - } - this->parent->add_blocks_to_free_list(firstAllocatedBlock); - this->tailBlock = startBlock; - MOODYCAMEL_RETHROW; - } - } - - if (this->tailBlock == endBlock) { - assert(currentTailIndex == newTailIndex); - break; - } - this->tailBlock = this->tailBlock->next; - } - this->tailIndex.store(newTailIndex, std::memory_order_release); - return true; - } - - template - size_t dequeue_bulk(It& itemFirst, size_t max) - { - auto tail = this->tailIndex.load(std::memory_order_relaxed); - auto overcommit = this->dequeueOvercommit.load(std::memory_order_relaxed); - auto desiredCount = static_cast(tail - (this->dequeueOptimisticCount.load(std::memory_order_relaxed) - overcommit)); - if (details::circular_less_than(0, desiredCount)) { - desiredCount = desiredCount < max ? desiredCount : max; - std::atomic_thread_fence(std::memory_order_acquire); - - auto myDequeueCount = this->dequeueOptimisticCount.fetch_add(desiredCount, std::memory_order_relaxed); - assert(overcommit <= myDequeueCount); - - tail = this->tailIndex.load(std::memory_order_acquire); - auto actualCount = static_cast(tail - (myDequeueCount - overcommit)); - if (details::circular_less_than(0, actualCount)) { - actualCount = desiredCount < actualCount ? desiredCount : actualCount; - if (actualCount < desiredCount) { - this->dequeueOvercommit.fetch_add(desiredCount - actualCount, std::memory_order_release); - } - - // Get the first index. Note that since there's guaranteed to be at least actualCount elements, this - // will never exceed tail. - auto firstIndex = this->headIndex.fetch_add(actualCount, std::memory_order_acq_rel); - - // Iterate the blocks and dequeue - auto index = firstIndex; - BlockIndexHeader* localBlockIndex; - auto indexIndex = get_block_index_index_for_index(index, localBlockIndex); - do { - auto blockStartIndex = index; - auto endIndex = (index & ~static_cast(BLOCK_SIZE - 1)) + static_cast(BLOCK_SIZE); - endIndex = details::circular_less_than(firstIndex + static_cast(actualCount), endIndex) ? firstIndex + static_cast(actualCount) : endIndex; - - auto entry = localBlockIndex->index[indexIndex]; - auto block = entry->value.load(std::memory_order_relaxed); - if (MOODYCAMEL_NOEXCEPT_ASSIGN(T, T&&, details::deref_noexcept(itemFirst) = std::move((*(*block)[index])))) { - while (index != endIndex) { - auto& el = *((*block)[index]); - *itemFirst++ = std::move(el); - el.~T(); - ++index; - } - } - else { - MOODYCAMEL_TRY { - while (index != endIndex) { - auto& el = *((*block)[index]); - *itemFirst = std::move(el); - ++itemFirst; - el.~T(); - ++index; - } - } - MOODYCAMEL_CATCH (...) { - do { - entry = localBlockIndex->index[indexIndex]; - block = entry->value.load(std::memory_order_relaxed); - while (index != endIndex) { - (*block)[index++]->~T(); - } - - if (block->ConcurrentQueue::Block::template set_many_empty(blockStartIndex, static_cast(endIndex - blockStartIndex))) { -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX - debug::DebugLock lock(mutex); -#endif - entry->value.store(nullptr, std::memory_order_relaxed); - this->parent->add_block_to_free_list(block); - } - indexIndex = (indexIndex + 1) & (localBlockIndex->capacity - 1); - - blockStartIndex = index; - endIndex = (index & ~static_cast(BLOCK_SIZE - 1)) + static_cast(BLOCK_SIZE); - endIndex = details::circular_less_than(firstIndex + static_cast(actualCount), endIndex) ? firstIndex + static_cast(actualCount) : endIndex; - } while (index != firstIndex + actualCount); - - MOODYCAMEL_RETHROW; - } - } - if (block->ConcurrentQueue::Block::template set_many_empty(blockStartIndex, static_cast(endIndex - blockStartIndex))) { - { -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX - debug::DebugLock lock(mutex); -#endif - // Note that the set_many_empty above did a release, meaning that anybody who acquires the block - // we're about to free can use it safely since our writes (and reads!) will have happened-before then. - entry->value.store(nullptr, std::memory_order_relaxed); - } - this->parent->add_block_to_free_list(block); // releases the above store - } - indexIndex = (indexIndex + 1) & (localBlockIndex->capacity - 1); - } while (index != firstIndex + actualCount); - - return actualCount; - } - else { - this->dequeueOvercommit.fetch_add(desiredCount, std::memory_order_release); - } - } - - return 0; - } - - private: - // The block size must be > 1, so any number with the low bit set is an invalid block base index - static const index_t INVALID_BLOCK_BASE = 1; - - struct BlockIndexEntry - { - std::atomic key; - std::atomic value; - }; - - struct BlockIndexHeader - { - size_t capacity; - std::atomic tail; - BlockIndexEntry* entries; - BlockIndexEntry** index; - BlockIndexHeader* prev; - }; - - template - inline bool insert_block_index_entry(BlockIndexEntry*& idxEntry, index_t blockStartIndex) - { - auto localBlockIndex = blockIndex.load(std::memory_order_relaxed); // We're the only writer thread, relaxed is OK - auto newTail = (localBlockIndex->tail.load(std::memory_order_relaxed) + 1) & (localBlockIndex->capacity - 1); - idxEntry = localBlockIndex->index[newTail]; - if (idxEntry->key.load(std::memory_order_relaxed) == INVALID_BLOCK_BASE || - idxEntry->value.load(std::memory_order_relaxed) == nullptr) { - - idxEntry->key.store(blockStartIndex, std::memory_order_relaxed); - localBlockIndex->tail.store(newTail, std::memory_order_release); - return true; - } - - // No room in the old block index, try to allocate another one! - if (allocMode == CannotAlloc || !new_block_index()) { - return false; - } - localBlockIndex = blockIndex.load(std::memory_order_relaxed); - newTail = (localBlockIndex->tail.load(std::memory_order_relaxed) + 1) & (localBlockIndex->capacity - 1); - idxEntry = localBlockIndex->index[newTail]; - assert(idxEntry->key.load(std::memory_order_relaxed) == INVALID_BLOCK_BASE); - idxEntry->key.store(blockStartIndex, std::memory_order_relaxed); - localBlockIndex->tail.store(newTail, std::memory_order_release); - return true; - } - - inline void rewind_block_index_tail() - { - auto localBlockIndex = blockIndex.load(std::memory_order_relaxed); - localBlockIndex->tail.store((localBlockIndex->tail.load(std::memory_order_relaxed) - 1) & (localBlockIndex->capacity - 1), std::memory_order_relaxed); - } - - inline BlockIndexEntry* get_block_index_entry_for_index(index_t index) const - { - BlockIndexHeader* localBlockIndex; - auto idx = get_block_index_index_for_index(index, localBlockIndex); - return localBlockIndex->index[idx]; - } - - inline size_t get_block_index_index_for_index(index_t index, BlockIndexHeader*& localBlockIndex) const - { -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX - debug::DebugLock lock(mutex); -#endif - index &= ~static_cast(BLOCK_SIZE - 1); - localBlockIndex = blockIndex.load(std::memory_order_acquire); - auto tail = localBlockIndex->tail.load(std::memory_order_acquire); - auto tailBase = localBlockIndex->index[tail]->key.load(std::memory_order_relaxed); - assert(tailBase != INVALID_BLOCK_BASE); - // Note: Must use division instead of shift because the index may wrap around, causing a negative - // offset, whose negativity we want to preserve - auto offset = static_cast(static_cast::type>(index - tailBase) / BLOCK_SIZE); - size_t idx = (tail + offset) & (localBlockIndex->capacity - 1); - assert(localBlockIndex->index[idx]->key.load(std::memory_order_relaxed) == index && localBlockIndex->index[idx]->value.load(std::memory_order_relaxed) != nullptr); - return idx; - } - - bool new_block_index() - { - auto prev = blockIndex.load(std::memory_order_relaxed); - size_t prevCapacity = prev == nullptr ? 0 : prev->capacity; - auto entryCount = prev == nullptr ? nextBlockIndexCapacity : prevCapacity; - auto raw = static_cast(Traits::malloc( - sizeof(BlockIndexHeader) + - std::alignment_of::value - 1 + sizeof(BlockIndexEntry) * entryCount + - std::alignment_of::value - 1 + sizeof(BlockIndexEntry*) * nextBlockIndexCapacity)); - if (raw == nullptr) { - return false; - } - - auto header = new (raw) BlockIndexHeader; - auto entries = reinterpret_cast(details::align_for(raw + sizeof(BlockIndexHeader))); - auto index = reinterpret_cast(details::align_for(reinterpret_cast(entries) + sizeof(BlockIndexEntry) * entryCount)); - if (prev != nullptr) { - auto prevTail = prev->tail.load(std::memory_order_relaxed); - auto prevPos = prevTail; - size_t i = 0; - do { - prevPos = (prevPos + 1) & (prev->capacity - 1); - index[i++] = prev->index[prevPos]; - } while (prevPos != prevTail); - assert(i == prevCapacity); - } - for (size_t i = 0; i != entryCount; ++i) { - new (entries + i) BlockIndexEntry; - entries[i].key.store(INVALID_BLOCK_BASE, std::memory_order_relaxed); - index[prevCapacity + i] = entries + i; - } - header->prev = prev; - header->entries = entries; - header->index = index; - header->capacity = nextBlockIndexCapacity; - header->tail.store((prevCapacity - 1) & (nextBlockIndexCapacity - 1), std::memory_order_relaxed); - - blockIndex.store(header, std::memory_order_release); - - nextBlockIndexCapacity <<= 1; - - return true; - } - - private: - size_t nextBlockIndexCapacity; - std::atomic blockIndex; - -#ifdef MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED - public: - details::ThreadExitListener threadExitListener; - private: -#endif - -#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG - public: - ImplicitProducer* nextImplicitProducer; - private: -#endif - -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX - mutable debug::DebugMutex mutex; -#endif -#if MCDBGQ_TRACKMEM - friend struct MemStats; -#endif - }; - - - ////////////////////////////////// - // Block pool manipulation - ////////////////////////////////// - - void populate_initial_block_list(size_t blockCount) - { - initialBlockPoolSize = blockCount; - if (initialBlockPoolSize == 0) { - initialBlockPool = nullptr; - return; - } - - initialBlockPool = create_array(blockCount); - if (initialBlockPool == nullptr) { - initialBlockPoolSize = 0; - } - for (size_t i = 0; i < initialBlockPoolSize; ++i) { - initialBlockPool[i].dynamicallyAllocated = false; - } - } - - inline Block* try_get_block_from_initial_pool() - { - if (initialBlockPoolIndex.load(std::memory_order_relaxed) >= initialBlockPoolSize) { - return nullptr; - } - - auto index = initialBlockPoolIndex.fetch_add(1, std::memory_order_relaxed); - - return index < initialBlockPoolSize ? (initialBlockPool + index) : nullptr; - } - - inline void add_block_to_free_list(Block* block) - { -#if MCDBGQ_TRACKMEM - block->owner = nullptr; -#endif - freeList.add(block); - } - - inline void add_blocks_to_free_list(Block* block) - { - while (block != nullptr) { - auto next = block->next; - add_block_to_free_list(block); - block = next; - } - } - - inline Block* try_get_block_from_free_list() - { - return freeList.try_get(); - } - - // Gets a free block from one of the memory pools, or allocates a new one (if applicable) - template - Block* requisition_block() - { - auto block = try_get_block_from_initial_pool(); - if (block != nullptr) { - return block; - } - - block = try_get_block_from_free_list(); - if (block != nullptr) { - return block; - } - - if (canAlloc == CanAlloc) { - return create(); - } - - return nullptr; - } - - -#if MCDBGQ_TRACKMEM - public: - struct MemStats { - size_t allocatedBlocks; - size_t usedBlocks; - size_t freeBlocks; - size_t ownedBlocksExplicit; - size_t ownedBlocksImplicit; - size_t implicitProducers; - size_t explicitProducers; - size_t elementsEnqueued; - size_t blockClassBytes; - size_t queueClassBytes; - size_t implicitBlockIndexBytes; - size_t explicitBlockIndexBytes; - - friend class ConcurrentQueue; - - private: - static MemStats getFor(ConcurrentQueue* q) - { - MemStats stats = { 0 }; - - stats.elementsEnqueued = q->size_approx(); - - auto block = q->freeList.head_unsafe(); - while (block != nullptr) { - ++stats.allocatedBlocks; - ++stats.freeBlocks; - block = block->freeListNext.load(std::memory_order_relaxed); - } - - for (auto ptr = q->producerListTail.load(std::memory_order_acquire); ptr != nullptr; ptr = ptr->next_prod()) { - bool implicit = dynamic_cast(ptr) != nullptr; - stats.implicitProducers += implicit ? 1 : 0; - stats.explicitProducers += implicit ? 0 : 1; - - if (implicit) { - auto prod = static_cast(ptr); - stats.queueClassBytes += sizeof(ImplicitProducer); - auto head = prod->headIndex.load(std::memory_order_relaxed); - auto tail = prod->tailIndex.load(std::memory_order_relaxed); - auto hash = prod->blockIndex.load(std::memory_order_relaxed); - if (hash != nullptr) { - for (size_t i = 0; i != hash->capacity; ++i) { - if (hash->index[i]->key.load(std::memory_order_relaxed) != ImplicitProducer::INVALID_BLOCK_BASE && hash->index[i]->value.load(std::memory_order_relaxed) != nullptr) { - ++stats.allocatedBlocks; - ++stats.ownedBlocksImplicit; - } - } - stats.implicitBlockIndexBytes += hash->capacity * sizeof(typename ImplicitProducer::BlockIndexEntry); - for (; hash != nullptr; hash = hash->prev) { - stats.implicitBlockIndexBytes += sizeof(typename ImplicitProducer::BlockIndexHeader) + hash->capacity * sizeof(typename ImplicitProducer::BlockIndexEntry*); - } - } - for (; details::circular_less_than(head, tail); head += BLOCK_SIZE) { - //auto block = prod->get_block_index_entry_for_index(head); - ++stats.usedBlocks; - } - } - else { - auto prod = static_cast(ptr); - stats.queueClassBytes += sizeof(ExplicitProducer); - auto tailBlock = prod->tailBlock; - bool wasNonEmpty = false; - if (tailBlock != nullptr) { - auto block = tailBlock; - do { - ++stats.allocatedBlocks; - if (!block->ConcurrentQueue::Block::template is_empty() || wasNonEmpty) { - ++stats.usedBlocks; - wasNonEmpty = wasNonEmpty || block != tailBlock; - } - ++stats.ownedBlocksExplicit; - block = block->next; - } while (block != tailBlock); - } - auto index = prod->blockIndex.load(std::memory_order_relaxed); - while (index != nullptr) { - stats.explicitBlockIndexBytes += sizeof(typename ExplicitProducer::BlockIndexHeader) + index->size * sizeof(typename ExplicitProducer::BlockIndexEntry); - index = static_cast(index->prev); - } - } - } - - auto freeOnInitialPool = q->initialBlockPoolIndex.load(std::memory_order_relaxed) >= q->initialBlockPoolSize ? 0 : q->initialBlockPoolSize - q->initialBlockPoolIndex.load(std::memory_order_relaxed); - stats.allocatedBlocks += freeOnInitialPool; - stats.freeBlocks += freeOnInitialPool; - - stats.blockClassBytes = sizeof(Block) * stats.allocatedBlocks; - stats.queueClassBytes += sizeof(ConcurrentQueue); - - return stats; - } - }; - - // For debugging only. Not thread-safe. - MemStats getMemStats() - { - return MemStats::getFor(this); - } - private: - friend struct MemStats; -#endif - - - ////////////////////////////////// - // Producer list manipulation - ////////////////////////////////// - - ProducerBase* recycle_or_create_producer(bool isExplicit) - { - bool recycled; - return recycle_or_create_producer(isExplicit, recycled); - } - - ProducerBase* recycle_or_create_producer(bool isExplicit, bool& recycled) - { -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODHASH - debug::DebugLock lock(implicitProdMutex); -#endif - // Try to re-use one first - for (auto ptr = producerListTail.load(std::memory_order_acquire); ptr != nullptr; ptr = ptr->next_prod()) { - if (ptr->inactive.load(std::memory_order_relaxed) && ptr->isExplicit == isExplicit) { - bool expected = true; - if (ptr->inactive.compare_exchange_strong(expected, /* desired */ false, std::memory_order_acquire, std::memory_order_relaxed)) { - // We caught one! It's been marked as activated, the caller can have it - recycled = true; - return ptr; - } - } - } - - recycled = false; - return add_producer(isExplicit ? static_cast(create(this)) : create(this)); - } - - ProducerBase* add_producer(ProducerBase* producer) - { - // Handle failed memory allocation - if (producer == nullptr) { - return nullptr; - } - - producerCount.fetch_add(1, std::memory_order_relaxed); - - // Add it to the lock-free list - auto prevTail = producerListTail.load(std::memory_order_relaxed); - do { - producer->next = prevTail; - } while (!producerListTail.compare_exchange_weak(prevTail, producer, std::memory_order_release, std::memory_order_relaxed)); - -#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG - if (producer->isExplicit) { - auto prevTailExplicit = explicitProducers.load(std::memory_order_relaxed); - do { - static_cast(producer)->nextExplicitProducer = prevTailExplicit; - } while (!explicitProducers.compare_exchange_weak(prevTailExplicit, static_cast(producer), std::memory_order_release, std::memory_order_relaxed)); - } - else { - auto prevTailImplicit = implicitProducers.load(std::memory_order_relaxed); - do { - static_cast(producer)->nextImplicitProducer = prevTailImplicit; - } while (!implicitProducers.compare_exchange_weak(prevTailImplicit, static_cast(producer), std::memory_order_release, std::memory_order_relaxed)); - } -#endif - - return producer; - } - - void reown_producers() - { - // After another instance is moved-into/swapped-with this one, all the - // producers we stole still think their parents are the other queue. - // So fix them up! - for (auto ptr = producerListTail.load(std::memory_order_relaxed); ptr != nullptr; ptr = ptr->next_prod()) { - ptr->parent = this; - } - } - - - ////////////////////////////////// - // Implicit producer hash - ////////////////////////////////// - - struct ImplicitProducerKVP - { - std::atomic key; - ImplicitProducer* value; // No need for atomicity since it's only read by the thread that sets it in the first place - - ImplicitProducerKVP() { } - - ImplicitProducerKVP(ImplicitProducerKVP&& other) MOODYCAMEL_NOEXCEPT - { - key.store(other.key.load(std::memory_order_relaxed), std::memory_order_relaxed); - value = other.value; - } - - inline ImplicitProducerKVP& operator=(ImplicitProducerKVP&& other) MOODYCAMEL_NOEXCEPT - { - swap(other); - return *this; - } - - inline void swap(ImplicitProducerKVP& other) MOODYCAMEL_NOEXCEPT - { - if (this != &other) { - details::swap_relaxed(key, other.key); - std::swap(value, other.value); - } - } - }; - - template - friend void moodycamel::swap(typename ConcurrentQueue::ImplicitProducerKVP&, typename ConcurrentQueue::ImplicitProducerKVP&) MOODYCAMEL_NOEXCEPT; - - struct ImplicitProducerHash - { - size_t capacity; - ImplicitProducerKVP* entries; - ImplicitProducerHash* prev; - }; - - inline void populate_initial_implicit_producer_hash() - { - if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return; - - implicitProducerHashCount.store(0, std::memory_order_relaxed); - auto hash = &initialImplicitProducerHash; - hash->capacity = INITIAL_IMPLICIT_PRODUCER_HASH_SIZE; - hash->entries = &initialImplicitProducerHashEntries[0]; - for (size_t i = 0; i != INITIAL_IMPLICIT_PRODUCER_HASH_SIZE; ++i) { - initialImplicitProducerHashEntries[i].key.store(details::invalid_thread_id, std::memory_order_relaxed); - } - hash->prev = nullptr; - implicitProducerHash.store(hash, std::memory_order_relaxed); - } - - void swap_implicit_producer_hashes(ConcurrentQueue& other) - { - if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return; - - // Swap (assumes our implicit producer hash is initialized) - initialImplicitProducerHashEntries.swap(other.initialImplicitProducerHashEntries); - initialImplicitProducerHash.entries = &initialImplicitProducerHashEntries[0]; - other.initialImplicitProducerHash.entries = &other.initialImplicitProducerHashEntries[0]; - - details::swap_relaxed(implicitProducerHashCount, other.implicitProducerHashCount); - - details::swap_relaxed(implicitProducerHash, other.implicitProducerHash); - if (implicitProducerHash.load(std::memory_order_relaxed) == &other.initialImplicitProducerHash) { - implicitProducerHash.store(&initialImplicitProducerHash, std::memory_order_relaxed); - } - else { - ImplicitProducerHash* hash; - for (hash = implicitProducerHash.load(std::memory_order_relaxed); hash->prev != &other.initialImplicitProducerHash; hash = hash->prev) { - continue; - } - hash->prev = &initialImplicitProducerHash; - } - if (other.implicitProducerHash.load(std::memory_order_relaxed) == &initialImplicitProducerHash) { - other.implicitProducerHash.store(&other.initialImplicitProducerHash, std::memory_order_relaxed); - } - else { - ImplicitProducerHash* hash; - for (hash = other.implicitProducerHash.load(std::memory_order_relaxed); hash->prev != &initialImplicitProducerHash; hash = hash->prev) { - continue; - } - hash->prev = &other.initialImplicitProducerHash; - } - } - - // Only fails (returns nullptr) if memory allocation fails - ImplicitProducer* get_or_add_implicit_producer() - { - // Note that since the data is essentially thread-local (key is thread ID), - // there's a reduced need for fences (memory ordering is already consistent - // for any individual thread), except for the current table itself. - - // Start by looking for the thread ID in the current and all previous hash tables. - // If it's not found, it must not be in there yet, since this same thread would - // have added it previously to one of the tables that we traversed. - - // Code and algorithm adapted from http://preshing.com/20130605/the-worlds-simplest-lock-free-hash-table - -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODHASH - debug::DebugLock lock(implicitProdMutex); -#endif - - auto id = details::thread_id(); - auto hashedId = details::hash_thread_id(id); - - auto mainHash = implicitProducerHash.load(std::memory_order_acquire); - for (auto hash = mainHash; hash != nullptr; hash = hash->prev) { - // Look for the id in this hash - auto index = hashedId; - while (true) { // Not an infinite loop because at least one slot is free in the hash table - index &= hash->capacity - 1; - - auto probedKey = hash->entries[index].key.load(std::memory_order_relaxed); - if (probedKey == id) { - // Found it! If we had to search several hashes deep, though, we should lazily add it - // to the current main hash table to avoid the extended search next time. - // Note there's guaranteed to be room in the current hash table since every subsequent - // table implicitly reserves space for all previous tables (there's only one - // implicitProducerHashCount). - auto value = hash->entries[index].value; - if (hash != mainHash) { - index = hashedId; - while (true) { - index &= mainHash->capacity - 1; - probedKey = mainHash->entries[index].key.load(std::memory_order_relaxed); - auto empty = details::invalid_thread_id; -#ifdef MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED - auto reusable = details::invalid_thread_id2; - if ((probedKey == empty && mainHash->entries[index].key.compare_exchange_strong(empty, id, std::memory_order_relaxed)) || - (probedKey == reusable && mainHash->entries[index].key.compare_exchange_strong(reusable, id, std::memory_order_acquire))) { -#else - if ((probedKey == empty && mainHash->entries[index].key.compare_exchange_strong(empty, id, std::memory_order_relaxed))) { -#endif - mainHash->entries[index].value = value; - break; - } - ++index; - } - } - - return value; - } - if (probedKey == details::invalid_thread_id) { - break; // Not in this hash table - } - ++index; - } - } - - // Insert! - auto newCount = 1 + implicitProducerHashCount.fetch_add(1, std::memory_order_relaxed); - while (true) { - if (newCount >= (mainHash->capacity >> 1) && !implicitProducerHashResizeInProgress.test_and_set(std::memory_order_acquire)) { - // We've acquired the resize lock, try to allocate a bigger hash table. - // Note the acquire fence synchronizes with the release fence at the end of this block, and hence when - // we reload implicitProducerHash it must be the most recent version (it only gets changed within this - // locked block). - mainHash = implicitProducerHash.load(std::memory_order_acquire); - if (newCount >= (mainHash->capacity >> 1)) { - auto newCapacity = mainHash->capacity << 1; - while (newCount >= (newCapacity >> 1)) { - newCapacity <<= 1; - } - auto raw = static_cast(Traits::malloc(sizeof(ImplicitProducerHash) + std::alignment_of::value - 1 + sizeof(ImplicitProducerKVP) * newCapacity)); - if (raw == nullptr) { - // Allocation failed - implicitProducerHashCount.fetch_add(-1, std::memory_order_relaxed); - implicitProducerHashResizeInProgress.clear(std::memory_order_relaxed); - return nullptr; - } - - auto newHash = new (raw) ImplicitProducerHash; - newHash->capacity = newCapacity; - newHash->entries = reinterpret_cast(details::align_for(raw + sizeof(ImplicitProducerHash))); - for (size_t i = 0; i != newCapacity; ++i) { - new (newHash->entries + i) ImplicitProducerKVP; - newHash->entries[i].key.store(details::invalid_thread_id, std::memory_order_relaxed); - } - newHash->prev = mainHash; - implicitProducerHash.store(newHash, std::memory_order_release); - implicitProducerHashResizeInProgress.clear(std::memory_order_release); - mainHash = newHash; - } - else { - implicitProducerHashResizeInProgress.clear(std::memory_order_release); - } - } - - // If it's < three-quarters full, add to the old one anyway so that we don't have to wait for the next table - // to finish being allocated by another thread (and if we just finished allocating above, the condition will - // always be true) - if (newCount < (mainHash->capacity >> 1) + (mainHash->capacity >> 2)) { - bool recycled; - auto producer = static_cast(recycle_or_create_producer(false, recycled)); - if (producer == nullptr) { - implicitProducerHashCount.fetch_add(-1, std::memory_order_relaxed); - return nullptr; - } - if (recycled) { - implicitProducerHashCount.fetch_add(-1, std::memory_order_relaxed); - } - -#ifdef MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED - producer->threadExitListener.callback = &ConcurrentQueue::implicit_producer_thread_exited_callback; - producer->threadExitListener.userData = producer; - details::ThreadExitNotifier::subscribe(&producer->threadExitListener); -#endif - - auto index = hashedId; - while (true) { - index &= mainHash->capacity - 1; - auto probedKey = mainHash->entries[index].key.load(std::memory_order_relaxed); - - auto empty = details::invalid_thread_id; -#ifdef MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED - auto reusable = details::invalid_thread_id2; - if ((probedKey == empty && mainHash->entries[index].key.compare_exchange_strong(empty, id, std::memory_order_relaxed)) || - (probedKey == reusable && mainHash->entries[index].key.compare_exchange_strong(reusable, id, std::memory_order_acquire))) { -#else - if ((probedKey == empty && mainHash->entries[index].key.compare_exchange_strong(empty, id, std::memory_order_relaxed))) { -#endif - mainHash->entries[index].value = producer; - break; - } - ++index; - } - return producer; - } - - // Hmm, the old hash is quite full and somebody else is busy allocating a new one. - // We need to wait for the allocating thread to finish (if it succeeds, we add, if not, - // we try to allocate ourselves). - mainHash = implicitProducerHash.load(std::memory_order_acquire); - } - } - -#ifdef MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED - void implicit_producer_thread_exited(ImplicitProducer* producer) - { - // Remove from thread exit listeners - details::ThreadExitNotifier::unsubscribe(&producer->threadExitListener); - - // Remove from hash -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODHASH - debug::DebugLock lock(implicitProdMutex); -#endif - auto hash = implicitProducerHash.load(std::memory_order_acquire); - assert(hash != nullptr); // The thread exit listener is only registered if we were added to a hash in the first place - auto id = details::thread_id(); - auto hashedId = details::hash_thread_id(id); - details::thread_id_t probedKey; - - // We need to traverse all the hashes just in case other threads aren't on the current one yet and are - // trying to add an entry thinking there's a free slot (because they reused a producer) - for (; hash != nullptr; hash = hash->prev) { - auto index = hashedId; - do { - index &= hash->capacity - 1; - probedKey = hash->entries[index].key.load(std::memory_order_relaxed); - if (probedKey == id) { - hash->entries[index].key.store(details::invalid_thread_id2, std::memory_order_release); - break; - } - ++index; - } while (probedKey != details::invalid_thread_id); // Can happen if the hash has changed but we weren't put back in it yet, or if we weren't added to this hash in the first place - } - - // Mark the queue as being recyclable - producer->inactive.store(true, std::memory_order_release); - } - - static void implicit_producer_thread_exited_callback(void* userData) - { - auto producer = static_cast(userData); - auto queue = producer->parent; - queue->implicit_producer_thread_exited(producer); - } -#endif - - ////////////////////////////////// - // Utility functions - ////////////////////////////////// - - template - static inline U* create_array(size_t count) - { - assert(count > 0); - auto p = static_cast(Traits::malloc(sizeof(U) * count)); - if (p == nullptr) { - return nullptr; - } - - for (size_t i = 0; i != count; ++i) { - new (p + i) U(); - } - return p; - } - - template - static inline void destroy_array(U* p, size_t count) - { - if (p != nullptr) { - assert(count > 0); - for (size_t i = count; i != 0; ) { - (p + --i)->~U(); - } - Traits::free(p); - } - } - - template - static inline U* create() - { - auto p = Traits::malloc(sizeof(U)); - return p != nullptr ? new (p) U : nullptr; - } - - template - static inline U* create(A1&& a1) - { - auto p = Traits::malloc(sizeof(U)); - return p != nullptr ? new (p) U(std::forward(a1)) : nullptr; - } - - template - static inline void destroy(U* p) - { - if (p != nullptr) { - p->~U(); - } - Traits::free(p); - } - -private: - std::atomic producerListTail; - std::atomic producerCount; - - std::atomic initialBlockPoolIndex; - Block* initialBlockPool; - size_t initialBlockPoolSize; - -#if !MCDBGQ_USEDEBUGFREELIST - FreeList freeList; -#else - debug::DebugFreeList freeList; -#endif - - std::atomic implicitProducerHash; - std::atomic implicitProducerHashCount; // Number of slots logically used - ImplicitProducerHash initialImplicitProducerHash; - std::array initialImplicitProducerHashEntries; - std::atomic_flag implicitProducerHashResizeInProgress; - - std::atomic nextExplicitConsumerId; - std::atomic globalExplicitConsumerOffset; - -#if MCDBGQ_NOLOCKFREE_IMPLICITPRODHASH - debug::DebugMutex implicitProdMutex; -#endif - -#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG - std::atomic explicitProducers; - std::atomic implicitProducers; -#endif -}; - - -template -ProducerToken::ProducerToken(ConcurrentQueue& queue) - : producer(queue.recycle_or_create_producer(true)) -{ - if (producer != nullptr) { - producer->token = this; - } -} - -template -ConsumerToken::ConsumerToken(ConcurrentQueue& queue) - : itemsConsumedFromCurrent(0), currentProducer(nullptr), desiredProducer(nullptr) -{ - initialOffset = queue.nextExplicitConsumerId.fetch_add(1, std::memory_order_release); - lastKnownGlobalOffset = -1; -} - -template -inline void swap(ConcurrentQueue& a, ConcurrentQueue& b) MOODYCAMEL_NOEXCEPT -{ - a.swap(b); -} - -inline void swap(ProducerToken& a, ProducerToken& b) MOODYCAMEL_NOEXCEPT -{ - a.swap(b); -} - -inline void swap(ConsumerToken& a, ConsumerToken& b) MOODYCAMEL_NOEXCEPT -{ - a.swap(b); -} - -template -inline void swap(typename ConcurrentQueue::ImplicitProducerKVP& a, typename ConcurrentQueue::ImplicitProducerKVP& b) MOODYCAMEL_NOEXCEPT -{ - a.swap(b); -} - -} - -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif diff --git a/QuantBox_Queue/main.cpp b/QuantBox_Queue/main.cpp deleted file mode 100644 index ba844b6..0000000 --- a/QuantBox_Queue/main.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "stdafx.h" -#include "MsgQueue.h" -#include "../include/QueueHeader.h" -#include "../include/QueueEnum.h" -#include "../include/QueueStruct.h" - -#include "../include/ApiHeader.h" -#include "../include/ApiStruct.h" - -inline CMsgQueue* GetQueue(void* pMsgQueue) -{ - return static_cast(pMsgQueue); -} - -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) -{ - RequestType rt = (RequestType)type; - switch (rt) - { - case GetApiType: - return nullptr; - case GetApiVersion: - return (void*)"0.4.0.20150526"; - case GetApiName: - return (void*)"Queue"; - case Create: - return new CMsgQueue(); - default: - break; - } - - if (pApi1 == nullptr) - { - return nullptr; - } - - CMsgQueue* pQueue = GetQueue(pApi1); - - switch (rt) - { - case Release: - delete pQueue; - return 0; - case Register: - pQueue->Register(ptr1,ptr2); - break; - case Config: - return (void*)pQueue->Config((ConfigInfoField*)ptr1); - case Connect: - pQueue->StartThread(); - break; - case Disconnect: - pQueue->StopThread(); - break; - case Clear: - pQueue->Clear(); - break; - case Process: - pQueue->Process(); - break; - default: - // ̬ãʹֱķʽ - pQueue->Input_Output(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - } - - return pApi1; -} \ No newline at end of file diff --git a/QuantBox_Queue/readerwriterqueue.h b/QuantBox_Queue/readerwriterqueue.h deleted file mode 100644 index c36de8b..0000000 --- a/QuantBox_Queue/readerwriterqueue.h +++ /dev/null @@ -1,557 +0,0 @@ -// ©2013 Cameron Desrochers. -// Distributed under the simplified BSD license (see the license file that -// should have come with this header). - -#pragma once - -#include "atomicops.h" -#include -#include -#include -#include -#include -#include // For malloc/free & size_t - - -// A lock-free queue for a single-consumer, single-producer architecture. -// The queue is also wait-free in the common path (except if more memory -// needs to be allocated, in which case malloc is called). -// Allocates memory sparingly (O(lg(n) times, amortized), and only once if -// the original maximum size estimate is never exceeded. -// Tested on x86/x64 processors, but semantics should be correct for all -// architectures (given the right implementations in atomicops.h), provided -// that aligned integer and pointer accesses are naturally atomic. -// Note that there should only be one consumer thread and producer thread; -// Switching roles of the threads, or using multiple consecutive threads for -// one role, is not safe unless properly synchronized. -// Using the queue exclusively from one thread is fine, though a bit silly. - -#define CACHE_LINE_SIZE 64 - -#ifdef AE_VCPP -#pragma warning(push) -#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) -#pragma warning(disable: 4820) // padding was added -#pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace moodycamel { - -template -class ReaderWriterQueue -{ - // Design: Based on a queue-of-queues. The low-level queues are just - // circular buffers with front and tail indices indicating where the - // next element to dequeue is and where the next element can be enqueued, - // respectively. Each low-level queue is called a "block". Each block - // wastes exactly one element's worth of space to keep the design simple - // (if front == tail then the queue is empty, and can't be full). - // The high-level queue is a circular linked list of blocks; again there - // is a front and tail, but this time they are pointers to the blocks. - // The front block is where the next element to be dequeued is, provided - // the block is not empty. The back block is where elements are to be - // enqueued, provided the block is not full. - // The producer thread owns all the tail indices/pointers. The consumer - // thread owns all the front indices/pointers. Both threads read each - // other's variables, but only the owning thread updates them. E.g. After - // the consumer reads the producer's tail, the tail may change before the - // consumer is done dequeuing an object, but the consumer knows the tail - // will never go backwards, only forwards. - // If there is no room to enqueue an object, an additional block (of - // greater size than the last block) is added. Blocks are never removed. - -public: - // Constructs a queue that can hold maxSize elements without further - // allocations. Allocates maxSize + 1, rounded up to the nearest power - // of 2, elements. - explicit ReaderWriterQueue(size_t maxSize = 15) - : largestBlockSize(ceilToPow2(maxSize + 1)) // We need a spare slot to fit maxSize elements in the block -#ifndef NDEBUG - ,enqueuing(false) - ,dequeuing(false) -#endif - { - assert(maxSize > 0); - - auto firstBlockRaw = static_cast(std::malloc(sizeof(Block) + std::alignment_of::value - 1)); - auto firstBlock = new (align_for(firstBlockRaw)) Block(largestBlockSize, firstBlockRaw); - firstBlock->next = firstBlock; - - frontBlock = firstBlock; - tailBlock = firstBlock; - - // Make sure the reader/writer threads will have the initialized memory setup above: - fence(memory_order_sync); - } - - // Note: The queue should not be accessed concurrently while it's - // being deleted. It's up to the user to synchronize this. - ~ReaderWriterQueue() - { - // Make sure we get the latest version of all variables from other CPUs: - fence(memory_order_sync); - - // Destroy any remaining objects in queue and free memory - Block* frontBlock_ = frontBlock; - Block* block = frontBlock_; - do { - Block* nextBlock = block->next; - size_t blockFront = block->front; - size_t blockTail = block->tail; - - for (size_t i = blockFront; i != blockTail; i = (i + 1) & block->sizeMask()) { - auto element = reinterpret_cast(block->data + i * sizeof(T)); - element->~T(); - (void)element; - } - - std::free(block->rawThis); - block = nextBlock; - - } while (block != frontBlock_); - } - - - // Enqueues a copy of element if there is room in the queue. - // Returns true if the element was enqueued, false otherwise. - // Does not allocate memory. - AE_FORCEINLINE bool try_enqueue(T const& element) - { - return inner_enqueue(element); - } - - // Enqueues a moved copy of element if there is room in the queue. - // Returns true if the element was enqueued, false otherwise. - // Does not allocate memory. - AE_FORCEINLINE bool try_enqueue(T&& element) - { - return inner_enqueue(std::forward(element)); - } - - - // Enqueues a copy of element on the queue. - // Allocates an additional block of memory if needed. - AE_FORCEINLINE void enqueue(T const& element) - { - inner_enqueue(element); - } - - // Enqueues a moved copy of element on the queue. - // Allocates an additional block of memory if needed. - AE_FORCEINLINE void enqueue(T&& element) - { - inner_enqueue(std::forward(element)); - } - - - // Attempts to dequeue an element; if the queue is empty, - // returns false instead. If the queue has at least one element, - // moves front to result using operator=, then returns true. - template - bool try_dequeue(U& result) - { -#ifndef NDEBUG - ReentrantGuard guard(this->dequeuing); -#endif - - // High-level pseudocode: - // Remember where the tail block is - // If the front block has an element in it, dequeue it - // Else - // If front block was the tail block when we entered the function, return false - // Else advance to next block and dequeue the item there - - // Note that we have to use the value of the tail block from before we check if the front - // block is full or not, in case the front block is empty and then, before we check if the - // tail block is at the front block or not, the producer fills up the front block *and - // moves on*, which would make us skip a filled block. Seems unlikely, but was consistently - // reproducible in practice. - Block* tailBlockAtStart = tailBlock; - fence(memory_order_acquire); - - Block* frontBlock_ = frontBlock.load(); - size_t blockTail = frontBlock_->tail.load(); - size_t blockFront = frontBlock_->front.load(); - fence(memory_order_acquire); - - if (blockFront != blockTail) { - // Front block not empty, dequeue from here - auto element = reinterpret_cast(frontBlock_->data + blockFront * sizeof(T)); - result = std::move(*element); - element->~T(); - - blockFront = (blockFront + 1) & frontBlock_->sizeMask(); - - fence(memory_order_release); - frontBlock_->front = blockFront; - } - else if (frontBlock_ != tailBlockAtStart) { - // Front block is empty but there's another block ahead, advance to it - Block* nextBlock = frontBlock_->next; - // Don't need an acquire fence here since next can only ever be set on the tailBlock, - // and we're not the tailBlock, and we did an acquire earlier after reading tailBlock which - // ensures next is up-to-date on this CPU in case we recently were at tailBlock. - - size_t nextBlockFront = nextBlock->front.load(); - size_t nextBlockTail = nextBlock->tail; - fence(memory_order_acquire); - - // Since the tailBlock is only ever advanced after being written to, - // we know there's for sure an element to dequeue on it - assert(nextBlockFront != nextBlockTail); - AE_UNUSED(nextBlockTail); - - // We're done with this block, let the producer use it if it needs - fence(memory_order_release); // Expose possibly pending changes to frontBlock->front from last dequeue - frontBlock = frontBlock_ = nextBlock; - - compiler_fence(memory_order_release); // Not strictly needed - - auto element = reinterpret_cast(frontBlock_->data + nextBlockFront * sizeof(T)); - - result = std::move(*element); - element->~T(); - - nextBlockFront = (nextBlockFront + 1) & frontBlock_->sizeMask(); - - fence(memory_order_release); - frontBlock_->front = nextBlockFront; - } - else { - // No elements in current block and no other block to advance to - return false; - } - - return true; - } - - - // Returns a pointer to the front element in the queue (the one that - // would be removed next by a call to `try_dequeue` or `pop`). If the - // queue appears empty at the time the method is called, nullptr is - // returned instead. - // Must be called only from the consumer thread. - T* peek() - { -#ifndef NDEBUG - ReentrantGuard guard(this->dequeuing); -#endif - // See try_dequeue() for reasoning - - Block* tailBlockAtStart = tailBlock; - fence(memory_order_acquire); - - Block* frontBlock_ = frontBlock.load(); - size_t blockTail = frontBlock_->tail.load(); - size_t blockFront = frontBlock_->front.load(); - fence(memory_order_acquire); - - if (blockFront != blockTail) { - return reinterpret_cast(frontBlock_->data + blockFront * sizeof(T)); - } - else if (frontBlock_ != tailBlockAtStart) { - Block* nextBlock = frontBlock_->next; - - size_t nextBlockFront = nextBlock->front.load(); - fence(memory_order_acquire); - - assert(nextBlockFront != nextBlock->tail); - return reinterpret_cast(nextBlock->data + nextBlockFront * sizeof(T)); - } - return nullptr; - } - - // Removes the front element from the queue, if any, without returning it. - // Returns true on success, or false if the queue appeared empty at the time - // `pop` was called. - bool pop() - { -#ifndef NDEBUG - ReentrantGuard guard(this->dequeuing); -#endif - // See try_dequeue() for reasoning - - Block* tailBlockAtStart = tailBlock; - fence(memory_order_acquire); - - Block* frontBlock_ = frontBlock.load(); - size_t blockTail = frontBlock_->tail.load(); - size_t blockFront = frontBlock_->front.load(); - fence(memory_order_acquire); - - if (blockFront != blockTail) { - // Front block not empty, pop - auto element = reinterpret_cast(frontBlock_->data + blockFront * sizeof(T)); - element->~T(); - - blockFront = (blockFront + 1) & frontBlock_->sizeMask(); - - fence(memory_order_release); - frontBlock_->front = blockFront; - } - else if (frontBlock_ != tailBlockAtStart) { - // Front block is empty but there's another block ahead, advance to it - Block* nextBlock = frontBlock_->next; - - size_t nextBlockFront = nextBlock->front.load(); - size_t nextBlockTail = nextBlock->tail; - fence(memory_order_acquire); - - assert(nextBlockFront != nextBlockTail); - AE_UNUSED(nextBlockTail); - - fence(memory_order_release); - frontBlock = frontBlock_ = nextBlock; - - compiler_fence(memory_order_release); - - auto element = reinterpret_cast(frontBlock_->data + nextBlockFront * sizeof(T)); - element->~T(); - - nextBlockFront = (nextBlockFront + 1) & frontBlock_->sizeMask(); - - fence(memory_order_release); - frontBlock_->front = nextBlockFront; - } - else { - // No elements in current block and no other block to advance to - return false; - } - - return true; - } - - // Returns the approximate number of items currently in the queue. - // Safe to call from both the producer and consumer threads. - inline size_t size_approx() const - { - size_t result = 0; - Block* frontBlock_ = frontBlock.load(); - Block* block = frontBlock_; - do { - fence(memory_order_acquire); - size_t blockFront = block->front.load(); - size_t blockTail = block->tail.load(); - result += (blockTail - blockFront) & block->sizeMask(); - block = block->next.load(); - } while (block != frontBlock_); - return result; - } - - -private: - enum AllocationMode { CanAlloc, CannotAlloc }; - - template - bool inner_enqueue(U&& element) - { -#ifndef NDEBUG - ReentrantGuard guard(this->enqueuing); -#endif - - // High-level pseudocode (assuming we're allowed to alloc a new block): - // If room in tail block, add to tail - // Else check next block - // If next block is not the head block, enqueue on next block - // Else create a new block and enqueue there - // Advance tail to the block we just enqueued to - - Block* tailBlock_ = tailBlock.load(); - size_t blockFront = tailBlock_->front.load(); - size_t blockTail = tailBlock_->tail.load(); - fence(memory_order_acquire); - - size_t nextBlockTail = (blockTail + 1) & tailBlock_->sizeMask(); - if (nextBlockTail != blockFront) { - // This block has room for at least one more element - char* location = tailBlock_->data + blockTail * sizeof(T); - new (location) T(std::forward(element)); - - fence(memory_order_release); - tailBlock_->tail = nextBlockTail; - } - else if (tailBlock_->next.load() != frontBlock) { - // Note that the reason we can't advance to the frontBlock and start adding new entries there - // is because if we did, then dequeue would stay in that block, eventually reading the new values, - // instead of advancing to the next full block (whose values were enqueued first and so should be - // consumed first). - - fence(memory_order_acquire); // Ensure we get latest writes if we got the latest frontBlock - - // tailBlock is full, but there's a free block ahead, use it - Block* tailBlockNext = tailBlock_->next.load(); - size_t nextBlockFront = tailBlockNext->front.load(); - nextBlockTail = tailBlockNext->tail.load(); - fence(memory_order_acquire); - - // This block must be empty since it's not the head block and we - // go through the blocks in a circle - assert(nextBlockFront == nextBlockTail); - AE_UNUSED(nextBlockFront); - - char* location = tailBlockNext->data + nextBlockTail * sizeof(T); - new (location) T(std::forward(element)); - - tailBlockNext->tail = (nextBlockTail + 1) & tailBlockNext->sizeMask(); - - fence(memory_order_release); - tailBlock = tailBlockNext; - } - else if (canAlloc == CanAlloc) { - // tailBlock is full and there's no free block ahead; create a new block - largestBlockSize *= 2; - auto newBlockRaw = static_cast(std::malloc(sizeof(Block) + std::alignment_of::value - 1)); - auto newBlock = new (align_for(newBlockRaw)) Block(largestBlockSize, newBlockRaw); - - new (newBlock->data) T(std::forward(element)); - - assert(newBlock->front == 0); - newBlock->tail = 1; - - newBlock->next = tailBlock_->next.load(); - tailBlock_->next = newBlock; - - // Might be possible for the dequeue thread to see the new tailBlock->next - // *without* seeing the new tailBlock value, but this is OK since it can't - // advance to the next block until tailBlock is set anyway (because the only - // case where it could try to read the next is if it's already at the tailBlock, - // and it won't advance past tailBlock in any circumstance). - - fence(memory_order_release); - tailBlock = newBlock; - } - else if (canAlloc == CannotAlloc) { - // Would have had to allocate a new block to enqueue, but not allowed - return false; - } - else { - assert(false && "Should be unreachable code"); - return false; - } - - return true; - } - - - // Disable copying - ReaderWriterQueue(ReaderWriterQueue const&) { } - - // Disable assignment - ReaderWriterQueue& operator=(ReaderWriterQueue const&) { } - - - - AE_FORCEINLINE static size_t ceilToPow2(size_t x) - { - // From http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 - --x; - x |= x >> 1; - x |= x >> 2; - x |= x >> 4; - for (size_t i = 1; i < sizeof(size_t); i <<= 1) { - x |= x >> (i << 3); - } - ++x; - return x; - } - - - template - static AE_FORCEINLINE char* align_for(char* ptr) - { - const std::size_t alignment = std::alignment_of::value; - return ptr + (alignment - (reinterpret_cast(ptr) % alignment)) % alignment; - } -private: -#ifndef NDEBUG - struct ReentrantGuard - { - ReentrantGuard(bool& _inSection) - : inSection(_inSection) - { - assert(!inSection); - if (inSection) { - throw std::runtime_error("ReaderWriterQueue does not support enqueuing or dequeuing elements from other elements' ctors and dtors"); - } - - inSection = true; - } - - ~ReentrantGuard() { inSection = false; } - - private: - ReentrantGuard& operator=(ReentrantGuard const&); - - private: - bool& inSection; - }; -#endif - - struct Block - { - // Avoid false-sharing by putting highly contended variables on their own cache lines - AE_ALIGN(CACHE_LINE_SIZE) - weak_atomic front; // (Atomic) Elements are read from here - - AE_ALIGN(CACHE_LINE_SIZE) - weak_atomic tail; // (Atomic) Elements are enqueued here - - AE_ALIGN(CACHE_LINE_SIZE) // next isn't very contended, but we don't want it on the same cache line as tail (which is) - weak_atomic next; // (Atomic) - - char* data; // Contents (on heap) are aligned to T's alignment - - const size_t size; - - AE_FORCEINLINE size_t sizeMask() const { return size - 1; } - - - // size must be a power of two (and greater than 0) - Block(size_t const& _size, char* rawThis) - : front(0), tail(0), next(nullptr), size(_size), rawThis(rawThis) - { - // Allocate enough memory for an array of Ts, aligned - size_t alignment = std::alignment_of::value; - data = rawData = static_cast(std::malloc(sizeof(T) * size + alignment - 1)); - assert(rawData); - auto alignmentOffset = (uintptr_t)rawData % alignment; - if (alignmentOffset != 0) { - data += alignment - alignmentOffset; - } - } - - ~Block() - { - std::free(rawData); - } - - private: - // C4512 - Assignment operator could not be generated - Block& operator=(Block const&); - - private: - char* rawData; - - public: - char* rawThis; - }; - -private: - weak_atomic frontBlock; // (Atomic) Elements are enqueued to this block - - char cachelineFiller[CACHE_LINE_SIZE - sizeof(weak_atomic)]; - weak_atomic tailBlock; // (Atomic) Elements are dequeued from this block - - size_t largestBlockSize; - -#ifndef NDEBUG - bool enqueuing; - bool dequeuing; -#endif -}; - -} // end namespace moodycamel - -#ifdef AE_VCPP -#pragma warning(pop) -#endif diff --git a/QuantBox_Tdx_Trade/Struct.h b/QuantBox_Tdx_Trade/Struct.h deleted file mode 100644 index 4124838..0000000 --- a/QuantBox_Tdx_Trade/Struct.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once - -/* -120_ͻ|134_|121_ʽʺ|125_ʺ|123_ɶ|110_ίзʽ|1207 -_ʼ|1227_|101_|5250_ͻȺ|5251_ͻӪҵ|5252_Ӳк -|5253_CPUID|5254_ýױʶ|5255_Ự|5256_ͻ| -=============== -143_ίʱ|123_ɶ|140_֤ȯ|141_֤ȯ|130_־|131_־|10 -0_|145_ίм۸|144_ί|153_ɽ۸|152_ɽ|162_|14 -6_ίб|194_۷ʽ|147_״̬˵|161_ʽ|1213_Ϣ| -*/ -//#define REQUEST_DRWT 1102 // ί - -/* -120_ͻ|134_|121_ʽʺ|125_ʺ|123_ɶ|110_ίзʽ|126_ -ʼ|127_ֹ|1207_ʼ|140_֤ȯ|1227_|5250_ͻȺ|5251_ -Ӫҵ|5252_Ӳк|5253_CPUID|5254_ýױʶ|5255_Ự|5256_ͻ| - -=============== -142_ί|123_ɶ|140_֤ȯ|141_֤ȯ|130_־|131_־|10 -0_|145_ίм۸|144_ί|153_ɽ۸|152_ɽ|162_|14 -6_ίб|194_۷ʽ|161_ʽ|1213_Ϣ| -*/ -//#define REQUEST_LSWT 1104 // ʷί - -struct WTLB_STRUCT -{ - int WTRQ; // 142_ί - int WTSJ; // 143_ίʱ - char GDDM[32]; // 123_ɶ - char ZQDM[32]; // 140_֤ȯ - char ZQMC[32]; // 141_֤ȯ - int MMBZ; // 130_־ - int WTLB; // 131_ί - int JYSDM; // 100_ - double WTJG; // 145_ίм۸ - int WTSL; // 144_ί - double CJJG; // 153_ɽ۸ - int CDSL; // 162_ - char WTBH[32]; // 146_ίб - int BJFS; // 194_۷ʽ - double DJZJ; // 161_ʽ -}; - - -/* -120_ͻ|134_|121_ʽʺ|125_ʺ|123_ɶ|110_ίзʽ|1207 -_ʼ|155_ɽ|101_|5250_ͻȺ|5251_ͻӪҵ|5252_Ӳ -к|5253_CPUID|5254_ýױʶ|5255_Ự|5256_ͻ| -=============== -151_ɽʱ|123_ɶ|140_֤ȯ|141_֤ȯ|130_־|131_־|15 -3_ɽ۸|152_ɽ|303_|155_ɽ|167_־|146_ίб|1213 -_Ϣ| -*/ -//#define REQUEST_DRCJ 1108 // ճɽ -/* -120_ͻ|134_|121_ʽʺ|125_ʺ|123_ɶ|110_ίзʽ|126_ -ʼ|127_ֹ|1207_ʼ|140_֤ȯ|101_|5250_ͻȺ|52 -51_ͻӪҵ|5252_Ӳк|5253_CPUID|5254_ýױʶ|5255_Ự|5256_ͻ -| -=============== -150_ɽ|151_ɽʱ|123_ɶ|140_֤ȯ|141_֤ȯ|130_־|13 -1_־|153_ɽ۸|152_ɽ|303_|304_ʣ|206_Ӷ|210_ӡ -˰|207_|208_ɽ|155_ɽ|146_ίб|1213_Ϣ| -*/ -//#define REQUEST_LSCJ 1110 // ʷɽ - -struct CJLB_STRUCT -{ - int CJRQ; // 150_ɽ - int CJSJ; // 151_ɽʱ - char GDDM[32]; // 123_ɶ - char ZQDM[32]; // 140_֤ȯ - char ZQMC[32]; // 141_֤ȯ - int MMBZ; // 130_־ - int WTLB; // 131_ί - double CJJG; // 153_ɽ۸ - int CJSL; // 152_ɽ - double FSJE; // 303_ - double SYJE; // 304_ʣ - double YJ; // 206_Ӷ - double YHS; // 210_ӡ˰ - double GHF; // 207_ - double CJF; // 208_ɽ - char CJBH[32]; // 155_ɽ - char WTBH[32]; // 146_ίб -}; \ No newline at end of file diff --git a/QuantBox_Tdx_Trade/TraderApi.cpp b/QuantBox_Tdx_Trade/TraderApi.cpp deleted file mode 100644 index 0bcd833..0000000 --- a/QuantBox_Tdx_Trade/TraderApi.cpp +++ /dev/null @@ -1,1420 +0,0 @@ -#include "stdafx.h" -#include "TraderApi.h" - -#include "../include/QueueEnum.h" -#include "../include/QueueHeader.h" - -#include "../include/ApiHeader.h" -#include "../include/ApiStruct.h" - -#include "../include/ApiProcess.h" -#include "../include/toolkit.h" - -#include "../QuantBox_Queue/MsgQueue.h" - -#include "TypeConvert.h" - -#include "../include/Tdx/tdx_function.h" - -#include -#include - - -void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - // 由内部调用,不用检查是否为空 - CTraderApi* pApi = (CTraderApi*)pApi2; - pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - return nullptr; -} - -void CTraderApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - int iRet = 0; - switch (type) - { - case E_Init: - iRet = _Init(); - break; - case E_ReqUserLoginField: - iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_InputOrderField: - iRet = _ReqOrderInsert(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_InputOrderActionField: - iRet = _ReqOrderAction(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_QryDepthMarketDataField: - iRet = _Subscribe(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - - case QueryType::ReqQryOrder : - iRet = _ReqQryOrder(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryTrade: - iRet = _ReqQryTrade(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryInvestor: - iRet = _ReqQryInvestor(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryTradingAccount: - iRet = _ReqQryTradingAccount(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryInvestorPosition: - iRet = _ReqQryInvestorPosition(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - - default: - break; - } - - if (0 == iRet) - { - //返回成功,填加到已发送池 - m_nSleep = 1; - } - else - { - m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - //失败,按4的幂进行延时,但不超过1s - m_nSleep *= 4; - m_nSleep %= 1023; - } - this_thread::sleep_for(chrono::milliseconds(m_nSleep)); -} - -void* __stdcall Test(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - // 由内部调用,不用检查是否为空 - CTraderApi* pApi = (CTraderApi*)pApi2; - pApi->TestInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - return nullptr; -} - -void CTraderApi::TestInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - int iRet = 0; - bool bQryOrder = false; - bool bQryTrade = false; - //bool bQryInvestor = false; - - time_t _now = time(nullptr); - - // 想在整点时查询一下,因为整点时交易所和柜台变状态的可能性比较大这样 - - if (_now > m_QueryOrderTime) - { - bQryOrder = true; - } - else - { - - } - - if (_now > m_QueryTradeTime) - { - bQryTrade = true; - } - else - { - - } - - //if (_now > m_QueryGDLBTime) - //{ - // bQryInvestor = true; - //} - //else - //{ - - //} - - //if (bQryInvestor) - //{ - // double _queryTime = QUERY_TIME_MAX * 60; - // m_QueryGDLBTime = time(nullptr) + _queryTime; - // OutputQueryTime(m_QueryGDLBTime, _queryTime, "QueryInvestor"); - - // ReqQryInvestor(); - //} - - if (bQryOrder) - { - double _queryTime = QUERY_TIME_MAX; - m_QueryOrderTime = time(nullptr) + _queryTime; - OutputQueryTime(m_QueryOrderTime, _queryTime, "QueryOrder"); - - ReqQryOrder(); - } - - if (bQryTrade) - { - double _queryTime = QUERY_TIME_MAX; - m_QueryTradeTime = time(nullptr) + _queryTime; - OutputQueryTime(m_QueryTradeTime, _queryTime, "QueryTrade"); - - ReqQryTrade(); - } - - this_thread::sleep_for(chrono::milliseconds(1000)); - m_msgQueue_Test->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); -} - -void CTraderApi::OutputQueryTime(time_t t, double db, const char* szSource) -{ - LogField* pField = (LogField*)m_msgQueue->new_block(sizeof(LogField)); - - sprintf(pField->Message, "Source:%s,Add:%d,Time:%s", szSource,(int)db, ctime(&t)); - - // 去了最后的回车 - int len = strlen(pField->Message); - pField->Message[len - 1] = 0; - - m_msgQueue->Input_NoCopy(ResponeType::OnLog, m_msgQueue, m_pClass, true, 0, pField, sizeof(LogField), nullptr, 0, nullptr, 0); -} - - -int CTraderApi::_Init() -{ - if (m_pApi == nullptr) - { - m_pApi = CTdxApi::CreateApi(m_ServerInfo.ExtInfoChar128); - } - - Error_STRUCT* pErr = nullptr; - - m_pApi->LoadScript(m_ServerInfo.Address, true, false); - m_pApi->Init(m_ServerInfo.ExtInfoChar128, &pErr); - - if (pErr) - { - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - - pField->RawErrorID = pErr->ErrCode; - strcpy(pField->Text, pErr->ErrInfo); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - } - else - { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - ReqUserLogin(); - } - - DeleteError(pErr); - - return 0; -} - -void CTraderApi::ReqUserLogin() -{ - if (m_UserInfo_Pos >= m_UserInfo_Count) - return; - - //STTraderLogin* pBody = (STTraderLogin*)m_msgQueue_Query->new_block(sizeof(STTraderLogin)); - - //strncpy(pBody->cust_no, m_pUserInfos[m_UserInfo_Pos].UserID, sizeof(TCustNoType)); - //strncpy(pBody->cust_pwd, m_pUserInfos[m_UserInfo_Pos].Password, sizeof(TCustPwdType)); - - m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, - nullptr, 0, nullptr, 0, nullptr, 0); -} - -int CTraderApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - char** ppResults = nullptr; - Error_STRUCT* pErr = nullptr; - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - m_pClient = m_pApi->Login(m_UserInfo.UserID, m_UserInfo.Password, m_UserInfo.ExtInfoChar64, &ppResults, &pErr); - - if (m_pClient) - { - // 有授权信息要输出 - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - if (pErr) - { - pField->RawErrorID = pErr->ErrCode; - strcpy(pField->Text, pErr->ErrInfo); - } - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(pField), nullptr, 0, nullptr, 0); - - // 以后支持多账号时这地方要改 - m_pApi->SetClient(m_pClient); - m_pApi->SetAccount(m_UserInfo.UserID); - - // 查询股东列表,华泰证券可能一开始查会返回非知请求[1122] - GDLB_STRUCT** ppRS = nullptr; - CharTable2Login(ppResults, &ppRS); - - int count = GetCountStructs((void**)ppRS); - - if (count>0) - { - for (int i = 0; i < count; ++i) - { - InvestorField* pField = (InvestorField*)m_msgQueue->new_block(sizeof(InvestorField)); - - GDLB_2_InvestorField(ppRS[i], pField); - - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInvestor, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(InvestorField), nullptr, 0, nullptr, 0); - } - } - else - { - // 查通达信仿真实验室账号不直接返回股东列表,需要主动查询 - ReqQryInvestor(); - } - - // 启动定时查询功能使用 - m_msgQueue_Test->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue_Test, this, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - - // 登录下一个账号 - //++m_UserInfo_Pos; - //ReqUserLogin(); - } - else - { - if (pErr) - { - RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); - - pField->RawErrorID = pErr->ErrCode; - strcpy(pField->Text, pErr->ErrInfo); - - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - } - } - - DeleteError(pErr); - DeleteTableBody(ppResults); - - return 0; -} - -void CTraderApi::ReqQuery(QueryType type, ReqQueryField* pQuery) -{ - m_msgQueue_Query->Input_Copy(type, m_msgQueue_Query, this, 0, 0, - pQuery, sizeof(ReqQueryField), nullptr, 0, nullptr, 0); -} - -void CTraderApi::ReqQryInvestor() -{ - m_msgQueue_Query->Input_NoCopy(QueryType::ReqQryInvestor, m_msgQueue_Query, this, 0, 0, - nullptr, 0, nullptr, 0, nullptr, 0); -} - -int CTraderApi::_ReqQryInvestor(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - if (m_pApi == nullptr) - return 0; - - FieldInfo_STRUCT** ppFieldInfos = nullptr; - char** ppResults = nullptr; - Error_STRUCT* pErr = nullptr; - - m_pApi->ReqQueryData(REQUEST_GDLB, &ppFieldInfos, &ppResults, &pErr); - - if (IsErrorRspInfo("ReqQryInvestor", pErr)) - { - //int _queryTime = QUERY_TIME_MIN; - //m_QueryGDLBTime = time(nullptr) + _queryTime; - //OutputQueryTime(m_QueryGDLBTime, _queryTime, "NextQueryInvestor_ReqQryInvestor"); - - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; - } - - GDLB_STRUCT** ppRS = nullptr; - CharTable2GDLB(ppFieldInfos, ppResults, &ppRS); - - int count = GetCountStructs((void**)ppRS); - - for (int i = 0; i < count; ++i) - { - InvestorField* pField = (InvestorField*)m_msgQueue->new_block(sizeof(InvestorField)); - - GDLB_2_InvestorField(ppRS[i], pField); - - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInvestor, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(InvestorField), nullptr, 0, nullptr, 0); - } - - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; -} - -CTraderApi::CTraderApi(void) -{ - m_pIDGenerator = nullptr; - m_pApi = nullptr; - m_pClient = nullptr; - m_lRequestID = 0; - m_nSleep = 1; - //m_FirstTradeID[0] = 0; - m_TradeListReverse = false; - m_LastIsMerge = false; - - // 自己维护两个消息队列 - m_msgQueue = new CMsgQueue(); - m_msgQueue_Query = new CMsgQueue(); - m_msgQueue_Test = new CMsgQueue(); - - m_msgQueue_Query->Register(Query,this); - m_msgQueue_Query->StartThread(); - - m_msgQueue_Test->Register(Test, this); - m_msgQueue_Test->StartThread(); -} - - -CTraderApi::~CTraderApi(void) -{ - Disconnect(); -} - -void CTraderApi::Register(void* pCallback, void* pClass) -{ - m_pClass = pClass; - if (m_msgQueue == nullptr) - return; - - m_msgQueue_Query->Register(Query,this); - m_msgQueue_Test->Register(Test, this); - m_msgQueue->Register(pCallback,this); - if (pCallback) - { - m_msgQueue_Query->StartThread(); - m_msgQueue->StartThread(); - m_msgQueue_Test->StartThread(); - } - else - { - m_msgQueue_Query->StopThread(); - m_msgQueue->StopThread(); - m_msgQueue_Test->StopThread(); - } -} - -bool CTraderApi::IsErrorRspInfo(const char* szSource, Error_STRUCT *pRspInfo) -{ - bool bRet = ((pRspInfo) && (pRspInfo->ErrType != 0)); - if (bRet) - { - ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); - - pField->RawErrorID = pRspInfo->ErrCode; - strcpy(pField->Text, pRspInfo->ErrInfo); - strcpy(pField->Source, szSource); - - m_msgQueue->Input_NoCopy(ResponeType::OnRtnError, m_msgQueue, m_pClass, true, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); - } - return bRet; -} - -void CTraderApi::Connect(const string& szPath, - ServerInfoField* pServerInfo, - UserInfoField* pUserInfo, - int count) -{ - m_szPath = szPath; - memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); - memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); - - m_pUserInfos = (UserInfoField*)(new char[sizeof(UserInfoField)*count]); - memcpy(m_pUserInfos, pUserInfo, sizeof(UserInfoField)*count); - - m_UserInfo_Pos = 0; - m_UserInfo_Count = count; - - m_pIDGenerator = new CIDGenerator(); - m_pIDGenerator->SetPrefix(m_UserInfo.UserID); - - m_msgQueue_Query->Input_NoCopy(E_Init, m_msgQueue_Query, this, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); -} - -void CTraderApi::Disconnect() -{ - if (m_msgQueue_Query) - { - m_msgQueue_Query->StopThread(); - m_msgQueue_Query->Register(nullptr,nullptr); - m_msgQueue_Query->Clear(); - delete m_msgQueue_Query; - m_msgQueue_Query = nullptr; - } - - if (m_msgQueue_Test) - { - m_msgQueue_Test->StopThread(); - m_msgQueue_Test->Register(nullptr, nullptr); - m_msgQueue_Test->Clear(); - delete m_msgQueue_Test; - m_msgQueue_Test = nullptr; - } - - if(m_pApi) - { - // 还没有登出 - m_pApi->Logout(m_pClient); - m_pClient = nullptr; - m_pApi->Exit(); - - m_pApi->Release(); - m_pApi = nullptr; - - // 全清理,只留最后一个 - if (m_msgQueue) - { - m_msgQueue->Clear(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); - // 主动触发 - m_msgQueue->Process(); - } - } - - if (m_msgQueue) - { - m_msgQueue->StopThread(); - m_msgQueue->Register(nullptr,nullptr); - m_msgQueue->Clear(); - delete m_msgQueue; - m_msgQueue = nullptr; - } - - if (m_pIDGenerator) - { - delete m_pIDGenerator; - m_pIDGenerator = nullptr; - } -} - -int CTraderApi::ReqOrderInsert( - OrderField* pOrder, - int count, - OrderIDType* pInOut) -{ - memset(pInOut, 0, sizeof(OrderIDType)*count); - - if (count < 1) - return 0; - - OrderField** ppOrders = new OrderField*[count]; - - // 生成本地ID,供上层进行定位使用 - for (int i = 0; i < count; ++i) - { - OrderField* pNewOrder = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); - memcpy(pNewOrder, pOrder, sizeof(OrderField)); - - strcpy(pInOut[i], m_pIDGenerator->GetIDString()); - strcpy(pNewOrder[i].LocalID, pInOut[i]); - ppOrders[i] = pNewOrder; - - // 注意这里保存了最开始发单的结构体的备份 - m_id_platform_order.insert(pair(pNewOrder->LocalID, pNewOrder)); - } - - m_msgQueue_Query->Input_Copy(RequestType::E_InputOrderField, m_msgQueue_Query, this, 0, 0, - ppOrders, sizeof(OrderField*)*count, nullptr, 0, nullptr, 0); - - delete[] ppOrders; - - return 0; -} - -int CTraderApi::_ReqOrderInsert(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - if (m_pApi == nullptr) - return 0; - - // 得到报单指针列表 - OrderField** ppOrders = (OrderField**)ptr1; - int count = (int)size1 / sizeof(OrderField*); - - Order_STRUCT** ppTdxOrders = new Order_STRUCT*[count]; - for (int i = 0; i < count; ++i) - { - ppTdxOrders[i] = (Order_STRUCT*)m_msgQueue->new_block(sizeof(Order_STRUCT)); - OrderField_2_Order_STRUCT(ppOrders[i], ppTdxOrders[i]); - } - - FieldInfo_STRUCT** ppFieldInfos = nullptr; - char** ppResults = nullptr; - Error_STRUCT** ppErrs = nullptr; - - // 注意:pTdxOrders在这里被修改了,需要使用修改后的东西 - int n = m_pApi->SendMultiOrders(ppTdxOrders, count, &ppFieldInfos, &ppResults, &ppErrs); - - // 标记批量下单是否有发成功过单的 - bool bSuccess = false; - // 将结果立即取出来 - for (int i = 0; i < count;++i) - { - m_id_api_order.insert(pair(ppOrders[i]->LocalID, ppTdxOrders[i])); - // 处理错误 - if (ppErrs && ppErrs[i]) - { - ppOrders[i]->RawErrorID = ppErrs[i]->ErrCode; - strcpy(ppOrders[i]->Text, ppErrs[i]->ErrInfo); - } - - // 处理结果 - if (ppResults && ppResults[i*COL_EACH_ROW + 0]) - { - bSuccess = true; - // 写上柜台的ID,以后将基于此进行定位 - strcpy(ppOrders[i]->ID, ppResults[i*COL_EACH_ROW + 0]); - - m_id_api_order.erase(ppOrders[i]->LocalID); - m_id_api_order.insert(pair(ppOrders[i]->ID, ppTdxOrders[i])); - - m_id_platform_order.erase(ppOrders[i]->LocalID); - m_id_platform_order.insert(pair(ppOrders[i]->ID, ppOrders[i])); - } - - // 现在有两个结构体,需要进行操作了 - // 1.通知下单的结果 - // 2.记录下单 - - OrderField* pField = ppOrders[i]; - if (pField->RawErrorID != 0) - { - pField->ExecType = ExecType::ExecType_Rejected; - pField->Status = OrderStatus::OrderStatus_Rejected; - } - else - { - pField->ExecType = ExecType::ExecType_New; - pField->Status = OrderStatus::OrderStatus_New; - } - - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); - } - - // 测试用,不能写这,太快了,要等一下 - //ReqQryTrade(); - - // 复制完了,可以删了以前东西 - delete[] ppTdxOrders; - - DeleteTableBody(ppResults, count); - DeleteErrors(ppErrs, count); - - if (bSuccess) - { - // 有挂单的,需要进行查询了 - - double _queryTime = QUERY_TIME_MIN; - - m_QueryOrderTime = time(nullptr) + _queryTime; - OutputQueryTime(m_QueryOrderTime, _queryTime, "NextQueryOrder_Send"); - } - - return 0; -} - -int CTraderApi::ReqOrderAction(OrderIDType* szId, int count, OrderIDType* pOutput) -{ - memset(pOutput, 0, sizeof(OrderIDType)*count); - - OrderField** ppOrders = new OrderField*[count]; - Order_STRUCT** ppTdxOrders = new Order_STRUCT*[count]; - - for (int i = 0; i < count; ++i) - { - ppOrders[i] = nullptr; - ppTdxOrders[i] = nullptr; - - { - unordered_map::iterator it = m_id_platform_order.find(szId[i]); - if (it != m_id_platform_order.end()) - ppOrders[i] = it->second; - } - - { - unordered_map::iterator it = m_id_api_order.find(szId[i]); - if (it != m_id_api_order.end()) - ppTdxOrders[i] = it->second; - } - } - - m_msgQueue_Query->Input_Copy(RequestType::E_InputOrderActionField, m_msgQueue_Query, this, 0, 0, - ppOrders, sizeof(OrderField*)*count, ppTdxOrders, sizeof(Order_STRUCT*)*count, nullptr, 0); - - delete[] ppOrders; - delete[] ppTdxOrders; - - return 0; -} - -int CTraderApi::_ReqOrderAction(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - int count = (int)size1 / sizeof(OrderField*); - // 通过ID找到原始结构,用于撤单 - // 通过ID找到通用结构,用于接收回报 - OrderField** ppOrders = (OrderField**)ptr1; - Order_STRUCT** ppTdxOrders = (Order_STRUCT**)ptr2; - - FieldInfo_STRUCT** ppFieldInfos = nullptr; - char** ppResults = nullptr; - Error_STRUCT** ppErrs = nullptr; - - int n = m_pApi->CancelMultiOrders(ppTdxOrders, count, &ppFieldInfos, &ppResults, &ppErrs); - - bool bSuccess = false; - // 将结果立即取出来 - for (int i = 0; i < count; ++i) - { - if (ppErrs) - { - if (ppErrs[i]) - { - ppOrders[i]->RawErrorID = ppErrs[i]->ErrCode; - strcpy(ppOrders[i]->Text, ppErrs[i]->ErrInfo); - - ppOrders[i]->ExecType = ExecType::ExecType_CancelReject; - // 注意报单状态问题 - } - else - { - bSuccess = true; - - // 会不会出现撤单时,当时不知道是否成功撤单,查询才得知没有撤成功? - //ppOrders[i]->ExecType = ExecType::ExecCancelled; - //ppOrders[i]->Status = OrderStatus::Cancelled; - continue; - } - } - // 撤单成功时,返回的东西还是null,所以这里使用错误信息来进行区分 - - //if (ppResults) - //{ - // if (ppResults[i*COL_EACH_ROW + 0]) - // { - // } - //} - - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, ppOrders[i], sizeof(OrderField), nullptr, 0, nullptr, 0); - } - - DeleteTableBody(ppResults, count); - DeleteErrors(ppErrs, count); - - if (bSuccess) - { - // 需要进行查询了 - double _queryTime = QUERY_TIME_MIN; - - m_QueryOrderTime = time(nullptr) + _queryTime; - OutputQueryTime(m_QueryOrderTime, _queryTime, "NextQueryOrder_Cancel"); - } - - return 0; -} - -void CTraderApi::ReqQryOrder() -{ - m_msgQueue_Query->Input_NoCopy(QueryType::ReqQryOrder, m_msgQueue_Query, this, 0, 0, - nullptr, 0, nullptr, 0, nullptr, 0); -} - -int CTraderApi::_ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - FieldInfo_STRUCT** ppFieldInfos = nullptr; - char** ppResults = nullptr; - Error_STRUCT* pErr = nullptr; - - m_pApi->ReqQueryData(REQUEST_DRWT, &ppFieldInfos, &ppResults, &pErr); - // 测试用,事后要删除 - //m_pApi->ReqQueryData(REQUEST_LSWT, &ppFieldInfos, &ppResults, &pErr, "20150801", "20151031"); - - if (IsErrorRspInfo("ReqQryOrder", pErr)) - { - double _queryTime = 0.5 * QUERY_TIME_MAX + QUERY_TIME_MIN; - m_QueryOrderTime = time(nullptr) + _queryTime; - //OutputQueryTime(m_QueryOrderTime, _queryTime, "NextQueryOrder_QueryOrder_Error"); - - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; - } - - WTLB_STRUCT** ppRS = nullptr; - CharTable2WTLB(ppFieldInfos, ppResults, &ppRS); - - // 操作前清空,按说之前已经清空过一次了 - m_NewOrderList.clear(); - - // 有未完成的,标记为true - bool IsDone = true; - // 有未申报的,标记为true - bool IsNotSent = false; - // 有更新的 - bool IsUpdated = false; - - if (ppRS) - { - int i = 0; - while (ppRS[i]) - { - // 将撤单委托过滤 - if (ppRS[i]->MMBZ_ != MMBZ_Cancel) - { - // 需要将它输入到一个地方用于计算 - OrderField* pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); - - WTLB_2_OrderField_0(ppRS[i], pField); - m_NewOrderList.push_back(pField); - - if (!ZTSM_IsDone(ppRS[i]->ZTSM_)) - { - IsDone = false; - } - if (ZTSM_IsNotSent(ppRS[i]->ZTSM_)) - { - IsNotSent = true; - } - } - ++i; - } - } - - // 委托列表 - // 1.新增的都需要输出 - // 2.老的看是否有变化 - ++m_OrderNotUpdateCount; - - int i = 0; - list::iterator it2 = m_OldOrderList.begin(); - for (list::iterator it = m_NewOrderList.begin(); it != m_NewOrderList.end(); ++it) - { - OrderField* pField = *it; - - bool bUpdate = false; - if (i >= m_OldOrderList.size()) - { - bUpdate = true; - } - else - { - // 相同位置的部分 - OrderField* pOldField = *it2; - if (pOldField->LeavesQty != pField->LeavesQty || pOldField->Status != pField->Status) - { - bUpdate = true; - } - } - - if (bUpdate) - { - IsUpdated = true; - m_OrderNotUpdateCount = 0; - - // 如果能找到下单时的委托,就修改后发出来 - unordered_map::iterator it = m_id_platform_order.find(pField->ID); - if (it != m_id_platform_order.end()) - { - OrderField* pField_ = it->second; - pField_->Date = pField->Date; - pField_->Time = pField->Time; - pField_->CumQty = pField->CumQty; - pField_->LeavesQty = pField->LeavesQty; - pField_->AvgPx = pField->AvgPx; - pField_->Status = pField->Status; - pField_->ExecType = pField->ExecType; - strcpy(pField_->Text, pField->Text); - - pField = pField_; - } - - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); - } - - // 前一个可能为空,移动到下一个时需要注意 - if (it2 != m_OldOrderList.end()) - { - ++it2; - } - - ++i; - } - - // 将老数据清理,防止内存泄漏 - for (list::iterator it = m_OldOrderList.begin(); it != m_OldOrderList.end(); ++it) - { - OrderField* pField = *it; - m_msgQueue->delete_block(pField); - } - - // 做交换 - m_OldOrderList.clear(); - m_OldOrderList = m_NewOrderList; - m_NewOrderList.clear(); - - DeleteTableBody(ppResults); - DeleteError(pErr); - - double _queryTime = 0; - if (!IsDone) - { - if (!IsUpdated) - { - // 没有更新,是否要慢点查 - _queryTime = 0.5 * QUERY_TIME_MAX + QUERY_TIME_MIN; - } - - // 有没有完成的,需要定时查询 - if (IsNotSent) - { - // 有没申报的,是否没在交易时间?慢点查 - _queryTime = 0.5 * QUERY_TIME_MAX + QUERY_TIME_MIN; - } - else - { - // 可能是交易时间了,是否需要考虑 - _queryTime = 2 * QUERY_TIME_MIN; - // 可能有些挂单一天都不会成交,挂在这一直导致查太多,加一下查询计数 - if (m_OrderNotUpdateCount>=3) - { - _queryTime = 0.5 * QUERY_TIME_MAX + QUERY_TIME_MIN; - } - } - } - else - { - // 全完成了,可以不查或慢查 - _queryTime = 5 * QUERY_TIME_MAX; - } - - m_QueryOrderTime = time(nullptr) + _queryTime; - OutputQueryTime(m_QueryOrderTime, _queryTime, "NextQueryOrder_QueryOrder"); - - // 决定成交查询间隔 - if (IsUpdated) - { - // 委托可能是撤单,也有可能是成交了,赶紧查一下 - _queryTime = 0; - m_QueryTradeTime = time(nullptr) + _queryTime; - OutputQueryTime(m_QueryTradeTime, _queryTime, "NextQueryTrade_QueryOrder"); - } - else - { - // 委托没有变化,那成交就没有必要查那么快了 - _queryTime = 5 * QUERY_TIME_MAX; - m_QueryTradeTime = time(nullptr) + _queryTime; - OutputQueryTime(m_QueryTradeTime, _queryTime, "NextQueryTrade_QueryOrder"); - } - - - return 0; -} - -void CTraderApi::ReqQryTrade() -{ - m_msgQueue_Query->Input_NoCopy(QueryType::ReqQryTrade, m_msgQueue_Query, this, 0, 0, - nullptr, 0, nullptr, 0, nullptr, 0); -} - -////////////////////////////////////////////////////////////////////////// -double GetTradeListQty(list &tradeList,int count) -{ - double Qty = 0; - int i = 0; - for (list::iterator it = tradeList.begin(); it != tradeList.end(); ++it) - { - ++i; - if (i>count) - { - break; - } - - TradeField* pField = *it; - Qty += pField->Qty; - } - return Qty; -} - -void TradeList2TradeMap(list &tradeList, unordered_map &tradeMap) -{ - // 只在这个函数中new和delete应当没有问题 - for (unordered_map::iterator it = tradeMap.begin(); it != tradeMap.end(); ++it) - { - TradeField* pNewField = it->second; - delete[] pNewField; - } - tradeMap.clear(); - - // 将多个合约拼接成 - for (list::iterator it = tradeList.begin(); it != tradeList.end(); ++it) - { - TradeField* pField = *it; - unordered_map::iterator it2 = tradeMap.find(pField->ID); - if (it2 == tradeMap.end()) - { - TradeField* pNewField = new TradeField; - memcpy(pNewField, pField, sizeof(TradeField)); - tradeMap[pField->ID] = pNewField; - } - else - { - TradeField* pNewField = it2->second; - pNewField->Price = pField->Price; - pNewField->Qty += pField->Qty; - } - } -} - -void CTraderApi::CompareTradeMapAndEmit(unordered_map &oldMap, unordered_map &newMap) -{ - for (unordered_map::iterator it = newMap.begin(); it != newMap.end(); ++it) - { - TradeField* pNewField = it->second; - unordered_map::iterator it2 = oldMap.find(pNewField->ID); - if (it2 == oldMap.end()) - { - // 没找到,是新单 - m_msgQueue->Input_Copy(ResponeType::OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pNewField, sizeof(TradeField), nullptr, 0, nullptr, 0); - } - else - { - TradeField* pOldField = it2->second; - int Qty = pNewField->Qty - pOldField->Qty; - if (Qty>0) - { - // 有变化的单 - TradeField* pField = new TradeField; - memcpy(pField, pNewField, sizeof(TradeField)); - pField->Qty = Qty; - m_msgQueue->Input_Copy(ResponeType::OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pNewField, sizeof(TradeField), nullptr, 0, nullptr, 0); - delete[] pField; - } - } - } -} - -void CTraderApi::CompareTradeListAndEmit(list &oldList, list &newList) -{ - int i = 0; - list::iterator it2 = oldList.begin(); - for (list::iterator it = newList.begin(); it != newList.end(); ++it) - { - TradeField* pField = *it; - - bool bUpdate = false; - if (i >= oldList.size()) - { - bUpdate = true; - } - //else - //{ - // // 相同位置的部分 - // TradeField* pOldField = *it2; - // if (pOldField->Qty != pField->Qty) - // { - // bUpdate = true; - // } - //} - - if (bUpdate) - { - m_msgQueue->Input_Copy(ResponeType::OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); - } - - // 前一个可能为空,移动到下一个时需要注意 - if (it2 != oldList.end()) - { - ++it2; - } - - ++i; - } -} -////////////////////////////////////////////////////////////////////////// - -int CTraderApi::_ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - FieldInfo_STRUCT** ppFieldInfos = nullptr; - char** ppResults = nullptr; - Error_STRUCT* pErr = nullptr; - - m_pApi->ReqQueryData(REQUEST_DRCJ, &ppFieldInfos, &ppResults, &pErr); - - if (IsErrorRspInfo("ReqQryTrade", pErr)) - { - double _queryTime = 0.5 * QUERY_TIME_MAX + QUERY_TIME_MIN; - m_QueryTradeTime = time(nullptr) + _queryTime; - - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; - } - - CJLB_STRUCT** ppRS = nullptr; - CharTable2CJLB(ppFieldInfos, ppResults, &ppRS); - - // 操作前清空,按说之前已经清空过一次了 - m_NewTradeList.clear(); - - if (ppRS) - { - // 利用成交编号的大小来判断正反序 - if (!m_TradeListReverse) - { - int count = GetCountStructs((void**)ppRS); - if (count>1) - { - // 转成数字的比较,是否会有非数字的情况出现? - long CJBH0 = atol(ppRS[0]->CJBH); - long CJBH1 = atol(ppRS[count - 1]->CJBH); - if (CJBH0>CJBH1) - { - m_TradeListReverse = true; - } - } - } - - int i = 0; - while (ppRS[i]) - { - TradeField* pField = (TradeField*)m_msgQueue->new_block(sizeof(TradeField)); - - CJLB_2_TradeField(ppRS[i], pField); - - if (m_TradeListReverse) - { - // 华泰查出来的表后生成的排第一,所以要处理一下 - m_NewTradeList.push_front(pField); - } - else - { - m_NewTradeList.push_back(pField); - } - - ++i; - } - } - - // 新查出来的反而少了,华泰有合并成交的情况,这种如何处理? - // 对同ID的需要累加,有发现累加不对应的,应当处理 - // 同样条数的,也有可能其中的有变化,如何处理? - bool bTryMerge = false; - int OldTradeListCount = m_OldTradeList.size(); - int NewTradeListCount = m_NewTradeList.size(); - - if (NewTradeListCount < OldTradeListCount) - { - // 行数变少了,应当是合并了 - bTryMerge = true; - } - else if (OldTradeListCount == 0) - { - // 如果上一次的为空,不管这次查出来的是合并还是没有合并,都没有关系,当成没合并处理即可 - } - else if (NewTradeListCount == OldTradeListCount) - { - // 行数不变,但有可能是其中的一条部分成交的更新,所以检查一下 - - double OldQty = GetTradeListQty(m_OldTradeList, m_OldTradeList.size()); - double NewQty = GetTradeListQty(m_NewTradeList, m_NewTradeList.size()); - if (NewQty != OldQty) - { - // 同样长度成交量发生了变化,可能是合并的列表其中一个新成交了 - bTryMerge = true; - } - } - else - { - // 行数变多了,只要其中上次的部分有变化就需要检查一下 - double OldQty = GetTradeListQty(m_OldTradeList, m_OldTradeList.size()); - double NewQty = GetTradeListQty(m_NewTradeList, m_NewTradeList.size()); - if (NewQty != OldQty) - { - bTryMerge = true; - } - } - - - - if (bTryMerge) - { - // 合并列表的处理方法 - // 如果上次是合并,这次就没有必要再生成一次了 - if (m_OldTradeMap.size() == 0 || !m_LastIsMerge) - { - for (unordered_map::iterator it = m_OldTradeMap.begin(); it != m_OldTradeMap.end(); ++it) - { - TradeField* pField = it->second; - delete[] pField; - } - m_OldTradeMap.clear(); - - TradeList2TradeMap(m_OldTradeList, m_OldTradeMap); - } - TradeList2TradeMap(m_NewTradeList, m_NewTradeMap); - CompareTradeMapAndEmit(m_OldTradeMap, m_NewTradeMap); - - // 交换 - for (unordered_map::iterator it = m_OldTradeMap.begin(); it != m_OldTradeMap.end(); ++it) - { - TradeField* pField = it->second; - delete[] pField; - } - m_OldTradeMap.clear(); - m_OldTradeMap = m_NewTradeMap; - m_NewTradeMap.clear(); - m_LastIsMerge = true; - } - else - { - // 普通的处理方法 - CompareTradeListAndEmit(m_OldTradeList, m_NewTradeList); - m_LastIsMerge = false; - } - - // 将老数据清理,防止内存泄漏 - for (list::iterator it = m_OldTradeList.begin(); it != m_OldTradeList.end(); ++it) - { - TradeField* pField = *it; - m_msgQueue->delete_block(pField); - } - - // 做交换 - m_OldTradeList.clear(); - m_OldTradeList = m_NewTradeList; - m_NewTradeList.clear(); - - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; -} - -//void CTraderApi::ReqQryInstrument(const string& szInstrumentId, const string& szExchange) -//{ -// -//} - -//void CTraderApi::ReqQryTradingAccount() -//{ -// m_msgQueue_Query->Input_NoCopy(QueryType::ReqQryTrade, m_msgQueue_Query, this, 0, 0, -// nullptr, 0, nullptr, 0, nullptr, 0); -//} - -int CTraderApi::_ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - if (m_pApi == nullptr) - return 0; - - FieldInfo_STRUCT** ppFieldInfos = nullptr; - char** ppResults = nullptr; - Error_STRUCT* pErr = nullptr; - - m_pApi->ReqQueryData(REQUEST_ZJYE, &ppFieldInfos, &ppResults, &pErr); - - if (IsErrorRspInfo("ReqQryTradingAccount", pErr)) - { - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; - } - - ZJYE_STRUCT** ppRS = nullptr; - CharTable2ZJYE(ppFieldInfos, ppResults, &ppRS); - - int count = GetCountStructs((void**)ppRS); - for (int i = 0; i < count; ++i) - { - AccountField* pField = (AccountField*)m_msgQueue->new_block(sizeof(AccountField)); - - ZJYE_2_AccountField(ppRS[i], pField); - - // 可能资金账号查不出来,手工填上 - if (strlen(pField->AccountID) <= 0) - { - // 多账户会有问题 - strcpy(pField->AccountID, m_pApi->GetAccount()); - } - - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryTradingAccount, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(AccountField), nullptr, 0, nullptr, 0); - } - - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; -} - -//void CTraderApi::ReqQryInvestorPosition() -//{ -// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryInvestorPositionField, m_msgQueue_Query, this, 0, 0, -// nullptr, 0, nullptr, 0, nullptr, 0); -//} - -int CTraderApi::_ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - if (m_pApi == nullptr) - return 0; - - FieldInfo_STRUCT** ppFieldInfos = nullptr; - char** ppResults = nullptr; - Error_STRUCT* pErr = nullptr; - - m_pApi->ReqQueryData(REQUEST_GFLB, &ppFieldInfos, &ppResults, &pErr); - - if (IsErrorRspInfo("ReqQryInvestorPosition", pErr)) - { - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; - } - - GFLB_STRUCT** ppRS = nullptr; - CharTable2GFLB(ppFieldInfos, ppResults, &ppRS); - - int count = GetCountStructs((void**)ppRS); - for (int i = 0; i < count; ++i) - { - PositionField* pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); - - // 应当处理一下,可能一个账号对应的有多个,如信用账户 - GFLB_2_PositionField(ppRS[i], pField); - - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInvestorPosition, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); - } - - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; -} - -void CTraderApi::Subscribe(const string& szInstrumentIDs, const string& szExchangeID) -{ - char buf[64] = { 0 }; - strcpy(buf, szInstrumentIDs.c_str()); - - m_msgQueue_Query->Input_Copy(RequestType::E_QryDepthMarketDataField, m_msgQueue_Query, this, 0, 0, - buf, sizeof(buf), nullptr, 0, nullptr, 0); -} - -int CTraderApi::_Subscribe(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - if (m_pApi == nullptr) - return 0; - - FieldInfo_STRUCT** ppFieldInfos = nullptr; - char** ppResults = nullptr; - Error_STRUCT* pErr = nullptr; - - m_pApi->ReqQueryData(REQUEST_HQ, &ppFieldInfos, &ppResults, &pErr, "", "", (char*)ptr1); - - if (IsErrorRspInfo("Subscribe", pErr)) - { - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; - } - - HQ_STRUCT** ppRS = nullptr; - CharTable2HQ(ppFieldInfos, ppResults, &ppRS); - - int count = GetCountStructs((void**)ppRS); - - for (int i = 0; i < count; ++i) - { - DepthMarketDataNField* pField = (DepthMarketDataNField*)m_msgQueue->new_block(sizeof(DepthMarketDataNField)+sizeof(DepthField)* 10); - - HQ_STRUCT* pDepthMarketData = ppRS[i]; - - strcpy(pField->InstrumentID, pDepthMarketData->ZQDM); - //pField->Exchange = JYSDM_2_ExchangeType(pDepthMarketData->JYSDM); - - sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, ""); - - // 交易时间 - GetExchangeTime(time(nullptr), &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime); - - - pField->LastPrice = pDepthMarketData->DQJ_; - //pField->Volume = 0; - //pField->Turnover = pDepthMarketData->Turnover; - //pField->OpenInterest = pDepthMarketData->OpenInterest; - //pField->AveragePrice = pDepthMarketData->AveragePrice; - pField->UpperLimitPrice = pDepthMarketData->ZTJG_; - pField->LowerLimitPrice = pDepthMarketData->DTJG_; - - pField->PreClosePrice = pDepthMarketData->ZSJ_; - pField->OpenPrice = pDepthMarketData->JKJ_; - - InitBidAsk(pField); - - do - { - if (pDepthMarketData->BidSize1_ == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice1_, pDepthMarketData->BidSize1_, 0); - - if (pDepthMarketData->BidSize2_ == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice2_, pDepthMarketData->BidSize2_, 0); - - if (pDepthMarketData->BidSize3_ == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice3_, pDepthMarketData->BidSize3_, 0); - - if (pDepthMarketData->BidSize4_ == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice4_, pDepthMarketData->BidSize4_, 0); - - if (pDepthMarketData->BidSize5_ == 0) - break; - AddBid(pField, pDepthMarketData->BidPrice5_, pDepthMarketData->BidSize5_, 0); - } while (false); - - do - { - if (pDepthMarketData->AskSize1_ == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice1_, pDepthMarketData->AskSize1_, 0); - - if (pDepthMarketData->AskSize2_ == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice2_, pDepthMarketData->AskSize2_, 0); - - if (pDepthMarketData->AskSize3_ == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice3_, pDepthMarketData->AskSize3_, 0); - - if (pDepthMarketData->AskSize4_ == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice4_, pDepthMarketData->AskSize4_, 0); - - if (pDepthMarketData->AskSize5_ == 0) - break; - AddAsk(pField, pDepthMarketData->AskPrice5_, pDepthMarketData->AskSize5_, 0); - } while (false); - - m_msgQueue->Input_NoCopy(ResponeType::OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); - } - - DeleteTableBody(ppResults); - DeleteError(pErr); - - return 0; -} \ No newline at end of file diff --git a/QuantBox_Tdx_Trade/TraderApi.h b/QuantBox_Tdx_Trade/TraderApi.h deleted file mode 100644 index 80b84e8..0000000 --- a/QuantBox_Tdx_Trade/TraderApi.h +++ /dev/null @@ -1,264 +0,0 @@ -#pragma once - -#include "../include/Tdx/TdxApi.h" -#include "../include/ApiStruct.h" -#include "../include/IDGenerator.h" -#include "../include/QueueEnum.h" - -#ifdef _WIN64 -#pragma comment(lib, "../include/Tdx/win64/TdxApi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x64.lib") -#else -#pragma comment(lib, "../include/Tdx/win32/TdxApi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") -#endif - - -#include -#include -#include -#include -#include -#include -#include -#include - -#define QUERY_TIME_MIN (3) -#define QUERY_TIME_MAX (60) - -using namespace std; - -class CMsgQueue; - -class CTraderApi -{ - //请求数据包类型 - enum RequestType - { - E_Init = 100, - E_ReqUserLoginField, - E_QryInvestorField, - E_InputOrderField, - E_InputOrderActionField, - E_QryOrderField, - E_QryTradeField, - E_QryTradingAccountField, - E_QryInvestorPositionField, - - E_QryDepthMarketDataField, - - - E_SettlementInfoConfirmField, - E_QryInstrumentField, - E_InputQuoteField, - E_InputQuoteActionField, - E_ParkedOrderField, - E_QryInvestorPositionDetailField, - E_QryInstrumentCommissionRateField, - E_QryInstrumentMarginRateField, - E_QrySettlementInfoField, - E_QryQuoteField, - }; - -public: - //static CTraderApi * pThis; - - CTraderApi(void); - virtual ~CTraderApi(void); - - void Register(void* pCallback, void* pClass); - - void Connect(const string& szPath, - ServerInfoField* pServerInfo, - UserInfoField* pUserInfo, - int count); - void Disconnect(); - - int ReqOrderInsert( - OrderField* pOrder, - int count, - OrderIDType* pInOut); - - //char* ReqParkedOrderInsert(int OrderRef, - // OrderField* pOrder1, - // OrderField* pOrder2); - - int ReqOrderAction(OrderIDType* szId, int count, OrderIDType* pOutput); - int ReqOrderAction(Order_STRUCT *pOrder, int count, OrderIDType* pOutput); - - //char* ReqQuoteInsert( - // int QuoteRef, - // QuoteField* pQuote); - - //int ReqQuoteAction(CThostFtdcQuoteField *pQuote); - ////int ReqQuoteAction(const string& szId); - - void ReqQuery(QueryType type, ReqQueryField* pQuery); - - //void ReqQryTradingAccount(); - //void ReqQryInvestorPosition(); - //void ReqQryInvestorPositionDetail(const string& szInstrumentId); - //void ReqQryInstrument(const string& szInstrumentId, const string& szExchange); - //void ReqQryInstrumentCommissionRate(const string& szInstrumentId); - ////void ReqQryInstrumentMarginRate(const string& szInstrumentId,TThostFtdcHedgeFlagType HedgeFlag = THOST_FTDC_HF_Speculation); - //void ReqQryDepthMarketData(const string& szInstrumentId); - //void ReqQrySettlementInfo(const string& szTradingDay); - - void ReqQryOrder(); - void ReqQryTrade(); - //void ReqQryQuote(); - - void ReqQryInvestor(); - - void Subscribe(const string& szInstrumentIDs, const string& szExchangeID); - -private: - //static void __stdcall OnReadPushData(ETX_APP_FUNCNO FuncNO, void* pEtxPushData); - //void _OnReadPushData(ETX_APP_FUNCNO FuncNO, void* pEtxPushData); - - friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - virtual void QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - friend void* __stdcall Test(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - virtual void TestInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - int _Init(); - - //登录请求 - void ReqUserLogin(); - int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - int _ReqQryInvestor(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - - int _ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - int _ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - int _ReqOrderInsert(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - int _ReqOrderAction(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - int _ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - int _ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - - int _Subscribe(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - - //检查是否出错 - //bool IsErrorRspInfo(Error_STRUCT *pRspInfo, int nRequestID, bool bIsLast);//向消息队列输出信息 - bool IsErrorRspInfo(const char* szSource, Error_STRUCT *pRspInfo);//不输出信息 - void OutputQueryTime(time_t t, double db,const char* szSource); - - ////连接 - //virtual void OnFrontConnected(); - //virtual void OnFrontDisconnected(int nReason); - - ////认证 - //virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - ////下单 - //virtual void OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo); - - ////撤单 - //virtual void OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo); - - ////报单回报 - //virtual void OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRtnOrder(CThostFtdcOrderField *pOrder); - - ////成交回报 - //virtual void OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRtnTrade(CThostFtdcTradeField *pTrade); - - ////报价录入 - //virtual void OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo); - //virtual void OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRtnQuote(CThostFtdcQuoteField *pQuote); - - ////报价撤单 - //virtual void OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo); - - ////仓位 - //virtual void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspQryInvestorPositionDetail(CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspQryInvestorPositionCombineDetail(CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; - - ////资金 - //virtual void OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - ////合约、手续费 - //virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - ////查询行情响应 - //virtual void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - ////请求查询投资者结算结果响应 - //virtual void OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - ////其它 - //virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus); -private: - void CompareTradeMapAndEmit(unordered_map &oldMap, unordered_map &newMap); - void CompareTradeListAndEmit(list &oldList, list &newList); - -private: - atomic m_lRequestID; //请求ID,得保持自增 - - OrderIDType m_orderInsert_Id; - - mutex m_csOrderRef; - int m_nMaxOrderRef; //报单引用,用于区分报单,保持自增 - - CTdxApi* m_pApi; //交易API - void* m_pClient; - - - string m_szPath; //生成配置文件的路径 - ServerInfoField m_ServerInfo; - UserInfoField m_UserInfo; - - int m_nSleep; - - unordered_map m_id_platform_order; - unordered_map m_id_api_order; - - unordered_map m_cust_acc_no; - - CMsgQueue* m_msgQueue; //消息队列指针 - CMsgQueue* m_msgQueue_Query; //发送消息队列指针 - CMsgQueue* m_msgQueue_Order; //报单消息队列指针 - CMsgQueue* m_msgQueue_Test; //测试用 - - UserInfoField* m_pUserInfos; - int m_UserInfo_Pos; - int m_UserInfo_Count; - - void* m_pClass; - - CIDGenerator* m_pIDGenerator; - - list m_OldTradeList; - list m_NewTradeList; - unordered_map m_NewTradeMap; - unordered_map m_OldTradeMap; - - - list m_OldOrderList; - list m_NewOrderList; - - time_t m_QueryTradeTime; - time_t m_QueryOrderTime; - int m_OrderNotUpdateCount; - bool m_TradeListReverse; - bool m_LastIsMerge; -}; - diff --git a/QuantBox_Tdx_Trade/TypeConvert.cpp b/QuantBox_Tdx_Trade/TypeConvert.cpp deleted file mode 100644 index 17cf766..0000000 --- a/QuantBox_Tdx_Trade/TypeConvert.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include "stdafx.h" -#include "TypeConvert.h" -#include "../include/Tdx/tdx_enum.h" - -OrderType WTFS_2_OrderType(int In) -{ - switch (In) - { - case WTFS_Limit: - return OrderType::OrderType_Limit; - default: - return OrderType::OrderType_Market; - } -} - -TimeInForce WTFS_2_TimeInForce(int In) -{ - switch (In) - { - case WTFS_Limit: - case WTFS_Best_Reverse: - case WTFS_Best_Forward: - return TimeInForce::TimeInForce_Day; - case WTFS_IOC: - case WTFS_Five_IOC: - return TimeInForce::TimeInForce_IOC; - case WTFS_FOK: - return TimeInForce::TimeInForce_FOK; - case WTFS_Five_Limit: - return TimeInForce::TimeInForce_Day; - default: - return TimeInForce::TimeInForce_Day; - } -} - -OrderStatus ZTSM_2_OrderStatus(int In) -{ - switch (In) - { - case ZTSM_NotSent: - return OrderStatus::OrderStatus_PendingNew; - case ZTSM_New: - return OrderStatus::OrderStatus_New; - case ZTSM_Illegal: - return OrderStatus::OrderStatus_Rejected; - case ZTSM_AllFilled: - return OrderStatus::OrderStatus_Filled; - case ZTSM_AllCancelled: - return OrderStatus::OrderStatus_Cancelled; - case ZTSM_PartiallyFilled: - return OrderStatus::OrderStatus_PartiallyFilled; - default: - return OrderStatus::OrderStatus_NotSent; - } -} - -ExecType ZTSM_2_ExecType(int In) -{ - switch (In) - { - case ZTSM_NotSent: - return ExecType::ExecType_New; - case ZTSM_New: - return ExecType::ExecType_New; - case ZTSM_Illegal: - return ExecType::ExecType_Rejected; - case ZTSM_AllFilled: - case ZTSM_PartiallyFilled: - return ExecType::ExecType_Trade; - case ZTSM_AllCancelled: - case ZTSM_PartiallyCancelled: - return ExecType::ExecType_Cancelled; - - return ExecType::ExecType_Trade; - default: - return ExecType::ExecType_New; - } -} - -bool ZTSM_IsDone(int In) -{ - switch (In) - { - case ZTSM_Illegal: - case ZTSM_AllFilled: - case ZTSM_AllCancelled: - case ZTSM_PartiallyCancelled: - return true; - } - return false; -} - -bool ZTSM_IsNotSent(int In) -{ - switch (In) - { - case ZTSM_NotSent: - return true; - } - return false; -} - -// 将买卖方式转成买卖方向 -OrderSide MMBZ_2_OrderSide(int In) -{ - switch (In) - { - case MMBZ_Buy_Limit: - return OrderSide::OrderSide_Buy; - case MMBZ_Sell_Limit: - return OrderSide::OrderSide_Sell; - default: - break; - } - return OrderSide::OrderSide_Buy; -} - -void CJLB_2_TradeField(CJLB_STRUCT* pIn, TradeField* pOut) -{ - strcpy(pOut->ID, pIn->WTBH); - strcpy(pOut->InstrumentID, pIn->ZQDM); - pOut->Price = pIn->CJJG_; - pOut->Qty = pIn->CJSL_; - pOut->Date = pIn->CJRQ_; - pOut->Time = pIn->CJSJ_; - pOut->Side = MMBZ_2_OrderSide(pIn->MMBZ_); - - strcpy(pOut->TradeID, pIn->CJBH); - - pOut->Commission = pIn->YJ_ + pIn->YHS_ + pIn->GHF_ + pIn->CJF_; - - pOut->OpenClose = pOut->Side == OrderSide::OrderSide_Buy ? OpenCloseType::OpenCloseType_Open : OpenCloseType::OpenCloseType_Close; - pOut->HedgeFlag = HedgeFlagType::HedgeFlagType_Speculation; - -} - -void WTLB_2_OrderField_0(WTLB_STRUCT* pIn, OrderField* pOut) -{ - strcpy(pOut->ID, pIn->WTBH); - strcpy(pOut->InstrumentID, pIn->ZQDM); - pOut->Price = pIn->WTJG_; - pOut->Qty = pIn->WTSL_; - pOut->Date = pIn->WTRQ_; - pOut->Time = pIn->WTSJ_; - pOut->Side = MMBZ_2_OrderSide(pIn->MMBZ_); - - pOut->Type = WTFS_2_OrderType(pIn->BJFS_); - pOut->TimeInForce = WTFS_2_TimeInForce(pIn->BJFS_); - - pOut->Status = ZTSM_2_OrderStatus(pIn->ZTSM_); - pOut->ExecType = ZTSM_2_ExecType(pIn->ZTSM_); - - pOut->OpenClose = pOut->Side == OrderSide::OrderSide_Buy ? OpenCloseType::OpenCloseType_Open : OpenCloseType::OpenCloseType_Close; - pOut->HedgeFlag = HedgeFlagType::HedgeFlagType_Speculation; - - strcpy(pOut->AccountID, pIn->GDDM); - - pOut->AvgPx = pIn->CJJG_; - pOut->CumQty = pIn->CJSL_; - pOut->LeavesQty = pIn->WTSL_ - pIn->CJSL_ - pIn->CDSL_; - - strcpy(pOut->Text, pIn->ZTSM); -} - -int OrderType_2_WTFS(OrderType In) -{ - switch (In) - { - case OrderType_Market: - case OrderType_Stop: - case OrderType_MarketOnClose: - case OrderType_TrailingStop: - return WTFS_Five_IOC;// 只推荐使用五档模拟市价 - case OrderType_Limit: - case OrderType_StopLimit: - case OrderType_TrailingStopLimit: - return WTFS_Limit; - case OrderType_Pegged: - default: - return WTFS_Limit; - } -} - - -void OrderField_2_Order_STRUCT(OrderField* pIn, Order_STRUCT* pOut) -{ - strcpy(pOut->ZQDM, pIn->InstrumentID); - pOut->Price = pIn->Price; - pOut->Qty = pIn->Qty; - pOut->WTFS = OrderType_2_WTFS(pIn->Type); - pOut->RZRQBS = RZRQBS_NO; - - // 这个地方后期要再改,因为没有处理基金等情况 - switch (pIn->Type) - { - case OrderType::OrderType_Market: - if (pIn->Side == OrderSide::OrderSide_Buy) - pOut->MMBZ = MMBZ_Buy_Market; - else - pOut->MMBZ = MMBZ_Sell_Market; - break; - case OrderType::OrderType_Limit: - if (pIn->Side == OrderSide::OrderSide_Buy) - pOut->MMBZ = MMBZ_Buy_Limit; - else - pOut->MMBZ = MMBZ_Sell_Limit; - break; - } -} - -void GDLB_2_InvestorField(GDLB_STRUCT* pIn, InvestorField* pOut) -{ - strcpy(pOut->InvestorID, pIn->GDDM); - strcpy(pOut->InvestorName, pIn->GDMC); -} - -void ZJYE_2_AccountField(ZJYE_STRUCT* pIn, AccountField* pOut) -{ - strcpy(pOut->AccountID, pIn->ZJZH); - //pIn->BZ; - pOut->Available = pIn->KYZJ_; - - // 还有很多不知道如何对应,有可能需要扩展XAPI部分 - pOut->Balance = pIn->ZZC_; - -} - -void GFLB_2_PositionField(GFLB_STRUCT* pIn, PositionField* pOut) -{ - pOut->Side = PositionSide::PositionSide_Long; - pOut->Position = pIn->ZQSL_; - pOut->TodayPosition = pIn->DJSL_; - pOut->HistoryPosition = pIn->KMSL_; - pOut->HedgeFlag = HedgeFlagType::HedgeFlagType_Speculation; - strcpy(pOut->InstrumentID, pIn->ZQDM); - strcpy(pOut->Symbol, pIn->ZQDM); - - // 还有一些信息没有 -} \ No newline at end of file diff --git a/QuantBox_Tdx_Trade/TypeConvert.h b/QuantBox_Tdx_Trade/TypeConvert.h deleted file mode 100644 index 86a7d6f..0000000 --- a/QuantBox_Tdx_Trade/TypeConvert.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "../include/ApiStruct.h" - -#include "../include/Tdx/tdx_struct.h" - -// 两种情况: -// 1.完全重建 -// 2.部分重建 -bool ZTSM_IsDone(int In); -bool ZTSM_IsNotSent(int In); - -void GDLB_2_InvestorField(GDLB_STRUCT* pIn, InvestorField* pOut); -void ZJYE_2_AccountField(ZJYE_STRUCT* pIn, AccountField* pOut); -void GFLB_2_PositionField(GFLB_STRUCT* pIn, PositionField* pOut); - -void CJLB_2_TradeField(CJLB_STRUCT* pIn, TradeField* pOut); - -// -void WTLB_2_OrderField_0(WTLB_STRUCT* pIn, OrderField* pOut); -//void WTLB_2_OrderField_1(WTLB_STRUCT* pIn, OrderField* pOut); - -void OrderField_2_Order_STRUCT(OrderField* pIn, Order_STRUCT* pOut); diff --git a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.h b/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.h deleted file mode 100644 index 20f961c..0000000 --- a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.h +++ /dev/null @@ -1,26 +0,0 @@ -// QuantBox_TongShi_Quote.h : main header file for the QuantBox_TongShi_Quote DLL -// - -#pragma once - -#ifndef __AFXWIN_H__ - #error "include 'stdafx.h' before including this file for PCH" -#endif - -#include "resource.h" // main symbols - -// CQuantBox_TongShi_QuoteApp -// See QuantBox_TongShi_Quote.cpp for the implementation of this class -// - -class CQuantBox_TongShi_QuoteApp : public CWinApp -{ -public: - CQuantBox_TongShi_QuoteApp(); - -// Overrides -public: - virtual BOOL InitInstance(); - - DECLARE_MESSAGE_MAP() -}; diff --git a/QuantBox_XAPI/XApiC.cpp b/QuantBox_XAPI/XApiC.cpp deleted file mode 100644 index 36e632a..0000000 --- a/QuantBox_XAPI/XApiC.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include "stdafx.h" - -#include -#include -#include "../include/XApiC.h" -#include "../include/QueueHeader.h" -#include "../include/QueueEnum.h" - -#if defined WINDOWS || WIN32 -#include -#else -#include -#include -#endif - - -void* X_LoadLib(char* libPath) -{ - if (libPath == nullptr) - return nullptr; - -#if defined WINDOWS || WIN32 - return LoadLibraryExA(libPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH); -#else - return dlopen(libPath, RTLD_NOW); -#endif -} - -char* X_GetLastError() -{ -#if defined WINDOWS || WIN32 - char szBuf[256] = {0}; - LPVOID lpMsgBuf; - DWORD dw = GetLastError(); - FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - dw, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPSTR)&lpMsgBuf, - 0, NULL); - return (char*)lpMsgBuf; -#else - extern int errno; - errno = 0; - return dlerror(); -#endif -} - -void* X_GetFunction(void* lib,char* ProcName) -{ - if (lib == nullptr) - return nullptr; -#if defined WINDOWS || WIN32 - return GetProcAddress((HMODULE)lib, ProcName); -#else - return (dlsym(lib, ProcName)); -#endif -} - -void X_FreeLib(void* lib) -{ - if (lib == nullptr) - return; - -#if defined WINDOWS || WIN32 - FreeLibrary((HMODULE)lib); -#else - dlclose(lib); -#endif -} - -ApiType X_GetApiType(void* pFun) -{ - if (pFun == nullptr) - return ApiType::ApiType_Nono; - - void* p = ((fnOnRespone)pFun)(RequestType::GetApiType, nullptr, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - return (ApiType)(char)(long long)(p); -} - -char* X_GetApiVersion(void* pFun) -{ - if (pFun == nullptr) - return nullptr; - - return (char*)((fnOnRespone)pFun)(RequestType::GetApiVersion, nullptr, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); -} - -char* X_GetApiName(void* pFun) -{ - if (pFun == nullptr) - return nullptr; - - return (char*)((fnOnRespone)pFun)(RequestType::GetApiName, nullptr, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); -} - -void* X_Create(void* pFun) -{ - if (pFun == nullptr) - return nullptr; - - return ((fnOnRespone)pFun)(RequestType::Create, nullptr, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); -} - -void X_Register(void* pFun, void* pApi, void* pCallback, void* pClass) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::Register, pApi, nullptr, 0, 0, pCallback, 0, pClass, 0, nullptr, 0); -} - -void X_Connect(void* pFun, void* pApi, char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::Connect, pApi, nullptr, 0, 0, pServerInfo, 0, pUserInfo, count, szPath, 0); -} - -void X_Disconnect(void* pFun, void* pApi) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::Disconnect, pApi, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); -} - -void X_Subscribe(void* pFun, void* pApi, char* szInstrument, char* szExchange) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::Subscribe, pApi, nullptr, 0, 0, szInstrument, 0, szExchange, 0, nullptr, 0); -} - -void X_Unsubscribe(void* pFun, void* pApi, char* szInstrument, char* szExchange) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::Unsubscribe, pApi, nullptr, 0, 0, szInstrument, 0, szExchange, 0, nullptr, 0); -} - -void X_SubscribeQuote(void* pFun, void* pApi, char* szInstrument, char* szExchange) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::SubscribeQuote, pApi, nullptr, 0, 0, szInstrument, 0, szExchange, 0, nullptr, 0); -} - -void X_UnsubscribeQuote(void* pFun, void* pApi, char* szInstrument, char* szExchange) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::UnsubscribeQuote, pApi, nullptr, 0, 0, szInstrument, 0, szExchange, 0, nullptr, 0); -} - -void X_ReqQryInstrument(void* pFun, void* pApi, char* szInstrument, char* szExchange) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(QueryType::ReqQryInstrument, pApi, nullptr, 0, 0, szInstrument, 0, szExchange, 0, nullptr, 0); -} - -void X_ReqQryInvestorPosition(void* pFun, void* pApi, char* szInstrument, char* szExchange) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(QueryType::ReqQryInvestorPosition, pApi, nullptr, 0, 0, szInstrument, 0, szExchange, 0, nullptr, 0); -} - -void X_ReqQryTradingAccount(void* pFun, void* pApi) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(QueryType::ReqQryTradingAccount, pApi, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); -} - -void X_SendOrder(void* pFun, void* pApi, OrderField* pOrder, OrderIDType* pInOut, int count) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::ReqOrderInsert, pApi, nullptr, 0, 0, pOrder, count, pInOut, 0, nullptr, 0); -} - -void X_CancelOrder(void* pFun, void* pApi, OrderIDType* pIn, OrderIDType* pOut, int count) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::ReqOrderAction, pApi, nullptr, 0, 0, pIn, count, pOut, 0, nullptr, 0); -} - -void X_SendQuote(void* pFun, void* pApi, QuoteField* pQuote, OrderIDType* pAskOut, OrderIDType* pBidOut, int count) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::ReqQuoteInsert, pApi, nullptr, 0, 0, pQuote, count, pAskOut, 0, pBidOut, 0); -} - -void X_CancelQuote(void* pFun, void* pApi, OrderIDType* pIn, OrderIDType* pOut, int count) -{ - if (pFun == nullptr || pApi == nullptr) - return; - - ((fnOnRespone)pFun)(RequestType::ReqQuoteAction, pApi, nullptr, 0, 0, pIn, count, pOut, 0, nullptr, 0); -} diff --git a/QuantBox_XAPI/XApiCpp.cpp b/QuantBox_XAPI/XApiCpp.cpp deleted file mode 100644 index d69c6ce..0000000 --- a/QuantBox_XAPI/XApiCpp.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "stdafx.h" -#include "../include/XApiCpp.h" - -#include "XApiImpl.h" - -CXApi::CXApi() -{ -} - -CXApi* CXApi::CreateApi(char* libPath) -{ - return new CXApiImpl(libPath); -} diff --git a/QuantBox_XAPI/XApiImpl.cpp b/QuantBox_XAPI/XApiImpl.cpp deleted file mode 100644 index a3a9126..0000000 --- a/QuantBox_XAPI/XApiImpl.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include "stdafx.h" -#include -#include -#include "XApiImpl.h" - -#include "../include/QueueEnum.h" -#include "../include/XApiC.h" - -void* __stdcall CXApiImpl::OnRespone(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - if (pApi2 == nullptr) - return nullptr; - - CXApiImpl* pThisClass = (CXApiImpl*)pApi2; - return pThisClass->_OnRespone(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); -} - -void* CXApiImpl::_OnRespone(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - if (nullptr == m_pSpi) - return nullptr; - - ResponeType rt = (ResponeType)type; - switch (rt) - { - case OnConnectionStatus: - m_pSpi->OnConnectionStatus(this, (ConnectionStatus)(char)double1, (RspUserLoginField*)ptr1, size1); - break; - case OnRtnError: - m_pSpi->OnRtnError(this, (ErrorField*)ptr1); - break; - case OnRtnDepthMarketData: - m_pSpi->OnRtnDepthMarketDataN(this, (DepthMarketDataNField*)ptr1); - break; - case OnRspQryInstrument: - m_pSpi->OnRspQryInstrument(this, (InstrumentField*)ptr1, size1, double1 != 0); - break; - case OnRspQryTradingAccount: - m_pSpi->OnRspQryTradingAccount(this, (AccountField*)ptr1, size1, double1 != 0); - break; - case OnRspQryInvestorPosition: - m_pSpi->OnRspQryInvestorPosition(this, (PositionField*)ptr1, size1, double1 != 0); - break; - case OnRspQrySettlementInfo: - m_pSpi->OnRspQrySettlementInfo(this, (SettlementInfoField*)ptr1, size1, double1 != 0); - break; - - case OnRtnOrder: - m_pSpi->OnRtnOrder(this, (OrderField*)ptr1); - break; - case OnRtnTrade: - m_pSpi->OnRtnTrade(this, (TradeField*)ptr1); - break; - - case OnRtnQuote: - m_pSpi->OnRtnQuote(this, (QuoteField*)ptr1); - break; - case OnRtnQuoteRequest: - m_pSpi->OnRtnQuoteRequest(this, (QuoteRequestField*)ptr1); - break; - - case OnRspQryHistoricalTicks: - m_pSpi->OnRspQryHistoricalTicks(this, (TickField*)ptr1, size1, (HistoricalDataRequestField*)ptr2, size2, double1 != 0); - break; - case OnRspQryHistoricalBars: - m_pSpi->OnRspQryHistoricalBars(this, (BarField*)ptr1, size1, (HistoricalDataRequestField*)ptr2, size2, double1 != 0); - break; - - case OnRspQryInvestor: - m_pSpi->OnRspQryInvestor(this, (InvestorField*)ptr1, size1, double1 != 0); - break; - case OnFilterSubscribe: - return (void*)m_pSpi->OnFilterSubscribe(this, (ExchangeType)(char)double1, (int)size1, (int)size1, (int)size3, (char*)ptr1); - default: - break; - } - return nullptr; -} - -CXApiImpl::CXApiImpl(char* libPath) :CXApi() -{ - m_pLib = nullptr; - m_pFun = nullptr; - m_pApi = nullptr; - m_pSpi = nullptr; - - strncpy(m_LibPath, libPath, sizeof(m_LibPath)); -} - - -CXApiImpl::~CXApiImpl() -{ - Disconnect(); -} - -ApiType CXApiImpl::GetApiType() -{ - return X_GetApiType(m_pFun); -} - -char* CXApiImpl::GetApiVersion() -{ - return X_GetApiVersion(m_pFun); -} - -char* CXApiImpl::GetApiName() -{ - return X_GetApiName(m_pFun); -} - -void CXApiImpl::RegisterSpi(CXSpi *pSpi) -{ - m_pSpi = pSpi; -} - -bool CXApiImpl::Init() -{ - m_pLib = X_LoadLib(m_LibPath); - if (m_pLib) - { - m_pFun = X_GetFunction(m_pLib); - if (m_pFun) - { - return true; - } - } - return false; -} - -char* CXApiImpl::GetLastError() -{ - return X_GetLastError(); -} - -void CXApiImpl::Connect(char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count) -{ - m_pApi = X_Create(m_pFun); - X_Register(m_pFun, m_pApi, (void*)OnRespone, this); - X_Connect(m_pFun, m_pApi, szPath, pServerInfo, pUserInfo, count); -} - -void CXApiImpl::Disconnect() -{ - X_Disconnect(m_pFun, m_pApi); - X_FreeLib(m_pLib); - - m_pLib = nullptr; - m_pFun = nullptr; - m_pApi = nullptr; - m_pSpi = nullptr; -} - -void CXApiImpl::Subscribe(char* szInstrument, char* szExchange) -{ - X_Subscribe(m_pFun, m_pApi, szInstrument, szExchange); -} - -void CXApiImpl::Unsubscribe(char* szInstrument, char* szExchange) -{ - X_Unsubscribe(m_pFun, m_pApi, szInstrument, szExchange); -} - -void CXApiImpl::ReqQryInstrument(char* szInstrument, char* szExchange) -{ - X_ReqQryInstrument(m_pFun, m_pApi, szInstrument, szExchange); -} - -void CXApiImpl::ReqQryInvestorPosition(char* szInstrument, char* szExchange) -{ - X_ReqQryInvestorPosition(m_pFun, m_pApi, szInstrument, szExchange); -} - -void CXApiImpl::ReqQryTradingAccount() -{ - X_ReqQryTradingAccount(m_pFun, m_pApi); -} - -void CXApiImpl::SendOrder(OrderField* pOrder, OrderIDType* pInOut, int count) -{ - X_SendOrder(m_pFun, m_pApi, pOrder, pInOut, count); -} - -void CXApiImpl::CancelOrder(OrderIDType* pIn, OrderIDType* pOut, int count) -{ - X_CancelOrder(m_pFun, m_pApi, pIn, pOut, count); -} - -void CXApiImpl::SendQuote(QuoteField* pQuote, OrderIDType* pAskOut, OrderIDType* pBidOut, int count) -{ - X_SendQuote(m_pFun, m_pApi, pQuote, pAskOut, pBidOut, count); -} -void CXApiImpl::CancelQuote(OrderIDType* pIn, OrderIDType* pOut, int count) -{ - X_CancelQuote(m_pFun, m_pApi, pIn, pOut, count); -} diff --git a/QuantBox_XAPI/XApiImpl.h b/QuantBox_XAPI/XApiImpl.h deleted file mode 100644 index fb73253..0000000 --- a/QuantBox_XAPI/XApiImpl.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once -#include "../include/XApiCpp.h" - -#include "../include/QueueHeader.h" - -class CXApiImpl : - public CXApi -{ -public: - CXApiImpl(char* libPath); - ~CXApiImpl(); - - virtual ApiType GetApiType(); - virtual char* GetApiVersion(); - virtual char* GetApiName(); - - virtual bool Init(); - virtual char* GetLastError(); - virtual void RegisterSpi(CXSpi *pSpi); - - virtual void Connect(char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count); - virtual void Disconnect(); - - virtual void Subscribe(char* szInstrument, char* szExchange); - virtual void Unsubscribe(char* szInstrument, char* szExchange); - - virtual void ReqQryInstrument(char* szInstrument, char* szExchange); - virtual void ReqQryInvestorPosition(char* szInstrument, char* szExchange); - virtual void ReqQryTradingAccount(); - - virtual void SendOrder(OrderField* pOrder, OrderIDType* pInOut, int count); - virtual void CancelOrder(OrderIDType* pIn, OrderIDType* pOut, int count); - - virtual void SendQuote(QuoteField* pQuote, OrderIDType* pAskOut, OrderIDType* pBidOut, int count); - virtual void CancelQuote(OrderIDType* pIn, OrderIDType* pOut, int count); -public: - static void* __stdcall OnRespone(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); -private: - void* _OnRespone(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - - void* m_pLib; - void* m_pFun; - void* m_pApi; - - CXSpi *m_pSpi; - char m_LibPath[1024]; -}; - diff --git a/QuantBox_XAPI_CSharp_Linux.sln b/QuantBox_XAPI_CSharp_Linux.sln deleted file mode 100644 index 99b6baf..0000000 --- a/QuantBox_XAPI_CSharp_Linux.sln +++ /dev/null @@ -1,75 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantBox.XAPI_Linux", "csharp\QuantBox.XAPI\QuantBox.XAPI_Linux.csproj", "{6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|Win32 = Debug|Win32 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Win32.ActiveCfg = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Win32.Build.0 = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Any CPU.Build.0 = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Win32.ActiveCfg = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Win32.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - Policies = $0 - $0.DotNetNamingPolicy = $1 - $1.DirectoryNamespaceAssociation = None - $1.ResourceNamePolicy = FileFormatDefault - $0.TextStylePolicy = $2 - $2.FileWidth = 120 - $2.TabsToSpaces = False - $2.inheritsSet = VisualStudio - $2.inheritsScope = text/plain - $2.scope = text/x-csharp - $0.CSharpFormattingPolicy = $3 - $3.IndentSwitchBody = True - $3.IndentBlocksInsideExpressions = True - $3.AnonymousMethodBraceStyle = NextLine - $3.PropertyBraceStyle = NextLine - $3.PropertyGetBraceStyle = NextLine - $3.PropertySetBraceStyle = NextLine - $3.EventBraceStyle = NextLine - $3.EventAddBraceStyle = NextLine - $3.EventRemoveBraceStyle = NextLine - $3.StatementBraceStyle = NextLine - $3.ElseNewLinePlacement = NewLine - $3.CatchNewLinePlacement = NewLine - $3.FinallyNewLinePlacement = NewLine - $3.WhileNewLinePlacement = DoNotCare - $3.ArrayInitializerWrapping = DoNotChange - $3.ArrayInitializerBraceStyle = NextLine - $3.BeforeMethodDeclarationParentheses = False - $3.BeforeMethodCallParentheses = False - $3.BeforeConstructorDeclarationParentheses = False - $3.NewLineBeforeConstructorInitializerColon = NewLine - $3.NewLineAfterConstructorInitializerColon = SameLine - $3.BeforeDelegateDeclarationParentheses = False - $3.NewParentheses = False - $3.SpacesBeforeBrackets = False - $3.inheritsSet = Mono - $3.inheritsScope = text/x-csharp - $3.scope = text/x-csharp - outputpath = bin - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/QuantBox_XAPI_C_Linux.workspace b/QuantBox_XAPI_C_Linux.workspace deleted file mode 100644 index 08b248c..0000000 --- a/QuantBox_XAPI_C_Linux.workspace +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/QuantBox_XAPI_Windows.sln b/QuantBox_XAPI_Windows.sln deleted file mode 100644 index c4d5dd1..0000000 --- a/QuantBox_XAPI_Windows.sln +++ /dev/null @@ -1,643 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_CTP_Quote", "QuantBox_CTP_Quote\QuantBox_CTP_Quote.vcxproj", "{919B914D-6840-453E-9201-8619E63AD0E1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_CTP_Trade", "QuantBox_CTP_Trade\QuantBox_CTP_Trade.vcxproj", "{9FBB0318-E21C-4B7C-A258-98E6A3860B35}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_LTS_Quote", "QuantBox_LTS_Quote\QuantBox_LTS_Quote.vcxproj", "{9767FE88-A225-4DC9-8B2F-D31707A4D4DB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_LTS_Trade", "QuantBox_LTS_Trade\QuantBox_LTS_Trade.vcxproj", "{B8978578-B853-46E3-A71B-3466FC1DE98C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_LTS_Level2", "QuantBox_LTS_Level2\QuantBox_LTS_Level2.vcxproj", "{97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_XSpeed_Quote", "QuantBox_XSpeed_Quote\QuantBox_XSpeed_Quote.vcxproj", "{80822F4A-0209-4358-A5B7-161DF7FADD8B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_XSpeed_Trade", "QuantBox_XSpeed_Trade\QuantBox_XSpeed_Trade.vcxproj", "{FE203F36-AD1F-421F-992A-EAD8D5A5458D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_DFITC_Level2", "QuantBox_DFITC_Level2\QuantBox_DFITC_Level2.vcxproj", "{45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_Femas_Quote", "QuantBox_Femas_Quote\QuantBox_Femas_Quote.vcxproj", "{47D9FF39-1450-45B7-A9B4-CA28F984EC87}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_Femas_Trade", "QuantBox_Femas_Trade\QuantBox_Femas_Trade.vcxproj", "{7E440983-F893-4E8D-B0E9-D9B02746B494}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_KingstarGold", "QuantBox_KingstarGold\QuantBox_KingstarGold.vcxproj", "{C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_Esunny_HistoricalData", "QuantBox_Esunny_HistoricalData\QuantBox_Esunny_HistoricalData.vcxproj", "{9FC06F89-5E4C-4962-ABB3-47D9805AA08D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_XSpeedStock_Quote", "QuantBox_XSpeedStock_Quote\QuantBox_XSpeedStock_Quote.vcxproj", "{9FD206D1-CD58-402B-B6A0-0A0BD568EB40}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_XSpeedStock_Trade", "QuantBox_XSpeedStock_Trade\QuantBox_XSpeedStock_Trade.vcxproj", "{643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_Kingstar_Quote", "QuantBox_Kingstar_Quote\QuantBox_Kingstar_Quote.vcxproj", "{199071F1-5059-4883-BA49-6A9922A71ADD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_Kingstar_Trade", "QuantBox_Kingstar_Trade\QuantBox_Kingstar_Trade.vcxproj", "{70015722-8252-4944-AE20-16A88B583CEE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_KingstarStock_Trade", "QuantBox_KingstarStock_Trade\QuantBox_KingstarStock_Trade.vcxproj", "{52BD46A7-5433-4583-A9C7-E35BC5CCC63B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_Queue", "QuantBox_Queue\QuantBox_Queue.vcxproj", "{3A9173AA-92DB-49F9-88E3-09419C1D8E9F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_ZeroMQ_Quote", "QuantBox_ZeroMQ_Quote\QuantBox_ZeroMQ_Quote.vcxproj", "{66FF43DF-8075-421D-A338-C651E9F02692}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_TongShi_Quote", "QuantBox_TongShi_Quote\QuantBox_TongShi_Quote.vcxproj", "{372C0D5E-ED93-4335-849C-65494AE8A17D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp", "csharp", "{5CAA3396-61F9-4079-8A0A-59AD9D3B1219}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cpp", "cpp", "{C47DF7F6-0F37-48E3-B510-3E021EBE6BF5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantBox.XAPI", "csharp\QuantBox.XAPI\QuantBox.XAPI.csproj", "{6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_XAPI", "QuantBox_XAPI\QuantBox_XAPI.vcxproj", "{39599EFE-428F-408F-BF4F-BF462E37C5E8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_XAPI_TEST", "QuantBox_XAPI_TEST\QuantBox_XAPI_TEST.vcxproj", "{C77ADBF7-E610-4E57-BE4D-C122FC5BE611}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_LTS_Quote_v2", "QuantBox_LTS_Quote_v2\QuantBox_LTS_Quote_v2.vcxproj", "{D4387736-0623-4442-A4AC-AF79239F9419}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_LTS_Trade_v2", "QuantBox_LTS_Trade_v2\QuantBox_LTS_Trade_v2.vcxproj", "{683AECBB-89EB-4692-99C5-A527853326D4}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_Tdx_Trade", "QuantBox_Tdx_Trade\QuantBox_Tdx_Trade.vcxproj", "{01D3F1DE-99B3-4D41-97C3-F4680CDB980B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_LTS_Query_v2", "QuantBox_LTS_Query_v2\QuantBox_LTS_Query_v2.vcxproj", "{51D11C21-C4A7-4F07-9658-B8BA223684B8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FakeAPI", "FakeAPI\FakeAPI.vcxproj", "{358586C9-A4B8-43E4-8376-59C68F0F6211}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Debug64|Any CPU = Debug64|Any CPU - Debug64|Mixed Platforms = Debug64|Mixed Platforms - Debug64|Win32 = Debug64|Win32 - Debug64|x64 = Debug64|x64 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|Win32.ActiveCfg = Debug|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|Win32.Build.0 = Debug|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|x64.ActiveCfg = Debug|x64 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug|x64.Build.0 = Debug|x64 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug64|Win32.Build.0 = Debug64|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug64|x64.ActiveCfg = Debug64|x64 - {919B914D-6840-453E-9201-8619E63AD0E1}.Debug64|x64.Build.0 = Debug64|x64 - {919B914D-6840-453E-9201-8619E63AD0E1}.Release|Any CPU.ActiveCfg = Release|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Release|Mixed Platforms.Build.0 = Release|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Release|Win32.ActiveCfg = Release|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Release|Win32.Build.0 = Release|Win32 - {919B914D-6840-453E-9201-8619E63AD0E1}.Release|x64.ActiveCfg = Release|x64 - {919B914D-6840-453E-9201-8619E63AD0E1}.Release|x64.Build.0 = Release|x64 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|Win32.ActiveCfg = Debug|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|Win32.Build.0 = Debug|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|x64.ActiveCfg = Debug|x64 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug|x64.Build.0 = Debug|x64 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|Win32.Build.0 = Debug64|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|x64.ActiveCfg = Debug64|x64 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Debug64|x64.Build.0 = Debug64|x64 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|Any CPU.ActiveCfg = Release|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|Mixed Platforms.Build.0 = Release|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|Win32.ActiveCfg = Release|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|Win32.Build.0 = Release|Win32 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|x64.ActiveCfg = Release|x64 - {9FBB0318-E21C-4B7C-A258-98E6A3860B35}.Release|x64.Build.0 = Release|x64 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug|Win32.ActiveCfg = Debug|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug|Win32.Build.0 = Debug|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug|x64.ActiveCfg = Debug|x64 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug|x64.Build.0 = Debug|x64 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug64|Win32.Build.0 = Debug64|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug64|x64.ActiveCfg = Debug64|x64 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Debug64|x64.Build.0 = Debug64|x64 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Release|Any CPU.ActiveCfg = Release|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Release|Mixed Platforms.Build.0 = Release|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Release|Win32.ActiveCfg = Release|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Release|Win32.Build.0 = Release|Win32 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Release|x64.ActiveCfg = Release|x64 - {9767FE88-A225-4DC9-8B2F-D31707A4D4DB}.Release|x64.Build.0 = Release|x64 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug|Win32.ActiveCfg = Debug|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug|Win32.Build.0 = Debug|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug|x64.ActiveCfg = Debug|x64 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug|x64.Build.0 = Debug|x64 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug64|Win32.Build.0 = Debug64|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug64|x64.ActiveCfg = Debug64|x64 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Debug64|x64.Build.0 = Debug64|x64 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Release|Any CPU.ActiveCfg = Release|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Release|Mixed Platforms.Build.0 = Release|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Release|Win32.ActiveCfg = Release|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Release|Win32.Build.0 = Release|Win32 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Release|x64.ActiveCfg = Release|x64 - {B8978578-B853-46E3-A71B-3466FC1DE98C}.Release|x64.Build.0 = Release|x64 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug|Win32.ActiveCfg = Debug|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug|Win32.Build.0 = Debug|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug|x64.ActiveCfg = Debug|x64 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug|x64.Build.0 = Debug|x64 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug64|Win32.Build.0 = Debug64|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug64|x64.ActiveCfg = Debug64|x64 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Debug64|x64.Build.0 = Debug64|x64 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Release|Any CPU.ActiveCfg = Release|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Release|Mixed Platforms.Build.0 = Release|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Release|Win32.ActiveCfg = Release|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Release|Win32.Build.0 = Release|Win32 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Release|x64.ActiveCfg = Release|x64 - {97BFCA85-4C15-4CCD-A6D0-2FEB91FD6ECD}.Release|x64.Build.0 = Release|x64 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug|Win32.ActiveCfg = Debug|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug|Win32.Build.0 = Debug|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug|x64.ActiveCfg = Debug|x64 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug|x64.Build.0 = Debug|x64 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug64|Win32.Build.0 = Debug64|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug64|x64.ActiveCfg = Debug64|x64 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Debug64|x64.Build.0 = Debug64|x64 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Release|Any CPU.ActiveCfg = Release|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Release|Mixed Platforms.Build.0 = Release|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Release|Win32.ActiveCfg = Release|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Release|Win32.Build.0 = Release|Win32 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Release|x64.ActiveCfg = Release|x64 - {80822F4A-0209-4358-A5B7-161DF7FADD8B}.Release|x64.Build.0 = Release|x64 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug|Win32.ActiveCfg = Debug|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug|Win32.Build.0 = Debug|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug|x64.ActiveCfg = Debug|x64 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug|x64.Build.0 = Debug|x64 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug64|Win32.Build.0 = Debug64|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug64|x64.ActiveCfg = Debug64|x64 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Debug64|x64.Build.0 = Debug64|x64 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Release|Any CPU.ActiveCfg = Release|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Release|Mixed Platforms.Build.0 = Release|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Release|Win32.ActiveCfg = Release|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Release|Win32.Build.0 = Release|Win32 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Release|x64.ActiveCfg = Release|x64 - {FE203F36-AD1F-421F-992A-EAD8D5A5458D}.Release|x64.Build.0 = Release|x64 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug|Win32.ActiveCfg = Debug|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug|Win32.Build.0 = Debug|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug|x64.ActiveCfg = Debug|x64 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug|x64.Build.0 = Debug|x64 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug64|Win32.Build.0 = Debug64|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug64|x64.ActiveCfg = Debug64|x64 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Debug64|x64.Build.0 = Debug64|x64 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Release|Any CPU.ActiveCfg = Release|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Release|Mixed Platforms.Build.0 = Release|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Release|Win32.ActiveCfg = Release|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Release|Win32.Build.0 = Release|Win32 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Release|x64.ActiveCfg = Release|x64 - {45A6ED8B-135F-4B18-B6A9-D4229E6D2AF9}.Release|x64.Build.0 = Release|x64 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug|Win32.ActiveCfg = Debug|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug|Win32.Build.0 = Debug|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug|x64.ActiveCfg = Debug|x64 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug|x64.Build.0 = Debug|x64 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug64|Win32.Build.0 = Debug64|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug64|x64.ActiveCfg = Debug64|x64 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Debug64|x64.Build.0 = Debug64|x64 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Release|Any CPU.ActiveCfg = Release|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Release|Mixed Platforms.Build.0 = Release|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Release|Win32.ActiveCfg = Release|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Release|Win32.Build.0 = Release|Win32 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Release|x64.ActiveCfg = Release|x64 - {47D9FF39-1450-45B7-A9B4-CA28F984EC87}.Release|x64.Build.0 = Release|x64 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug|Win32.ActiveCfg = Debug|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug|Win32.Build.0 = Debug|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug|x64.ActiveCfg = Debug|x64 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug|x64.Build.0 = Debug|x64 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug64|Win32.Build.0 = Debug64|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug64|x64.ActiveCfg = Debug64|x64 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Debug64|x64.Build.0 = Debug64|x64 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Release|Any CPU.ActiveCfg = Release|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Release|Mixed Platforms.Build.0 = Release|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Release|Win32.ActiveCfg = Release|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Release|Win32.Build.0 = Release|Win32 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Release|x64.ActiveCfg = Release|x64 - {7E440983-F893-4E8D-B0E9-D9B02746B494}.Release|x64.Build.0 = Release|x64 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug|Win32.ActiveCfg = Debug|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug|Win32.Build.0 = Debug|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug|x64.ActiveCfg = Debug|x64 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug|x64.Build.0 = Debug|x64 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug64|Win32.Build.0 = Debug64|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug64|x64.ActiveCfg = Debug64|x64 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Debug64|x64.Build.0 = Debug64|x64 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Release|Any CPU.ActiveCfg = Release|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Release|Mixed Platforms.Build.0 = Release|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Release|Win32.ActiveCfg = Release|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Release|Win32.Build.0 = Release|Win32 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Release|x64.ActiveCfg = Release|x64 - {C8F7594A-F33D-445C-8ADB-5D4BAB5BD95B}.Release|x64.Build.0 = Release|x64 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug|Win32.ActiveCfg = Debug|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug|Win32.Build.0 = Debug|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug|x64.ActiveCfg = Debug|x64 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug|x64.Build.0 = Debug|x64 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug64|Win32.Build.0 = Debug64|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug64|x64.ActiveCfg = Debug64|x64 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Debug64|x64.Build.0 = Debug64|x64 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Release|Any CPU.ActiveCfg = Release|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Release|Mixed Platforms.Build.0 = Release|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Release|Win32.ActiveCfg = Release|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Release|Win32.Build.0 = Release|Win32 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Release|x64.ActiveCfg = Release|x64 - {9FC06F89-5E4C-4962-ABB3-47D9805AA08D}.Release|x64.Build.0 = Release|x64 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug|Win32.ActiveCfg = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug|Win32.Build.0 = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug|x64.ActiveCfg = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug64|Win32.ActiveCfg = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug64|Win32.Build.0 = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Debug64|x64.ActiveCfg = Debug|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Release|Any CPU.ActiveCfg = Release|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Release|Mixed Platforms.Build.0 = Release|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Release|Win32.ActiveCfg = Release|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Release|Win32.Build.0 = Release|Win32 - {9FD206D1-CD58-402B-B6A0-0A0BD568EB40}.Release|x64.ActiveCfg = Release|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug|Win32.ActiveCfg = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug|Win32.Build.0 = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug|x64.ActiveCfg = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug64|Win32.ActiveCfg = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug64|Win32.Build.0 = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Debug64|x64.ActiveCfg = Debug|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Release|Any CPU.ActiveCfg = Release|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Release|Mixed Platforms.Build.0 = Release|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Release|Win32.ActiveCfg = Release|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Release|Win32.Build.0 = Release|Win32 - {643E1AC7-594D-4A9C-936D-CC7C7B5D2AE0}.Release|x64.ActiveCfg = Release|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug|Win32.ActiveCfg = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug|Win32.Build.0 = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug|x64.ActiveCfg = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug64|Win32.ActiveCfg = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug64|Win32.Build.0 = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Debug64|x64.ActiveCfg = Debug|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Release|Any CPU.ActiveCfg = Release|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Release|Mixed Platforms.Build.0 = Release|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Release|Win32.ActiveCfg = Release|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Release|Win32.Build.0 = Release|Win32 - {199071F1-5059-4883-BA49-6A9922A71ADD}.Release|x64.ActiveCfg = Release|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug|Win32.ActiveCfg = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug|Win32.Build.0 = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug|x64.ActiveCfg = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug64|Win32.ActiveCfg = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug64|Win32.Build.0 = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Debug64|x64.ActiveCfg = Debug|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Release|Any CPU.ActiveCfg = Release|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Release|Mixed Platforms.Build.0 = Release|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Release|Win32.ActiveCfg = Release|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Release|Win32.Build.0 = Release|Win32 - {70015722-8252-4944-AE20-16A88B583CEE}.Release|x64.ActiveCfg = Release|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug|Win32.ActiveCfg = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug|Win32.Build.0 = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug|x64.ActiveCfg = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug64|Win32.ActiveCfg = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug64|Win32.Build.0 = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Debug64|x64.ActiveCfg = Debug|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Release|Any CPU.ActiveCfg = Release|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Release|Mixed Platforms.Build.0 = Release|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Release|Win32.ActiveCfg = Release|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Release|Win32.Build.0 = Release|Win32 - {52BD46A7-5433-4583-A9C7-E35BC5CCC63B}.Release|x64.ActiveCfg = Release|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug|Win32.ActiveCfg = Debug|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug|Win32.Build.0 = Debug|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug|x64.ActiveCfg = Debug|x64 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug|x64.Build.0 = Debug|x64 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug64|Win32.Build.0 = Debug64|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug64|x64.ActiveCfg = Debug64|x64 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Debug64|x64.Build.0 = Debug64|x64 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Release|Any CPU.ActiveCfg = Release|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Release|Mixed Platforms.Build.0 = Release|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Release|Win32.ActiveCfg = Release|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Release|Win32.Build.0 = Release|Win32 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Release|x64.ActiveCfg = Release|x64 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F}.Release|x64.Build.0 = Release|x64 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug|Win32.ActiveCfg = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug|Win32.Build.0 = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug|x64.ActiveCfg = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug64|Win32.ActiveCfg = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug64|Win32.Build.0 = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Debug64|x64.ActiveCfg = Debug|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Release|Any CPU.ActiveCfg = Release|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Release|Mixed Platforms.Build.0 = Release|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Release|Win32.ActiveCfg = Release|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Release|Win32.Build.0 = Release|Win32 - {66FF43DF-8075-421D-A338-C651E9F02692}.Release|x64.ActiveCfg = Release|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug|Win32.ActiveCfg = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug|Win32.Build.0 = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug|x64.ActiveCfg = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug64|Win32.ActiveCfg = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug64|Win32.Build.0 = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Debug64|x64.ActiveCfg = Debug|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release|Any CPU.ActiveCfg = Release|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release|Mixed Platforms.Build.0 = Release|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release|Win32.ActiveCfg = Release|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release|Win32.Build.0 = Release|Win32 - {372C0D5E-ED93-4335-849C-65494AE8A17D}.Release|x64.ActiveCfg = Release|Win32 - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Win32.ActiveCfg = Debug|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|x64.ActiveCfg = Debug|x64 - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|x64.Build.0 = Debug|x64 - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|Any CPU.ActiveCfg = Debug64|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|Any CPU.Build.0 = Debug64|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|Mixed Platforms.Build.0 = Debug64|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|Win32.ActiveCfg = Debug64|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|x64.ActiveCfg = Debug64|x64 - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|x64.Build.0 = Debug64|x64 - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Any CPU.Build.0 = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Win32.ActiveCfg = Release|Any CPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|x64.ActiveCfg = Release|x64 - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|x64.Build.0 = Release|x64 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug|Win32.ActiveCfg = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug|Win32.Build.0 = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug|x64.ActiveCfg = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|Win32.ActiveCfg = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|Win32.Build.0 = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Debug64|x64.ActiveCfg = Debug|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release|Any CPU.ActiveCfg = Release|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release|Mixed Platforms.Build.0 = Release|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release|Win32.ActiveCfg = Release|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release|Win32.Build.0 = Release|Win32 - {39599EFE-428F-408F-BF4F-BF462E37C5E8}.Release|x64.ActiveCfg = Release|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug|Win32.ActiveCfg = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug|Win32.Build.0 = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug|x64.ActiveCfg = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug64|Win32.ActiveCfg = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug64|Win32.Build.0 = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Debug64|x64.ActiveCfg = Debug|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|Any CPU.ActiveCfg = Release|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|Mixed Platforms.Build.0 = Release|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|Win32.ActiveCfg = Release|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|Win32.Build.0 = Release|Win32 - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|x64.ActiveCfg = Release|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|Win32.ActiveCfg = Debug|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|Win32.Build.0 = Debug|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|x64.ActiveCfg = Debug|x64 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug|x64.Build.0 = Debug|x64 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|Win32.Build.0 = Debug64|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|x64.ActiveCfg = Debug64|x64 - {D4387736-0623-4442-A4AC-AF79239F9419}.Debug64|x64.Build.0 = Debug64|x64 - {D4387736-0623-4442-A4AC-AF79239F9419}.Release|Any CPU.ActiveCfg = Release|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Release|Mixed Platforms.Build.0 = Release|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Release|Win32.ActiveCfg = Release|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Release|Win32.Build.0 = Release|Win32 - {D4387736-0623-4442-A4AC-AF79239F9419}.Release|x64.ActiveCfg = Release|x64 - {D4387736-0623-4442-A4AC-AF79239F9419}.Release|x64.Build.0 = Release|x64 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|Win32.ActiveCfg = Debug|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|Win32.Build.0 = Debug|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|x64.ActiveCfg = Debug|x64 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug|x64.Build.0 = Debug|x64 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|Any CPU.ActiveCfg = Debug64|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|Mixed Platforms.ActiveCfg = Debug64|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|Mixed Platforms.Build.0 = Debug64|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|Win32.ActiveCfg = Debug64|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|Win32.Build.0 = Debug64|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|x64.ActiveCfg = Debug64|x64 - {683AECBB-89EB-4692-99C5-A527853326D4}.Debug64|x64.Build.0 = Debug64|x64 - {683AECBB-89EB-4692-99C5-A527853326D4}.Release|Any CPU.ActiveCfg = Release|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Release|Mixed Platforms.Build.0 = Release|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Release|Win32.ActiveCfg = Release|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Release|Win32.Build.0 = Release|Win32 - {683AECBB-89EB-4692-99C5-A527853326D4}.Release|x64.ActiveCfg = Release|x64 - {683AECBB-89EB-4692-99C5-A527853326D4}.Release|x64.Build.0 = Release|x64 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug|Win32.ActiveCfg = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug|Win32.Build.0 = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug|x64.ActiveCfg = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug64|Win32.ActiveCfg = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug64|Win32.Build.0 = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Debug64|x64.ActiveCfg = Debug|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release|Any CPU.ActiveCfg = Release|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release|Mixed Platforms.Build.0 = Release|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release|Win32.ActiveCfg = Release|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release|Win32.Build.0 = Release|Win32 - {01D3F1DE-99B3-4D41-97C3-F4680CDB980B}.Release|x64.ActiveCfg = Release|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug|Win32.ActiveCfg = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug|Win32.Build.0 = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug|x64.ActiveCfg = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug64|Win32.ActiveCfg = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug64|Win32.Build.0 = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Debug64|x64.ActiveCfg = Debug|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release|Any CPU.ActiveCfg = Release|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release|Mixed Platforms.Build.0 = Release|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release|Win32.ActiveCfg = Release|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release|Win32.Build.0 = Release|Win32 - {51D11C21-C4A7-4F07-9658-B8BA223684B8}.Release|x64.ActiveCfg = Release|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug|Win32.ActiveCfg = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug|Win32.Build.0 = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug|x64.ActiveCfg = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug64|Any CPU.ActiveCfg = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug64|Win32.ActiveCfg = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug64|Win32.Build.0 = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Debug64|x64.ActiveCfg = Debug|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release|Any CPU.ActiveCfg = Release|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release|Mixed Platforms.Build.0 = Release|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release|Win32.ActiveCfg = Release|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release|Win32.Build.0 = Release|Win32 - {358586C9-A4B8-43E4-8376-59C68F0F6211}.Release|x64.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB} = {5CAA3396-61F9-4079-8A0A-59AD9D3B1219} - {39599EFE-428F-408F-BF4F-BF462E37C5E8} = {C47DF7F6-0F37-48E3-B510-3E021EBE6BF5} - {C77ADBF7-E610-4E57-BE4D-C122FC5BE611} = {C47DF7F6-0F37-48E3-B510-3E021EBE6BF5} - EndGlobalSection -EndGlobal diff --git a/README.linux b/README.linux new file mode 100644 index 0000000..e6ca8ee --- /dev/null +++ b/README.linux @@ -0,0 +1,4 @@ +1. modify conf.sh according to your setting +2. source ~/.conf.sh +3. make clean && make +4. run CPP_TEST diff --git a/README.md b/README.md index 9f12bf7..c2a36eb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ -# QuantBox_XAPI 统一行情交易接口 +# XAPI统一行情交易接口 -##介绍 +## 交流QQ群 +XAPI统一行情交易接口 377319643
+XAPI标准委员会 142703128(需邀请,用于高手进行标准的制定) + +## 介绍 现在市场上的交易与行情API太多,对每家都接特别麻烦,如果能统一用一套API接入就好了。
如果进行接口的统一,要实现以下几点: @@ -10,40 +14,56 @@ 实现统一的结构体必然会有些API的特殊字段没法照顾到;调用方式统一则有些功能将不会实现,而有些功能需要几个请求,或本机模拟的方法来实现;加载方式以前C#层是用的P/Invoke,现在改用LoadLibraryEx/dlopen来实现。 -## 如何使用C#版 -编译QuantBox.XAPI,有两种输出方式 +## 目录结构 +1. **apis**:各种行情交易API的XAPI封装代码 +2. **bin**:各项目的编译输出路径 +3. **common**:一些通用库 +4. **include**:各种头文件,或API的接口 +5. **lib**:各种库文件 +6. **languages**:各种语言的XAPI封装 +7. **tests**:测试代码 +8. **tools**:一些小工具。如FakeAPI用来获取CTP/LTS客户端授权码,请看项目中的READEME.md + +## 编译XAPI -1. 生成QuantBox.XAPI.dll,设置输出类型为类库,可以在其它项目中引用 -2. 生成QuantBox.XAPI.exe,设置输出类型为控制台程序,将运行项目中的Program.cs文件,是API的使用示例 +### 使用CMake +直接使用CMake生成工程即可,对于不熟悉cmake的朋友,可以安装cmake (https://cmake.org/) 后,直接执行在工程根目录中的 build 脚本即可。 +1. windows环境下,运行build.bat,在build目录中,会生成对应的vs工程文件。注意,默认情况下,生成的是32位vs工程,若想指定生成工程的版本,运行cmake --help查看。 +1. linux环境下,运行build.sh,在build目录中,会生成对应的makefile工程文件。 -### 在Windows .Net项目中使用 -1. 使用Visual Studio 2013打开QuantBox\_XAPI\_Windows.sln进行编译,会生成 -> **QuantBox\.XAPI\.dll**:C#接口,由它进行C接口的加载
-> **QuantBox\_Queue.dll**:C接口,消息队列,行情与交易的数据先进入队列然后,由内部的线程进行触发
-> **QuantBox\_CTP\_Quote.dll**:C接口,调用CTP的行情API
-> **QuantBox\_CTP\_Trade.dll**:C接口,调用CTP的交易API
-> 其它如XSpeed/LTS等行情与交易接口 +### 直接使用VS工程 +1. 打开AllCppProjects.sln +2. common\Queue是每个API封装都依赖它的处理消息队列的库,有64位和32位版。所以在部署时可以放在System32或SysWOW64下。或放在客户端程序的exe同目录下,或放在每个API封装库的同目录下。 +3. apis\CTP_Quote等一类的项目,是对应的API的封装。编译好后还需要将API官方的库复制到同目录,你可以直接运行CopyApiDll.bat将依赖的dll复制到bin对应的目录下 +4. 有些项目需要使用到一些授权库的功能common\License,比如说apis\CTP_Trade,直接编译你会发现编译不过,这是因用到的第三方的库文件太大,我在提交代码时提交的是zip。你需要先解压include/cryptopp.zip和lib/cryptlib.zip。你也可在项目属性中去掉**ENABLE\_LICENSE**,这样授权功能模块将不参与编译。具体的方式是,哪个项目编译的时候,报关于randpool.h的错误,就在哪个项目的属性Configuration Properties -> C/C++ -> Preprossor中找到**ENABLE\_LICENSE**,然后去掉它。 -### 在Linux Mono项目中使用 -1. 使用Mono Develop打开QuantBox\_XAPI\_CSharp\_Linux.sln进行编译,会生成 -> **QuantBox\.XAPI\.dll**:C#接口,由它进行C接口的加载 +## 编译各种语言封装 +### C/C++版 +languages\CPP\XAPI\_CPP,直接编译即可。会生成XAPI_CPP.dll,内置了C和C++两种调用方式。tests\CPP中提供了C++版接口的调用示例。所要用到的头文件是include/XApiCpp.h,它的调用的机制模仿了CTP,使用CXApi和CXSpi.
+如想使用C版接口,可参考CXApi与CXSpi是如何实现的,直接使用include/XApiC.h头文件 -2. 使用Code::Blocks打开QuantBox\_XAPI\_C\_Linux.workspace进行编译,注意得使用Clang编译器,会生成 -> **libQuantBox\_Queue.so**:C接口,消息队列,行情与交易的数据先进入队列然后,由内部的线程进行触发
-> **libQuantBox\_CTP\_Quote.so**:C接口,调用CTP的行情API
-> **libQuantBox\_CTP\_Trade.so**:C接口,调用CTP的交易API
-> 其它如XSpeed/LTS等行情与交易接口 +### C/C++ Linux版 +1. 使用Code::Blocks打开*.workspace进行编译,注意得使用Clang编译器,会生成so文件 +2. 将所有生成的lib*.so文件cp命令复制到/usr/lib下 +3. 将CTP的两个文件\*.so前面加lib复制到/usr/lib下 -3. 将所有生成的lib*.so文件cp命令复制到/usr/lib下 +### C#版 +languages\CSharp\XAPI\_CSharp.sln +
编译后会生成XAPI\_CSharp.dll,这个项目支持COM功能,所以在编译时会进行COM注册。这个注册需要VS以管理员权限运行。如果你不想使用COM功能,也不想切换到管理员进行注册,可以在项目属性页中的Build->Register for COM interop前的勾去了。 +
+编译XAPI_CSharp,有两种输出方式 -4. 将CTP的两个文件\*.so前面加lib复制到/usr/lib下 +1. 生成XAPI_CSharp.dll,设置输出类型为类库,可以在其它项目中引用 +2. 生成XAPI_CSharp.exe,设置输出类型为控制台程序,将运行项目中的Program.cs文件,是API的使用示例 -## 如何使用C++版 -直接参考QuantBox_XAPI_TEST项目即可,简单的行情订阅,下单撤单 +### MATLAB版 +实际上是调用的C#版的库,细节请参考languages\MATLAB下的readme.md -## 如何使用C版 -参考QuantBox_XAPI这个项目中的CXApi与CXSpi是如何实现的 +### COM版 +其实也是用的C#版的库,注册好后直接到tests\COM下运行示例即可 + +## 部署 +bin/Debug/x86下会编译一些库,运行CopyApiDll.bat复制一些API官方的库进来,然后再运行clearBin.bat将编译时的一些多余文件清理。在目标机器或客户端下新建XAPI文件夹,将x86文件夹复制到此。注意Queue\_x86.dll一定要放在合适的位置,实在搞不清就放在与CTP\_Quote\_x86.dll这些库在同一个目录下。 ## 如何开发新的接口 1. 模仿已经提供的几个项目即可 - diff --git a/Synthetic.md b/Synthetic.md new file mode 100644 index 0000000..b8bdb9c --- /dev/null +++ b/Synthetic.md @@ -0,0 +1,23 @@ +# 指数合成说明 + +## 需求 +* 部分用户有使用指数来驱动,下单到主力的需求。使用指数驱动的好处是数据波动小 +* 这里提供了通过配置文件生成合成行情的功能,目前所有CTP和仿CTP接口都支持此功能 + +## 使用方法 +1. 第一次调用时自动在CTP_Quote_x86.dll下生成Synthetic.json +2. 编辑此json文件,格式严格不能有误,然后重新启动 +3. 订阅json文件中设置好的合成合约即可收到行情。 +4. 默认是成份合约的行情都到达才能合成新的行情,由于CTP对于很不活跃的合约在初次订阅时也会推送一条行情。而没有这个机制的API在这个功能下会遇到问题。 + +## 格式说明 +1. Symbol:合成合约代码。用于上层接口调用 +2. Method:所使用的算法 +3. Emits: 触发行情的合约数组,为空则任意成份合约行情过来都触发。出于效率考虑,只保留一个主力合约最合适 +4. Legs: 成份合约和权重 + +## 算法说明 +1. OpenInterest:持仓量加权。Legs中的权重参数被忽略。大部分品种的指数是使用的此方法,如IF000 +2. Weight:权重法。权重参数可以任意设置,但在这里一般是让权重和等于1。如南华商品指数 +3. Spread:价差法。算法与Weight法一样,但多加了买卖一价和买卖一量的计算。参数一般会有正有负,权重之和也不会等于1了 +4. Copy:复制法。纯粹是给合约换个名,所以权重参数被忽略。如IF888这种主力合约行情 \ No newline at end of file diff --git a/QuantBox_LTS_Quote_v2/QuantBox_LTS_Quote_v2.vcxproj b/apis/ATP_Quote/ATP_Quote.vcxproj similarity index 56% rename from QuantBox_LTS_Quote_v2/QuantBox_LTS_Quote_v2.vcxproj rename to apis/ATP_Quote/ATP_Quote.vcxproj index ba3fb43..9f86561 100644 --- a/QuantBox_LTS_Quote_v2/QuantBox_LTS_Quote_v2.vcxproj +++ b/apis/ATP_Quote/ATP_Quote.vcxproj @@ -1,111 +1,83 @@  - + - - Debug64 - Win32 - - - Debug64 - x64 - Debug Win32 - - Debug - x64 - Release Win32 + + Debug + x64 + Release x64 - {D4387736-0623-4442-A4AC-AF79239F9419} + {3F2DB224-C53A-4983-B77D-0629D3ABDD80} Win32Proj - QuantBox_LTS_Quote + ATP_Quote + 7.0 DynamicLibrary true - v120 + v141_xp Unicode - - DynamicLibrary - true - v120 - Unicode - - + DynamicLibrary - true - v120 + false + v140 + true Unicode - + DynamicLibrary true - v120 - Unicode - - - DynamicLibrary - false - v120 - true + v140 Unicode DynamicLibrary false - v120 + v140 true Unicode - - - - - + - + - + - + - + true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\LTS_v2\x86 + ..\..\bin\$(Configuration)\$(PlatformTarget)\ATP + $(ProjectName)_$(PlatformTarget) + ./;$(IncludePath) true - - true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\LTS - - - true - false @@ -117,59 +89,26 @@ Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_LTS_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;ATP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true Windows true - ..\include\ApiHeader.def + ../../include/ApiHeader.def - - xcopy "$(TargetPath)" "$(SolutionDir)XAPI\LTS_v2\x86\" /Y -xcopy "$(SolutionDir)include\LTS_v2\win32\*.dll" "$(SolutionDir)XAPI\LTS_v2\x86\" /Y - Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_LTS_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - ..\include\ApiHeader.def - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_LTS_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _DEBUG;_WINDOWS;_USRDLL;ATP_QUOTE_EXPORTS;%(PreprocessorDefinitions) true Windows true - ..\include\ApiHeader.def - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_LTS_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - ..\include\ApiHeader.def @@ -179,15 +118,14 @@ xcopy "$(SolutionDir)include\LTS_v2\win32\*.dll" "$(SolutionDir)XAPI\LTS_v2\x86 MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_LTS_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;ATP_QUOTE_EXPORTS;%(PreprocessorDefinitions) true Windows - true true true - ..\include\ApiHeader.def + true @@ -197,57 +135,65 @@ xcopy "$(SolutionDir)include\LTS_v2\win32\*.dll" "$(SolutionDir)XAPI\LTS_v2\x86 MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_LTS_QUOTE_EXPORTS;%(PreprocessorDefinitions) + NDEBUG;_WINDOWS;_USRDLL;ATP_QUOTE_EXPORTS;%(PreprocessorDefinitions) true Windows - true true true - QuantBox_LTS_Quote.def + true - - - + + + + + + + + + + + + - - + + + + + + + + + + + + false - false - false - false + false - - - - false - false + false - - Create Create - Create - Create Create Create diff --git a/apis/ATP_Quote/ATP_Quote.vcxproj.filters b/apis/ATP_Quote/ATP_Quote.vcxproj.filters new file mode 100644 index 0000000..46fd575 --- /dev/null +++ b/apis/ATP_Quote/ATP_Quote.vcxproj.filters @@ -0,0 +1,108 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/apis/ATP_Quote/Include.h b/apis/ATP_Quote/Include.h new file mode 100644 index 0000000..b34026e --- /dev/null +++ b/apis/ATP_Quote/Include.h @@ -0,0 +1,24 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.1.0.20120722" +#define API_NAME "ATP" +#define DLL_PUBLIC_KEY "" + +#include "../../include/CrossPlatform.h" +#include "../../include/ATP/ThostFtdcUserApiDataType.h" +#include "../../include/ATP/ThostFtdcUserApiStruct.h" +#include "../../include/ATP/ThostFtdcMdApi.h" + +#ifdef _WIN64 + #pragma comment(lib, "../../include/ATP/win64/thostmduserapi.lib") +#else + #pragma comment(lib, "../../include/ATP/win32/thostmduserapi.lib") +#endif + +// +#include "../CTP/include_pub.h" diff --git a/QuantBox_Tdx_Trade/ReadMe.txt b/apis/ATP_Quote/ReadMe.txt similarity index 84% rename from QuantBox_Tdx_Trade/ReadMe.txt rename to apis/ATP_Quote/ReadMe.txt index f89d1b6..4850524 100644 --- a/QuantBox_Tdx_Trade/ReadMe.txt +++ b/apis/ATP_Quote/ReadMe.txt @@ -1,27 +1,27 @@ ======================================================================== - DYNAMIC LINK LIBRARY : QuantBox_Tdx_Trade Project Overview + DYNAMIC LINK LIBRARY : ATP_Quote Project Overview ======================================================================== -AppWizard has created this QuantBox_Tdx_Trade DLL for you. +AppWizard has created this ATP_Quote DLL for you. This file contains a summary of what you will find in each of the files that -make up your QuantBox_Tdx_Trade application. +make up your ATP_Quote application. -QuantBox_Tdx_Trade.vcxproj +ATP_Quote.vcxproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and information about the platforms, configurations, and project features selected with the Application Wizard. -QuantBox_Tdx_Trade.vcxproj.filters +ATP_Quote.vcxproj.filters This is the filters file for VC++ projects generated using an Application Wizard. It contains information about the association between the files in your project and the filters. This association is used in the IDE to show grouping of files with similar extensions under a specific node (for e.g. ".cpp" files are associated with the "Source Files" filter). -QuantBox_Tdx_Trade.cpp +ATP_Quote.cpp This is the main DLL source file. When created, this DLL does not export any symbols. As a result, it @@ -37,7 +37,7 @@ Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file - named QuantBox_Tdx_Trade.pch and a precompiled types file named StdAfx.obj. + named ATP_Quote.pch and a precompiled types file named StdAfx.obj. ///////////////////////////////////////////////////////////////////////////// Other notes: diff --git a/FakeAPI/dllmain.cpp b/apis/ATP_Quote/dllmain.cpp similarity index 100% rename from FakeAPI/dllmain.cpp rename to apis/ATP_Quote/dllmain.cpp diff --git a/QuantBox_Queue/stdafx.cpp b/apis/ATP_Quote/stdafx.cpp similarity index 81% rename from QuantBox_Queue/stdafx.cpp rename to apis/ATP_Quote/stdafx.cpp index 2b6a7ab..35e8589 100644 --- a/QuantBox_Queue/stdafx.cpp +++ b/apis/ATP_Quote/stdafx.cpp @@ -1,5 +1,5 @@ // stdafx.cpp : source file that includes just the standard includes -// QuantBox_Queue.pch will be the pre-compiled header +// ATP_Quote.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" diff --git a/FakeAPI/stdafx.h b/apis/ATP_Quote/stdafx.h similarity index 100% rename from FakeAPI/stdafx.h rename to apis/ATP_Quote/stdafx.h diff --git a/FakeAPI/targetver.h b/apis/ATP_Quote/targetver.h similarity index 100% rename from FakeAPI/targetver.h rename to apis/ATP_Quote/targetver.h diff --git a/apis/CTP/Makefile b/apis/CTP/Makefile new file mode 100644 index 0000000..e3cd3cc --- /dev/null +++ b/apis/CTP/Makefile @@ -0,0 +1,13 @@ +ALL=libQuantBox_CTP_Quote.so libQuantBox_CTP_Trade.so +include ../../Makefile.global + +DEPS=../../include/toolkit.o \ + ../../include/ApiProcess.o + +LFLAGS=-Wl,-rpath,\$$ORIGIN -ldl -L../../include/CTP/linux64 -L../../common/Queue -lQueue + +libQuantBox_CTP_Quote.so: Quote/main.cpp Quote/MdUserApi.cpp TypeConvert.cpp $(DEPS) + $(CXX) --shared $(IFLAGS) $(LFLAGS) $(CFLAGS) -lthostmduserapi -I../CTP_Quote -o $@ $^ +libQuantBox_CTP_Trade.so: Trade/main.cpp Trade/TraderApi.cpp TypeConvert.cpp $(DEPS) + $(CXX) --shared $(IFLAGS) $(LFLAGS) $(CFLAGS) -lthosttraderapi -I../CTP_Trade -o $@ $^ + diff --git a/apis/CTP/Quote/MdUserApi.cpp b/apis/CTP/Quote/MdUserApi.cpp new file mode 100644 index 0000000..aa4121a --- /dev/null +++ b/apis/CTP/Quote/MdUserApi.cpp @@ -0,0 +1,842 @@ +#include "stdafx.h" +#include "MdUserApi.h" +#include "../../include/QueueEnum.h" + +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" + +#include "../../include/toolkit.h" +#include "../../include/ApiProcess.h" +#include "../TypeConvert.h" + +#include "../../include/queue/MsgQueue.h" + + +#include "../../include/CSubscribeManager.h" +#include "../../include/synthetic/CSyntheticConfig.h" +#include "../../include/synthetic/CSyntheticManager.h" +#include "../../include/CSyntheticCalculate_DepthMarketDataNField.h" + +#include +#include +#include +#include + +using namespace std; + +void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + // 由内部调用,不用检查是否为空 + CMdUserApi* pApi = (CMdUserApi*)pApi2; + pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + return nullptr; +} + +CMdUserApi::CMdUserApi(void) +{ + //_CrtSetBreakAlloc(251); + + m_pApi = nullptr; + m_lRequestID = 0; + m_nSleep = 1; + + m_pSyntheticConfig = new CSyntheticConfig(); + m_pSyntheticManager = new CSyntheticManager(); + m_pCalculateFactory = new CSyntheticCalculateFactory_XAPI(); + m_pSubscribeManager = new CSubscribeManager(m_pSyntheticConfig, m_pSyntheticManager, m_pCalculateFactory); + m_pQuoteSubscribeManager = new CSubscribeManager(m_pSyntheticConfig, m_pSyntheticManager, m_pCalculateFactory); + + // 自己维护两个消息队列 + m_msgQueue = new CMsgQueue(); + m_msgQueue_Query = new CMsgQueue(); + + m_msgQueue_Query->Register(Query); + m_msgQueue_Query->StartThread(); + + //m_msgQueue->m_bDirectOutput = true; + + + //m_delete = false; +} + +CMdUserApi::~CMdUserApi(void) +{ + _Disconnect(false); +} + +void CMdUserApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + int iRet = 0; + switch (type) + { + case E_Init: + iRet = _Init(); + break; + case E_Disconnect: + _Disconnect(true); + // 不再循环 + return; + + } + + if (m_pApi) + { + switch (type) + { + case E_ReqUserLoginField: + iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + default: + break; + } + } + + if (0 == iRet) + { + //返回成功,填加到已发送池 + m_nSleep = 1; + } + else + { + m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + //失败,按4的幂进行延时,但不超过1s + m_nSleep *= 4; + m_nSleep %= 1023; + } + this_thread::sleep_for(chrono::milliseconds(m_nSleep)); +} + +void CMdUserApi::Register(void* pCallback, void* pClass) +{ + m_pClass = pClass; + if (m_msgQueue == nullptr) + return; + + m_msgQueue_Query->Register(Query); + m_msgQueue->Register((fnOnResponse)pCallback); + if (pCallback) + { + m_msgQueue_Query->StartThread(); + m_msgQueue->StartThread(); + } + else + { + m_msgQueue_Query->StopThread(); + m_msgQueue->StopThread(); + } +} + +ConfigInfoField* CMdUserApi::Config(ConfigInfoField* pConfigInfo) +{ + return nullptr; +} + +bool CMdUserApi::IsErrorRspInfo(const char* szSource, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); + if (bRet) + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = pRspInfo->ErrorID; + strcpy(pField->Text, pRspInfo->ErrorMsg); + strcpy(pField->Source, szSource); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } + return bRet; +} + +bool CMdUserApi::IsErrorRspInfo(CThostFtdcRspInfoField *pRspInfo) +{ + bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); + + return bRet; +} + +void CMdUserApi::Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo, + int count) +{ +#if _WIN32 + char szExePath[MAX_PATH] = { 0 }; + GetExePath(szExePath); + char szDllPath[MAX_PATH] = { 0 }; + GetDllPathByFunctionName("XRequest", szDllPath); + + char szExistingFileName[MAX_PATH] = { 0 }; + char szNewFileName[MAX_PATH] = { 0 }; + GetNewPathInSameDirectory(szDllPath, "Synthetic", "json", szExistingFileName); + GetNewPathInSameDirectory(szExePath, "Synthetic", "json", szNewFileName); + + // TODO:先测试用 + auto sc = m_pSyntheticConfig->Read(szExistingFileName); + if (sc.size() == 0) + { + m_pSyntheticConfig->Write(szExistingFileName); + } +#endif + + m_szPath = szPath; + memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); + memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); + + m_msgQueue_Query->Input_NoCopy(RequestType::E_Init, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} + +int CMdUserApi::_Init() +{ + char *pszPath = new char[m_szPath.length() + 1024]; + srand((unsigned int)time(NULL)); + sprintf(pszPath, "%s/%s/%s/Md/%d/", m_szPath.c_str(), m_ServerInfo.BrokerID, m_UserInfo.UserID, rand()); + makedirs(pszPath); + + // 本来想使用chdir的方法解决Kingstar的证书问题,测试多次发现还是读取的exe目录下 + // 打算使用文件复制的方法来实现, + // 1.先检查证书是否存在,存在就跳过 + // 2.复制,用完要删 +#ifdef KS_COPYFILE + + char szExePath[MAX_PATH] = { 0 }; + GetExePath(szExePath); + char szDllPath[MAX_PATH] = { 0 }; + GetDllPathByFunctionName("XRequest", szDllPath); + + char szExistingFileName[MAX_PATH] = { 0 }; + char szNewFileName[MAX_PATH] = { 0 }; + GetNewPathInSameDirectory(szDllPath, KS_LKC_FILENAME, KS_LKC_EXT, szExistingFileName); + GetNewPathInSameDirectory(szExePath, KS_LKC_FILENAME, KS_LKC_EXT, szNewFileName); + + bool bRet = CopyFileA(szExistingFileName, szNewFileName, false); + + if (!bRet) + { + char szBuf[256] = { 0 }; + LPVOID lpMsgBuf; + DWORD dw = GetLastError(); + FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&lpMsgBuf, + 0, NULL); + + LogField* pField = (LogField*)m_msgQueue->new_block(sizeof(LogField)); + + sprintf(pField->Message, "CopyFile:%s", lpMsgBuf); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnLog, m_msgQueue, m_pClass, true, 0, pField, sizeof(LogField), nullptr, 0, nullptr, 0); + } +#endif // KS_COPYFILE + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + +#ifdef CreateFtdcMdApi_argc_3 + m_pApi = CThostFtdcMdApi::CreateFtdcMdApi(pszPath, m_ServerInfo.IsUsingUdp, m_ServerInfo.IsMulticast); +#else + m_pApi = CThostFtdcMdApi::CreateFtdcMdApi(pszPath, m_ServerInfo.IsUsingUdp); +#endif // CreateFtdcMdApi_argc_3 + + delete[] pszPath; + + if (m_pApi) + { + m_pApi->RegisterSpi(this); + + //添加地址 + size_t len = strlen(m_ServerInfo.Address) + 1; + char* buf = new char[len]; + strncpy(buf, m_ServerInfo.Address, len); + + char* token = strtok(buf, _QUANTBOX_SEPS_); + while (token) + { + if (strlen(token) > 0) + { + m_pApi->RegisterFront(token); + } + token = strtok(NULL, _QUANTBOX_SEPS_); + } + delete[] buf; + + //初始化连接 + m_pApi->Init(); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + else + { + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + pField->RawErrorID = 0; + strncpy(pField->Text, "(Api==null)", sizeof(Char256Type)); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + } + +#ifdef KS_COPYFILE + if (bRet) + { + DeleteFileA(szNewFileName); + } +#endif // KS_COPYFILE + + return 0; +} + +void CMdUserApi::ReqUserLogin() +{ + CThostFtdcReqUserLoginField* pBody = (CThostFtdcReqUserLoginField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcReqUserLoginField)); + + strncpy(pBody->BrokerID, m_ServerInfo.BrokerID, sizeof(TThostFtdcBrokerIDType)); + strncpy(pBody->UserID, m_UserInfo.UserID, sizeof(TThostFtdcInvestorIDType)); + strncpy(pBody->Password, m_UserInfo.Password, sizeof(TThostFtdcPasswordType)); + + m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, + pBody, sizeof(CThostFtdcReqUserLoginField), nullptr, 0, nullptr, 0); +} + +int CMdUserApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); + return m_pApi->ReqUserLogin((CThostFtdcReqUserLoginField*)ptr1, ++m_lRequestID); +} + +void CMdUserApi::Disconnect() +{ + _Disconnect(false); +} + +void CMdUserApi::_DisconnectInThread() +{ + m_msgQueue_Query->Input_NoCopy(RequestType::E_Disconnect, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} + +void CMdUserApi::_Disconnect(bool IsInQueue) +{ + // 清理查询队列 + if (IsInQueue) + { + + } + else + { + if (m_msgQueue_Query) + { + m_msgQueue_Query->StopThread(); + m_msgQueue_Query->Register(nullptr); + m_msgQueue_Query->Clear(); + delete m_msgQueue_Query; + m_msgQueue_Query = nullptr; + } + } + + if (m_pApi) + { + m_pApi->RegisterSpi(nullptr); + m_pApi->Release(); + m_pApi = nullptr; + + // 全清理,只留最后一个 + m_msgQueue->Clear(); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + // 主动触发 + m_msgQueue->Process(); + } + + // 清理响应队列 + if (m_msgQueue) + { + m_msgQueue->StopThread(); + m_msgQueue->Register(nullptr); + m_msgQueue->Clear(); + delete m_msgQueue; + m_msgQueue = nullptr; + } + + if (m_pSubscribeManager) + { + delete m_pSubscribeManager; + m_pSubscribeManager = nullptr; + } + if (m_pQuoteSubscribeManager) + { + delete m_pQuoteSubscribeManager; + m_pQuoteSubscribeManager = nullptr; + } + if (m_pSyntheticConfig) + { + delete m_pSyntheticConfig; + m_pSyntheticConfig = nullptr; + } + if (m_pSyntheticManager) + { + delete m_pSyntheticManager; + m_pSyntheticManager = nullptr; + } + if (m_pCalculateFactory) + { + delete m_pCalculateFactory; + m_pCalculateFactory = nullptr; + } +} + + +void CMdUserApi::Subscribe(const string& szInstrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + set ss_new = m_pSubscribeManager->String2Set(szInstrumentIDs.c_str()); + Subscribe(ss_new, szExchangeID); +} + +void CMdUserApi::Subscribe(const set& instrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + if (instrumentIDs.size() == 0) + return; + + set s_dif = m_pSubscribeManager->Subscribe(instrumentIDs, szExchangeID); + string str_dif = m_pSubscribeManager->Set2String(s_dif); + + vector vct; + char* pBuf = m_pSubscribeManager->String2Buf(str_dif.c_str(), vct); + + if (vct.size() > 0) + { + //转成字符串数组 + char** pArray = new char*[vct.size()]; + for (size_t j = 0; j < vct.size(); ++j) + { + pArray[j] = vct[j]; + } + + //订阅 +#ifdef SubscribeMarketData_argc_2 + m_pApi->SubscribeMarketData(pArray, (int)vct.size()); +#else + m_pApi->SubscribeMarketData(pArray, (int)vct.size(), (char*)szExchangeID.c_str()); +#endif // SubscribeMarketData_argc_2 + + + delete[] pArray; + } + delete[] pBuf; +} + +void CMdUserApi::Unsubscribe(const set& instrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + if (instrumentIDs.size() == 0) + return; + + set s_dif = m_pSubscribeManager->Unsubscribe(instrumentIDs, szExchangeID); + string str_dif = m_pSubscribeManager->Set2String(s_dif); + + vector vct; + char* pBuf = m_pSubscribeManager->String2Buf(str_dif.c_str(), vct); + + if (vct.size() > 0) + { + //转成字符串数组 + char** pArray = new char*[vct.size()]; + for (size_t j = 0; j < vct.size(); ++j) + { + pArray[j] = vct[j]; + } + + //订阅 +#ifdef SubscribeMarketData_argc_2 + m_pApi->UnSubscribeMarketData(pArray, (int)vct.size()); +#else + m_pApi->UnSubscribeMarketData(pArray, (int)vct.size(), (char*)szExchangeID.c_str()); +#endif // SubscribeMarketData_argc_2 + + + delete[] pArray; + } + delete[] pBuf; +} + +void CMdUserApi::Unsubscribe(const string& szInstrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + set ss_new = m_pSubscribeManager->String2Set(szInstrumentIDs.c_str()); + Unsubscribe(ss_new, szExchangeID); +} + +void CMdUserApi::OnFrontConnected() +{ + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + //连接成功后自动请求登录 + ReqUserLogin(); +} + +void CMdUserApi::OnFrontDisconnected(int nReason) +{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + //连接失败返回的信息是拼接而成,主要是为了统一输出 + pField->RawErrorID = nReason; + GetOnFrontDisconnectedMsg(nReason, pField->Text); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + + // 断开连接 + _DisconnectInThread(); +} + +void CMdUserApi::OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + if (!IsErrorRspInfo(pRspInfo) + && pRspUserLogin) + { +#ifdef HAS_TradingDay_UserLogin + pField->TradingDay = GetDate(pRspUserLogin->TradingDay); +#endif // HAS_TradingDay_UserLogin + pField->LoginTime = GetTime(pRspUserLogin->LoginTime); + m_TradingDay = pField->TradingDay; + + sprintf(pField->SessionID, "%d:%d", pRspUserLogin->FrontID, pRspUserLogin->SessionID); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + { + set exchanges = m_pSubscribeManager->GetExchanges(); + for (auto exchange = exchanges.begin(); exchange != exchanges.end(); ++exchange) + { + set mapOld = m_pSubscribeManager->GetParentInstruments(exchange->data());//记下上次订阅的合约 + m_pSubscribeManager->Clear(); + Subscribe(mapOld, exchange->data());//订阅 + } + } + { +#ifdef HAS_Quote + set exchanges = m_pQuoteSubscribeManager->GetExchanges(); + for (auto exchange = exchanges.begin(); exchange != exchanges.end(); ++exchange) + { + set mapOld = m_pQuoteSubscribeManager->GetParentInstruments(exchange->data());//记下上次订阅的合约 + m_pQuoteSubscribeManager->Clear(); + SubscribeQuote(mapOld, exchange->data());//订阅 + } +#endif // HAS_Quote + } + } + else + { + pField->RawErrorID = pRspInfo->ErrorID; + strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + + // 断开连接 + _DisconnectInThread(); + } +} + +void CMdUserApi::OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + IsErrorRspInfo("OnRspError", pRspInfo, nRequestID, bIsLast); +} + +void CMdUserApi::OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + //在模拟平台可能这个函数不会触发,所以要自己维护一张已经订阅的合约列表 + if (!IsErrorRspInfo("OnRspSubMarketData", pRspInfo, nRequestID, bIsLast) + && pSpecificInstrument) + { + } +} + +void CMdUserApi::OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + //模拟平台可能这个函数不会触发 + if (!IsErrorRspInfo("OnRspUnSubMarketData", pRspInfo, nRequestID, bIsLast) + && pSpecificInstrument) + { + } +} + +//行情回调,得保证此函数尽快返回 +void CMdUserApi::OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) +{ + //for (int i = 0; i < 50; ++i) + //{ + // // 测试平台穿越速度,用完后需要注释掉 + // WriteLog("CTP:OnRtnDepthMarketData:%s %f %s.%03d", pDepthMarketData->InstrumentID, pDepthMarketData->LastPrice, pDepthMarketData->UpdateTime, pDepthMarketData->UpdateMillisec); + + DepthMarketDataNField* pField = (DepthMarketDataNField*)m_msgQueue->new_block(sizeof(DepthMarketDataNField) + sizeof(DepthField) * 10); + + strcpy(pField->InstrumentID, pDepthMarketData->InstrumentID); + strcpy(pField->ExchangeID, pDepthMarketData->ExchangeID); + pField->Exchange = TThostFtdcExchangeIDType_2_ExchangeType(pDepthMarketData->ExchangeID); + + sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pDepthMarketData->ExchangeID); + + // 交易时间 + switch (pField->Exchange) + { + case ExchangeType::ExchangeType_DCE: + GetExchangeTime_DCE(pDepthMarketData->TradingDay, pDepthMarketData->ActionDay, pDepthMarketData->UpdateTime + , &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec); + break; + case ExchangeType::ExchangeType_CZCE: + GetExchangeTime_CZCE(m_TradingDay, pDepthMarketData->TradingDay, pDepthMarketData->ActionDay, pDepthMarketData->UpdateTime + , &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec); + break; + case ExchangeType::ExchangeType_Undefined: + GetExchangeTime_Undefined(m_TradingDay, pDepthMarketData->TradingDay, pDepthMarketData->ActionDay, pDepthMarketData->UpdateTime + , &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec); + break; + default: + GetExchangeTime(pDepthMarketData->TradingDay, pDepthMarketData->ActionDay, pDepthMarketData->UpdateTime + , &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec); + break; + } + + pField->UpdateMillisec = pDepthMarketData->UpdateMillisec; + + pField->LastPrice = pDepthMarketData->LastPrice == DBL_MAX ? 0 : pDepthMarketData->LastPrice; + pField->Volume = pDepthMarketData->Volume; + pField->Turnover = pDepthMarketData->Turnover; + pField->OpenInterest = pDepthMarketData->OpenInterest; + pField->AveragePrice = pDepthMarketData->AveragePrice; + + if (pDepthMarketData->OpenPrice != DBL_MAX) + { + pField->OpenPrice = pDepthMarketData->OpenPrice; + pField->HighestPrice = pDepthMarketData->HighestPrice; + pField->LowestPrice = pDepthMarketData->LowestPrice; + } + else + { + pField->OpenPrice = 0; + pField->HighestPrice = 0; + pField->LowestPrice = 0; + } + pField->SettlementPrice = pDepthMarketData->SettlementPrice != DBL_MAX ? pDepthMarketData->SettlementPrice : 0; + + pField->UpperLimitPrice = pDepthMarketData->UpperLimitPrice; + pField->LowerLimitPrice = pDepthMarketData->LowerLimitPrice; + pField->PreClosePrice = pDepthMarketData->PreClosePrice; + pField->PreSettlementPrice = pDepthMarketData->PreSettlementPrice; + pField->PreOpenInterest = pDepthMarketData->PreOpenInterest; + + InitBidAsk(pField); + + do + { + if (pDepthMarketData->BidVolume1 == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice1, pDepthMarketData->BidVolume1, 0); + + if (pDepthMarketData->BidVolume2 == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice2, pDepthMarketData->BidVolume2, 0); + + if (pDepthMarketData->BidVolume3 == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice3, pDepthMarketData->BidVolume3, 0); + + if (pDepthMarketData->BidVolume4 == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice4, pDepthMarketData->BidVolume4, 0); + + if (pDepthMarketData->BidVolume5 == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice5, pDepthMarketData->BidVolume5, 0); + } while (false); + + do + { + if (pDepthMarketData->AskVolume1 == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice1, pDepthMarketData->AskVolume1, 0); + + if (pDepthMarketData->AskVolume2 == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice2, pDepthMarketData->AskVolume2, 0); + + if (pDepthMarketData->AskVolume3 == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice3, pDepthMarketData->AskVolume3, 0); + + if (pDepthMarketData->AskVolume4 == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice4, pDepthMarketData->AskVolume4, 0); + + if (pDepthMarketData->AskVolume5 == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice5, pDepthMarketData->AskVolume5, 0); + } while (false); + + // 不使用CThostFtdcDepthMarketDataField是因为不通用 + char* pBuf = m_pSyntheticManager->Update(pField->InstrumentID, pField, pField->Size); + + // 先通知成分,再通知合成,这样合成要触发事件时,成分的数据已经完成了 + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); + + if (pBuf) + { + // 0号位是标记位 + auto pSyntheticBuf = (DepthMarketDataNField*)(pBuf); + // 合约不能为空,空了就不知道通知谁了 + int offest = pSyntheticBuf->InstrumentID - pBuf; + // 有相关的合约与数据 + auto products = m_pSyntheticManager->GetByInstrument(pSyntheticBuf->InstrumentID); + for (auto iter = products.begin(); iter != products.end(); iter++) + { + auto p = *iter; + // 只对需要的进行计算和触发 + if (p->CheckEmit(pSyntheticBuf->InstrumentID, offest)) + { + // 0号位是标记位 + auto q = (DepthMarketDataNField*)p->Calculate(pBuf); + if (q) + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, q, q->Size, nullptr, 0, nullptr, 0); + } + } + } + } + //} +} + +#ifdef HAS_Quote + +void CMdUserApi::SubscribeQuote(const string& szInstrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + set ss_new = m_pQuoteSubscribeManager->String2Set(szInstrumentIDs.c_str()); + SubscribeQuote(ss_new, szExchangeID); +} + +void CMdUserApi::SubscribeQuote(const set& instrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + if (instrumentIDs.size() == 0) + return; + + set ss_new = m_pQuoteSubscribeManager->Subscribe(instrumentIDs, szExchangeID); + string str_new = m_pQuoteSubscribeManager->Set2String(ss_new); + vector vct; + char* pBuf = m_pQuoteSubscribeManager->String2Buf(str_new.c_str(), vct); + + if (vct.size() > 0) + { + //转成字符串数组 + char** pArray = new char*[vct.size()]; + for (size_t j = 0; j < vct.size(); ++j) + { + pArray[j] = vct[j]; + } + + //订阅 +#ifdef SubscribeMarketData_argc_2 + m_pApi->SubscribeForQuoteRsp(pArray, (int)vct.size()); +#else + m_pApi->SubscribeForQuoteRsp(pArray, (int)vct.size(), (char*)szExchangeID.c_str()); +#endif // SubscribeMarketData_argc_2 + + + delete[] pArray; + } + delete[] pBuf; +} + +void CMdUserApi::UnsubscribeQuote(const set& instrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + if (instrumentIDs.size() == 0) + return; + + set ss_new = m_pQuoteSubscribeManager->Unsubscribe(instrumentIDs, szExchangeID); + string str_new = m_pQuoteSubscribeManager->Set2String(ss_new); + vector vct; + char* pBuf = m_pQuoteSubscribeManager->String2Buf(str_new.c_str(), vct); + + if (vct.size() > 0) + { + //转成字符串数组 + char** pArray = new char*[vct.size()]; + for (size_t j = 0; j < vct.size(); ++j) + { + pArray[j] = vct[j]; + } + + //订阅 +#ifdef SubscribeMarketData_argc_2 + m_pApi->UnSubscribeForQuoteRsp(pArray, (int)vct.size()); +#else + m_pApi->UnSubscribeForQuoteRsp(pArray, (int)vct.size(), (char*)szExchangeID.c_str()); +#endif // SubscribeMarketData_argc_2 + + + delete[] pArray; + } + delete[] pBuf; +} + +void CMdUserApi::UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + set ss_new = m_pSubscribeManager->String2Set(szInstrumentIDs.c_str()); + UnsubscribeQuote(ss_new, szExchangeID); +} + + +void CMdUserApi::OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspSubForQuoteRsp", pRspInfo, nRequestID, bIsLast) + && pSpecificInstrument) + { + } +} + +void CMdUserApi::OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspUnSubForQuoteRsp", pRspInfo, nRequestID, bIsLast) + && pSpecificInstrument) + { + } +} + +void CMdUserApi::OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) +{ + // 上期技术的人说,上海中金走的交易接口,大商,郑商走行情,所以这个地方后期可能要改 + QuoteRequestField* pField = (QuoteRequestField*)m_msgQueue->new_block(sizeof(QuoteRequestField)); + + pField->TradingDay = GetDate(pForQuoteRsp->TradingDay); + pField->QuoteTime = GetDate(pForQuoteRsp->ForQuoteTime); + strcpy(pField->Symbol, pForQuoteRsp->InstrumentID); + strcpy(pField->InstrumentID, pForQuoteRsp->InstrumentID); + strcpy(pField->ExchangeID, pForQuoteRsp->ExchangeID); + sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pField->ExchangeID); + strcpy(pField->QuoteID, pForQuoteRsp->ForQuoteSysID); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnQuoteRequest, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteRequestField), nullptr, 0, nullptr, 0); +} +#endif // HAS_Quote + + diff --git a/QuantBox_CTP_Quote/MdUserApi.h b/apis/CTP/Quote/MdUserApi.h similarity index 66% rename from QuantBox_CTP_Quote/MdUserApi.h rename to apis/CTP/Quote/MdUserApi.h index f3be004..55307e8 100644 --- a/QuantBox_CTP_Quote/MdUserApi.h +++ b/apis/CTP/Quote/MdUserApi.h @@ -1,32 +1,32 @@ -#pragma once +#pragma once -#include "../include/ApiStruct.h" -#include "../include/CTP/ThostFtdcMdApi.h" +#include "../../include/ApiStruct.h" +// 由于这个Include.h需要使用每个项目自己的文件,所以需要在VC++ Directories->Include Directories中添加一个"./" +#include "Include.h" -#ifdef _WIN64 -#pragma comment(lib, "../include/CTP/win64/thostmduserapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x64.lib") -#else -#pragma comment(lib, "../include/CTP/win32/thostmduserapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") -#endif - -#include #include #include #include +#include + using namespace std; class CMsgQueue; +class CSubscribeManager; +class CSyntheticConfig; +class CSyntheticManager; +class CSyntheticCalculateFactory; + class CMdUserApi : public CThostFtdcMdSpi { enum RequestType { E_Init, + E_Disconnect, E_ReqUserLoginField, }; @@ -44,23 +44,30 @@ class CMdUserApi : void Disconnect(); void Subscribe(const string& szInstrumentIDs, const string& szExchangeID); - void Unsubscribe(const string& szInstrumentIDs, const string& szExchageID); + void Unsubscribe(const string& szInstrumentIDs, const string& szExchangeID); - void SubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); - void UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); +#ifdef HAS_Quote + void SubscribeQuote(const string& szInstrumentIDs, const string& szExchangeID); + void UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchangeID); +#endif // HAS_Quote private: friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); void QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); int _Init(); - //¼ + void _Disconnect(bool IsInQueue); + void _DisconnectInThread(); + + //登录请求 void ReqUserLogin(); int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - // + //订阅行情 void Subscribe(const set& instrumentIDs, const string& szExchangeID); - void SubscribeQuote(const set& instrumentIDs, const string& szExchageID); + void Unsubscribe(const set& instrumentIDs, const string& szExchangeID); + void SubscribeQuote(const set& instrumentIDs, const string& szExchangeID); + void UnsubscribeQuote(const set& instrumentIDs, const string& szExchangeID); virtual void OnFrontConnected(); virtual void OnFrontDisconnected(int nReason); @@ -71,35 +78,41 @@ class CMdUserApi : virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData); + //检查是否出错 + bool IsErrorRspInfo(const char* szSource, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);//将出错消息送到消息队列 + bool IsErrorRspInfo(CThostFtdcRspInfoField *pRspInfo);//不送出错消息 + +#ifdef HAS_Quote virtual void OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp); - - //Ƿ - bool IsErrorRspInfo(const char* szSource, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);//Ϣ͵Ϣ - bool IsErrorRspInfo(CThostFtdcRspInfoField *pRspInfo);//ͳϢ +#endif // HAS_Quote private: - mutex m_csMapInstrumentIDs; - mutex m_csMapQuoteInstrumentIDs; + //bool m_delete; + + atomic m_lRequestID; //请求ID,每次请求前自增 + - atomic m_lRequestID; //IDÿǰ - set m_setInstrumentIDs; //ڶĵĺԼ - set m_setQuoteInstrumentIDs; //ڶĵĺԼ - CThostFtdcMdApi* m_pApi; //API - string m_szPath; //ļ· + CThostFtdcMdApi* m_pApi; //行情API + + string m_szPath; //生成配置文件的路径 ServerInfoField m_ServerInfo; UserInfoField m_UserInfo; int m_nSleep; - CMsgQueue* m_msgQueue; //Ϣָ + CMsgQueue* m_msgQueue; //消息队列指针 CMsgQueue* m_msgQueue_Query; void* m_pClass; - CMsgQueue* m_remoteQueue; - int m_TradingDay; + + CSubscribeManager* m_pSubscribeManager; + CSubscribeManager* m_pQuoteSubscribeManager; + CSyntheticConfig* m_pSyntheticConfig; + CSyntheticManager* m_pSyntheticManager; + CSyntheticCalculateFactory* m_pCalculateFactory; }; diff --git a/QuantBox_CTP_Quote/main.cpp b/apis/CTP/Quote/main.cpp similarity index 66% rename from QuantBox_CTP_Quote/main.cpp rename to apis/CTP/Quote/main.cpp index 80628cf..8a641d1 100644 --- a/QuantBox_CTP_Quote/main.cpp +++ b/apis/CTP/Quote/main.cpp @@ -1,9 +1,11 @@ #include "stdafx.h" -#include "../include/ApiHeader.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" -#include "../include/QueueEnum.h" #include "MdUserApi.h" +#include "Include.h" + inline CMdUserApi* GetApi(void* pApi) { return static_cast(pApi); @@ -14,13 +16,13 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do RequestType rt = (RequestType)type; switch (rt) { - case GetApiType: + case RequestType_GetApiTypes: return (void*)(ApiType::ApiType_MarketData | ApiType::ApiType_QuoteRequest); - case GetApiVersion: - return (void*)"0.2.0.20150226"; - case GetApiName: - return (void*)"CTP"; - case Create: + case RequestType_GetApiVersion: + return (void*)API_VERSION; + case RequestType_GetApiName: + return (void*)API_NAME; + case RequestType_Create: return new CMdUserApi(); default: break; @@ -35,32 +37,36 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do switch (rt) { - case Release: + case RequestType_Release: delete pApi; return 0; - case Register: + case RequestType_Register: pApi->Register(ptr1,ptr2); break; - case Config: + case RequestType_Config: return (void*)pApi->Config((ConfigInfoField*)ptr1); - case Connect: + case RequestType_Connect: pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2,size2); break; - case Disconnect: + case RequestType_Disconnect: pApi->Disconnect(); break; - case Subscribe: + case RequestType_Subscribe: pApi->Subscribe((const char*)ptr1, (const char*)ptr2); break; - case Unsubscribe: + case RequestType_Unsubscribe: pApi->Unsubscribe((const char*)ptr1, (const char*)ptr2); break; - case SubscribeQuote: + +#if HAS_Quote + case RequestType_SubscribeQuote: pApi->SubscribeQuote((const char*)ptr1, (const char*)ptr2); break; - case UnsubscribeQuote: + case RequestType_UnsubscribeQuote: pApi->UnsubscribeQuote((const char*)ptr1, (const char*)ptr2); break; +#endif // HAS_Quote + default: break; } diff --git a/apis/CTP/README.md b/apis/CTP/README.md new file mode 100644 index 0000000..48ecfe3 --- /dev/null +++ b/apis/CTP/README.md @@ -0,0 +1,8 @@ +# CTP兼容统一封装 + +##介绍 +Kingstar\UFT\XSpeed都有CTP兼容的接口,所以将公共部分写一起,应当以后要移植就更快了 + +##操作 +每个项目有自己特殊的Inluce.h,然后再设置Include目录即可 + diff --git a/QuantBox_CTP_Trade/TraderApi.cpp b/apis/CTP/Trade/TraderApi.cpp similarity index 61% rename from QuantBox_CTP_Trade/TraderApi.cpp rename to apis/CTP/Trade/TraderApi.cpp index 12355c7..d768862 100644 --- a/QuantBox_CTP_Trade/TraderApi.cpp +++ b/apis/CTP/Trade/TraderApi.cpp @@ -1,21 +1,30 @@ #include "stdafx.h" #include "TraderApi.h" -#include "../include/QueueEnum.h" -#include "../include/QueueHeader.h" +#include "../../include/QueueEnum.h" -#include "../include/ApiHeader.h" -#include "../include/ApiStruct.h" +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" -#include "../include/toolkit.h" +#include "../../include/toolkit.h" + +#include "../../include/queue/MsgQueue.h" + +#include "../CTP/TypeConvert.h" -#include "../QuantBox_Queue/MsgQueue.h" -#include "TypeConvert.h" #include #include #include +#if defined(_MSC_VER) || defined(_WIN32) +#include +#endif + +#ifdef ENABLE_LICENSE +#include "../../common/License/License.h" +#endif + void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { @@ -33,42 +42,62 @@ void CTraderApi::QueryInThread(char type, void* pApi1, void* pApi2, double doubl case E_Init: iRet = _Init(); break; - case E_ReqAuthenticateField: - iRet = _ReqAuthenticate(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_ReqUserLoginField: - iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_SettlementInfoConfirmField: - iRet = _ReqSettlementInfoConfirm(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; + case E_Disconnect: + _Disconnect(true); + // 不再循环 + return; + } - case QueryType::ReqQryTradingAccount: - iRet = _ReqQryTradingAccount(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryInvestorPosition : - iRet = _ReqQryInvestorPosition(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryInstrument : - iRet = _ReqQryInstrument(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryInvestor : - iRet = _ReqQryInvestor(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryOrder : - iRet = _ReqQryOrder(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryTrade: - iRet = _ReqQryTrade(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQryQuote: - iRet = _ReqQryQuote(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case QueryType::ReqQrySettlementInfo: - iRet = _ReqQrySettlementInfo(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - default: - break; + if (m_pApi) + { + switch (type) + { + case E_ReqAuthenticateField: + iRet = _ReqAuthenticate(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case E_ReqUserLoginField: + iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case E_UserLogoutField: + iRet = _ReqUserLogout(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryTradingAccount: + iRet = _ReqQryTradingAccount(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryInvestorPosition: + iRet = _ReqQryInvestorPosition(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryInstrument: + iRet = _ReqQryInstrument(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryInvestor: + iRet = _ReqQryInvestor(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryOrder: + iRet = _ReqQryOrder(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryTrade: + iRet = _ReqQryTrade(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + +#ifdef HAS_Quote + case QueryType::QueryType_ReqQryQuote: + iRet = _ReqQryQuote(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; +#endif // HAS_Quote + +#ifdef HAS_Settlement + case E_SettlementInfoConfirmField: + iRet = _ReqSettlementInfoConfirm(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQrySettlementInfo: + iRet = _ReqQrySettlementInfo(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; +#endif // HAS_Settlement + + default: + break; + } } if (0 == iRet) @@ -92,8 +121,8 @@ void CTraderApi::Register(void* pCallback, void* pClass) if (m_msgQueue == nullptr) return; - m_msgQueue_Query->Register((void*)Query,this); - m_msgQueue->Register(pCallback,this); + m_msgQueue_Query->Register(Query); + m_msgQueue->Register((fnOnResponse)pCallback); if (pCallback) { m_msgQueue_Query->StartThread(); @@ -116,14 +145,38 @@ CTraderApi::CTraderApi(void) m_msgQueue = new CMsgQueue(); m_msgQueue_Query = new CMsgQueue(); - m_msgQueue_Query->Register((void*)Query,this); + m_msgQueue_Query->Register(Query); m_msgQueue_Query->StartThread(); + +#ifdef ENABLE_LICENSE + // 为了这个加密库,居然把编译选项由/MDd改成了/MTd,以后一定要想办法改回去 + m_pLicense = new CLicense(); + + char szPath[MAX_PATH] = { 0 }; + m_pLicense->GetDllPathByFunctionName("XRequest", szPath); + m_pLicense->SetLicensePath(szPath); + // 这里选的是从文件中加载公钥,可以写死到资源或代码中,这样用户就没有那么容易自己生成公私钥对替换了 + m_pLicense->SetPublicKeyString(DLL_PUBLIC_KEY); + + string signatureString = m_pLicense->LoadStringFromFile(m_pLicense->m_SignaturePath); + m_pLicense->SetSignatureString(signatureString.c_str()); +#endif + + //m_delete = false; } CTraderApi::~CTraderApi(void) { - Disconnect(); + _Disconnect(false); + +#ifdef ENABLE_LICENSE + if (m_pLicense == nullptr) + { + delete m_pLicense; + m_pLicense = nullptr; + } +#endif } bool CTraderApi::IsErrorRspInfo(const char* szSource, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) @@ -137,7 +190,7 @@ bool CTraderApi::IsErrorRspInfo(const char* szSource, CThostFtdcRspInfoField *pR strcpy(pField->Text, pRspInfo->ErrorMsg); strcpy(pField->Source, szSource); - m_msgQueue->Input_NoCopy(ResponeType::OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); } return bRet; } @@ -164,16 +217,107 @@ void CTraderApi::Connect(const string& szPath, int CTraderApi::_Init() { +#ifdef ENABLE_LICENSE + int err = m_pLicense->LoadIni(); + if (err != 0) + { + // 没有授权文件 + m_pLicense->CreateDefault(); + m_pLicense->AddUser(m_UserInfo.UserID, "*"); + err = m_pLicense->SaveIni(); + } + + if (err == 0) + { + err = m_pLicense->GetErrorCodeForMachineID(); + } + + if (err == 0) + { + err = m_pLicense->GetErrorCodeByAccount(m_UserInfo.UserID); + } + + if (err == 0) + { + err = m_pLicense->GetErrorCodeForSign(); + } + + if (err == 0) + { + err = m_pLicense->GetErrorCodeForExpireDate(); + } + + if (err != 0) + { + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + pField->RawErrorID = err; + strncpy(pField->Text, m_pLicense->GetErrorInfo(), sizeof(Char256Type)); + + // >0的错误表示不严重,可以继续 + if (err > 0) + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + } + else if (err < 0) + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + return 0; + } + } +#endif + char *pszPath = new char[m_szPath.length() + 1024]; srand((unsigned int)time(nullptr)); sprintf(pszPath, "%s/%s/%s/Td/%d/", m_szPath.c_str(), m_ServerInfo.BrokerID, m_UserInfo.UserID, rand()); makedirs(pszPath); + + // 本来想使用chdir的方法解决Kingstar的证书问题,测试多次发现还是读取的exe目录下 + // 打算使用文件复制的方法来实现, + // 1.先检查证书是否存在,存在就跳过 + // 2.复制,用完要删 +#ifdef KS_COPYFILE + lock_guard cl(m_csOrderRef); + + char szExePath[MAX_PATH] = { 0 }; + GetExePath(szExePath); + char szDllPath[MAX_PATH] = { 0 }; + GetDllPathByFunctionName("XRequest", szDllPath); + + char szExistingFileName[MAX_PATH] = { 0 }; + char szNewFileName[MAX_PATH] = { 0 }; + GetNewPathInSameDirectory(szDllPath, KS_LKC_FILENAME, KS_LKC_EXT, szExistingFileName); + GetNewPathInSameDirectory(szExePath, KS_LKC_FILENAME, KS_LKC_EXT, szNewFileName); + + bool bRet = CopyFileA(szExistingFileName, szNewFileName, false); + + if (!bRet) + { + char szBuf[256] = { 0 }; + LPVOID lpMsgBuf; + DWORD dw = GetLastError(); + FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&lpMsgBuf, + 0, NULL); + + LogField* pField = (LogField*)m_msgQueue->new_block(sizeof(LogField)); + + sprintf(pField->Message, "CopyFile:%s", lpMsgBuf); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnLog, m_msgQueue, m_pClass, true, 0, pField, sizeof(LogField), nullptr, 0, nullptr, 0); + } +#endif // KS_COPYFILE + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_pApi = CThostFtdcTraderApi::CreateFtdcTraderApi(pszPath); delete[] pszPath; - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); - if (m_pApi) { m_pApi->RegisterSpi(this); @@ -186,7 +330,7 @@ int CTraderApi::_Init() char* token = strtok(buf, _QUANTBOX_SEPS_); while (token) { - if (strlen(token)>0) + if (strlen(token) > 0) { m_pApi->RegisterFront(token); } @@ -203,7 +347,7 @@ int CTraderApi::_Init() { m_pApi->SubscribePublicTopic(THOST_TERT_QUICK); } - + if (m_ServerInfo.PrivateTopicResumeType < ResumeType::ResumeType_Undefined) { m_pApi->SubscribePrivateTopic((THOST_TE_RESUME_TYPE)m_ServerInfo.PrivateTopicResumeType); @@ -215,19 +359,35 @@ int CTraderApi::_Init() //初始化连接 m_pApi->Init(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + else + { + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + pField->RawErrorID = 0; + strncpy(pField->Text, "(Api==null)", sizeof(Char256Type)); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + } + +#ifdef KS_COPYFILE + if (bRet) + { + DeleteFileA(szNewFileName); } +#endif // KS_COPYFILE return 0; } void CTraderApi::OnFrontConnected() { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); //连接成功后自动请求认证或登录 - if (strlen(m_ServerInfo.AuthCode)>0 - && strlen(m_ServerInfo.UserProductInfo)>0) + if (strlen(m_ServerInfo.AuthCode) > 0 + && strlen(m_ServerInfo.UserProductInfo) > 0) { //填了认证码就先认证 ReqAuthenticate(); @@ -246,7 +406,10 @@ void CTraderApi::OnFrontDisconnected(int nReason) pField->RawErrorID = nReason; GetOnFrontDisconnectedMsg(nReason, pField->Text); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + + // 收到登录失败后并没有销毁API,飞鼠只能登录一个用户,所以导致飞鼠登录失败 + _DisconnectInThread(); } void CTraderApi::ReqAuthenticate() @@ -264,7 +427,7 @@ void CTraderApi::ReqAuthenticate() int CTraderApi::_ReqAuthenticate(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorizing, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorizing, 0, nullptr, 0, nullptr, 0, nullptr, 0); return m_pApi->ReqAuthenticate((CThostFtdcReqAuthenticateField*)ptr1, ++m_lRequestID); } @@ -273,7 +436,7 @@ void CTraderApi::OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthentic if (!IsErrorRspInfo(pRspInfo) && pRspAuthenticateField) { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorized, 0, nullptr, 0, nullptr, 0, nullptr, 0); ReqUserLogin(); } @@ -284,7 +447,7 @@ void CTraderApi::OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthentic pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); } } @@ -303,10 +466,34 @@ void CTraderApi::ReqUserLogin() int CTraderApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); return m_pApi->ReqUserLogin((CThostFtdcReqUserLoginField*)ptr1, ++m_lRequestID); } +void CTraderApi::ReqUserLogout() +{ + CThostFtdcUserLogoutField* pBody = (CThostFtdcUserLogoutField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcUserLogoutField)); + + strncpy(pBody->BrokerID, m_ServerInfo.BrokerID, sizeof(TThostFtdcBrokerIDType)); + strncpy(pBody->UserID, m_UserInfo.UserID, sizeof(TThostFtdcInvestorIDType)); + + if (m_msgQueue_Query) + { + m_msgQueue_Query->Input_NoCopy(RequestType::E_UserLogoutField, m_msgQueue_Query, this, 0, 0, + pBody, sizeof(CThostFtdcReqUserLoginField), nullptr, 0, nullptr, 0); + } +} + +int CTraderApi::_ReqUserLogout(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi) + { + return m_pApi->ReqUserLogout((CThostFtdcUserLogoutField*)ptr1, ++m_lRequestID); + } + return 0; +} + + void CTraderApi::OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); @@ -314,22 +501,56 @@ void CTraderApi::OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CTho if (!IsErrorRspInfo(pRspInfo) && pRspUserLogin) { +#ifdef HAS_TradingDay_UserLogin pField->TradingDay = GetDate(pRspUserLogin->TradingDay); +#endif // HAS_TradingDay_UserLogin pField->LoginTime = GetTime(pRspUserLogin->LoginTime); sprintf(pField->SessionID, "%d:%d", pRspUserLogin->FrontID, pRspUserLogin->SessionID); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); // 记下登录信息,可能会用到 memcpy(&m_RspUserLogin, pRspUserLogin, sizeof(CThostFtdcRspUserLoginField)); + + // 飞鼠是报单引用是长字符串 +#ifdef USE_LONG_ORDER_REF + m_nMaxOrderRef = atol(pRspUserLogin->MaxOrderRef); +#else m_nMaxOrderRef = atol(pRspUserLogin->MaxOrderRef); +#endif // 自己发单时ID从1开始,不能从0开始 - m_nMaxOrderRef = m_nMaxOrderRef>1 ? m_nMaxOrderRef : 1; + //m_nMaxOrderRef = m_nMaxOrderRef>1 ? m_nMaxOrderRef : 1; + + // 飞鼠接口,这个数返回的是上次退出时最大编号,所以将要使用的得+1 + // 而其它接口是这次可以使用的报单编号,所以出于使用考虑,直接+1 + m_nMaxOrderRef += 1; + + // 结算单确认,CTP必须确认才能下单 +#ifdef HAS_Settlement ReqSettlementInfoConfirm(); +#else + QueryOrderTrade(false); +#endif // HAS_Settlement + + +#ifdef IS_SGIT_API + // 飞鼠返回的资金太多了,关闭掉 + m_pApi->IsReviveNtyCapital(FALSE); + +#ifdef ENABLE_LICENSE + // 飞鼠由于目前没办法查投资者列表,无法根据姓名来判断授权,所以只能提前设置为可用 + m_pLicense->SetSendOrderFlag(true); +#endif + +#else + // 查询投资查,授权认证时使 + // 飞鼠使用此功能需要服务器升级 ReqQueryField body = { 0 }; - ReqQuery(QueryType::ReqQryInvestor, &body); + ReqQuery(QueryType::QueryType_ReqQryInvestor, &body); +#endif + //TEST:测完要删 //body.DateStart = 20151111; @@ -340,10 +561,26 @@ void CTraderApi::OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CTho pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + + // 收到登录失败后并没有销毁API,飞鼠一次只能登录一个用户,所以导致飞鼠用户失败 + _DisconnectInThread(); + } +} + +void CTraderApi::QueryOrderTrade(bool bForceQuery) +{ + if (bForceQuery || + (m_ServerInfo.PrivateTopicResumeType > ResumeType::ResumeType_Restart + && (m_ServerInfo.PrivateTopicResumeType < ResumeType::ResumeType_Undefined))) + { + ReqQueryField body = { 0 }; + ReqQuery(QueryType::QueryType_ReqQryOrder, &body); + ReqQuery(QueryType::QueryType_ReqQryQuote, &body); } } +#ifdef HAS_Settlement void CTraderApi::ReqSettlementInfoConfirm() { CThostFtdcSettlementInfoConfirmField* pBody = (CThostFtdcSettlementInfoConfirmField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcSettlementInfoConfirmField)); @@ -357,7 +594,7 @@ void CTraderApi::ReqSettlementInfoConfirm() int CTraderApi::_ReqSettlementInfoConfirm(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Confirming, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Confirming, 0, nullptr, 0, nullptr, 0, nullptr, 0); return m_pApi->ReqSettlementInfoConfirm((CThostFtdcSettlementInfoConfirmField*)ptr1, ++m_lRequestID); } @@ -366,20 +603,11 @@ void CTraderApi::OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField if (!IsErrorRspInfo(pRspInfo) && pSettlementInfoConfirm) { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Confirmed, 0, nullptr, 0, nullptr, 0, nullptr, 0); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); - - if (m_ServerInfo.PrivateTopicResumeType > ResumeType::ResumeType_Restart - && (m_ServerInfo.PrivateTopicResumeTypeInput_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Confirmed, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); - ReqQueryField body = { 0 }; - ReqQuery(QueryType::ReqQryOrder, &body); - ReqQuery(QueryType::ReqQryQuote, &body); - } + // 结算单确认完成,后查询委托与成交 + QueryOrderTrade(false); } else { @@ -388,30 +616,63 @@ void CTraderApi::OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); } } +#endif // HAS_Settlement + + void CTraderApi::Disconnect() { - if (m_msgQueue_Query) + _Disconnect(false); +} + +void CTraderApi::_DisconnectInThread() +{ + m_msgQueue_Query->Input_NoCopy(RequestType::E_Disconnect, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} + +void CTraderApi::_Disconnect(bool IsInQueue) +{ + //if (m_delete) + // return; + + //m_delete = true; + + // 由于飞鼠一次只能登录一个账号,以前的方法连接可能没有断开,这里只能主动退出,其它的程序就不管了 +#ifdef IS_SGIT_API + ReqUserLogout(); + Sleep(1000); +#endif + + if (IsInQueue) { - m_msgQueue_Query->StopThread(); - m_msgQueue_Query->Register(nullptr,nullptr); - m_msgQueue_Query->Clear(); - delete m_msgQueue_Query; - m_msgQueue_Query = nullptr; + + } + else + { + if (m_msgQueue_Query) + { + m_msgQueue_Query->StopThread(); + m_msgQueue_Query->Register(nullptr); + m_msgQueue_Query->Clear(); + delete m_msgQueue_Query; + m_msgQueue_Query = nullptr; + } } - if(m_pApi) + if (m_pApi) { + // 为何感觉飞鼠没有登出成功,还在运行? m_pApi->RegisterSpi(nullptr); m_pApi->Release(); m_pApi = nullptr; // 全清理,只留最后一个 m_msgQueue->Clear(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); // 主动触发 m_msgQueue->Process(); } @@ -419,7 +680,7 @@ void CTraderApi::Disconnect() if (m_msgQueue) { m_msgQueue->StopThread(); - m_msgQueue->Register(nullptr,nullptr); + m_msgQueue->Register(nullptr); m_msgQueue->Clear(); delete m_msgQueue; m_msgQueue = nullptr; @@ -440,6 +701,15 @@ void CTraderApi::Clear() delete it->second; m_id_api_order.clear(); + for (unordered_map::iterator it = m_id_platform_position.begin(); it != m_id_platform_position.end(); ++it) + delete it->second; + m_id_platform_position.clear(); + + for (unordered_map::iterator it = m_id_api_position.begin(); it != m_id_api_position.end(); ++it) + delete it->second; + m_id_api_position.clear(); + +#ifdef HAS_Quote for (unordered_map::iterator it = m_id_platform_quote.begin(); it != m_id_platform_quote.end(); ++it) delete it->second; m_id_platform_quote.clear(); @@ -447,26 +717,29 @@ void CTraderApi::Clear() for (unordered_map::iterator it = m_id_api_quote.begin(); it != m_id_api_quote.end(); ++it) delete it->second; m_id_api_quote.clear(); +#endif // HAS_Quote - for (unordered_map::iterator it = m_id_platform_position.begin(); it != m_id_platform_position.end(); ++it) - delete it->second; - m_id_platform_position.clear(); } -int CTraderApi::ReqOrderInsert( +char* CTraderApi::ReqOrderInsert( OrderField* pOrder, int count, - OrderIDType* pInOut) + char* pszLocalIDBuf) { int OrderRef = -1; if (nullptr == m_pApi) - return -1; + return nullptr; - CThostFtdcInputOrderField body = {0}; + CThostFtdcInputOrderField body = { 0 }; strncpy(body.BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); strncpy(body.InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); +#ifdef IS_SGIT_API + // 为飞鼠加的,否则报席位不符 + strncpy(body.UserID, m_RspUserLogin.UserID, sizeof(TThostFtdcUserIDType)); +#endif + body.MinVolume = 1; body.ForceCloseReason = THOST_FTDC_FCC_NotForceClose; body.IsAutoSuspend = 0; @@ -475,7 +748,10 @@ int CTraderApi::ReqOrderInsert( //合约 strncpy(body.InstrumentID, pOrder->InstrumentID, sizeof(TThostFtdcInstrumentIDType)); +#ifdef HAS_ExchangeID_Order strncpy(body.ExchangeID, pOrder->ExchangeID, sizeof(TThostFtdcExchangeIDType)); +#endif // HAS_ExchangeID_Order + //买卖 body.Direction = OrderSide_2_TThostFtdcDirectionType(pOrder->Side); //开平 @@ -490,7 +766,7 @@ int CTraderApi::ReqOrderInsert( body.StopPrice = pOrder->StopPx; // 针对第二个进行处理,如果有第二个参数,认为是交易所套利单 - if (count>1) + if (count > 1) { body.CombOffsetFlag[1] = OpenCloseType_2_TThostFtdcOffsetFlagType(pOrder[1].OpenClose); body.CombHedgeFlag[1] = HedgeFlagType_2_TThostFtdcHedgeFlagType(pOrder[1].HedgeFlag); @@ -565,9 +841,38 @@ int CTraderApi::ReqOrderInsert( nRet = OrderRef; } sprintf(body.OrderRef, "%d", nRet); +#ifdef USE_LONG_ORDER_REF + sprintf(body.OrderRef, "%012lld", nRet); +#endif // 测试平台穿越速度,用完后需要注释掉 //WriteLog("CTP:ReqOrderInsert:%s %d", body.InstrumentID, nRet); +#ifdef ENABLE_LICENSE + int err = m_pLicense->GetErrorCodeForSendOrder(); + if (err < 0) + { + sprintf(m_orderInsert_Id, "%d", -5); + + OrderField* pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + memcpy(pField, pOrder, sizeof(OrderField)); + strcpy(pField->ID, m_orderInsert_Id); + strcpy(pField->LocalID, pField->ID); + m_id_platform_order.insert(pair(pField->LocalID, pField)); + + pField->RawErrorID = err; + strncpy(pField->Text, m_pLicense->GetErrorInfo(), sizeof(Char256Type)); + + pField->Status = OrderStatus::OrderStatus_Rejected; + pField->ExecType = ExecType::ExecType_Rejected; + + strncpy((char*)pszLocalIDBuf, m_orderInsert_Id, sizeof(OrderIDType)); + + // 这个问题的关键是先到队列还是先返回 + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + + return pszLocalIDBuf; + } +#endif //不保存到队列,而是直接发送 @@ -581,49 +886,57 @@ int CTraderApi::ReqOrderInsert( { // 用于各种情况下找到原订单,用于进行响应的通知 sprintf(m_orderInsert_Id, "%d:%d:%d", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, nRet); +#ifdef USE_LONG_ORDER_REF + sprintf(m_orderInsert_Id, "%d:%d:%012lld", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, nRet); +#endif OrderField* pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); memcpy(pField, pOrder, sizeof(OrderField)); strcpy(pField->ID, m_orderInsert_Id); strcpy(pField->LocalID, pField->ID); - m_id_platform_order.insert(pair(m_orderInsert_Id, pField)); + m_id_platform_order.insert(pair(pField->LocalID, pField)); } - strncpy((char*)pInOut, m_orderInsert_Id, sizeof(OrderIDType)); + strncpy((char*)pszLocalIDBuf, m_orderInsert_Id, sizeof(OrderIDType)); } - return nRet; + return pszLocalIDBuf; } void CTraderApi::OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { OrderIDType orderId = { 0 }; + // 飞鼠报单成功也会走此路,所以需要处理一下,即只有发现有错误信息时才报出去 + if (pInputOrder) { sprintf(orderId, "%d:%d:%s", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, pInputOrder->OrderRef); } else { - IsErrorRspInfo("OnRspOrderInsert", pRspInfo, nRequestID, bIsLast); + // IsErrorRspInfo("OnRspOrderInsert", pRspInfo, nRequestID, bIsLast); } - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) - { - // 没找到?不应当,这表示出错了 - //assert(false); - } - else + if (IsErrorRspInfo(pRspInfo)) { - // 找到了,要更新状态 - // 得使用上次的状态 - OrderField* pField = it->second; - pField->ExecType = ExecType::ExecType_Rejected; - pField->Status = OrderStatus::OrderStatus_Rejected; - pField->RawErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + unordered_map::iterator it = m_id_platform_order.find(orderId); + if (it == m_id_platform_order.end()) + { + // 没找到?不应当,这表示出错了 + //assert(false); + } + else + { + // 找到了,要更新状态 + // 得使用上次的状态 + OrderField* pField = it->second; + pField->ExecType = ExecType::ExecType_Rejected; + pField->Status = OrderStatus::OrderStatus_Rejected; + pField->RawErrorID = pRspInfo->ErrorID; + strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + } } } @@ -655,7 +968,7 @@ void CTraderApi::OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CTh pField->Status = OrderStatus::OrderStatus_Rejected; pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); } } @@ -664,19 +977,20 @@ void CTraderApi::OnRtnTrade(CThostFtdcTradeField *pTrade) OnTrade(pTrade, 0, true); } -int CTraderApi::ReqOrderAction(OrderIDType* szIds, int count, OrderIDType* pOutput) +char* CTraderApi::ReqOrderAction(OrderIDType* szIds, int count, char* pzsRtn) { unordered_map::iterator it = m_id_api_order.find(szIds[0]); if (it == m_id_api_order.end()) { - sprintf((char*)pOutput, "%d", -100); - return -100; + sprintf(pzsRtn, "%d", -100); } else { // 找到了订单 - return ReqOrderAction(it->second, count, pOutput); + return ReqOrderAction(it->second, count, pzsRtn); } + + return pzsRtn; } int CTraderApi::ReqOrderAction(OrderField *pOrder, int count, OrderIDType* pOutput) @@ -721,31 +1035,31 @@ int CTraderApi::ReqOrderAction(OrderField *pOrder, int count, OrderIDType* pOutp return 0; } -int CTraderApi::ReqOrderAction(CThostFtdcOrderField *pOrder, int count, OrderIDType* pOutput) +char* CTraderApi::ReqOrderAction(CThostFtdcOrderField *pOrder, int count, char* pzsRtn) { if (nullptr == m_pApi) return 0; - CThostFtdcInputOrderActionField body = {0}; + CThostFtdcInputOrderActionField body = { 0 }; ///经纪公司代码 - strncpy(body.BrokerID, pOrder->BrokerID,sizeof(TThostFtdcBrokerIDType)); + strncpy(body.BrokerID, pOrder->BrokerID, sizeof(TThostFtdcBrokerIDType)); ///投资者代码 - strncpy(body.InvestorID, pOrder->InvestorID,sizeof(TThostFtdcInvestorIDType)); + strncpy(body.InvestorID, pOrder->InvestorID, sizeof(TThostFtdcInvestorIDType)); ///报单引用 - strncpy(body.OrderRef, pOrder->OrderRef,sizeof(TThostFtdcOrderRefType)); + strncpy(body.OrderRef, pOrder->OrderRef, sizeof(TThostFtdcOrderRefType)); ///前置编号 body.FrontID = pOrder->FrontID; ///会话编号 body.SessionID = pOrder->SessionID; ///交易所代码 - strncpy(body.ExchangeID,pOrder->ExchangeID,sizeof(TThostFtdcExchangeIDType)); + strncpy(body.ExchangeID, pOrder->ExchangeID, sizeof(TThostFtdcExchangeIDType)); ///报单编号 - strncpy(body.OrderSysID,pOrder->OrderSysID,sizeof(TThostFtdcOrderSysIDType)); + strncpy(body.OrderSysID, pOrder->OrderSysID, sizeof(TThostFtdcOrderSysIDType)); ///操作标志 body.ActionFlag = THOST_FTDC_AF_Delete; ///合约代码 - strncpy(body.InstrumentID, pOrder->InstrumentID,sizeof(TThostFtdcInstrumentIDType)); + strncpy(body.InstrumentID, pOrder->InstrumentID, sizeof(TThostFtdcInstrumentIDType)); int nRet = m_pApi->ReqOrderAction(&body, ++m_lRequestID); if (nRet < 0) @@ -756,10 +1070,9 @@ int CTraderApi::ReqOrderAction(CThostFtdcOrderField *pOrder, int count, OrderIDT { memset(m_orderAction_Id, 0, sizeof(OrderIDType)); } - strncpy((char*)pOutput, m_orderAction_Id, sizeof(OrderIDType)); + strncpy(pzsRtn, m_orderAction_Id, sizeof(OrderIDType)); - - return nRet; + return pzsRtn; } void CTraderApi::OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) @@ -771,26 +1084,29 @@ void CTraderApi::OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAc } else { - IsErrorRspInfo("OnRspOrderAction", pRspInfo, nRequestID, bIsLast); + //IsErrorRspInfo("OnRspOrderAction", pRspInfo, nRequestID, bIsLast); } - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) + if (IsErrorRspInfo(pRspInfo)) { - // 没找到?不应当,这表示出错了 - //assert(false); - } - else - { - // 找到了,要更新状态 - // 得使用上次的状态 - OrderField* pField = it->second; - strcpy(pField->ID, orderId); - strcpy(pField->LocalID, pField->ID); - pField->ExecType = ExecType::ExecType_CancelReject; - pField->RawErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + unordered_map::iterator it = m_id_platform_order.find(orderId); + if (it == m_id_platform_order.end()) + { + // 没找到?不应当,这表示出错了 + //assert(false); + } + else + { + // 找到了,要更新状态 + // 得使用上次的状态 + OrderField* pField = it->second; + strcpy(pField->ID, orderId); + strcpy(pField->LocalID, pField->ID); + pField->ExecType = ExecType::ExecType_CancelReject; + pField->RawErrorID = pRspInfo->ErrorID; + strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + } } } @@ -822,7 +1138,7 @@ void CTraderApi::OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, C pField->ExecType = ExecType::ExecType_CancelReject; pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); } } @@ -831,838 +1147,1028 @@ void CTraderApi::OnRtnOrder(CThostFtdcOrderField *pOrder) OnOrder(pOrder, 0, true); } -char* CTraderApi::ReqQuoteInsert( - QuoteField* pQuote, - OrderIDType* pAskRef, - OrderIDType* pBidRef) -{ - int QuoteRef = -1; - if (nullptr == m_pApi) - return nullptr; - CThostFtdcInputQuoteField body = {0}; +int CTraderApi::_ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + CThostFtdcQryTradingAccountField body = { 0 }; strcpy(body.BrokerID, m_RspUserLogin.BrokerID); strcpy(body.InvestorID, m_RspUserLogin.UserID); - //合约,目前只从订单1中取 - strncpy(body.InstrumentID, pQuote->InstrumentID, sizeof(TThostFtdcInstrumentIDType)); - strncpy(body.ExchangeID, pQuote->ExchangeID, sizeof(TThostFtdcExchangeIDType)); - //开平 - body.AskOffsetFlag = OpenCloseType_2_TThostFtdcOffsetFlagType(pQuote->AskOpenClose); - body.BidOffsetFlag = OpenCloseType_2_TThostFtdcOffsetFlagType(pQuote->BidOpenClose); - //投保 - body.AskHedgeFlag = HedgeFlagType_2_TThostFtdcHedgeFlagType(pQuote->AskHedgeFlag); - body.BidHedgeFlag = HedgeFlagType_2_TThostFtdcHedgeFlagType(pQuote->BidHedgeFlag); - - //价格 - body.AskPrice = pQuote->AskPrice; - body.BidPrice = pQuote->BidPrice; - - //数量 - body.AskVolume = (int)pQuote->AskQty; - body.BidVolume = (int)pQuote->BidQty; - - strncpy(body.ForQuoteSysID, pQuote->QuoteReqID, sizeof(TThostFtdcOrderSysIDType)); + return m_pApi->ReqQryTradingAccount(&body, ++m_lRequestID); +} - int nRet = 0; +void CTraderApi::OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspQryTradingAccount", pRspInfo, nRequestID, bIsLast)) { - //可能报单太快,m_nMaxOrderRef还没有改变就提交了 - lock_guard cl(m_csOrderRef); - - if (QuoteRef < 0) + if (pTradingAccount) { - nRet = m_nMaxOrderRef; - sprintf(body.QuoteRef, "%d", m_nMaxOrderRef); - sprintf(body.AskOrderRef, "%d", m_nMaxOrderRef); - sprintf(body.BidOrderRef, "%d", ++m_nMaxOrderRef); - ++m_nMaxOrderRef; + AccountField* pField = (AccountField*)m_msgQueue->new_block(sizeof(AccountField)); + + strcpy(pField->AccountID, pTradingAccount->AccountID); + pField->CurrMargin = pTradingAccount->CurrMargin; + pField->Commission = pTradingAccount->Commission; + pField->Available = pTradingAccount->Available; + pField->Deposit = pTradingAccount->Deposit; + pField->Withdraw = pTradingAccount->Withdraw; + pField->WithdrawQuota = pTradingAccount->WithdrawQuota; + +#ifdef HAS_Account_Future + pField->PreBalance = pTradingAccount->PreBalance; + pField->CloseProfit = pTradingAccount->CloseProfit; + pField->PositionProfit = pTradingAccount->PositionProfit; + pField->Balance = pTradingAccount->Balance; +#endif + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryTradingAccount, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(AccountField), nullptr, 0, nullptr, 0); } else { - nRet = QuoteRef; - sprintf(body.QuoteRef, "%d", QuoteRef); - sprintf(body.AskOrderRef, "%d", QuoteRef); - sprintf(body.BidOrderRef, "%d", ++QuoteRef); - ++QuoteRef; + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryTradingAccount, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); } + } +} - //不保存到队列,而是直接发送 - int n = m_pApi->ReqQuoteInsert(&body, ++m_lRequestID); - if (n < 0) - { - nRet = n; - return nullptr; - } - else - { - sprintf(m_orderInsert_Id, "%d:%d:%d", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, nRet); - QuoteField* pField = (QuoteField*)m_msgQueue->new_block(sizeof(QuoteField)); - memcpy(pField, pQuote, sizeof(QuoteField)); - strcpy(pField->ID, m_orderInsert_Id); - strcpy(pField->LocalID, pField->ID); - strcpy(pField->AskID, m_orderInsert_Id); - sprintf(pField->BidID, "%d:%d:%d", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, nRet + 1); +int CTraderApi::_ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + ReqQueryField* pQuery = (ReqQueryField*)ptr1; - m_id_platform_quote.insert(pair(m_orderInsert_Id, pField)); - } - } + CThostFtdcQryInvestorPositionField body = { 0 }; - return m_orderInsert_Id; + strncpy(body.BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); + strncpy(body.InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); + strncpy(body.InstrumentID, pQuery->InstrumentID, sizeof(TThostFtdcInstrumentIDType)); + + return m_pApi->ReqQryInvestorPosition(&body, ++m_lRequestID); } -void CTraderApi::OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +void CTraderApi::GetPositionID(CThostFtdcInvestorPositionField *pInvestorPosition, PositionIDType positionId) { - OrderIDType quoteId = { 0 }; - - if (pInputQuote) - { - sprintf(quoteId, "%d:%d:%s", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, pInputQuote->QuoteRef); - } - else - { - IsErrorRspInfo("OnRspQuoteInsert", pRspInfo, nRequestID, bIsLast); - } - unordered_map::iterator it = m_id_platform_quote.find(quoteId); - if (it == m_id_platform_quote.end()) - { - // 没找到?不应当,这表示出错了 - //assert(false); - } - else - { - // 找到了,要更新状态 - // 得使用上次的状态 - QuoteField* pField = it->second; - pField->ExecType = ExecType::ExecType_Rejected; - pField->Status = OrderStatus::OrderStatus_Rejected; - pField->RawErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); - } +#ifdef HAS_ExchangeID_Position + //PositionIDType positionId = { 0 }; + sprintf(positionId, "%s:%s:%d:%d:%c", + pInvestorPosition->ExchangeID, + pInvestorPosition->InstrumentID, + TThostFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection), + TThostFtdcHedgeFlagType_2_HedgeFlagType(pInvestorPosition->HedgeFlag), + pInvestorPosition->PositionDate); +#else + //PositionIDType positionId = { 0 }; + sprintf(positionId, "%s:%s:%d:%d:%c", + "", + pInvestorPosition->InstrumentID, + TThostFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection), + TThostFtdcHedgeFlagType_2_HedgeFlagType(pInvestorPosition->HedgeFlag), + pInvestorPosition->PositionDate); + +#endif // HAS_ExchangeID } -void CTraderApi::OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo) +void CTraderApi::GetPositionID2(CThostFtdcInvestorPositionField *pInvestorPosition, PositionIDType positionId) { - OrderIDType quoteId = { 0 }; +#ifdef HAS_ExchangeID_Position + //PositionIDType positionId = { 0 }; + sprintf(positionId, "%s:%s:%d:%d", + pInvestorPosition->ExchangeID, + pInvestorPosition->InstrumentID, + TThostFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection), + TThostFtdcHedgeFlagType_2_HedgeFlagType(pInvestorPosition->HedgeFlag)); +#else + //PositionIDType positionId = { 0 }; + sprintf(positionId, "%s:%s:%d:%d", + "", + pInvestorPosition->InstrumentID, + TThostFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection), + TThostFtdcHedgeFlagType_2_HedgeFlagType(pInvestorPosition->HedgeFlag)); + +#endif // HAS_ExchangeID +} - if (pInputQuote) +// 如果是请求查询,就将数据全部返回 +// 如果是后期的成交回报,就只返回更新的记录 +// 对于中金所,同时有今昨两天的持仓时,只返回今天的两条多空数据 +// 对于上期所,目前没条件测,当成是也只有两条 +void CTraderApi::OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + // 融航接口的设计缺陷,20180830 + // 它会通过返回-1来表示没有记录,而查询委托就没有这个问题 + if (pRspInfo && pRspInfo->ErrorID == -1) { - sprintf(quoteId, "%d:%d:%s", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, pInputQuote->QuoteRef); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + return; } - else + if (!IsErrorRspInfo("OnRspQryInvestorPosition", pRspInfo, nRequestID, bIsLast)) { - IsErrorRspInfo("",pRspInfo, 0, true); - } + // 如果没有持仓,返回空的数据 + if (nullptr == pInvestorPosition) + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + return; + } - unordered_map::iterator it = m_id_platform_quote.find(quoteId); - if (it == m_id_platform_quote.end()) - { - // 没找到?不应当,这表示出错了 - //assert(false); - } - else - { - // 找到了,要更新状态 - // 得使用上次的状态 - QuoteField* pField = it->second; - pField->ExecType = ExecType::ExecType_Rejected; - pField->Status = OrderStatus::OrderStatus_Rejected; - pField->RawErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); + // 得到持仓ID + PositionIDType positionId = { 0 }; + GetPositionID(pInvestorPosition, positionId); + + // 先将原始的持仓都记录下来 + { + unordered_map::iterator it = m_id_api_position.find(positionId); + if (it == m_id_api_position.end()) + { + // 找不到此订单,表示是新单 + CThostFtdcInvestorPositionField* pField = (CThostFtdcInvestorPositionField*)m_msgQueue->new_block(sizeof(CThostFtdcInvestorPositionField)); + memcpy(pField, pInvestorPosition, sizeof(CThostFtdcInvestorPositionField)); + m_id_api_position.insert(pair(positionId, pField)); + } + else + { + // 找到了订单 + // 需要再复制保存最后一次的状态,还是只要第一次的用于撤单即可?记下,这样最后好比较 + CThostFtdcInvestorPositionField* pField = it->second; + memcpy(pField, pInvestorPosition, sizeof(CThostFtdcInvestorPositionField)); + } + } + + // 等最后一条记录,开始遍历列表,将所有持仓整理后推送出去 + // 为何要这样做?因为今昨是两条记录,但我记在一个里面 + if (!bIsLast) + return; + + // 清理一下否则可能加错 + for (unordered_map::iterator it = m_id_platform_position.begin(); it != m_id_platform_position.end(); ++it) + delete it->second; + m_id_platform_position.clear(); + + // 遍历原始的持仓,生成自己的结构体 + for (unordered_map::iterator iter = m_id_api_position.begin(); iter != m_id_api_position.end(); iter++) + { + CThostFtdcInvestorPositionField* pField2 = iter->second; + + // 得到持仓ID + PositionIDType positionId2 = { 0 }; + GetPositionID2(pField2, positionId2); + + // 没到找,创建 + // 找到了,求和,修改 + PositionField* pField = nullptr; + unordered_map::iterator it = m_id_platform_position.find(positionId2); + if (it == m_id_platform_position.end()) + { + pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); + + strcpy(pField->ID, positionId2); + + strcpy(pField->InstrumentID, pField2->InstrumentID); +#ifdef HAS_ExchangeID_Position + strcpy(pField->ExchangeID, pField2->ExchangeID); +#endif // HAS_ExchangeID + sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pField->ExchangeID); + strcpy(pField->AccountID, pField2->InvestorID); + + pField->Side = TThostFtdcPosiDirectionType_2_PositionSide(pField2->PosiDirection); + pField->HedgeFlag = TThostFtdcHedgeFlagType_2_HedgeFlagType(pField2->HedgeFlag); + + m_id_platform_position.insert(pair(positionId2, pField)); + + pField->Position = pField2->Position; + pField->TodayPosition = pField2->TodayPosition; + pField->HistoryPosition = pField2->YdPosition; + } + else + { + pField = it->second; + + pField->Position += pField2->Position; + pField->TodayPosition += pField2->TodayPosition; + pField->HistoryPosition += pField2->YdPosition; + } + + // 飞鼠的定义与CTP有所不同 +#ifdef IS_SGIT_API + double tmp = pField->Position; + pField->Position = pField->TodayPosition; + pField->TodayPosition = tmp; + pField->HistoryPosition = pField->HistoryPosition; +#else + pField->HistoryPosition = pField->Position - pField->TodayPosition; +#endif + } + + // 将持仓通知出来 + { + int cnt = 0; + size_t count = m_id_platform_position.size(); + for (unordered_map::iterator iter = m_id_platform_position.begin(); iter != m_id_platform_position.end(); iter++) + { + ++cnt; + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, cnt == count, 0, iter->second, sizeof(PositionField), nullptr, 0, nullptr, 0); + } + } } } -void CTraderApi::OnRtnQuote(CThostFtdcQuoteField *pQuote) +void CTraderApi::ReqQuery(QueryType type, ReqQueryField* pQuery) { - OnQuote(pQuote, 0, true); + m_msgQueue_Query->Input_Copy(type, m_msgQueue_Query, this, 0, 0, + pQuery, sizeof(ReqQueryField), nullptr, 0, nullptr, 0); } -int CTraderApi::ReqQuoteAction(const string& szId,OrderIDType* pOutput) +int CTraderApi::_ReqQryInstrument(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { - unordered_map::iterator it = m_id_api_quote.find(szId); - if (it == m_id_api_quote.end()) - { - sprintf((char*)pOutput, "%d", -100); - return -100; - } - else - { - // 找到了订单 - ReqQuoteAction(it->second,pOutput); - } - return 0; + ReqQueryField* pQuery = (ReqQueryField*)ptr1; + + CThostFtdcQryInstrumentField body = { 0 }; + strncpy(body.InstrumentID, pQuery->InstrumentID, sizeof(TThostFtdcInstrumentIDType)); + strncpy(body.ExchangeID, pQuery->ExchangeID, sizeof(TThostFtdcExchangeIDType)); + + return m_pApi->ReqQryInstrument(&body, ++m_lRequestID); } -int CTraderApi::ReqQuoteAction(CThostFtdcQuoteField *pQuote, OrderIDType* pOutput) +void CTraderApi::OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { - if (nullptr == m_pApi) - return 0; + if (!IsErrorRspInfo("OnRspQryInstrument", pRspInfo, nRequestID, bIsLast)) + { + if (pInstrument) + { + InstrumentField* pField = (InstrumentField*)m_msgQueue->new_block(sizeof(InstrumentField)); - CThostFtdcInputQuoteActionField body = {0}; + strncpy(pField->InstrumentID, pInstrument->InstrumentID, sizeof(InstrumentIDType)); + strncpy(pField->ExchangeID, pInstrument->ExchangeID, sizeof(ExchangeIDType)); - ///经纪公司代码 - strcpy(body.BrokerID, pQuote->BrokerID); - ///投资者代码 - strcpy(body.InvestorID, pQuote->InvestorID); - ///报单引用 - strcpy(body.QuoteRef, pQuote->QuoteRef); - ///前置编号 - body.FrontID = pQuote->FrontID; - ///会话编号 - body.SessionID = pQuote->SessionID; - ///交易所代码 - strcpy(body.ExchangeID, pQuote->ExchangeID); - ///报单编号 - strcpy(body.QuoteSysID, pQuote->QuoteSysID); - ///操作标志 - body.ActionFlag = THOST_FTDC_AF_Delete; - ///合约代码 - strcpy(body.InstrumentID, pQuote->InstrumentID); + strncpy(pField->Symbol, pInstrument->InstrumentID, sizeof(SymbolType)); + strncpy(pField->ProductID, pInstrument->ProductID, sizeof(InstrumentIDType)); - int nRet = m_pApi->ReqQuoteAction(&body, ++m_lRequestID); - if (nRet < 0) - { - sprintf(m_orderAction_Id, "%d", nRet); - } - else - { - memset(m_orderAction_Id, 0, sizeof(OrderIDType)); + strncpy(pField->InstrumentName, pInstrument->InstrumentName, sizeof(InstrumentNameType)); + pField->Type = CThostFtdcInstrumentField_2_InstrumentType(pInstrument); + pField->VolumeMultiple = pInstrument->VolumeMultiple; + pField->PriceTick = pInstrument->PriceTick; + pField->ExpireDate = GetDate(pInstrument->ExpireDate); + pField->OptionsType = TThostFtdcOptionsTypeType_2_PutCall(pInstrument->OptionsType); + pField->StrikePrice = (pInstrument->StrikePrice < DBL_EPSILON || pInstrument->StrikePrice == DBL_MAX) ? 0 : pInstrument->StrikePrice; + strcpy(pField->UnderlyingInstrID, pInstrument->UnderlyingInstrID); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InstrumentField), nullptr, 0, nullptr, 0); + } + else + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } } - strncpy((char*)pOutput, m_orderAction_Id, sizeof(OrderIDType)); +} - return nRet; +//void CTraderApi::ReqQryInstrumentCommissionRate(const string& szInstrumentId) +//{ +// CThostFtdcQryInstrumentCommissionRateField body = {0}; +// +// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID,sizeof(TThostFtdcBrokerIDType)); +// strncpy(pBody->InvestorID, m_RspUserLogin.UserID,sizeof(TThostFtdcInvestorIDType)); +// strncpy(pBody->InstrumentID,szInstrumentId.c_str(),sizeof(TThostFtdcInstrumentIDType)); +//} +// +//void CTraderApi::OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +//{ +// +//} + +//void CTraderApi::ReqQryInstrumentMarginRate(const string& szInstrumentId,TThostFtdcHedgeFlagType HedgeFlag) +//{ +// CThostFtdcQryInstrumentMarginRateField body = {0}; +// +// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID,sizeof(TThostFtdcBrokerIDType)); +// strncpy(pBody->InvestorID, m_RspUserLogin.UserID,sizeof(TThostFtdcInvestorIDType)); +// strncpy(pBody->InstrumentID,szInstrumentId.c_str(),sizeof(TThostFtdcInstrumentIDType)); +// pBody->HedgeFlag = HedgeFlag; +// +// //AddToSendQueue(pRequest); +//} + +//void CTraderApi::OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +//{ +// +//} +// + +#ifdef HAS_Settlement +int CTraderApi::_ReqQrySettlementInfo(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + ReqQueryField* pQuery = (ReqQueryField*)ptr1; + + CThostFtdcQrySettlementInfoField body = { 0 }; + strncpy(body.BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); + strncpy(body.InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); + sprintf(body.TradingDay, "%d", pQuery->DateStart); + + return m_pApi->ReqQrySettlementInfo(&body, ++m_lRequestID); } -void CTraderApi::OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +vector vct_SettlementInfo; + +void CTraderApi::OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { - OrderIDType quoteId = { 0 }; - if (pInputQuoteAction) - { - sprintf(quoteId, "%d:%d:%s", pInputQuoteAction->FrontID, pInputQuoteAction->SessionID, pInputQuoteAction->QuoteRef); - } - else + if (!IsErrorRspInfo("OnRspQrySettlementInfo", pRspInfo, nRequestID, bIsLast)) { - IsErrorRspInfo("OnRspQuoteAction", pRspInfo, nRequestID, bIsLast); - } + if (pSettlementInfo) + { + CThostFtdcSettlementInfoField* pField = new CThostFtdcSettlementInfoField; + memcpy(pField, pSettlementInfo, sizeof(CThostFtdcSettlementInfoField)); + vct_SettlementInfo.push_back(pField); - unordered_map::iterator it = m_id_platform_quote.find(quoteId); - if (it == m_id_platform_quote.end()) - { - // 没找到?不应当,这表示出错了 - //assert(false); - } - else - { - // 找到了,要更新状态 - // 得使用上次的状态 - QuoteField* pField = it->second; - strcpy(pField->ID, quoteId); - strcpy(pField->LocalID, pField->ID); - //sprintf(pField->AskID, "%d:%d:%s", pInputQuoteAction->FrontID, pInputQuoteAction->SessionID, pInputQuoteAction->); - //sprintf(pField->BidID, "%d:%d:%s", pInputQuoteAction->FrontID, pInputQuoteAction->SessionID, pInputQuoteAction->QuoteRef); - pField->ExecType = ExecType::ExecType_CancelReject; - pField->RawErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); + if (bIsLast) + { + int len = 0; + for (vector::iterator it = vct_SettlementInfo.begin(); it != vct_SettlementInfo.end(); ++it) + { + CThostFtdcSettlementInfoField* p = *it; + len += sizeof(p->Content); + } + + SettlementInfoField* pField = (SettlementInfoField*)m_msgQueue->new_block(sizeof(SettlementInfoField) + len); + pField->TradingDay = atoi(pSettlementInfo->TradingDay); + pField->Size = sizeof(SettlementInfoField) + len; + char* pContent = (((char*)pField) + sizeof(SettlementInfoField)); + memset(pContent, 0, len); + for (vector::iterator it = vct_SettlementInfo.begin(); it != vct_SettlementInfo.end(); ++it) + { + CThostFtdcSettlementInfoField* p = *it; + strcat(pContent, p->Content); + } + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQrySettlementInfo, m_msgQueue, this, bIsLast, 0, pField, pField->Size, nullptr, 0, nullptr, 0); + + // 需要将结算单清理 + for (vector::iterator it = vct_SettlementInfo.begin(); it != vct_SettlementInfo.end(); ++it) + { + CThostFtdcSettlementInfoField* p = *it; + delete[] p; + } + vct_SettlementInfo.clear(); + } + } + else + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQrySettlementInfo, m_msgQueue, this, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } } } +#endif -void CTraderApi::OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo) + + +void CTraderApi::OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { - OrderIDType quoteId = { 0 }; + IsErrorRspInfo("OnRspError", pRspInfo, nRequestID, bIsLast); +} - if (pQuoteAction) +int CTraderApi::_ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + CThostFtdcQryOrderField body = { 0 }; + + strcpy(body.BrokerID, m_RspUserLogin.BrokerID); + strcpy(body.InvestorID, m_RspUserLogin.UserID); + + return m_pApi->ReqQryOrder(&body, ++m_lRequestID); +} + +void CTraderApi::OnOrder(CThostFtdcOrderField *pOrder, int nRequestID, bool bIsLast) +{ + if (nullptr == pOrder) { - sprintf(quoteId, "%d:%d:%s", pQuoteAction->FrontID, pQuoteAction->SessionID, pQuoteAction->QuoteRef); + // 如果是请求报单而当日无报单,也需要回调告知 bIsLast = true + if (nRequestID != 0) + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryOrder, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + return; } - else + + OrderIDType orderId = { 0 }; + sprintf(orderId, "%d:%d:%s", pOrder->FrontID, pOrder->SessionID, pOrder->OrderRef); + OrderIDType orderSydId = { 0 }; + { - IsErrorRspInfo("OnRspQuoteAction",pRspInfo, 0, true); + // 保存原始订单信息,用于撤单 + + unordered_map::iterator it = m_id_api_order.find(orderId); + if (it == m_id_api_order.end()) + { + // 找不到此订单,表示是新单 + CThostFtdcOrderField* pField = (CThostFtdcOrderField*)m_msgQueue->new_block(sizeof(CThostFtdcOrderField)); + memcpy(pField, pOrder, sizeof(CThostFtdcOrderField)); + m_id_api_order.insert(pair(orderId, pField)); + } + else + { + // 找到了订单 + // 需要再复制保存最后一次的状态,还是只要第一次的用于撤单即可?记下,这样最后好比较 + CThostFtdcOrderField* pField = it->second; + memcpy(pField, pOrder, sizeof(CThostFtdcOrderField)); + } + + // 保存SysID用于定义成交回报与订单 + sprintf(orderSydId, "%s:%s:%s", pOrder->ExchangeID, pOrder->InstrumentID, pOrder->OrderSysID); + m_sysId_orderId.insert(pair(orderSydId, orderId)); } - unordered_map::iterator it = m_id_platform_quote.find(quoteId); - if (it == m_id_platform_quote.end()) - { - // 没找到?不应当,这表示出错了 - //assert(false); + { + // 从API的订单转换成自己的结构体 + if (nRequestID == 0) + { + OrderField* pField = nullptr; + unordered_map::iterator it = m_id_platform_order.find(orderId); + if (it == m_id_platform_order.end()) + { + pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + + // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 + CThostFtdcOrderField_2_OrderField_0(orderId, pOrder, pField); + pField->Time = GetTime(pOrder->InsertTime); + + // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 + m_id_platform_order.insert(pair(orderId, pField)); + } + else + { + pField = it->second; + strcpy(pField->ID, orderId); + strcpy(pField->LocalID, pField->ID); + // 为了解决发送时交易所与接收时交易所不一样的情况 + strcpy(pField->ExchangeID, pOrder->ExchangeID); + pField->LeavesQty = pOrder->VolumeTotal; + pField->Price = pOrder->LimitPrice; + pField->Status = CThostFtdcOrderField_2_OrderStatus(pOrder); + pField->ExecType = CThostFtdcOrderField_2_ExecType(pOrder); + strcpy(pField->OrderID, pOrder->OrderSysID); + strncpy(pField->Text, pOrder->StatusMsg, sizeof(Char256Type)); + //pField->Time = GetTime(pOrder->InsertTime); + } + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + } + else + { + OrderField* pField = nullptr; + pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + + // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 + CThostFtdcOrderField_2_OrderField_0(orderId, pOrder, pField); + pField->Time = GetTime(pOrder->InsertTime); + + // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 + //m_id_platform_order.insert(pair(orderId, pField)); + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryOrder, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + + m_msgQueue->delete_block(pField); + } } - else +} + +void CTraderApi::OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspQryOrder", pRspInfo, nRequestID, bIsLast)) { - // 找到了,要更新状态 - // 得使用上次的状态 - QuoteField* pField = it->second; - strcpy(pField->ID, quoteId); - strcpy(pField->LocalID, pField->ID); - pField->ExecType = ExecType::ExecType_CancelReject; - pField->RawErrorID = pRspInfo->ErrorID; - strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); + OnOrder(pOrder, nRequestID, bIsLast); } } -//void CTraderApi::ReqQryTradingAccount() +//void CTraderApi::ReqQryTrade() //{ -// CThostFtdcQryTradingAccountField* pBody = (CThostFtdcQryTradingAccountField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcQryTradingAccountField)); +// CThostFtdcQryTradeField* pBody = (CThostFtdcQryTradeField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcQryTradeField)); // -// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID,sizeof(TThostFtdcBrokerIDType)); -// strncpy(pBody->InvestorID, m_RspUserLogin.UserID,sizeof(TThostFtdcInvestorIDType)); +// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); +// strncpy(pBody->InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); // -// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryTradingAccountField, m_msgQueue_Query, this, 0, 0, -// pBody, sizeof(CThostFtdcQryTradingAccountField), nullptr, 0, nullptr, 0); +// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryTradeField, m_msgQueue_Query, this, 0, 0, +// pBody, sizeof(CThostFtdcQryTradeField), nullptr, 0, nullptr, 0); //} -int CTraderApi::_ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +int CTraderApi::_ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { - CThostFtdcQryTradingAccountField body = { 0 }; + CThostFtdcQryTradeField body = { 0 }; strcpy(body.BrokerID, m_RspUserLogin.BrokerID); strcpy(body.InvestorID, m_RspUserLogin.UserID); - return m_pApi->ReqQryTradingAccount(&body, ++m_lRequestID); + return m_pApi->ReqQryTrade(&body, ++m_lRequestID); } -void CTraderApi::OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +void CTraderApi::OnTrade(CThostFtdcTradeField *pTrade, int nRequestID, bool bIsLast) { - if (!IsErrorRspInfo("OnRspQryTradingAccount",pRspInfo, nRequestID, bIsLast)) + if (nullptr == pTrade) { - if (pTradingAccount) + if (nRequestID != 0) { - AccountField* pField = (AccountField*)m_msgQueue->new_block(sizeof(AccountField)); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryTrade, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + return; + } - strcpy(pField->AccountID, pTradingAccount->AccountID); - pField->PreBalance = pTradingAccount->PreBalance; - pField->CurrMargin = pTradingAccount->CurrMargin; - pField->Commission = pTradingAccount->Commission; - pField->CloseProfit = pTradingAccount->CloseProfit; - pField->PositionProfit = pTradingAccount->PositionProfit; - pField->Balance = pTradingAccount->Balance; - pField->Available = pTradingAccount->Available; + TradeField* pField = (TradeField*)m_msgQueue->new_block(sizeof(TradeField)); + strcpy(pField->InstrumentID, pTrade->InstrumentID); + strcpy(pField->ExchangeID, pTrade->ExchangeID); + strcpy(pField->AccountID, pTrade->InvestorID); + pField->Side = TThostFtdcDirectionType_2_OrderSide(pTrade->Direction); + pField->Qty = pTrade->Volume; + pField->Price = pTrade->Price; + pField->OpenClose = TThostFtdcOffsetFlagType_2_OpenCloseType(pTrade->OffsetFlag); + pField->HedgeFlag = TThostFtdcHedgeFlagType_2_HedgeFlagType(pTrade->HedgeFlag); + pField->Commission = 0;//TODO收续费以后要计算出来 + pField->Time = GetTime(pTrade->TradeTime); + strcpy(pField->TradeID, pTrade->TradeID); - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryTradingAccount, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(AccountField), nullptr, 0, nullptr, 0); + if (nRequestID == 0) + { + OrderIDType orderSysId = { 0 }; + sprintf(orderSysId, "%s:%s:%s", pTrade->ExchangeID, pTrade->InstrumentID, pTrade->OrderSysID); + unordered_map::iterator it = m_sysId_orderId.find(orderSysId); + if (it == m_sysId_orderId.end()) + { + // 此成交找不到对应的报单 + //assert(false); } else { - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryTradingAccount, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); - } - } -} - -//void CTraderApi::ReqQryInvestorPosition(const string& szInstrumentId, const string& szExchange) -//{ -// CThostFtdcQryInvestorPositionField* pBody = (CThostFtdcQryInvestorPositionField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcQryInvestorPositionField)); -// -// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID,sizeof(TThostFtdcBrokerIDType)); -// strncpy(pBody->InvestorID, m_RspUserLogin.UserID,sizeof(TThostFtdcInvestorIDType)); -// strncpy(pBody->InstrumentID,szInstrumentId.c_str(),sizeof(TThostFtdcInstrumentIDType)); -// -// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryInvestorPositionField, m_msgQueue_Query, this, 0, 0, -// pBody, sizeof(CThostFtdcQryInvestorPositionField), nullptr, 0, nullptr, 0); -//} + // 找到对应的报单 + strcpy(pField->ID, it->second.c_str()); -int CTraderApi::_ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - ReqQueryField* pQuery = (ReqQueryField*)ptr1; + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnTrade, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); - CThostFtdcQryInvestorPositionField body = { 0 }; + unordered_map::iterator it2 = m_id_platform_order.find(it->second); + if (it2 == m_id_platform_order.end()) + { + // 此成交找不到对应的报单 + //assert(false); + } + else + { + // 更新订单的状态 + // 是否要通知接口 + } - strncpy(body.BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); - strncpy(body.InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); - strncpy(body.InstrumentID, pQuery->InstrumentID, sizeof(TThostFtdcInstrumentIDType)); + // 实时根据本地持仓进行计算 + //OnTrade(pField); + } + } + else + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryTrade, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); + } - return m_pApi->ReqQryInvestorPosition(&body, ++m_lRequestID); + // 清理内存 + m_msgQueue->delete_block(pField); } -// 如果是请求查询,就将数据全部返回 -// 如果是后期的成交回报,就只返回更新的记录 -// 对于中金所,同时有今昨两天的持仓时,只返回今天的两条多空数据 -// 对于上期所,目前没条件测,当成是也只有两条 -void CTraderApi::OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +void CTraderApi::OnTrade(TradeField *pTrade) { - if (!IsErrorRspInfo("OnRspQryInvestorPosition", pRspInfo, nRequestID, bIsLast)) - { - if (pInvestorPosition) - { - PositionIDType positionId = { 0 }; - sprintf(positionId, "%s:%s:%d:%c", - pInvestorPosition->ExchangeID, - pInvestorPosition->InstrumentID, - TThostFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection), - pInvestorPosition->HedgeFlag); - - PositionField* pField = nullptr; - unordered_map::iterator it = m_id_platform_position.find(positionId); - if (it == m_id_platform_position.end()) - { - pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); + PositionIDType positionId = { 0 }; + sprintf(positionId, "%s:%s:%d:%d", + pTrade->ExchangeID, pTrade->InstrumentID, TradeField_2_PositionSide(pTrade), pTrade->HedgeFlag); - //sprintf(pField->Symbol, "%s.%s", pInvestorPosition->InstrumentID, pInvestorPosition->ExchangeID); - strcpy(pField->Symbol, pInvestorPosition->InstrumentID); - strcpy(pField->InstrumentID, pInvestorPosition->InstrumentID); - strcpy(pField->ExchangeID, pInvestorPosition->ExchangeID); - pField->Side = TThostFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection); - pField->HedgeFlag = TThostFtdcHedgeFlagType_2_HedgeFlagType(pInvestorPosition->HedgeFlag); + PositionField* pField = nullptr; + unordered_map::iterator it = m_id_platform_position.find(positionId); + if (it == m_id_platform_position.end()) + { + pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); - m_id_platform_position.insert(pair(positionId, pField)); - } - else - { - pField = it->second; - } + strcpy(pField->Symbol, pTrade->InstrumentID); + strcpy(pField->InstrumentID, pTrade->InstrumentID); + strcpy(pField->ExchangeID, pTrade->ExchangeID); + strcpy(pField->AccountID, pTrade->AccountID); + pField->Side = TradeField_2_PositionSide(pTrade); + pField->HedgeFlag = pTrade->HedgeFlag; - pField->Position = pInvestorPosition->Position; - pField->TodayPosition = pInvestorPosition->TodayPosition; - pField->HistoryPosition = pInvestorPosition->Position - pInvestorPosition->TodayPosition; + m_id_platform_position.insert(pair(positionId, pField)); + } + else + { + pField = it->second; + } - // 等数据收集全了再遍历通知一次,为何要这样做?因为今昨是两条记录,但我记在一个里面 - if (bIsLast) + if (pTrade->OpenClose == OpenCloseType::OpenCloseType_Open) + { + pField->Position += pTrade->Qty; + pField->TodayPosition += pTrade->Qty; + } + else + { + pField->Position -= pTrade->Qty; + if (pTrade->OpenClose == OpenCloseType::OpenCloseType_CloseToday) + { + pField->TodayPosition -= pTrade->Qty; + } + else + { + pField->HistoryPosition -= pTrade->Qty; + // 如果昨天的被减成负数,从今天开始继续减 + if (pField->HistoryPosition < 0) { - int cnt = 0; - size_t count = m_id_platform_position.size(); - for (unordered_map::iterator iter = m_id_platform_position.begin(); iter != m_id_platform_position.end(); iter++) - { - ++cnt; - m_msgQueue->Input_Copy(ResponeType::OnRspQryInvestorPosition, m_msgQueue, m_pClass, cnt == count, 0, iter->second, sizeof(PositionField), nullptr, 0, nullptr, 0); - } + pField->TodayPosition += pField->HistoryPosition; + pField->HistoryPosition = 0; } - //XRespone(ResponeType::OnRspQryInvestorPosition, m_msgQueue, this, bIsLast, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); } - else + + // 计算错误,直接重新查询 + if (pField->Position < 0 || pField->TodayPosition < 0 || pField->HistoryPosition < 0) { - m_msgQueue->Input_Copy(ResponeType::OnRspQryInvestorPosition, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + //ReqQryInvestorPosition("", ""); + ReqQueryField body = { 0 }; + ReqQuery(QueryType::QueryType_ReqQryInvestorPosition, &body); + return; } } + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, false, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); } -void CTraderApi::ReqQuery(QueryType type, ReqQueryField* pQuery) +void CTraderApi::OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { - m_msgQueue_Query->Input_Copy(type, m_msgQueue_Query, this, 0, 0, - pQuery, sizeof(ReqQueryField), nullptr, 0, nullptr, 0); + if (!IsErrorRspInfo("OnRspQryTrade", pRspInfo, nRequestID, bIsLast)) + { + OnTrade(pTrade, nRequestID, bIsLast); + } } -//void CTraderApi::ReqQryInstrument(ReqQueryField* pQuery) +//void CTraderApi::ReqQryQuote() //{ -// CThostFtdcQryInstrumentField* pBody = (CThostFtdcQryInstrumentField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcQryInstrumentField)); +// CThostFtdcQryQuoteField* pBody = (CThostFtdcQryQuoteField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcQryQuoteField)); // -// //strncpy(pBody->InstrumentID,szInstrumentId.c_str(),sizeof(TThostFtdcInstrumentIDType)); -// //strncpy(pBody->ExchangeID, szExchange.c_str(), sizeof(TThostFtdcExchangeIDType)); +// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); +// strncpy(pBody->InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); // -// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryInstrumentField, m_msgQueue_Query, this, 0, 0, -// pBody, sizeof(CThostFtdcQryInstrumentField), nullptr, 0, nullptr, 0); +// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryQuoteField, m_msgQueue_Query, this, 0, 0, +// pBody, sizeof(CThostFtdcQryQuoteField), nullptr, 0, nullptr, 0); //} -int CTraderApi::_ReqQryInstrument(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - ReqQueryField* pQuery = (ReqQueryField*)ptr1; - - CThostFtdcQryInstrumentField body = {0}; - strncpy(body.InstrumentID, pQuery->InstrumentID, sizeof(TThostFtdcInstrumentIDType)); - strncpy(body.ExchangeID, pQuery->ExchangeID, sizeof(TThostFtdcExchangeIDType)); - - return m_pApi->ReqQryInstrument(&body, ++m_lRequestID); -} - -void CTraderApi::OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +#ifdef HAS_InstrumentStatus +void CTraderApi::OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) { - if (!IsErrorRspInfo("OnRspQryInstrument", pRspInfo, nRequestID, bIsLast)) + if (pInstrumentStatus) { - if (pInstrument) - { - InstrumentField* pField = (InstrumentField*)m_msgQueue->new_block(sizeof(InstrumentField)); - - strncpy(pField->InstrumentID, pInstrument->InstrumentID, sizeof(InstrumentIDType)); - strncpy(pField->ExchangeID, pInstrument->ExchangeID, sizeof(ExchangeIDType)); + InstrumentStatusField* pField = (InstrumentStatusField*)m_msgQueue->new_block(sizeof(InstrumentStatusField)); - strncpy(pField->Symbol, pInstrument->InstrumentID, sizeof(SymbolType)); - strncpy(pField->ProductID, pInstrument->ProductID, sizeof(InstrumentIDType)); + strcpy(pField->InstrumentID, pInstrumentStatus->InstrumentID); + strcpy(pField->ExchangeID, pInstrumentStatus->ExchangeID); + sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pField->ExchangeID); - strncpy(pField->InstrumentName, pInstrument->InstrumentName, sizeof(InstrumentNameType)); - pField->Type = CThostFtdcInstrumentField_2_InstrumentType(pInstrument); - pField->VolumeMultiple = pInstrument->VolumeMultiple; - pField->PriceTick = pInstrument->PriceTick; - pField->ExpireDate = GetDate(pInstrument->ExpireDate); - pField->OptionsType = TThostFtdcOptionsTypeType_2_PutCall(pInstrument->OptionsType); - pField->StrikePrice = (pInstrument->StrikePrice < DBL_EPSILON || pInstrument->StrikePrice == DBL_MAX) ? 0 : pInstrument->StrikePrice; - strcpy(pField->UnderlyingInstrID, pInstrument->UnderlyingInstrID); + pField->InstrumentStatus = TThostFtdcInstrumentStatusType_2_TradingPhaseType(pInstrumentStatus->InstrumentStatus); + pField->EnterTime = GetTime(pInstrumentStatus->EnterTime); - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InstrumentField), nullptr, 0, nullptr, 0); - } - else - { - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); - } + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnInstrumentStatus, m_msgQueue, m_pClass, true, 0, pField, sizeof(InstrumentStatusField), nullptr, 0, nullptr, 0); } } - -//void CTraderApi::ReqQryInstrumentCommissionRate(const string& szInstrumentId) -//{ -// CThostFtdcQryInstrumentCommissionRateField body = {0}; -// -// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID,sizeof(TThostFtdcBrokerIDType)); -// strncpy(pBody->InvestorID, m_RspUserLogin.UserID,sizeof(TThostFtdcInvestorIDType)); -// strncpy(pBody->InstrumentID,szInstrumentId.c_str(),sizeof(TThostFtdcInstrumentIDType)); -//} -// -//void CTraderApi::OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -//{ -// -//} - -//void CTraderApi::ReqQryInstrumentMarginRate(const string& szInstrumentId,TThostFtdcHedgeFlagType HedgeFlag) -//{ -// CThostFtdcQryInstrumentMarginRateField body = {0}; -// -// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID,sizeof(TThostFtdcBrokerIDType)); -// strncpy(pBody->InvestorID, m_RspUserLogin.UserID,sizeof(TThostFtdcInvestorIDType)); -// strncpy(pBody->InstrumentID,szInstrumentId.c_str(),sizeof(TThostFtdcInstrumentIDType)); -// pBody->HedgeFlag = HedgeFlag; -// -// //AddToSendQueue(pRequest); -//} - -//void CTraderApi::OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -//{ -// -//} -// +#endif // HAS_InstrumentStatus -int CTraderApi::_ReqQrySettlementInfo(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +int CTraderApi::_ReqQryInvestor(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { - ReqQueryField* pQuery = (ReqQueryField*)ptr1; + CThostFtdcQryInvestorField body = { 0 }; - CThostFtdcQrySettlementInfoField body = { 0 }; - strncpy(body.BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); - strncpy(body.InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); - sprintf_s(body.TradingDay, "%d", pQuery->DateStart); + strcpy(body.BrokerID, m_RspUserLogin.BrokerID); + strcpy(body.InvestorID, m_RspUserLogin.UserID); - return m_pApi->ReqQrySettlementInfo(&body, ++m_lRequestID); + return m_pApi->ReqQryInvestor(&body, ++m_lRequestID); } -vector vct_SettlementInfo; - -void CTraderApi::OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +void CTraderApi::OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { - if (!IsErrorRspInfo("OnRspQrySettlementInfo", pRspInfo, nRequestID, bIsLast)) + if (!IsErrorRspInfo("OnRspQryInvestor", pRspInfo, nRequestID, bIsLast)) { - if (pSettlementInfo) + if (pInvestor) { - CThostFtdcSettlementInfoField* pField = new CThostFtdcSettlementInfoField; - memcpy(pField, pSettlementInfo, sizeof(CThostFtdcSettlementInfoField)); - vct_SettlementInfo.push_back(pField); + memcpy(&m_Investor, pInvestor, sizeof(CThostFtdcInvestorField)); - if (bIsLast) - { - int len = 0; - for (vector::iterator it = vct_SettlementInfo.begin(); it != vct_SettlementInfo.end(); ++it) - { - CThostFtdcSettlementInfoField* p = *it; - len += sizeof(p->Content); - } + InvestorField* pField = (InvestorField*)m_msgQueue->new_block(sizeof(InvestorField)); - SettlementInfoField* pField = (SettlementInfoField*)m_msgQueue->new_block(sizeof(SettlementInfoField)+len); - pField->TradingDay = atoi(pSettlementInfo->TradingDay); - pField->Size = sizeof(SettlementInfoField)+len; - char* pContent = (((char*)pField) + sizeof(SettlementInfoField)); - memset(pContent, 0, len); - for (vector::iterator it = vct_SettlementInfo.begin(); it != vct_SettlementInfo.end(); ++it) - { - CThostFtdcSettlementInfoField* p = *it; - strcat(pContent, p->Content); - } - m_msgQueue->Input_NoCopy(ResponeType::OnRspQrySettlementInfo, m_msgQueue, this, bIsLast, 0, pField, pField->Size, nullptr, 0, nullptr, 0); + strcpy(pField->BrokerID, pInvestor->BrokerID); + strcpy(pField->InvestorID, pInvestor->InvestorID); + strcpy(pField->InvestorName, pInvestor->InvestorName); + strcpy(pField->IdentifiedCardNo, pInvestor->IdentifiedCardNo); + pField->IdentifiedCardType = TThostFtdcIdCardTypeType_2_IdCardType(pInvestor->IdentifiedCardType); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInvestor, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InvestorField), nullptr, 0, nullptr, 0); + +#ifdef ENABLE_LICENSE + // 这里不使用pInvestor->InvestorID,因为有可能股东代码与登录账号不一样 + if (m_pLicense->HasSaved()) + { + m_pLicense->AddUser(m_UserInfo.UserID, pField->InvestorName); + m_pLicense->SaveIni(); } - //SettlementInfoField field = { 0 }; - //strncpy(field.TradingDay, pSettlementInfo->TradingDay, sizeof(TThostFtdcDateType)); - //strncpy(field.Content, pSettlementInfo->Content, sizeof(TThostFtdcContentType)); - //m_msgQueue->Input_Copy(ResponeType::OnRspQrySettlementInfo, m_msgQueue, this, bIsLast, 0, &field, sizeof(SettlementInfoField), nullptr, 0, nullptr, 0); + m_pLicense->SetSendOrderFlag(true); + int err = m_pLicense->GetErrorCodeByNameThenAccount(pField->InvestorName, m_UserInfo.UserID); + if (err < 0) + { + m_pLicense->SetSendOrderFlag(false); + + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + pField->RawErrorID = err; + strncpy(pField->Text, m_pLicense->GetErrorInfo(), sizeof(Char256Type)); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + + //IsErrorRspInfo("") + } +#endif } else { - m_msgQueue->Input_NoCopy(ResponeType::OnRspQrySettlementInfo, m_msgQueue, this, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInvestor, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); } } } -void CTraderApi::OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +#ifdef HAS_Quote +char* CTraderApi::ReqQuoteInsert( + QuoteField* pQuote, + OrderIDType* pAskRef, + OrderIDType* pBidRef) { - IsErrorRspInfo("OnRspError", pRspInfo, nRequestID, bIsLast); -} - -//void CTraderApi::ReqQryOrder() -//{ -// CThostFtdcQryOrderField* pBody = (CThostFtdcQryOrderField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcQryOrderField)); -// -// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); -// strncpy(pBody->InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); -// -// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryOrderField, m_msgQueue_Query, this, 0, 0, -// pBody, sizeof(CThostFtdcQryOrderField), nullptr, 0, nullptr, 0); -//} + int QuoteRef = -1; + if (nullptr == m_pApi) + return nullptr; -int CTraderApi::_ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - CThostFtdcQryOrderField body = { 0 }; + CThostFtdcInputQuoteField body = { 0 }; strcpy(body.BrokerID, m_RspUserLogin.BrokerID); strcpy(body.InvestorID, m_RspUserLogin.UserID); - return m_pApi->ReqQryOrder(&body, ++m_lRequestID); -} + //合约,目前只从订单1中取 + strncpy(body.InstrumentID, pQuote->InstrumentID, sizeof(TThostFtdcInstrumentIDType)); -void CTraderApi::OnOrder(CThostFtdcOrderField *pOrder, int nRequestID, bool bIsLast) -{ - if (nullptr == pOrder) - return; +#ifdef HAS_ExchangeID_Quote + strncpy(body.ExchangeID, pQuote->ExchangeID, sizeof(TThostFtdcExchangeIDType)); +#endif // HAS_ExchangeID + + //开平 + body.AskOffsetFlag = OpenCloseType_2_TThostFtdcOffsetFlagType(pQuote->AskOpenClose); + body.BidOffsetFlag = OpenCloseType_2_TThostFtdcOffsetFlagType(pQuote->BidOpenClose); + //投保 + body.AskHedgeFlag = HedgeFlagType_2_TThostFtdcHedgeFlagType(pQuote->AskHedgeFlag); + body.BidHedgeFlag = HedgeFlagType_2_TThostFtdcHedgeFlagType(pQuote->BidHedgeFlag); + + //价格 + body.AskPrice = pQuote->AskPrice; + body.BidPrice = pQuote->BidPrice; + + //数量 + body.AskVolume = (int)pQuote->AskQty; + body.BidVolume = (int)pQuote->BidQty; +#ifdef HAS_ExchangeID_Quote_ForQuoteSysID + strncpy(body.ForQuoteSysID, pQuote->QuoteReqID, sizeof(TThostFtdcOrderSysIDType)); +#endif // HAS_ExchangeID_Quote_ForQuoteSysID - OrderIDType orderId = { 0 }; - sprintf(orderId, "%d:%d:%s", pOrder->FrontID, pOrder->SessionID, pOrder->OrderRef); - OrderIDType orderSydId = { 0 }; + + int nRet = 0; { - // 保存原始订单信息,用于撤单 + //可能报单太快,m_nMaxOrderRef还没有改变就提交了 + lock_guard cl(m_csOrderRef); - unordered_map::iterator it = m_id_api_order.find(orderId); - if (it == m_id_api_order.end()) + if (QuoteRef < 0) { - // 找不到此订单,表示是新单 - CThostFtdcOrderField* pField = new CThostFtdcOrderField(); - memcpy(pField, pOrder, sizeof(CThostFtdcOrderField)); - m_id_api_order.insert(pair(orderId, pField)); + nRet = m_nMaxOrderRef; + sprintf(body.QuoteRef, "%d", m_nMaxOrderRef); + sprintf(body.AskOrderRef, "%d", m_nMaxOrderRef); + sprintf(body.BidOrderRef, "%d", ++m_nMaxOrderRef); + ++m_nMaxOrderRef; } else { - // 找到了订单 - // 需要再复制保存最后一次的状态,还是只要第一次的用于撤单即可?记下,这样最后好比较 - CThostFtdcOrderField* pField = it->second; - memcpy(pField, pOrder, sizeof(CThostFtdcOrderField)); + nRet = QuoteRef; + sprintf(body.QuoteRef, "%d", QuoteRef); + sprintf(body.AskOrderRef, "%d", QuoteRef); + sprintf(body.BidOrderRef, "%d", ++QuoteRef); + ++QuoteRef; } - // 保存SysID用于定义成交回报与订单 - sprintf(orderSydId, "%s:%s:%s", pOrder->ExchangeID, pOrder->InstrumentID, pOrder->OrderSysID); - m_sysId_orderId.insert(pair(orderSydId, orderId)); + //不保存到队列,而是直接发送 + int n = m_pApi->ReqQuoteInsert(&body, ++m_lRequestID); + if (n < 0) + { + nRet = n; + return nullptr; + } + else + { + sprintf(m_orderInsert_Id, "%d:%d:%d", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, nRet); + + QuoteField* pField = (QuoteField*)m_msgQueue->new_block(sizeof(QuoteField)); + memcpy(pField, pQuote, sizeof(QuoteField)); + strcpy(pField->ID, m_orderInsert_Id); + strcpy(pField->LocalID, pField->ID); + strcpy(pField->AskID, m_orderInsert_Id); + sprintf(pField->BidID, "%d:%d:%d", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, nRet + 1); + + m_id_platform_quote.insert(pair(m_orderInsert_Id, pField)); + } } - { - // 从API的订单转换成自己的结构体 - if (nRequestID == 0) - { - OrderField* pField = nullptr; - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) - { - pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + return m_orderInsert_Id; +} - // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 - CThostFtdcOrderField_2_OrderField_0(orderId, pOrder, pField); +void CTraderApi::OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + OrderIDType quoteId = { 0 }; - // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 - m_id_platform_order.insert(pair(orderId, pField)); - } - else - { - pField = it->second; - strcpy(pField->ID, orderId); - strcpy(pField->LocalID, pField->ID); - pField->LeavesQty = pOrder->VolumeTotal; - pField->Price = pOrder->LimitPrice; - pField->Status = CThostFtdcOrderField_2_OrderStatus(pOrder); - pField->ExecType = CThostFtdcOrderField_2_ExecType(pOrder); - strcpy(pField->OrderID, pOrder->OrderSysID); - strncpy(pField->Text, pOrder->StatusMsg, sizeof(Char256Type)); - } + if (pInputQuote) + { + sprintf(quoteId, "%d:%d:%s", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, pInputQuote->QuoteRef); + } + else + { + IsErrorRspInfo("OnRspQuoteInsert", pRspInfo, nRequestID, bIsLast); + } - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); - } - else - { - OrderField* pField = nullptr; - pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + unordered_map::iterator it = m_id_platform_quote.find(quoteId); + if (it == m_id_platform_quote.end()) + { + // 没找到?不应当,这表示出错了 + //assert(false); + } + else + { + // 找到了,要更新状态 + // 得使用上次的状态 + QuoteField* pField = it->second; + pField->ExecType = ExecType::ExecType_Rejected; + pField->Status = OrderStatus::OrderStatus_Rejected; + pField->RawErrorID = pRspInfo->ErrorID; + strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); + } +} - // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 - CThostFtdcOrderField_2_OrderField_0(orderId, pOrder, pField); +void CTraderApi::OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo) +{ + OrderIDType quoteId = { 0 }; - // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 - //m_id_platform_order.insert(pair(orderId, pField)); + if (pInputQuote) + { + sprintf(quoteId, "%d:%d:%s", m_RspUserLogin.FrontID, m_RspUserLogin.SessionID, pInputQuote->QuoteRef); + } + else + { + IsErrorRspInfo("", pRspInfo, 0, true); + } + + unordered_map::iterator it = m_id_platform_quote.find(quoteId); + if (it == m_id_platform_quote.end()) + { + // 没找到?不应当,这表示出错了 + //assert(false); + } + else + { + // 找到了,要更新状态 + // 得使用上次的状态 + QuoteField* pField = it->second; + pField->ExecType = ExecType::ExecType_Rejected; + pField->Status = OrderStatus::OrderStatus_Rejected; + pField->RawErrorID = pRspInfo->ErrorID; + strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); + } +} - m_msgQueue->Input_Copy(ResponeType::OnRspQryOrder, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); +void CTraderApi::OnRtnQuote(CThostFtdcQuoteField *pQuote) +{ + OnQuote(pQuote, 0, true); +} - m_msgQueue->delete_block(pField); - } +int CTraderApi::ReqQuoteAction(const string& szId, OrderIDType* pOutput) +{ + unordered_map::iterator it = m_id_api_quote.find(szId); + if (it == m_id_api_quote.end()) + { + sprintf((char*)pOutput, "%d", -100); + return -100; + } + else + { + // 找到了订单 + ReqQuoteAction(it->second, pOutput); } + return 0; } -void CTraderApi::OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +int CTraderApi::ReqQuoteAction(CThostFtdcQuoteField *pQuote, OrderIDType* pOutput) { - if (!IsErrorRspInfo("OnRspQryOrder", pRspInfo, nRequestID, bIsLast)) - { - OnOrder(pOrder, nRequestID, bIsLast); - } -} + if (nullptr == m_pApi) + return 0; -//void CTraderApi::ReqQryTrade() -//{ -// CThostFtdcQryTradeField* pBody = (CThostFtdcQryTradeField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcQryTradeField)); -// -// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); -// strncpy(pBody->InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); -// -// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryTradeField, m_msgQueue_Query, this, 0, 0, -// pBody, sizeof(CThostFtdcQryTradeField), nullptr, 0, nullptr, 0); -//} + CThostFtdcInputQuoteActionField body = { 0 }; -int CTraderApi::_ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - CThostFtdcQryTradeField body = { 0 }; + ///经纪公司代码 + strcpy(body.BrokerID, pQuote->BrokerID); + ///投资者代码 + strcpy(body.InvestorID, pQuote->InvestorID); + ///报单引用 + strcpy(body.QuoteRef, pQuote->QuoteRef); + ///前置编号 + body.FrontID = pQuote->FrontID; + ///会话编号 + body.SessionID = pQuote->SessionID; + ///交易所代码 + strcpy(body.ExchangeID, pQuote->ExchangeID); + ///报单编号 + strcpy(body.QuoteSysID, pQuote->QuoteSysID); + ///操作标志 + body.ActionFlag = THOST_FTDC_AF_Delete; + ///合约代码 + strcpy(body.InstrumentID, pQuote->InstrumentID); - strcpy(body.BrokerID, m_RspUserLogin.BrokerID); - strcpy(body.InvestorID, m_RspUserLogin.UserID); + int nRet = m_pApi->ReqQuoteAction(&body, ++m_lRequestID); + if (nRet < 0) + { + sprintf(m_orderAction_Id, "%d", nRet); + } + else + { + memset(m_orderAction_Id, 0, sizeof(OrderIDType)); + } + strncpy((char*)pOutput, m_orderAction_Id, sizeof(OrderIDType)); - return m_pApi->ReqQryTrade(&body, ++m_lRequestID); + return nRet; } -void CTraderApi::OnTrade(CThostFtdcTradeField *pTrade, int nRequestID, bool bIsLast) +void CTraderApi::OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { - if (nullptr == pTrade) - return; - - TradeField* pField = (TradeField*)m_msgQueue->new_block(sizeof(TradeField)); - strcpy(pField->InstrumentID, pTrade->InstrumentID); - strcpy(pField->ExchangeID, pTrade->ExchangeID); - pField->Side = TThostFtdcDirectionType_2_OrderSide(pTrade->Direction); - pField->Qty = pTrade->Volume; - pField->Price = pTrade->Price; - pField->OpenClose = TThostFtdcOffsetFlagType_2_OpenCloseType(pTrade->OffsetFlag); - pField->HedgeFlag = TThostFtdcHedgeFlagType_2_HedgeFlagType(pTrade->HedgeFlag); - pField->Commission = 0;//TODO收续费以后要计算出来 - pField->Time = GetTime(pTrade->TradeTime); - strcpy(pField->TradeID, pTrade->TradeID); - - if (nRequestID == 0) + OrderIDType quoteId = { 0 }; + if (pInputQuoteAction) { - OrderIDType orderSysId = { 0 }; - sprintf(orderSysId, "%s:%s:%s", pTrade->ExchangeID, pTrade->InstrumentID, pTrade->OrderSysID); - unordered_map::iterator it = m_sysId_orderId.find(orderSysId); - if (it == m_sysId_orderId.end()) - { - // 此成交找不到对应的报单 - //assert(false); - } - else - { - // 找到对应的报单 - strcpy(pField->ID, it->second.c_str()); - - m_msgQueue->Input_Copy(ResponeType::OnRtnTrade, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); - - unordered_map::iterator it2 = m_id_platform_order.find(it->second); - if (it2 == m_id_platform_order.end()) - { - // 此成交找不到对应的报单 - //assert(false); - } - else - { - // 更新订单的状态 - // 是否要通知接口 - } - - OnTrade(pField); - } + sprintf(quoteId, "%d:%d:%s", pInputQuoteAction->FrontID, pInputQuoteAction->SessionID, pInputQuoteAction->QuoteRef); } else { - m_msgQueue->Input_Copy(ResponeType::OnRspQryOrder, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); + IsErrorRspInfo("OnRspQuoteAction", pRspInfo, nRequestID, bIsLast); } - // 清理内存 - m_msgQueue->delete_block(pField); + unordered_map::iterator it = m_id_platform_quote.find(quoteId); + if (it == m_id_platform_quote.end()) + { + // 没找到?不应当,这表示出错了 + //assert(false); + } + else + { + // 找到了,要更新状态 + // 得使用上次的状态 + QuoteField* pField = it->second; + strcpy(pField->ID, quoteId); + strcpy(pField->LocalID, pField->ID); + //sprintf(pField->AskID, "%d:%d:%s", pInputQuoteAction->FrontID, pInputQuoteAction->SessionID, pInputQuoteAction->); + //sprintf(pField->BidID, "%d:%d:%s", pInputQuoteAction->FrontID, pInputQuoteAction->SessionID, pInputQuoteAction->QuoteRef); + pField->ExecType = ExecType::ExecType_CancelReject; + pField->RawErrorID = pRspInfo->ErrorID; + strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); + } } -void CTraderApi::OnTrade(TradeField *pTrade) +void CTraderApi::OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo) { - PositionIDType positionId = { 0 }; - sprintf(positionId, "%s:%s:%d:%c", - pTrade->ExchangeID, pTrade->InstrumentID, TradeField_2_PositionSide(pTrade), pTrade->HedgeFlag); + OrderIDType quoteId = { 0 }; - PositionField* pField = nullptr; - unordered_map::iterator it = m_id_platform_position.find(positionId); - if (it == m_id_platform_position.end()) + if (pQuoteAction) { - pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); - - strcpy(pField->Symbol, pTrade->InstrumentID); - strcpy(pField->InstrumentID, pTrade->InstrumentID); - strcpy(pField->ExchangeID, pTrade->ExchangeID); - pField->Side = TradeField_2_PositionSide(pTrade); - pField->HedgeFlag = TThostFtdcHedgeFlagType_2_HedgeFlagType(pTrade->HedgeFlag); - - m_id_platform_position.insert(pair(positionId, pField)); + sprintf(quoteId, "%d:%d:%s", pQuoteAction->FrontID, pQuoteAction->SessionID, pQuoteAction->QuoteRef); } else { - pField = it->second; + IsErrorRspInfo("OnRspQuoteAction", pRspInfo, 0, true); } - if (pTrade->OpenClose == OpenCloseType::OpenCloseType_Open) + unordered_map::iterator it = m_id_platform_quote.find(quoteId); + if (it == m_id_platform_quote.end()) { - pField->Position += pTrade->Qty; - pField->TodayPosition += pTrade->Qty; + // 没找到?不应当,这表示出错了 + //assert(false); } else { - pField->Position -= pTrade->Qty; - if (pTrade->OpenClose == OpenCloseType::OpenCloseType_CloseToday) - { - pField->TodayPosition -= pTrade->Qty; - } - else - { - pField->HistoryPosition -= pTrade->Qty; - // 如果昨天的被减成负数,从今天开始继续减 - if (pField->HistoryPosition<0) - { - pField->TodayPosition += pField->HistoryPosition; - pField->HistoryPosition = 0; - } - } - - // 计算错误,直接重新查询 - if (pField->Position < 0 || pField->TodayPosition < 0 || pField->HistoryPosition < 0) - { - //ReqQryInvestorPosition("", ""); - ReqQueryField body = { 0 }; - ReqQuery(QueryType::ReqQryInvestorPosition, &body); - return; - } + // 找到了,要更新状态 + // 得使用上次的状态 + QuoteField* pField = it->second; + strcpy(pField->ID, quoteId); + strcpy(pField->LocalID, pField->ID); + pField->ExecType = ExecType::ExecType_CancelReject; + pField->RawErrorID = pRspInfo->ErrorID; + strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); } - - m_msgQueue->Input_Copy(ResponeType::OnRspQryInvestorPosition, m_msgQueue, m_pClass, false, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); } -void CTraderApi::OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +void CTraderApi::OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { - if (!IsErrorRspInfo("OnRspQryTrade", pRspInfo, nRequestID, bIsLast)) + if (!IsErrorRspInfo("OnRspQryQuote", pRspInfo, nRequestID, bIsLast)) { - OnTrade(pTrade, nRequestID, bIsLast); + OnQuote(pQuote, nRequestID, bIsLast); } } -//void CTraderApi::ReqQryQuote() -//{ -// CThostFtdcQryQuoteField* pBody = (CThostFtdcQryQuoteField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcQryQuoteField)); -// -// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); -// strncpy(pBody->InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); -// -// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryQuoteField, m_msgQueue_Query, this, 0, 0, -// pBody, sizeof(CThostFtdcQryQuoteField), nullptr, 0, nullptr, 0); -//} - int CTraderApi::_ReqQryQuote(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { CThostFtdcQryQuoteField body = { 0 }; @@ -1676,7 +2182,13 @@ int CTraderApi::_ReqQryQuote(char type, void* pApi1, void* pApi2, double double1 void CTraderApi::OnQuote(CThostFtdcQuoteField *pQuote, int nRequestID, bool bIsLast) { if (nullptr == pQuote) + { + if (nRequestID != 0) + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryQuote, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } return; + } OrderIDType quoteId = { 0 }; sprintf(quoteId, "%d:%d:%s", pQuote->FrontID, pQuote->SessionID, pQuote->QuoteRef); @@ -1722,6 +2234,7 @@ void CTraderApi::OnQuote(CThostFtdcQuoteField *pQuote, int nRequestID, bool bIsL strcpy(pField->InstrumentID, pQuote->InstrumentID); strcpy(pField->ExchangeID, pQuote->ExchangeID); + strcpy(pField->AccountID, pQuote->InvestorID); pField->AskQty = pQuote->AskVolume; pField->AskPrice = pQuote->AskPrice; @@ -1763,7 +2276,7 @@ void CTraderApi::OnQuote(CThostFtdcQuoteField *pQuote, int nRequestID, bool bIsL strncpy(pField->Text, pQuote->StatusMsg, sizeof(Char256Type)); } - m_msgQueue->Input_Copy(ResponeType::OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnQuote, m_msgQueue, m_pClass, 0, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); } else { @@ -1776,6 +2289,7 @@ void CTraderApi::OnQuote(CThostFtdcQuoteField *pQuote, int nRequestID, bool bIsL strcpy(pField->InstrumentID, pQuote->InstrumentID); strcpy(pField->ExchangeID, pQuote->ExchangeID); + strcpy(pField->AccountID, pQuote->InvestorID); pField->AskQty = pQuote->AskVolume; pField->AskPrice = pQuote->AskPrice; @@ -1803,68 +2317,11 @@ void CTraderApi::OnQuote(CThostFtdcQuoteField *pQuote, int nRequestID, bool bIsL // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 //m_id_platform_quote.insert(pair(quoteId, pField)); - m_msgQueue->Input_Copy(ResponeType::OnRspQryQuote, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryQuote, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(QuoteField), nullptr, 0, nullptr, 0); m_msgQueue->delete_block(pField); } } } } - -void CTraderApi::OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo("OnRspQryQuote", pRspInfo, nRequestID, bIsLast)) - { - OnQuote(pQuote, nRequestID, bIsLast); - } -} - -void CTraderApi::OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) -{ -} - -//void CTraderApi::ReqQryInvestor() -//{ -// CThostFtdcQryInvestorField* pBody = (CThostFtdcQryInvestorField*)m_msgQueue_Query->new_block(sizeof(CThostFtdcQryInvestorField)); -// -// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID, sizeof(TThostFtdcBrokerIDType)); -// strncpy(pBody->InvestorID, m_RspUserLogin.UserID, sizeof(TThostFtdcInvestorIDType)); -// -// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryInvestorField, m_msgQueue_Query, this, 0, 0, -// pBody, sizeof(CThostFtdcQryInvestorField), nullptr, 0, nullptr, 0); -//} - -int CTraderApi::_ReqQryInvestor(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) -{ - CThostFtdcQryInvestorField body = { 0 }; - - strcpy(body.BrokerID, m_RspUserLogin.BrokerID); - strcpy(body.InvestorID, m_RspUserLogin.UserID); - - return m_pApi->ReqQryInvestor(&body, ++m_lRequestID); -} - -void CTraderApi::OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) -{ - if (!IsErrorRspInfo("OnRspQryInvestor", pRspInfo, nRequestID, bIsLast)) - { - if (pInvestor) - { - memcpy(&m_Investor, pInvestor, sizeof(CThostFtdcInvestorField)); - - InvestorField* pField = (InvestorField*)m_msgQueue->new_block(sizeof(InvestorField)); - - strcpy(pField->BrokerID, pInvestor->BrokerID); - strcpy(pField->InvestorID, pInvestor->InvestorID); - strcpy(pField->InvestorName, pInvestor->InvestorName); - strcpy(pField->IdentifiedCardNo, pInvestor->IdentifiedCardNo); - pField->IdentifiedCardType = TThostFtdcIdCardTypeType_2_IdCardType(pInvestor->IdentifiedCardType); - - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInvestor, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InvestorField), nullptr, 0, nullptr, 0); - } - else - { - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInvestor, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); - } - } -} +#endif // HAS_Quote \ No newline at end of file diff --git a/QuantBox_CTP_Trade/TraderApi.h b/apis/CTP/Trade/TraderApi.h similarity index 79% rename from QuantBox_CTP_Trade/TraderApi.h rename to apis/CTP/Trade/TraderApi.h index 83cf596..e6a9bf4 100644 --- a/QuantBox_CTP_Trade/TraderApi.h +++ b/apis/CTP/Trade/TraderApi.h @@ -1,16 +1,11 @@ -#pragma once - -#include "../include/CTP/ThostFtdcTraderApi.h" -#include "../include/ApiStruct.h" -#include "../include/QueueEnum.h" - -#ifdef _WIN64 -#pragma comment(lib, "../include/CTP/win64/thosttraderapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x64.lib") -#else -#pragma comment(lib, "../include/CTP/win32/thosttraderapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") -#endif +#pragma once + +#include "../../include/ApiStruct.h" +#include "../../include/QueueEnum.h" +// 由于这个Include.h需要使用每个项目自己的文件,所以需要在VC++ Directories->Include Directories中添加一个"./" +#include "Include.h" + + #include @@ -26,15 +21,22 @@ using namespace std; class CMsgQueue; +#ifdef ENABLE_LICENSE +class CLicense; +#endif + + class CTraderApi : public CThostFtdcTraderSpi { - //ݰ + //请求数据包类型 enum RequestType { E_Init = 100, + E_Disconnect, E_ReqAuthenticateField, E_ReqUserLoginField, + E_UserLogoutField, E_SettlementInfoConfirmField, E_QryInvestorField, @@ -70,19 +72,20 @@ class CTraderApi : int count); void Disconnect(); - int ReqOrderInsert( + char* ReqOrderInsert( OrderField* pOrder, int count, - OrderIDType* pInOut); + char* pszLocalIDBuf); char* ReqParkedOrderInsert(int OrderRef, OrderField* pOrder1, OrderField* pOrder2); - int ReqOrderAction(OrderIDType* szIds, int count, OrderIDType* pOutput); + char* ReqOrderAction(OrderIDType* szIds, int count, char* pzsRtn); int ReqOrderAction(OrderField *pOrder, int count, OrderIDType* pOutput); - int ReqOrderAction(CThostFtdcOrderField *pOrder, int count, OrderIDType* pOutput); + char* ReqOrderAction(CThostFtdcOrderField *pOrder, int count, char* pzsRtn); +#ifdef HAS_Quote char* ReqQuoteInsert( QuoteField* pQuote, OrderIDType* pAskRef, @@ -90,6 +93,7 @@ class CTraderApi : int ReqQuoteAction(CThostFtdcQuoteField *pQuote, OrderIDType* pOutput); int ReqQuoteAction(const string& szId, OrderIDType* pOutput); +#endif // HAS_Quote //void ReqQryTradingAccount(); //void ReqQryInvestorPosition(const string& szInstrumentId, const string& szExchange); @@ -114,6 +118,8 @@ class CTraderApi : void Clear(); int _Init(); + void _Disconnect(bool IsInQueue); + void _DisconnectInThread(); void ReqAuthenticate(); int _ReqAuthenticate(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); @@ -121,101 +127,130 @@ class CTraderApi : void ReqUserLogin(); int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + void ReqUserLogout(); + int _ReqUserLogout(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + +#ifdef HAS_Settlement void ReqSettlementInfoConfirm(); int _ReqSettlementInfoConfirm(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + int _ReqQrySettlementInfo(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); +#endif // HAS_Settlement + int _ReqQryInstrument(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); int _ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); int _ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); int _ReqQryInvestor(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - int _ReqQrySettlementInfo(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - + int _ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); int _ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - int _ReqQryQuote(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - + void OnOrder(CThostFtdcOrderField *pOrder, int nRequestID, bool bIsLast); void OnTrade(CThostFtdcTradeField *pTrade, int nRequestID, bool bIsLast); - void OnQuote(CThostFtdcQuoteField *pQuote, int nRequestID, bool bIsLast); + void OnTrade(TradeField *pTrade); - //Ƿ - bool IsErrorRspInfo(const char* szSource, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);//ϢϢ - bool IsErrorRspInfo(CThostFtdcRspInfoField *pRspInfo);//Ϣ + //检查是否出错 + bool IsErrorRspInfo(const char* szSource, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);//向消息队列输出信息 + bool IsErrorRspInfo(CThostFtdcRspInfoField *pRspInfo);//不输出信息 - // + //连接 virtual void OnFrontConnected(); virtual void OnFrontDisconnected(int nReason); - //֤ + //认证 virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - virtual void OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //µ + //下单 virtual void OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo); - // + //撤单 virtual void OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo); - //ر + //报单回报 virtual void OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnRtnOrder(CThostFtdcOrderField *pOrder); - //ɽر + //成交回报 virtual void OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnRtnTrade(CThostFtdcTradeField *pTrade); - //¼ +#ifdef HAS_Quote + int _ReqQryQuote(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + void OnQuote(CThostFtdcQuoteField *pQuote, int nRequestID, bool bIsLast); + + //报价录入 virtual void OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo); virtual void OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnRtnQuote(CThostFtdcQuoteField *pQuote); - //۳ + //报价撤单 virtual void OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo); - //λ +#endif // HAS_Quote + +#ifdef HAS_Settlement + virtual void OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); + + //请求查询投资者结算结果响应 + virtual void OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); + +#endif // HAS_Settlement + + + //仓位 virtual void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //ʽ + //资金 virtual void OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //Լ + //合约、手续费 virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); //virtual void OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); //virtual void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //ѯӦ + //查询行情响应 //virtual void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //ѯͶ߽Ӧ - virtual void OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - - // + + //其它 virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); +#ifdef HAS_InstrumentStatus virtual void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus); +#endif // HAS_InstrumentStatus + + + + // 今昨分开 + void GetPositionID(CThostFtdcInvestorPositionField *pInvestorPosition, PositionIDType positionId); + // 今昨一起 + void GetPositionID2(CThostFtdcInvestorPositionField *pInvestorPosition, PositionIDType positionId); + + void QueryOrderTrade(bool bForceQuery); private: - atomic m_lRequestID; //ID,ñ + //bool m_delete; + atomic m_lRequestID; //请求ID,得保持自增 - CThostFtdcRspUserLoginField m_RspUserLogin; //صĵ¼ɹӦĿǰôڳԱб + CThostFtdcRspUserLoginField m_RspUserLogin; //返回的登录成功响应,目前利用此内成员进行报单所属区分 CThostFtdcInvestorField m_Investor; OrderIDType m_orderInsert_Id; OrderIDType m_orderAction_Id; mutex m_csOrderRef; - int m_nMaxOrderRef; //ãֱ + int m_nMaxOrderRef; //报单引用,用于区分报单,保持自增 - CThostFtdcTraderApi* m_pApi; //API + CThostFtdcTraderApi* m_pApi; //交易API - string m_szPath; //ļ· + string m_szPath; //生成配置文件的路径 ServerInfoField m_ServerInfo; UserInfoField m_UserInfo; int m_nSleep; @@ -224,14 +259,21 @@ class CTraderApi : unordered_map m_id_api_order; unordered_map m_sysId_orderId; +#ifdef HAS_Quote unordered_map m_id_platform_quote; unordered_map m_id_api_quote; unordered_map m_sysId_quoteId; +#endif // HAS_Quote unordered_map m_id_platform_position; + unordered_map m_id_api_position; - CMsgQueue* m_msgQueue; //Ϣָ + CMsgQueue* m_msgQueue; //消息队列指针 CMsgQueue* m_msgQueue_Query; void* m_pClass; + +#ifdef ENABLE_LICENSE + CLicense* m_pLicense; +#endif }; diff --git a/QuantBox_CTP_Trade/main.cpp b/apis/CTP/Trade/main.cpp similarity index 57% rename from QuantBox_CTP_Trade/main.cpp rename to apis/CTP/Trade/main.cpp index a0f23ca..e9b8097 100644 --- a/QuantBox_CTP_Trade/main.cpp +++ b/apis/CTP/Trade/main.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -#include "../include/ApiHeader.h" -#include "../include/QueueEnum.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" #include "TraderApi.h" inline CTraderApi* GetApi(void* pApi) @@ -13,13 +13,13 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do RequestType rt = (RequestType)type; switch (rt) { - case GetApiType: + case RequestType_GetApiTypes: return (void*)(ApiType::ApiType_Trade | ApiType::ApiType_Instrument | ApiType::ApiType_Query); - case GetApiVersion: - return (void*)"0.4.0.20151124"; - case GetApiName: - return (void*)"CTP"; - case Create: + case RequestType_GetApiVersion: + return (void*)API_VERSION; + case RequestType_GetApiName: + return (void*)API_NAME; + case RequestType_Create: return new CTraderApi(); default: break; @@ -34,39 +34,37 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do switch (rt) { - case Release: + case RequestType_Release: delete pApi; return nullptr; - case Register: + case RequestType_Register: pApi->Register(ptr1, ptr2); break; - case Connect: + case RequestType_Connect: pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2,size2); break; - case Disconnect: + case RequestType_Disconnect: pApi->Disconnect(); break; - case ReqQryInstrument: - case ReqQryInvestorPosition: - case ReqQryTradingAccount: - case ReqQrySettlementInfo: + case QueryType_ReqQryInstrument: + case QueryType_ReqQryInvestorPosition: + case QueryType_ReqQryTradingAccount: + case QueryType_ReqQrySettlementInfo: + case QueryType_ReqQryTrade: + case QueryType_ReqQryOrder: pApi->ReqQuery((QueryType)type, (ReqQueryField*)ptr1); break; - case ReqOrderInsert: - if (double2 == 0) - { - return (void*)pApi->ReqOrderInsert((OrderField*)ptr1, size1, (OrderIDType*)ptr2); - } - //else - //{ - // return pApi->ReqParkedOrderInsert((int)double1, (OrderField*)ptr1, (OrderField*)ptr2); - //} - case ReqQuoteInsert: + case RequestType_ReqOrderInsert: + return (void*)pApi->ReqOrderInsert((OrderField*)ptr1, size1, (char*)ptr2); + case RequestType_ReqOrderAction: + return (void*)pApi->ReqOrderAction((OrderIDType*)ptr1, size1, (char*)ptr2); +#ifdef HAS_Quote + case RequestType_ReqQuoteInsert: return pApi->ReqQuoteInsert((QuoteField*)ptr1, (OrderIDType*)ptr2, (OrderIDType*)ptr3); - case ReqOrderAction: - return (void*)pApi->ReqOrderAction((OrderIDType*)ptr1, size1, (OrderIDType*)ptr2); - case ReqQuoteAction: + case RequestType_ReqQuoteAction: return (void*)pApi->ReqQuoteAction((const char*)ptr1, (OrderIDType*)ptr2); +#endif // HAS_Quote + default: break; } diff --git a/QuantBox_CTP_Trade/TypeConvert.cpp b/apis/CTP/TypeConvert.cpp similarity index 90% rename from QuantBox_CTP_Trade/TypeConvert.cpp rename to apis/CTP/TypeConvert.cpp index 31a8e94..d87c2f8 100644 --- a/QuantBox_CTP_Trade/TypeConvert.cpp +++ b/apis/CTP/TypeConvert.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "TypeConvert.h" - +#include #include @@ -56,6 +56,7 @@ OpenCloseType TThostFtdcOffsetFlagType_2_OpenCloseType(TThostFtdcOffsetFlagType case THOST_FTDC_OF_CloseToday: return OpenCloseType::OpenCloseType_CloseToday; case THOST_FTDC_OF_Close: + case THOST_FTDC_OF_CloseYesterday: return OpenCloseType::OpenCloseType_Close; case THOST_FTDC_OF_Open: default: @@ -179,58 +180,6 @@ ExecType CThostFtdcOrderField_2_ExecType(CThostFtdcOrderField* pIn) } } -OrderStatus CThostFtdcQuoteField_2_OrderStatus(CThostFtdcQuoteField* pIn) -{ - switch (pIn->QuoteStatus) - { - case THOST_FTDC_OST_Canceled: - if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertRejected) - return OrderStatus::OrderStatus_Rejected; - return OrderStatus::OrderStatus_Cancelled; - case THOST_FTDC_OST_Unknown: - // 如果是撤单,也有可能出现这一条,如何过滤? - if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertSubmitted) - return OrderStatus::OrderStatus_New; - case THOST_FTDC_OST_Touched: - if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertRejected) - return OrderStatus::OrderStatus_Rejected; - default: - // 这个地方要改 - - //if (pIn->VolumeTotal == 0) - // return OrderStatus::Filled; - //else if (pIn->VolumeTotal == pIn->VolumeTotalOriginal) - return OrderStatus::OrderStatus_New; - //else - // return OrderStatus::PartiallyFilled; - } -} - -ExecType CThostFtdcQuoteField_2_ExecType(CThostFtdcQuoteField* pIn) -{ - switch (pIn->QuoteStatus) - { - case THOST_FTDC_OST_Canceled: - if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertRejected) - return ExecType::ExecType_Rejected; - return ExecType::ExecType_Cancelled; - case THOST_FTDC_OST_Unknown: - // 如果是撤单,也有可能出现这一条,如何过滤? - if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertSubmitted) - return ExecType::ExecType_New; - case THOST_FTDC_OST_AllTraded: - case THOST_FTDC_OST_PartTradedQueueing: - return ExecType::ExecType_Trade; - case THOST_FTDC_OST_Touched: - if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertRejected) - return ExecType::ExecType_Rejected; - default: - return ExecType::ExecType_New; - } -} - - - OrderType CThostFtdcOrderField_2_OrderType(CThostFtdcOrderField* pIn) { switch (pIn->OrderPriceType) @@ -311,6 +260,29 @@ IdCardType TThostFtdcIdCardTypeType_2_IdCardType(TThostFtdcIdCardTypeType In) } } +TradingPhaseType TThostFtdcInstrumentStatusType_2_TradingPhaseType(TThostFtdcInstrumentStatusType In) +{ + switch (In) + { + case THOST_FTDC_IS_BeforeTrading: + return TradingPhaseType::TradingPhaseType_BeforeTrading; + case THOST_FTDC_IS_NoTrading: + return TradingPhaseType::TradingPhaseType_NoTrading; + case THOST_FTDC_IS_Continous: + return TradingPhaseType::TradingPhaseType_Continuous; + case THOST_FTDC_IS_AuctionOrdering: + return TradingPhaseType::TradingPhaseType_AuctionOrdering; + case THOST_FTDC_IS_AuctionBalance: + return TradingPhaseType::TradingPhaseType_AuctionBalance; + case THOST_FTDC_IS_AuctionMatch: + return TradingPhaseType::TradingPhaseType_AuctionMatch; + case THOST_FTDC_IS_Closed: + return TradingPhaseType::TradingPhaseType_Closed; + default: + return TradingPhaseType::TradingPhaseType_NoTrading; + } +} + ExchangeType TThostFtdcExchangeIDType_2_ExchangeType(TThostFtdcExchangeIDType In) { switch (In[1]) @@ -336,6 +308,7 @@ void CThostFtdcOrderField_2_OrderField_0(OrderIDType OrderID,CThostFtdcOrderFiel strcpy(pOut->LocalID, pOut->ID); strcpy(pOut->InstrumentID, pIn->InstrumentID); strcpy(pOut->ExchangeID, pIn->ExchangeID); + strcpy(pOut->AccountID, pIn->InvestorID); pOut->HedgeFlag = TThostFtdcHedgeFlagType_2_HedgeFlagType(pIn->CombHedgeFlag[0]); pOut->Side = TThostFtdcDirectionType_2_OrderSide(pIn->Direction); pOut->Price = pIn->LimitPrice; @@ -351,4 +324,57 @@ void CThostFtdcOrderField_2_OrderField_0(OrderIDType OrderID,CThostFtdcOrderFiel pOut->ExecType = CThostFtdcOrderField_2_ExecType(pIn); strcpy(pOut->OrderID, pIn->OrderSysID); strncpy(pOut->Text, pIn->StatusMsg, sizeof(Char256Type)); -} \ No newline at end of file +} + +#ifdef HAS_Quote +OrderStatus CThostFtdcQuoteField_2_OrderStatus(CThostFtdcQuoteField* pIn) +{ + switch (pIn->QuoteStatus) + { + case THOST_FTDC_OST_Canceled: + if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertRejected) + return OrderStatus::OrderStatus_Rejected; + return OrderStatus::OrderStatus_Cancelled; + case THOST_FTDC_OST_Unknown: + // 如果是撤单,也有可能出现这一条,如何过滤? + if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertSubmitted) + return OrderStatus::OrderStatus_New; + case THOST_FTDC_OST_Touched: + if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertRejected) + return OrderStatus::OrderStatus_Rejected; + default: + // 这个地方要改 + + //if (pIn->VolumeTotal == 0) + // return OrderStatus::OrderStatus_Filled; + //else if (pIn->VolumeTotal == pIn->VolumeTotalOriginal) + return OrderStatus::OrderStatus_New; + //else + // return OrderStatus::OrderStatus_PartiallyFilled; + } +} + +ExecType CThostFtdcQuoteField_2_ExecType(CThostFtdcQuoteField* pIn) +{ + switch (pIn->QuoteStatus) + { + case THOST_FTDC_OST_Canceled: + if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertRejected) + return ExecType::ExecType_Rejected; + return ExecType::ExecType_Cancelled; + case THOST_FTDC_OST_Unknown: + // 如果是撤单,也有可能出现这一条,如何过滤? + if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertSubmitted) + return ExecType::ExecType_New; + case THOST_FTDC_OST_AllTraded: + case THOST_FTDC_OST_PartTradedQueueing: + return ExecType::ExecType_Trade; + case THOST_FTDC_OST_Touched: + if (pIn->OrderSubmitStatus == THOST_FTDC_OSS_InsertRejected) + return ExecType::ExecType_Rejected; + default: + return ExecType::ExecType_New; + } +} +#endif // HAS_Quote + diff --git a/QuantBox_CTP_Trade/TypeConvert.h b/apis/CTP/TypeConvert.h similarity index 83% rename from QuantBox_CTP_Trade/TypeConvert.h rename to apis/CTP/TypeConvert.h index be39fec..b584a7a 100644 --- a/QuantBox_CTP_Trade/TypeConvert.h +++ b/apis/CTP/TypeConvert.h @@ -1,9 +1,9 @@ #pragma once -#include "../include/CTP/ThostFtdcUserApiDataType.h" -#include "../include/CTP/ThostFtdcUserApiStruct.h" -#include "../include/ApiStruct.h" +#include "../../include/ApiStruct.h" +// Include.hҪʹÿĿԼļҪVC++ Directories->Include Directoriesһ"./" +#include "Include.h" PutCall TThostFtdcOptionsTypeType_2_PutCall(TThostFtdcOptionsTypeType In); @@ -26,8 +26,7 @@ TimeInForce CThostFtdcOrderField_2_TimeInForce(CThostFtdcOrderField* pIn); OrderStatus CThostFtdcOrderField_2_OrderStatus(CThostFtdcOrderField* pIn); ExecType CThostFtdcOrderField_2_ExecType(CThostFtdcOrderField* pIn); -OrderStatus CThostFtdcQuoteField_2_OrderStatus(CThostFtdcQuoteField* pIn); -ExecType CThostFtdcQuoteField_2_ExecType(CThostFtdcQuoteField* pIn); + InstrumentType CThostFtdcInstrumentField_2_InstrumentType(CThostFtdcInstrumentField* pIn); @@ -36,3 +35,12 @@ IdCardType TThostFtdcIdCardTypeType_2_IdCardType(TThostFtdcIdCardTypeType In); ExchangeType TThostFtdcExchangeIDType_2_ExchangeType(TThostFtdcExchangeIDType In); void CThostFtdcOrderField_2_OrderField_0(OrderIDType OrderID, CThostFtdcOrderField* pIn, OrderField* pOut); + +TradingPhaseType TThostFtdcInstrumentStatusType_2_TradingPhaseType(TThostFtdcInstrumentStatusType In); + + +#ifdef HAS_Quote +OrderStatus CThostFtdcQuoteField_2_OrderStatus(CThostFtdcQuoteField* pIn); +ExecType CThostFtdcQuoteField_2_ExecType(CThostFtdcQuoteField* pIn); +#endif // HAS_Quote + diff --git a/QuantBox_CTP_Quote/dllmain.cpp b/apis/CTP/dllmain.cpp similarity index 100% rename from QuantBox_CTP_Quote/dllmain.cpp rename to apis/CTP/dllmain.cpp diff --git a/apis/CTP/include_pub.h b/apis/CTP/include_pub.h new file mode 100644 index 0000000..c1f8532 --- /dev/null +++ b/apis/CTP/include_pub.h @@ -0,0 +1,25 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +// 条件编译 + +// 使用长报单引用,飞鼠的12位前需要补0 +#define USE_LONG_ORDER_REF 1 +// 是否有做市商报价功能 +#define HAS_Quote 1 +#define HAS_Account_Future 1 +#define HAS_InstrumentStatus 1 +#define HAS_Settlement 1 +#define HAS_TradingDay_UserLogin 1 +#define CreateFtdcMdApi_argc_3 1 +#define SubscribeMarketData_argc_2 1 + +#define HAS_ExchangeID_Position 1 +#define HAS_ExchangeID_Order 1 +#define HAS_ExchangeID_Quote 1 +#define HAS_ExchangeID_Quote_ForQuoteSysID 1 + diff --git a/apis/CTPZQ_Quote/CTPZQ_Quote.cpp b/apis/CTPZQ_Quote/CTPZQ_Quote.cpp new file mode 100644 index 0000000..8609b7e --- /dev/null +++ b/apis/CTPZQ_Quote/CTPZQ_Quote.cpp @@ -0,0 +1,6 @@ +// CTPZQ_Quote.cpp : Defines the exported functions for the DLL application. +// + +#include "stdafx.h" + + diff --git a/apis/CTPZQ_Quote/CTPZQ_Quote.vcxproj b/apis/CTPZQ_Quote/CTPZQ_Quote.vcxproj new file mode 100644 index 0000000..ab9a4ed --- /dev/null +++ b/apis/CTPZQ_Quote/CTPZQ_Quote.vcxproj @@ -0,0 +1,206 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {891F3DF0-72F6-404A-AF4A-85F1A640AB82} + Win32Proj + CTPZQ_Quote + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTPZQ + $(ProjectName)_$(PlatformTarget) + ./;$(IncludePath) + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;CTPZQ_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + + + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;CTPZQ_QUOTE_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;CTPZQ_QUOTE_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_WINDOWS;_USRDLL;CTPZQ_QUOTE_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + + + + + + \ No newline at end of file diff --git a/apis/CTPZQ_Quote/CTPZQ_Quote.vcxproj.filters b/apis/CTPZQ_Quote/CTPZQ_Quote.vcxproj.filters new file mode 100644 index 0000000..9e087e9 --- /dev/null +++ b/apis/CTPZQ_Quote/CTPZQ_Quote.vcxproj.filters @@ -0,0 +1,117 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/apis/CTPZQ_Quote/Include.h b/apis/CTPZQ_Quote/Include.h new file mode 100644 index 0000000..42eaa19 --- /dev/null +++ b/apis/CTPZQ_Quote/Include.h @@ -0,0 +1,35 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.1.0.20170921" +#define API_NAME "CTPZQ" +#define DLL_PUBLIC_KEY "" + +// 由于CTPZQ与CTP各种类型定义不一样,所以重新定义一下 +#include "Redefine.h" + +#include "../../include/CrossPlatform.h" +#include "../../include/CTPZQ/ZQThostFtdcUserApiDataType.h" +#include "../../include/CTPZQ/ZQThostFtdcUserApiStruct.h" +#include "../../include/CTPZQ/ZQThostFtdcMdApi.h" + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/CTPZQ/win64/zqthostmdapi.lib") +#else + #pragma comment(lib, "../../include/CTPZQ/win32/zqthostmdapi.lib") +#endif +#endif + + +// 条件编译 +#include "../CTP/include_pub.h" + +#undef HAS_TradingDay_UserLogin +#undef HAS_Quote +#undef CreateFtdcMdApi_argc_3 +#undef SubscribeMarketData_argc_2 diff --git a/QuantBox_CTP_Quote/ReadMe.txt b/apis/CTPZQ_Quote/ReadMe.txt similarity index 84% rename from QuantBox_CTP_Quote/ReadMe.txt rename to apis/CTPZQ_Quote/ReadMe.txt index 5e8e1d9..26775c1 100644 --- a/QuantBox_CTP_Quote/ReadMe.txt +++ b/apis/CTPZQ_Quote/ReadMe.txt @@ -1,27 +1,27 @@ ======================================================================== - DYNAMIC LINK LIBRARY : QuantBox_CTP_Quote Project Overview + DYNAMIC LINK LIBRARY : CTPZQ_Quote Project Overview ======================================================================== -AppWizard has created this QuantBox_CTP_Quote DLL for you. +AppWizard has created this CTPZQ_Quote DLL for you. This file contains a summary of what you will find in each of the files that -make up your QuantBox_CTP_Quote application. +make up your CTPZQ_Quote application. -QuantBox_CTP_Quote.vcxproj +CTPZQ_Quote.vcxproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and information about the platforms, configurations, and project features selected with the Application Wizard. -QuantBox_CTP_Quote.vcxproj.filters +CTPZQ_Quote.vcxproj.filters This is the filters file for VC++ projects generated using an Application Wizard. It contains information about the association between the files in your project and the filters. This association is used in the IDE to show grouping of files with similar extensions under a specific node (for e.g. ".cpp" files are associated with the "Source Files" filter). -QuantBox_CTP_Quote.cpp +CTPZQ_Quote.cpp This is the main DLL source file. When created, this DLL does not export any symbols. As a result, it @@ -37,7 +37,7 @@ Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file - named QuantBox_CTP_Quote.pch and a precompiled types file named StdAfx.obj. + named CTPZQ_Quote.pch and a precompiled types file named StdAfx.obj. ///////////////////////////////////////////////////////////////////////////// Other notes: diff --git a/apis/CTPZQ_Quote/Redefine.h b/apis/CTPZQ_Quote/Redefine.h new file mode 100644 index 0000000..f80e7b1 --- /dev/null +++ b/apis/CTPZQ_Quote/Redefine.h @@ -0,0 +1,126 @@ +#pragma once + +// +#define TThostFtdcOptionsTypeType TZQThostFtdcOptionsTypeType +#define TThostFtdcExchangeIDType TZQThostFtdcExchangeIDType +#define TThostFtdcDirectionType TZQThostFtdcDirectionType +#define TThostFtdcPosiDirectionType TZQThostFtdcPosiDirectionType +#define TThostFtdcOffsetFlagType TZQThostFtdcOffsetFlagType +#define TThostFtdcIdCardTypeType TZQThostFtdcIdCardTypeType +#define TThostFtdcBrokerIDType TZQThostFtdcBrokerIDType +#define TThostFtdcInvestorIDType TZQThostFtdcInvestorIDType +#define TThostFtdcPasswordType TZQThostFtdcPasswordType +#define TThostFtdcHedgeFlagType TZQThostFtdcHedgeFlagType +#define TThostFtdcOrderPriceTypeType TZQThostFtdcOrderPriceTypeType +#define TThostFtdcOrderSysIDType TZQThostFtdcOrderSysIDType +#define TThostFtdcInstrumentIDType TZQThostFtdcInstrumentIDType +#define TThostFtdcProductInfoType TZQThostFtdcProductInfoType +#define TThostFtdcAuthCodeType TZQThostFtdcAuthCodeType +#define TThostFtdcOrderRefType TZQThostFtdcOrderRefType +#define TThostFtdcInstrumentStatusType TZQThostFtdcInstrumentStatusType + +// ṹ +#define CThostFtdcRspInfoField CZQThostFtdcRspInfoField +#define CThostFtdcOrderField CZQThostFtdcOrderField +#define CThostFtdcTradeField CZQThostFtdcTradeField +#define CThostFtdcInstrumentField CZQThostFtdcInstrumentField +#define CThostFtdcRspUserLoginField CZQThostFtdcRspUserLoginField +#define CThostFtdcReqUserLoginField CZQThostFtdcReqUserLoginField +#define CThostFtdcUserLogoutField CZQThostFtdcUserLogoutField +#define CThostFtdcDepthMarketDataField CZQThostFtdcDepthMarketDataField +#define CThostFtdcSpecificInstrumentField CZQThostFtdcSpecificInstrumentField +#define CThostFtdcInvestorPositionField CZQThostFtdcInvestorPositionField +#define CThostFtdcInputOrderField CZQThostFtdcInputOrderField +#define CThostFtdcInputOrderActionField CZQThostFtdcInputOrderActionField +#define CThostFtdcOrderActionField CZQThostFtdcOrderActionField +#define CThostFtdcRspAuthenticateField CZQThostFtdcRspAuthenticateField +#define CThostFtdcInvestorField CZQThostFtdcInvestorField +#define CThostFtdcQryInstrumentField CZQThostFtdcQryInstrumentField +#define CThostFtdcReqAuthenticateField CZQThostFtdcReqAuthenticateField +#define CThostFtdcTradingAccountField CZQThostFtdcTradingAccountField +#define CThostFtdcQryOrderField CZQThostFtdcQryOrderField +#define CThostFtdcQryTradeField CZQThostFtdcQryTradeField +#define CThostFtdcQryInvestorField CZQThostFtdcQryInvestorField +#define CThostFtdcQryInvestorPositionField CZQThostFtdcQryInvestorPositionField +#define CThostFtdcQryTradingAccountField CZQThostFtdcQryTradingAccountField + + +// +#define CThostFtdcMdApi CZQThostFtdcMdApi +#define CThostFtdcMdSpi CZQThostFtdcMdSpi +#define CThostFtdcTraderApi CZQThostFtdcTraderApi +#define CThostFtdcTraderSpi CZQThostFtdcTraderSpi + +// öֵ +#define THOST_FTDC_CP_CallOptions ZQTHOST_FTDC_CP_CallOptions + +#define THOST_FTDC_HF_Arbitrage ZQTHOST_FTDC_HF_Arbitrage +#define THOST_FTDC_HF_Hedge ZQTHOST_FTDC_HF_Hedge +#define THOST_FTDC_HF_Speculation ZQTHOST_FTDC_HF_Speculation + +#define THOST_FTDC_OF_CloseToday ZQTHOST_FTDC_OF_CloseToday +#define THOST_FTDC_OF_Close ZQTHOST_FTDC_OF_Close +#define THOST_FTDC_OF_CloseYesterday ZQTHOST_FTDC_OF_CloseYesterday +#define THOST_FTDC_OF_Open ZQTHOST_FTDC_OF_Open + +#define THOST_FTDC_D_Sell ZQTHOST_FTDC_D_Sell +#define THOST_FTDC_D_Buy ZQTHOST_FTDC_D_Buy + +#define THOST_FTDC_PD_Short ZQTHOST_FTDC_PD_Short + +#define THOST_FTDC_OPT_AnyPrice ZQTHOST_FTDC_OPT_AnyPrice +#define THOST_FTDC_OPT_LimitPrice ZQTHOST_FTDC_OPT_LimitPrice + +#define THOST_FTDC_OST_Unknown ZQTHOST_FTDC_OST_Unknown +#define THOST_FTDC_OST_Canceled ZQTHOST_FTDC_OST_Canceled +#define THOST_FTDC_OST_AllTraded ZQTHOST_FTDC_OST_AllTraded +#define THOST_FTDC_OST_PartTradedQueueing ZQTHOST_FTDC_OST_PartTradedQueueing + +#define THOST_FTDC_OSS_InsertRejected ZQTHOST_FTDC_OSS_InsertRejected +#define THOST_FTDC_OSS_InsertSubmitted ZQTHOST_FTDC_OSS_InsertSubmitted + +#define THOST_FTDC_TC_GFD ZQTHOST_FTDC_TC_GFD +#define THOST_FTDC_TC_IOC ZQTHOST_FTDC_TC_IOC + +#define THOST_FTDC_VC_AV ZQTHOST_FTDC_VC_AV +#define THOST_FTDC_VC_CV ZQTHOST_FTDC_VC_CV + +#define THOST_FTDC_CC_Immediately ZQTHOST_FTDC_CC_Immediately + +#define THOST_FTDC_AF_Delete ZQTHOST_FTDC_AF_Delete + +#define THOST_FTDC_FCC_NotForceClose ZQTHOST_FTDC_FCC_NotForceClose + +#define THOST_FTDC_PC_Futures ZQTHOST_FTDC_PC_Futures +#define THOST_FTDC_PC_Options ZQTHOST_FTDC_PC_Options +#define THOST_FTDC_PC_Combination ZQTHOST_FTDC_PC_Combination +#define THOST_FTDC_PC_EFP ZQTHOST_FTDC_PC_EFP +#define THOST_FTDC_PC_SpotOption ZQTHOST_FTDC_PC_SpotOption + +#define THOST_FTDC_ICT_EID ZQTHOST_FTDC_ICT_EID +#define THOST_FTDC_ICT_IDCard ZQTHOST_FTDC_ICT_IDCard +#define THOST_FTDC_ICT_Passport ZQTHOST_FTDC_ICT_Passport +#define THOST_FTDC_ICT_LicenseNo ZQTHOST_FTDC_ICT_LicenseNo +#define THOST_FTDC_ICT_TaxNo ZQTHOST_FTDC_ICT_TaxNo +#define THOST_FTDC_ICT_DrivingLicense ZQTHOST_FTDC_ICT_DrivingLicense +#define THOST_FTDC_ICT_SocialID ZQTHOST_FTDC_ICT_SocialID +#define THOST_FTDC_ICT_LocalID ZQTHOST_FTDC_ICT_LocalID +#define THOST_FTDC_ICT_OtherCard ZQTHOST_FTDC_ICT_OtherCard + +#define THOST_FTDC_IS_BeforeTrading ZQTHOST_FTDC_IS_BeforeTrading +#define THOST_FTDC_IS_NoTrading ZQTHOST_FTDC_IS_NoTrading +#define THOST_FTDC_IS_Continous ZQTHOST_FTDC_IS_Continous +#define THOST_FTDC_IS_AuctionOrdering ZQTHOST_FTDC_IS_AuctionOrdering +#define THOST_FTDC_IS_AuctionBalance ZQTHOST_FTDC_IS_AuctionBalance +#define THOST_FTDC_IS_AuctionMatch ZQTHOST_FTDC_IS_AuctionMatch +#define THOST_FTDC_IS_Closed ZQTHOST_FTDC_IS_Closed + + +#define THOST_TE_RESUME_TYPE ZQTHOST_TE_RESUME_TYPE +#define THOST_TERT_QUICK ZQTHOST_TERT_QUICK + +// ûжĽṹ +#define CThostFtdcQuoteField CZQThostFtdcQuoteField +#define CThostFtdcForQuoteRspField CZQThostFtdcForQuoteRspField +#define CThostFtdcSettlementInfoConfirmField CZQThostFtdcSettlementInfoConfirmField +#define CThostFtdcInputQuoteActionField CZQThostFtdcInputQuoteActionField \ No newline at end of file diff --git a/QuantBox_CTP_Trade/dllmain.cpp b/apis/CTPZQ_Quote/dllmain.cpp similarity index 100% rename from QuantBox_CTP_Trade/dllmain.cpp rename to apis/CTPZQ_Quote/dllmain.cpp diff --git a/QuantBox_XAPI_TEST/stdafx.cpp b/apis/CTPZQ_Quote/stdafx.cpp similarity index 80% rename from QuantBox_XAPI_TEST/stdafx.cpp rename to apis/CTPZQ_Quote/stdafx.cpp index 6f6a809..290b7ed 100644 --- a/QuantBox_XAPI_TEST/stdafx.cpp +++ b/apis/CTPZQ_Quote/stdafx.cpp @@ -1,5 +1,5 @@ // stdafx.cpp : source file that includes just the standard includes -// QuantBox_XAPI_TEST.pch will be the pre-compiled header +// CTPZQ_Quote.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" diff --git a/QuantBox_LTS_Query_v2/stdafx.h b/apis/CTPZQ_Quote/stdafx.h similarity index 100% rename from QuantBox_LTS_Query_v2/stdafx.h rename to apis/CTPZQ_Quote/stdafx.h diff --git a/QuantBox_CTP_Quote/targetver.h b/apis/CTPZQ_Quote/targetver.h similarity index 100% rename from QuantBox_CTP_Quote/targetver.h rename to apis/CTPZQ_Quote/targetver.h diff --git a/apis/CTPZQ_Trade/CTPZQ_Trade.cpp b/apis/CTPZQ_Trade/CTPZQ_Trade.cpp new file mode 100644 index 0000000..221c185 --- /dev/null +++ b/apis/CTPZQ_Trade/CTPZQ_Trade.cpp @@ -0,0 +1,6 @@ +// CTPZQ_Trade.cpp : Defines the exported functions for the DLL application. +// + +#include "stdafx.h" + + diff --git a/QuantBox_Queue/QuantBox_Queue.vcxproj b/apis/CTPZQ_Trade/CTPZQ_Trade.vcxproj similarity index 50% rename from QuantBox_Queue/QuantBox_Queue.vcxproj rename to apis/CTPZQ_Trade/CTPZQ_Trade.vcxproj index 438eca1..9ff4e19 100644 --- a/QuantBox_Queue/QuantBox_Queue.vcxproj +++ b/apis/CTPZQ_Trade/CTPZQ_Trade.vcxproj @@ -1,120 +1,85 @@  - + - - Debug64 - Win32 - - - Debug64 - x64 - Debug Win32 - - Debug - x64 - Release Win32 + + Debug + x64 + Release x64 - {3A9173AA-92DB-49F9-88E3-09419C1D8E9F} + {5307B252-E992-4907-9C15-4BC5BD746F4C} Win32Proj - QuantBox_Queue + CTPZQ_Trade + 8.1 DynamicLibrary true - v120 + v141_xp Unicode - - DynamicLibrary - true - v120 - Unicode - - + DynamicLibrary - true - v120 + false + v140 + true Unicode - + DynamicLibrary true - v120 - Unicode - - - DynamicLibrary - false - v120 - true + v140 Unicode DynamicLibrary false - v120 + v140 true Unicode - - - - - + - + - + - + - + true - QuantBox_Queue_x86 - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\Tdx\x86 + ./;$(IncludePath) + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTPZQ + $(ProjectName)_$(PlatformTarget) true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI - QuantBox_Queue_x64 - - - true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014 - - - true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI - QuantBox_Queue_x64 false - QuantBox_Queue_x86 - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\TongShi\x86 false @@ -124,67 +89,26 @@ Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;CTPZQ_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true - ..\include\ZeroMQ\libzmq\include;..\include\ZeroMQ\czmq\include;%(AdditionalIncludeDirectories) Windows true - - + ../../include/ApiHeader.def - - - - - - xcopy "$(TargetPath)" "$(SolutionDir)XAPI\" /Y - Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;%(PreprocessorDefinitions) + _DEBUG;_WINDOWS;_USRDLL;CTPZQ_TRADE_EXPORTS;%(PreprocessorDefinitions) true Windows true - - - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - Windows - true - - @@ -194,16 +118,14 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;CTPZQ_TRADE_EXPORTS;%(PreprocessorDefinitions) true Windows - true true true - - + true @@ -213,66 +135,51 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_QUEUE_EXPORTS;%(PreprocessorDefinitions) + NDEBUG;_WINDOWS;_USRDLL;CTPZQ_TRADE_EXPORTS;%(PreprocessorDefinitions) true Windows - true true true - QuantBox_Queue.def + true - - - - - - - + + + + + + + + + + false + + false - false - false - Use - Use - Use - Use + + false - false + false - - Use - Use - Use - Use - - - Use - Use - Use - Use - - Create Create - Create - Create Create Create diff --git a/apis/CTPZQ_Trade/CTPZQ_Trade.vcxproj.filters b/apis/CTPZQ_Trade/CTPZQ_Trade.vcxproj.filters new file mode 100644 index 0000000..4ea32d2 --- /dev/null +++ b/apis/CTPZQ_Trade/CTPZQ_Trade.vcxproj.filters @@ -0,0 +1,66 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/apis/CTPZQ_Trade/Include.h b/apis/CTPZQ_Trade/Include.h new file mode 100644 index 0000000..0ecb255 --- /dev/null +++ b/apis/CTPZQ_Trade/Include.h @@ -0,0 +1,36 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.1.0.20170921" +#define API_NAME "CTPZQ" +#define DLL_PUBLIC_KEY "" + +// 由于CTPZQ与CTP各种类型定义不一样,所以重新定义一下 +#include "../CTPZQ_Quote/Redefine.h" + +#include "../../include/CrossPlatform.h" +#include "../../include/CTPZQ/ZQThostFtdcUserApiDataType.h" +#include "../../include/CTPZQ/ZQThostFtdcUserApiStruct.h" +#include "../../include/CTPZQ/ZQThostFtdcTraderApi.h" + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/CTPZQ/win64/zqthosttraderapi.lib") +#else + #pragma comment(lib, "../../include/CTPZQ/win32/zqthosttraderapi.lib") +#endif +#endif + +// 条件编译 +#include "../CTP/include_pub.h" + +#undef HAS_Quote +#undef HAS_Account_Future +#undef HAS_TradingDay_UserLogin +#undef HAS_InstrumentStatus +#undef HAS_Settlement +#undef USE_LONG_ORDER_REF diff --git a/QuantBox_CTP_Trade/ReadMe.txt b/apis/CTPZQ_Trade/ReadMe.txt similarity index 84% rename from QuantBox_CTP_Trade/ReadMe.txt rename to apis/CTPZQ_Trade/ReadMe.txt index e05ea6a..c6e66ca 100644 --- a/QuantBox_CTP_Trade/ReadMe.txt +++ b/apis/CTPZQ_Trade/ReadMe.txt @@ -1,27 +1,27 @@ ======================================================================== - DYNAMIC LINK LIBRARY : QuantBox_CTP_Trade Project Overview + DYNAMIC LINK LIBRARY : CTPZQ_Trade Project Overview ======================================================================== -AppWizard has created this QuantBox_CTP_Trade DLL for you. +AppWizard has created this CTPZQ_Trade DLL for you. This file contains a summary of what you will find in each of the files that -make up your QuantBox_CTP_Trade application. +make up your CTPZQ_Trade application. -QuantBox_CTP_Trade.vcxproj +CTPZQ_Trade.vcxproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and information about the platforms, configurations, and project features selected with the Application Wizard. -QuantBox_CTP_Trade.vcxproj.filters +CTPZQ_Trade.vcxproj.filters This is the filters file for VC++ projects generated using an Application Wizard. It contains information about the association between the files in your project and the filters. This association is used in the IDE to show grouping of files with similar extensions under a specific node (for e.g. ".cpp" files are associated with the "Source Files" filter). -QuantBox_CTP_Trade.cpp +CTPZQ_Trade.cpp This is the main DLL source file. When created, this DLL does not export any symbols. As a result, it @@ -37,7 +37,7 @@ Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file - named QuantBox_CTP_Trade.pch and a precompiled types file named StdAfx.obj. + named CTPZQ_Trade.pch and a precompiled types file named StdAfx.obj. ///////////////////////////////////////////////////////////////////////////// Other notes: diff --git a/QuantBox_LTS_Query_v2/dllmain.cpp b/apis/CTPZQ_Trade/dllmain.cpp similarity index 100% rename from QuantBox_LTS_Query_v2/dllmain.cpp rename to apis/CTPZQ_Trade/dllmain.cpp diff --git a/QuantBox_Tdx_Trade/stdafx.cpp b/apis/CTPZQ_Trade/stdafx.cpp similarity index 80% rename from QuantBox_Tdx_Trade/stdafx.cpp rename to apis/CTPZQ_Trade/stdafx.cpp index 06ec8f9..50224f7 100644 --- a/QuantBox_Tdx_Trade/stdafx.cpp +++ b/apis/CTPZQ_Trade/stdafx.cpp @@ -1,5 +1,5 @@ // stdafx.cpp : source file that includes just the standard includes -// QuantBox_Tdx_Trade.pch will be the pre-compiled header +// CTPZQ_Trade.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" diff --git a/QuantBox_Tdx_Trade/stdafx.h b/apis/CTPZQ_Trade/stdafx.h similarity index 100% rename from QuantBox_Tdx_Trade/stdafx.h rename to apis/CTPZQ_Trade/stdafx.h diff --git a/QuantBox_CTP_Trade/targetver.h b/apis/CTPZQ_Trade/targetver.h similarity index 100% rename from QuantBox_CTP_Trade/targetver.h rename to apis/CTPZQ_Trade/targetver.h diff --git a/QuantBox_CTP_Quote/QuantBox_CTP_Quote.cbp b/apis/CTP_Quote/CTP_Quote.cbp similarity index 100% rename from QuantBox_CTP_Quote/QuantBox_CTP_Quote.cbp rename to apis/CTP_Quote/CTP_Quote.cbp diff --git a/QuantBox_CTP_Quote/QuantBox_CTP_Quote.depend b/apis/CTP_Quote/CTP_Quote.depend similarity index 100% rename from QuantBox_CTP_Quote/QuantBox_CTP_Quote.depend rename to apis/CTP_Quote/CTP_Quote.depend diff --git a/apis/CTP_Quote/CTP_Quote.vcxproj b/apis/CTP_Quote/CTP_Quote.vcxproj new file mode 100644 index 0000000..5cd543f --- /dev/null +++ b/apis/CTP_Quote/CTP_Quote.vcxproj @@ -0,0 +1,208 @@ + + + + + Debug64 + x64 + + + Debug + Win32 + + + Release64 + x64 + + + Release + Win32 + + + + {919B914D-6840-453E-9201-8619E63AD0E1} + Win32Proj + CTP_Quote + 7.0 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP + ./;$(IncludePath) + $(ProjectName)_$(PlatformTarget) + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP + ./;$(IncludePath) + $(ProjectName)_$(PlatformTarget) + + + false + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP + $(ProjectName)_$(PlatformTarget) + ./;$(IncludePath) + + + false + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP + $(ProjectName)_$(PlatformTarget) + ./;$(IncludePath) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;CTP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Cdecl + ..\include\ZeroMQ\libzmq\include;..\include\ZeroMQ\czmq\include;%(AdditionalIncludeDirectories) + + + Windows + true + ../../include/ApiHeader.def + + + + + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;CTP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;CTP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;CTP_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/apis/CTP_Quote/CTP_Quote.vcxproj.filters b/apis/CTP_Quote/CTP_Quote.vcxproj.filters new file mode 100644 index 0000000..159b613 --- /dev/null +++ b/apis/CTP_Quote/CTP_Quote.vcxproj.filters @@ -0,0 +1,117 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {ebd67be1-c27d-4343-8673-bbbb26cdef71} + + + {267198b6-38cc-4319-8680-5fad03149361} + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + synthetic + + + synthetic + + + synthetic + + + Header Files + + + queue + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + synthetic + + + synthetic + + + synthetic + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/apis/CTP_Quote/Include.h b/apis/CTP_Quote/Include.h new file mode 100644 index 0000000..5ef6d16 --- /dev/null +++ b/apis/CTP_Quote/Include.h @@ -0,0 +1,27 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.3.0.20151216" +#define API_NAME "CTP" +#define DLL_PUBLIC_KEY "" + +#include "../../include/CrossPlatform.h" +#include "../../include/CTP/ThostFtdcUserApiDataType.h" +#include "../../include/CTP/ThostFtdcUserApiStruct.h" +#include "../../include/CTP/ThostFtdcMdApi.h" + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/CTP/win64/thostmduserapi.lib") +#else + #pragma comment(lib, "../../include/CTP/win32/thostmduserapi.lib") +#endif +#endif + + +// +#include "../CTP/include_pub.h" diff --git a/apis/CTP_Quote/ReadMe.txt b/apis/CTP_Quote/ReadMe.txt new file mode 100644 index 0000000..5b54557 --- /dev/null +++ b/apis/CTP_Quote/ReadMe.txt @@ -0,0 +1,48 @@ +======================================================================== + DYNAMIC LINK LIBRARY : CTP_Quote Project Overview +======================================================================== + +AppWizard has created this CTP_Quote DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your CTP_Quote application. + + +CTP_Quote.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +CTP_Quote.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +CTP_Quote.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named CTP_Quote.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/QuantBox_CTP_Quote/stdafx.cpp b/apis/CTP_Quote/stdafx.cpp similarity index 100% rename from QuantBox_CTP_Quote/stdafx.cpp rename to apis/CTP_Quote/stdafx.cpp diff --git a/QuantBox_CTP_Quote/stdafx.h b/apis/CTP_Quote/stdafx.h similarity index 100% rename from QuantBox_CTP_Quote/stdafx.h rename to apis/CTP_Quote/stdafx.h diff --git a/QuantBox_LTS_Query_v2/targetver.h b/apis/CTP_Quote/targetver.h similarity index 100% rename from QuantBox_LTS_Query_v2/targetver.h rename to apis/CTP_Quote/targetver.h diff --git a/apis/CTP_SOPT_Trade/CTP_SOPT_Trade.vcxproj b/apis/CTP_SOPT_Trade/CTP_SOPT_Trade.vcxproj new file mode 100644 index 0000000..ee609ac --- /dev/null +++ b/apis/CTP_SOPT_Trade/CTP_SOPT_Trade.vcxproj @@ -0,0 +1,192 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {ADCD2BDB-C723-4E9A-BFA4-2FC7EA10DC9A} + Win32Proj + CTP_SOPT_Trade + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP_SOPT + $(ProjectName)_$(PlatformTarget) + ./;../../include/cryptopp/;$(IncludePath) + + + true + + + false + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP_SOPT + $(ProjectName)_$(PlatformTarget) + ./;../../include/cryptopp/;$(IncludePath) + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;CTP_SOPT_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + Use + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;CTP_SOPT_TRADE_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;CTP_SOPT_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_WINDOWS;_USRDLL;CTP_SOPT_TRADE_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj.filters b/apis/CTP_SOPT_Trade/CTP_SOPT_Trade.vcxproj.filters similarity index 77% rename from QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj.filters rename to apis/CTP_SOPT_Trade/CTP_SOPT_Trade.vcxproj.filters index 8b20d4f..a16956b 100644 --- a/QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj.filters +++ b/apis/CTP_SOPT_Trade/CTP_SOPT_Trade.vcxproj.filters @@ -24,16 +24,16 @@ Header Files - + Header Files - + Header Files - + Header Files - + Header Files @@ -44,19 +44,16 @@ Source Files - + Source Files - + Source Files - + Source Files - - Source Files - - + Source Files diff --git a/apis/CTP_SOPT_Trade/Include.h b/apis/CTP_SOPT_Trade/Include.h new file mode 100644 index 0000000..25d8695 --- /dev/null +++ b/apis/CTP_SOPT_Trade/Include.h @@ -0,0 +1,29 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.1.0.20161126" +#define API_NAME "CTP_SOPT" +#define DLL_PUBLIC_KEY "0" + +#include "../../include/CrossPlatform.h" +#include "../../include/CTP_SOPT/ThostFtdcUserApiDataType.h" +#include "../../include/CTP_SOPT/ThostFtdcUserApiStruct.h" +#include "../../include/CTP_SOPT/ThostFtdcTraderApi.h" + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/CTP_SOPT/win64/thosttraderapi.lib") +#else + #pragma comment(lib, "../../include/CTP_SOPT/win32/thosttraderapi.lib") +#endif +#endif + + +// 条件编译 +#include "../CTP/include_pub.h" + +#undef USE_LONG_ORDER_REF diff --git a/QuantBox_Queue/ReadMe.txt b/apis/CTP_SOPT_Trade/ReadMe.txt similarity index 86% rename from QuantBox_Queue/ReadMe.txt rename to apis/CTP_SOPT_Trade/ReadMe.txt index f7d2719..30156c4 100644 --- a/QuantBox_Queue/ReadMe.txt +++ b/apis/CTP_SOPT_Trade/ReadMe.txt @@ -1,27 +1,27 @@ ======================================================================== - DYNAMIC LINK LIBRARY : QuantBox_Queue Project Overview + DYNAMIC LINK LIBRARY : CTP_SOPT_Trade Project Overview ======================================================================== -AppWizard has created this QuantBox_Queue DLL for you. +AppWizard has created this CTP_SOPT_Trade DLL for you. This file contains a summary of what you will find in each of the files that -make up your QuantBox_Queue application. +make up your CTP_SOPT_Trade application. -QuantBox_Queue.vcxproj +CTP_SOPT_Trade.vcxproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and information about the platforms, configurations, and project features selected with the Application Wizard. -QuantBox_Queue.vcxproj.filters +CTP_SOPT_Trade.vcxproj.filters This is the filters file for VC++ projects generated using an Application Wizard. It contains information about the association between the files in your project and the filters. This association is used in the IDE to show grouping of files with similar extensions under a specific node (for e.g. ".cpp" files are associated with the "Source Files" filter). -QuantBox_Queue.cpp +CTP_SOPT_Trade.cpp This is the main DLL source file. When created, this DLL does not export any symbols. As a result, it @@ -37,7 +37,7 @@ Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file - named QuantBox_Queue.pch and a precompiled types file named StdAfx.obj. + named CTP_SOPT_Trade.pch and a precompiled types file named StdAfx.obj. ///////////////////////////////////////////////////////////////////////////// Other notes: diff --git a/QuantBox_LTS_Quote_v2/dllmain.cpp b/apis/CTP_SOPT_Trade/dllmain.cpp similarity index 100% rename from QuantBox_LTS_Quote_v2/dllmain.cpp rename to apis/CTP_SOPT_Trade/dllmain.cpp diff --git a/apis/CTP_SOPT_Trade/stdafx.cpp b/apis/CTP_SOPT_Trade/stdafx.cpp new file mode 100644 index 0000000..83af722 --- /dev/null +++ b/apis/CTP_SOPT_Trade/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// CTP_SOPT_Trade.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/apis/CTP_SOPT_Trade/stdafx.h b/apis/CTP_SOPT_Trade/stdafx.h new file mode 100644 index 0000000..f3a0737 --- /dev/null +++ b/apis/CTP_SOPT_Trade/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here diff --git a/QuantBox_LTS_Quote_v2/targetver.h b/apis/CTP_SOPT_Trade/targetver.h similarity index 100% rename from QuantBox_LTS_Quote_v2/targetver.h rename to apis/CTP_SOPT_Trade/targetver.h diff --git a/QuantBox_CTP_Trade/QuantBox_CTP_Trade.cbp b/apis/CTP_Trade/CTP_Trade.cbp similarity index 100% rename from QuantBox_CTP_Trade/QuantBox_CTP_Trade.cbp rename to apis/CTP_Trade/CTP_Trade.cbp diff --git a/apis/CTP_Trade/CTP_Trade.vcxproj b/apis/CTP_Trade/CTP_Trade.vcxproj new file mode 100644 index 0000000..9be0738 --- /dev/null +++ b/apis/CTP_Trade/CTP_Trade.vcxproj @@ -0,0 +1,194 @@ + + + + + Debug64 + x64 + + + Debug + Win32 + + + Release64 + x64 + + + Release + Win32 + + + + {9FBB0318-E21C-4B7C-A258-98E6A3860B35} + Win32Proj + CTP_Trade + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP + ./;../../include/cryptopp/;$(IncludePath) + $(ProjectName)_$(PlatformTarget) + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP + ./;$(IncludePath) + $(ProjectName)_$(PlatformTarget) + + + false + ./;../../include/cryptopp/;$(IncludePath) + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP + $(ProjectName)_$(PlatformTarget) + + + false + ..\..\bin\$(Configuration)\$(PlatformTarget)\CTP + $(ProjectName)_$(PlatformTarget) + ./;$(IncludePath) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;_ENABLE_LICENSE;%(PreprocessorDefinitions) + true + MultiThreadedDebugDLL + + + Windows + true + ../../include/ApiHeader.def + + + + + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_ENABLE_LICENSE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;CTP_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj.filters b/apis/CTP_Trade/CTP_Trade.vcxproj.filters similarity index 67% rename from QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj.filters rename to apis/CTP_Trade/CTP_Trade.vcxproj.filters index 5895a9e..570beaf 100644 --- a/QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj.filters +++ b/apis/CTP_Trade/CTP_Trade.vcxproj.filters @@ -27,39 +27,48 @@ Header Files - + Header Files - + Header Files - + Header Files - - include + + Header Files + + + Header Files - - include + + Header Files Source Files - + + Source Files + + + Source Files + + Source Files - + Source Files - + Source Files - + Source Files - + Source Files diff --git a/apis/CTP_Trade/Include.h b/apis/CTP_Trade/Include.h new file mode 100644 index 0000000..a4854a9 --- /dev/null +++ b/apis/CTP_Trade/Include.h @@ -0,0 +1,29 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.3.0.20151216" +#define API_NAME "CTP" +#define DLL_PUBLIC_KEY "30819D300D06092A864886F70D010101050003818B0030818702818100A5411C1BAC072723B8EC84F609B88DF913308C6B38D2F304B4285AA290686888D05D731793AD30342E8917ACC57AF8DA4976877AC1B701A664EDEB668B14027F5ED4A96A61DA00AB0208E3E7DD4C8249E88B7A3BA511C7C082979B23AA1876ED2B7A77BB1A405D15B164E586431CD3ECFB3E448A193A41BA21C34A659196C353020111" + +#include "../../include/CrossPlatform.h" +#include "../../include/CTP/ThostFtdcUserApiDataType.h" +#include "../../include/CTP/ThostFtdcUserApiStruct.h" +#include "../../include/CTP/ThostFtdcTraderApi.h" + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/CTP/win64/thosttraderapi.lib") +#else + #pragma comment(lib, "../../include/CTP/win32/thosttraderapi.lib") +#endif +#endif + +// 条件编译 +#include "../CTP/include_pub.h" + +// #undef HAS_ExchangeID_Position +#undef USE_LONG_ORDER_REF diff --git a/apis/CTP_Trade/ReadMe.txt b/apis/CTP_Trade/ReadMe.txt new file mode 100644 index 0000000..918e658 --- /dev/null +++ b/apis/CTP_Trade/ReadMe.txt @@ -0,0 +1,48 @@ +======================================================================== + DYNAMIC LINK LIBRARY : CTP_Trade Project Overview +======================================================================== + +AppWizard has created this CTP_Trade DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your CTP_Trade application. + + +CTP_Trade.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +CTP_Trade.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +CTP_Trade.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named CTP_Trade.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/QuantBox_CTP_Trade/stdafx.cpp b/apis/CTP_Trade/stdafx.cpp similarity index 100% rename from QuantBox_CTP_Trade/stdafx.cpp rename to apis/CTP_Trade/stdafx.cpp diff --git a/QuantBox_CTP_Trade/stdafx.h b/apis/CTP_Trade/stdafx.h similarity index 100% rename from QuantBox_CTP_Trade/stdafx.h rename to apis/CTP_Trade/stdafx.h diff --git a/QuantBox_LTS_Trade_v2/targetver.h b/apis/CTP_Trade/targetver.h similarity index 100% rename from QuantBox_LTS_Trade_v2/targetver.h rename to apis/CTP_Trade/targetver.h diff --git a/apis/Kingstar_Quote/Include.h b/apis/Kingstar_Quote/Include.h new file mode 100644 index 0000000..2c9a663 --- /dev/null +++ b/apis/Kingstar_Quote/Include.h @@ -0,0 +1,34 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.3.0.20151216" +#define API_NAME "Kingstar" +#define DLL_PUBLIC_KEY "" + +#include "../../include/CrossPlatform.h" +#include "../../include/Kingstar/IncEx/KSUserApiDataTypeEx.h" +#include "../../include/Kingstar/IncEx/KSUserApiStructEx.h" +#include "../../include/Kingstar/inc/KSMarketDataAPI.h" + +using namespace KingstarAPI; + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/Kingstar/win64/KSMarketDataAPI.lib") +#else + #pragma comment(lib, "../../include/Kingstar/win32/KSMarketDataAPI.lib") +#endif +#endif + +// 为了解决金仕达授权问题而加的功能 +#define KS_LKC_FILENAME "KSInterB2C" +#define KS_LKC_EXT "lkc" + +#define KS_COPYFILE 1 + +// 条件编译 +#include "../CTP/include_pub.h" diff --git a/apis/Kingstar_Quote/Kingstar_Quote.vcxproj b/apis/Kingstar_Quote/Kingstar_Quote.vcxproj new file mode 100644 index 0000000..94149a9 --- /dev/null +++ b/apis/Kingstar_Quote/Kingstar_Quote.vcxproj @@ -0,0 +1,132 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {199071F1-5059-4883-BA49-6A9922A71ADD} + Win32Proj + Kingstar_Quote + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\Kingstar + ./;$(IncludePath) + $(ProjectName)_$(PlatformTarget) + + + false + ..\..\bin\$(Configuration)\$(PlatformTarget)\Kingstar + $(ProjectName)_$(PlatformTarget) + ./;$(IncludePath) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;KINGSTAR_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;KINGSTAR_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/apis/Kingstar_Quote/Kingstar_Quote.vcxproj.filters b/apis/Kingstar_Quote/Kingstar_Quote.vcxproj.filters new file mode 100644 index 0000000..d590432 --- /dev/null +++ b/apis/Kingstar_Quote/Kingstar_Quote.vcxproj.filters @@ -0,0 +1,108 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/apis/Kingstar_Quote/ReadMe.txt b/apis/Kingstar_Quote/ReadMe.txt new file mode 100644 index 0000000..262bfa1 --- /dev/null +++ b/apis/Kingstar_Quote/ReadMe.txt @@ -0,0 +1,48 @@ +======================================================================== + DYNAMIC LINK LIBRARY : Kingstar_Quote Project Overview +======================================================================== + +AppWizard has created this Kingstar_Quote DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your Kingstar_Quote application. + + +Kingstar_Quote.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +Kingstar_Quote.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +Kingstar_Quote.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named Kingstar_Quote.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/apis/Kingstar_Quote/stdafx.cpp b/apis/Kingstar_Quote/stdafx.cpp new file mode 100644 index 0000000..fb7e65c --- /dev/null +++ b/apis/Kingstar_Quote/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Kingstar_Quote.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/apis/Kingstar_Quote/stdafx.h b/apis/Kingstar_Quote/stdafx.h new file mode 100644 index 0000000..f3a0737 --- /dev/null +++ b/apis/Kingstar_Quote/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here diff --git a/QuantBox_Queue/targetver.h b/apis/Kingstar_Quote/targetver.h similarity index 100% rename from QuantBox_Queue/targetver.h rename to apis/Kingstar_Quote/targetver.h diff --git a/apis/Kingstar_Trade/Include.h b/apis/Kingstar_Trade/Include.h new file mode 100644 index 0000000..3a1bf9e --- /dev/null +++ b/apis/Kingstar_Trade/Include.h @@ -0,0 +1,36 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.3.0.20151216" +#define API_NAME "Kingstar" +#define DLL_PUBLIC_KEY "" + +#include "../../include/CrossPlatform.h" +#include "../../include/Kingstar/IncEx/KSUserApiDataTypeEx.h" +#include "../../include/Kingstar/IncEx/KSUserApiStructEx.h" +#include "../../include/Kingstar/inc/KSTradeAPI.h" + +using namespace KingstarAPI; + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/Kingstar/win64/KSTradeAPI.lib") +#else + #pragma comment(lib, "../../include/Kingstar/win32/KSTradeAPI.lib") +#endif +#endif + +// 为了解决金仕达授权问题而加的功能 +#define KS_LKC_FILENAME "KSInterB2C" +#define KS_LKC_EXT "lkc" + +#define KS_COPYFILE 1 + +// 条件编译 +#include "../CTP/include_pub.h" + +#undef USE_LONG_ORDER_REF diff --git a/apis/Kingstar_Trade/Kingstar_Trade.vcxproj b/apis/Kingstar_Trade/Kingstar_Trade.vcxproj new file mode 100644 index 0000000..97d6e57 --- /dev/null +++ b/apis/Kingstar_Trade/Kingstar_Trade.vcxproj @@ -0,0 +1,117 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {70015722-8252-4944-AE20-16A88B583CEE} + Win32Proj + Kingstar_Trade + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\Kingstar + ./;$(IncludePath) + $(ProjectName)_$(PlatformTarget) + + + false + ./;$(IncludePath) + ..\..\bin\$(Configuration)\$(PlatformTarget)\Kingstar + $(ProjectName)_$(PlatformTarget) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;KINGSTAR_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;KINGSTAR_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/apis/Kingstar_Trade/Kingstar_Trade.vcxproj.filters b/apis/Kingstar_Trade/Kingstar_Trade.vcxproj.filters new file mode 100644 index 0000000..54e8630 --- /dev/null +++ b/apis/Kingstar_Trade/Kingstar_Trade.vcxproj.filters @@ -0,0 +1,60 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/apis/Kingstar_Trade/ReadMe.txt b/apis/Kingstar_Trade/ReadMe.txt new file mode 100644 index 0000000..ad3554e --- /dev/null +++ b/apis/Kingstar_Trade/ReadMe.txt @@ -0,0 +1,48 @@ +======================================================================== + DYNAMIC LINK LIBRARY : Kingstar_Trade Project Overview +======================================================================== + +AppWizard has created this Kingstar_Trade DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your Kingstar_Trade application. + + +Kingstar_Trade.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +Kingstar_Trade.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +Kingstar_Trade.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named Kingstar_Trade.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/apis/Kingstar_Trade/stdafx.cpp b/apis/Kingstar_Trade/stdafx.cpp new file mode 100644 index 0000000..d21ef9a --- /dev/null +++ b/apis/Kingstar_Trade/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Kingstar_Trade.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/apis/Kingstar_Trade/stdafx.h b/apis/Kingstar_Trade/stdafx.h new file mode 100644 index 0000000..f3a0737 --- /dev/null +++ b/apis/Kingstar_Trade/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here diff --git a/QuantBox_Tdx_Trade/targetver.h b/apis/Kingstar_Trade/targetver.h similarity index 100% rename from QuantBox_Tdx_Trade/targetver.h rename to apis/Kingstar_Trade/targetver.h diff --git a/QuantBox_LTS_Query_v2/QuantBox_LTS_Query_v2.vcxproj b/apis/LTS_Query_v2/LTS_Query_v2.vcxproj similarity index 73% rename from QuantBox_LTS_Query_v2/QuantBox_LTS_Query_v2.vcxproj rename to apis/LTS_Query_v2/LTS_Query_v2.vcxproj index ffef572..4fe0dbb 100644 --- a/QuantBox_LTS_Query_v2/QuantBox_LTS_Query_v2.vcxproj +++ b/apis/LTS_Query_v2/LTS_Query_v2.vcxproj @@ -13,19 +13,20 @@ {51D11C21-C4A7-4F07-9658-B8BA223684B8} Win32Proj - QuantBox_LTS_Query_v2 + LTS_Query_v2 + 8.1 DynamicLibrary true - v120 + v141_xp Unicode DynamicLibrary false - v120 + v140 true Unicode @@ -41,26 +42,30 @@ true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\LTS_v2\x86 + ..\..\bin\$(Configuration)\$(PlatformTarget)\LTS_v2 + $(ProjectName)_$(PlatformTarget) false + ..\..\bin\$(Configuration)\$(PlatformTarget)\LTS_v2 + $(ProjectName)_$(PlatformTarget) Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_LTS_QUERY_V2_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;LTS_QUERY_V2_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true Windows true - ..\include\ApiHeader.def + ../../include/ApiHeader.def - xcopy "$(TargetPath)" "$(SolutionDir)XAPI\LTS_v2\x86\" /Y + + @@ -70,7 +75,7 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_LTS_QUERY_V2_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;LTS_QUERY_V2_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -78,31 +83,25 @@ true true true + ../../include/ApiHeader.def - - - + + + - - - - - false - - - false - - - + + + + diff --git a/QuantBox_LTS_Query_v2/QuantBox_LTS_Query_v2.vcxproj.filters b/apis/LTS_Query_v2/LTS_Query_v2.vcxproj.filters similarity index 85% rename from QuantBox_LTS_Query_v2/QuantBox_LTS_Query_v2.vcxproj.filters rename to apis/LTS_Query_v2/LTS_Query_v2.vcxproj.filters index a2781ef..b0941ee 100644 --- a/QuantBox_LTS_Query_v2/QuantBox_LTS_Query_v2.vcxproj.filters +++ b/apis/LTS_Query_v2/LTS_Query_v2.vcxproj.filters @@ -27,13 +27,13 @@ Header Files - + Header Files - + Header Files - + Header Files @@ -50,13 +50,13 @@ Source Files - + Source Files - + Source Files - + Source Files diff --git a/apis/LTS_Query_v2/QueryApi.cpp b/apis/LTS_Query_v2/QueryApi.cpp new file mode 100644 index 0000000..7b705df --- /dev/null +++ b/apis/LTS_Query_v2/QueryApi.cpp @@ -0,0 +1,868 @@ +#include "stdafx.h" +#include "QueryApi.h" + +#include "../../include/QueueEnum.h" + +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" + +#include "../../include/toolkit.h" + +#include "../../include/queue/MsgQueue.h" + +// 这里用的是与交易同一个类型转换 +#include "../LTS_Trade_v2/TypeConvert.h" + +#include +#include + +void* __stdcall Query_Q(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + // 由内部调用,不用检查是否为空 + CQueryApi* pApi = (CQueryApi*)pApi2; + pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + return nullptr; +} + +void CQueryApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + int iRet = 0; + switch (type) + { + case E_Init: + iRet = _Init(); + break; + } + + if (m_pApi) + { + switch (type) + { + case E_ReqUserLoginField: + iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryTradingAccount: + iRet = _ReqQryTradingAccount(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryInvestorPosition: + iRet = _ReqQryInvestorPosition(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryInstrument: + iRet = _ReqQryInstrument(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryInvestor: + iRet = _ReqQryInvestor(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryOrder: + iRet = _ReqQryOrder(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryTrade: + iRet = _ReqQryTrade(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case E_AuthRandCodeField: + iRet = _ReqFetchAuthRandCode(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + default: + break; + } + } + + if (0 == iRet) + { + //返回成功,填加到已发送池 + m_nSleep = 1; + } + else + { + m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + //失败,按4的幂进行延时,但不超过1s + m_nSleep *= 4; + m_nSleep %= 1023; + } + this_thread::sleep_for(chrono::milliseconds(m_nSleep)); +} + +void CQueryApi::Register(void* pCallback, void* pClass) +{ + m_pClass = pClass; + if (m_msgQueue == nullptr) + return; + + m_msgQueue_Query->Register(Query_Q); + m_msgQueue->Register((fnOnResponse)pCallback); + if (pCallback) + { + m_msgQueue_Query->StartThread(); + m_msgQueue->StartThread(); + } + else + { + m_msgQueue_Query->StopThread(); + m_msgQueue->StopThread(); + } +} + +CQueryApi::CQueryApi(void) +{ + m_pApi = nullptr; + m_lRequestID = 0; + m_nSleep = 1; + + // 自己维护两个消息队列 + m_msgQueue = new CMsgQueue(); + m_msgQueue_Query = new CMsgQueue(); + + m_msgQueue_Query->Register(Query_Q); + m_msgQueue_Query->StartThread(); +} + + +CQueryApi::~CQueryApi(void) +{ + Disconnect(); +} + +bool CQueryApi::IsErrorRspInfo(const char* szSource, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); + if (bRet) + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = pRspInfo->ErrorID; + strcpy(pField->Text, pRspInfo->ErrorMsg); + strcpy(pField->Source, szSource); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } + return bRet; +} + +bool CQueryApi::IsErrorRspInfo(CSecurityFtdcRspInfoField *pRspInfo) +{ + bool bRet = ((pRspInfo) && (pRspInfo->ErrorID != 0)); + + return bRet; +} + +void CQueryApi::Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo) +{ + m_szPath = szPath; + memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); + memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); + + m_msgQueue_Query->Input_NoCopy(RequestType::E_Init, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} + +int CQueryApi::_Init() +{ + char *pszPath = new char[m_szPath.length() + 1024]; + srand((unsigned int)time(nullptr)); + sprintf(pszPath, "%s/%s/%s/Qr/%d/", m_szPath.c_str(), m_ServerInfo.BrokerID, m_UserInfo.UserID, rand()); + makedirs(pszPath); + + m_pApi = CSecurityFtdcQueryApi::CreateFtdcQueryApi(pszPath); + delete[] pszPath; + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + if (m_pApi) + { + m_pApi->RegisterSpi(this); + + //添加地址 + size_t len = strlen(m_ServerInfo.Address) + 1; + char* buf = new char[len]; + strncpy(buf, m_ServerInfo.Address, len); + + char* token = strtok(buf, _QUANTBOX_SEPS_); + while (token) + { + if (strlen(token)>0) + { + m_pApi->RegisterFront(token); + } + token = strtok(nullptr, _QUANTBOX_SEPS_); + } + delete[] buf; + + //如果空着,反而是从头开始接收了,所以这里要特别处理一下 + //if (m_ServerInfo.PublicTopicResumeType < ResumeType::ResumeType_Undefined) + //{ + // m_pApi->SubscribePublicTopic((THOST_TE_RESUME_TYPE)m_ServerInfo.PublicTopicResumeType); + //} + //else + //{ + // m_pApi->SubscribePublicTopic(THOST_TERT_QUICK); + //} + + //if (m_ServerInfo.PrivateTopicResumeType < ResumeType::ResumeType_Undefined) + //{ + // m_pApi->SubscribePrivateTopic((THOST_TE_RESUME_TYPE)m_ServerInfo.PrivateTopicResumeType); + //} + //else + //{ + // m_pApi->SubscribePrivateTopic(THOST_TERT_QUICK); + //} + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + //初始化连接 + m_pApi->Init(); + } + + return 0; +} + +void CQueryApi::Disconnect() +{ + if (m_msgQueue_Query) + { + m_msgQueue_Query->StopThread(); + m_msgQueue_Query->Register(nullptr); + m_msgQueue_Query->Clear(); + delete m_msgQueue_Query; + m_msgQueue_Query = nullptr; + } + + if (m_pApi) + { + m_pApi->RegisterSpi(nullptr); + m_pApi->Release(); + m_pApi = nullptr; + + // 全清理,只留最后一个 + m_msgQueue->Clear(); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + // 主动触发 + m_msgQueue->Process(); + } + + if (m_msgQueue) + { + m_msgQueue->StopThread(); + m_msgQueue->Register(nullptr); + m_msgQueue->Clear(); + delete m_msgQueue; + m_msgQueue = nullptr; + } + + m_lRequestID = 0;//由于线程已经停止,没有必要用原子操作了 + + Clear(); +} + +void CQueryApi::Clear() +{ + for (unordered_map::iterator it = m_id_platform_order.begin(); it != m_id_platform_order.end(); ++it) + delete it->second; + m_id_platform_order.clear(); + + for (unordered_map::iterator it = m_id_api_order.begin(); it != m_id_api_order.end(); ++it) + delete it->second; + m_id_api_order.clear(); + + //for (unordered_map::iterator it = m_id_platform_quote.begin(); it != m_id_platform_quote.end(); ++it) + // delete it->second; + //m_id_platform_quote.clear(); + + //for (unordered_map::iterator it = m_id_api_quote.begin(); it != m_id_api_quote.end(); ++it) + // delete it->second; + //m_id_api_quote.clear(); + + for (unordered_map::iterator it = m_id_platform_position.begin(); it != m_id_platform_position.end(); ++it) + delete it->second; + m_id_platform_position.clear(); +} + +void CQueryApi::OnFrontConnected() +{ + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + //ReqUserLogin(); + ReqFetchAuthRandCode(); +} + +void CQueryApi::OnFrontDisconnected(int nReason) +{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + //连接失败返回的信息是拼接而成,主要是为了统一输出 + pField->RawErrorID = nReason; + GetOnFrontDisconnectedMsg(nReason, pField->Text); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); +} + +void CQueryApi::ReqFetchAuthRandCode() +{ + CSecurityFtdcAuthRandCodeField* pBody = (CSecurityFtdcAuthRandCodeField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcAuthRandCodeField)); + + strncpy(pBody->RandCode, "", sizeof(TSecurityFtdcAuthCodeType)); + + m_msgQueue_Query->Input_NoCopy(RequestType::E_AuthRandCodeField, m_msgQueue_Query, this, 0, 0, + pBody, sizeof(CSecurityFtdcAuthRandCodeField), nullptr, 0, nullptr, 0); +} + +int CQueryApi::_ReqFetchAuthRandCode(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorizing, 0, nullptr, 0, nullptr, 0, nullptr, 0); + return m_pApi->ReqFetchAuthRandCode((CSecurityFtdcAuthRandCodeField*)ptr1, ++m_lRequestID); +} + +void CQueryApi::OnRspFetchAuthRandCode(CSecurityFtdcAuthRandCodeField *pAuthRandCode, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + if (!IsErrorRspInfo(pRspInfo) + && pAuthRandCode) + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorized, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + + ReqUserLogin(pAuthRandCode->RandCode); + } + else + { + pField->RawErrorID = pRspInfo->ErrorID; + strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + } +} + +void CQueryApi::ReqUserLogin(TSecurityFtdcAuthCodeType RandCode) +{ + CSecurityFtdcReqUserLoginField* pBody = (CSecurityFtdcReqUserLoginField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcReqUserLoginField)); + + strncpy(pBody->BrokerID, m_ServerInfo.BrokerID, sizeof(TSecurityFtdcBrokerIDType)); + strncpy(pBody->UserID, m_UserInfo.UserID, sizeof(TSecurityFtdcInvestorIDType)); + strncpy(pBody->Password, m_UserInfo.Password, sizeof(TSecurityFtdcPasswordType)); + strncpy(pBody->UserProductInfo, m_ServerInfo.UserProductInfo, sizeof(TSecurityFtdcProductInfoType)); + strncpy(pBody->AuthCode, m_ServerInfo.AuthCode, sizeof(TSecurityFtdcAuthCodeType)); + strncpy(pBody->RandCode, RandCode, sizeof(TSecurityFtdcAuthCodeType)); + + m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, + pBody, sizeof(CSecurityFtdcReqUserLoginField), nullptr, 0, nullptr, 0); +} + +int CQueryApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); + return m_pApi->ReqUserLogin((CSecurityFtdcReqUserLoginField*)ptr1, ++m_lRequestID); +} + +void CQueryApi::OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + if (!IsErrorRspInfo(pRspInfo) + &&pRspUserLogin) + { + pField->TradingDay = GetDate(pRspUserLogin->TradingDay); + pField->LoginTime = GetTime(pRspUserLogin->LoginTime); + + sprintf(pField->SessionID, "%d:%d", pRspUserLogin->FrontID, pRspUserLogin->SessionID); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + + // 记下登录信息,可能会用到 + memcpy(&m_RspUserLogin,pRspUserLogin,sizeof(CSecurityFtdcRspUserLoginField)); + m_nMaxOrderRef = atol(pRspUserLogin->MaxOrderRef); + // 自己发单时ID从1开始,不能从0开始 + m_nMaxOrderRef = m_nMaxOrderRef>1 ? m_nMaxOrderRef : 1; + //ReqSettlementInfoConfirm(); + ReqQueryField body = { 0 }; + ReqQuery(QueryType::QueryType_ReqQryInvestor, &body); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + if (m_ServerInfo.PrivateTopicResumeType > ResumeType::ResumeType_Restart + && (m_ServerInfo.PrivateTopicResumeTypeRawErrorID = pRspInfo->ErrorID; + strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + } +} + +void CQueryApi::ReqQuery(QueryType type, ReqQueryField* pQuery) +{ + m_msgQueue_Query->Input_Copy(type, m_msgQueue_Query, this, 0, 0, + pQuery, sizeof(ReqQueryField), nullptr, 0, nullptr, 0); +} + +int CQueryApi::_ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + CSecurityFtdcQryTradingAccountField body = { 0 }; + + strcpy(body.BrokerID, m_RspUserLogin.BrokerID); + strcpy(body.InvestorID, m_RspUserLogin.UserID); + + return m_pApi->ReqQryTradingAccount(&body, ++m_lRequestID); +} + +void CQueryApi::OnRspQryTradingAccount(CSecurityFtdcTradingAccountField *pTradingAccount, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspQryTradingAccount", pRspInfo, nRequestID, bIsLast)) + { + if (pTradingAccount) + { + AccountField* pField = (AccountField*)m_msgQueue->new_block(sizeof(AccountField)); + + strcpy(pField->AccountID, pTradingAccount->AccountID); + pField->PreBalance = pTradingAccount->PreBalance; + pField->CurrMargin = pTradingAccount->CurrMargin; + //pField->CloseProfit = pTradingAccount->CloseProfit; + //pField->PositionProfit = pTradingAccount->PositionProfit; + pField->Balance = pTradingAccount->Balance; + pField->Available = pTradingAccount->Available; + pField->Deposit = pTradingAccount->Deposit; + pField->Withdraw = pTradingAccount->Withdraw; + pField->FrozenTransferFee = pTradingAccount->FrozenTransferFee; + pField->FrozenStampTax = pTradingAccount->FrozenStampTax; + pField->FrozenCommission = pTradingAccount->FrozenCommission; + pField->FrozenCash = pTradingAccount->FrozenCash; + pField->TransferFee = pTradingAccount->TransferFee; + pField->StampTax = pTradingAccount->StampTax; + pField->Commission = pTradingAccount->Commission; + pField->CashIn = pTradingAccount->CashIn; + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryTradingAccount, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(AccountField), nullptr, 0, nullptr, 0); + } + else + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryTradingAccount, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + } +} + +int CQueryApi::_ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + ReqQueryField* pQuery = (ReqQueryField*)ptr1; + + CSecurityFtdcQryInvestorPositionField body = { 0 }; + + strncpy(body.BrokerID, m_RspUserLogin.BrokerID, sizeof(TSecurityFtdcBrokerIDType)); + strncpy(body.InvestorID, m_RspUserLogin.UserID, sizeof(TSecurityFtdcInvestorIDType)); + strncpy(body.InstrumentID, pQuery->InstrumentID, sizeof(TSecurityFtdcInstrumentIDType)); + + return m_pApi->ReqQryInvestorPosition(&body, ++m_lRequestID); +} + +// 国债逆回购,持仓是Net,我归类到了Long中,如果我直接从成交中分析出来的又归到了Net中 +// 所有开平和投保类型都是空 +void CQueryApi::OnRspQryInvestorPosition(CSecurityFtdcInvestorPositionField *pInvestorPosition, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspQryInvestorPosition", pRspInfo, nRequestID, bIsLast)) + { + if (pInvestorPosition) + { + PositionIDType positionId = { 0 }; + sprintf(positionId, "%s:%s:%d:%d", + pInvestorPosition->InstrumentID, pInvestorPosition->ExchangeID, + TSecurityFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection), TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pInvestorPosition->HedgeFlag)); + + PositionField* pField = nullptr; + unordered_map::iterator it = m_id_platform_position.find(positionId); + if (it == m_id_platform_position.end()) + { + pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); + // 添加 + strcpy(pField->ID, positionId); + + sprintf(pField->Symbol, "%s.%s", pInvestorPosition->InstrumentID, pInvestorPosition->ExchangeID); + strcpy(pField->InstrumentID, pInvestorPosition->InstrumentID); + strcpy(pField->ExchangeID, pInvestorPosition->ExchangeID); + strcpy(pField->AccountID, pInvestorPosition->AccountID); + pField->Side = TSecurityFtdcPosiDirectionType_2_PositionSide(pInvestorPosition->PosiDirection); + pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pInvestorPosition->HedgeFlag); + + m_id_platform_position.insert(pair(positionId, pField)); + } + else + { + pField = it->second; + } + + pField->Position = pInvestorPosition->Position; + pField->TodayPosition = pInvestorPosition->TodayPosition; + pField->HistoryPosition = pInvestorPosition->YdPosition; + + // 等数据收集全了再遍历通知一次 + if (bIsLast) + { + int cnt = 0; + int count = m_id_platform_position.size(); + for (unordered_map::iterator iter = m_id_platform_position.begin(); iter != m_id_platform_position.end(); iter++) + { + ++cnt; + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, cnt == count, 0, iter->second, sizeof(PositionField), nullptr, 0, nullptr, 0); + } + } + } + } +} + +int CQueryApi::_ReqQryInstrument(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + ReqQueryField* pQuery = (ReqQueryField*)ptr1; + + CSecurityFtdcQryInstrumentField body = { 0 }; + strncpy(body.InstrumentID, pQuery->InstrumentID, sizeof(TSecurityFtdcInstrumentIDType)); + strncpy(body.ExchangeID, pQuery->ExchangeID, sizeof(TSecurityFtdcExchangeIDType)); + + return m_pApi->ReqQryInstrument(&body, ++m_lRequestID); +} + +void CQueryApi::OnRspQryInstrument(CSecurityFtdcInstrumentField *pInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspQryInstrument", pRspInfo, nRequestID, bIsLast)) + { + if (pInstrument) + { + InstrumentField* pField = (InstrumentField*)m_msgQueue->new_block(sizeof(InstrumentField)); + + strncpy(pField->InstrumentID, pInstrument->InstrumentID, sizeof(InstrumentIDType)); + strncpy(pField->ExchangeID, pInstrument->ExchangeID, sizeof(ExchangeIDType)); + + sprintf(pField->Symbol,"%s.%s",pInstrument->InstrumentID,pInstrument->ExchangeID); + sprintf(pField->InstrumentName, "%s(%s)", pInstrument->ExchangeInstID, pInstrument->InstrumentName); + strncpy(pField->ProductID, pInstrument->ProductID, sizeof(InstrumentIDType)); + + //strncpy(pField->InstrumentName, pInstrument->InstrumentName, sizeof(InstrumentNameType)); + pField->Type = CSecurityFtdcInstrumentField_2_InstrumentType(pInstrument); + pField->VolumeMultiple = pInstrument->VolumeMultiple; + pField->PriceTick = CSecurityFtdcInstrumentField_2_PriceTick(pInstrument); + pField->ExpireDate = GetDate(pInstrument->ExpireDate); + pField->OptionsType = CSecurityFtdcInstrumentField_2_PutCall(pInstrument); + pField->StrikePrice = pInstrument->ExecPrice; + + + // 期权的标的物 + if (strlen(pInstrument->InstrumentID) == 8) + { + strncpy(pField->UnderlyingInstrID, pInstrument->ExchangeInstID, 6); + sprintf(&pField->UnderlyingInstrID[6], ".%s", pInstrument->ExchangeID); + } + + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InstrumentField), nullptr, 0, nullptr, 0); + } + else + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + } +} + +void CQueryApi::OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + IsErrorRspInfo("OnRspError", pRspInfo, nRequestID, bIsLast); +} + +int CQueryApi::_ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + CSecurityFtdcQryOrderField body = { 0 }; + + strcpy(body.BrokerID, m_RspUserLogin.BrokerID); + strcpy(body.InvestorID, m_RspUserLogin.UserID); + + return m_pApi->ReqQryOrder(&body, ++m_lRequestID); +} + +void CQueryApi::OnOrder(CSecurityFtdcOrderField *pOrder, int nRequestID, bool bIsLast) +{ + if (nullptr == pOrder) + return; + + OrderIDType orderId = { 0 }; + sprintf(orderId, "%d:%d:%s", pOrder->FrontID, pOrder->SessionID, pOrder->OrderRef); + OrderIDType orderSydId = { 0 }; + + { + // 保存原始订单信息,用于撤单 + + unordered_map::iterator it = m_id_api_order.find(orderId); + if (it == m_id_api_order.end()) + { + // 找不到此订单,表示是新单 + CSecurityFtdcOrderField* pField = new CSecurityFtdcOrderField(); + memcpy(pField, pOrder, sizeof(CSecurityFtdcOrderField)); + m_id_api_order.insert(pair(orderId, pField)); + } + else + { + // 找到了订单 + // 需要再复制保存最后一次的状态,还是只要第一次的用于撤单即可?记下,这样最后好比较 + CSecurityFtdcOrderField* pField = it->second; + memcpy(pField, pOrder, sizeof(CSecurityFtdcOrderField)); + } + + // 保存SysID用于定义成交回报与订单 + sprintf(orderSydId, "%s:%s", pOrder->ExchangeID, pOrder->OrderSysID); + m_sysId_orderId.insert(pair(orderSydId, orderId)); + } + + { + // 从API的订单转换成自己的结构体 + if (nRequestID == 0) + { + OrderField* pField = nullptr; + unordered_map::iterator it = m_id_platform_order.find(orderId); + if (it == m_id_platform_order.end()) + { + // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 + pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + + // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 + CSecurityFtdcOrderField_2_OrderField_0(orderId, pOrder, pField); + + + // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 + m_id_platform_order.insert(pair(orderId, pField)); + } + else + { + pField = it->second; + strcpy(pField->ID, orderId); + strcpy(pField->LocalID, pField->ID); + pField->LeavesQty = pOrder->VolumeTotal; + pField->Price = atof(pOrder->LimitPrice); + pField->Status = CSecurityFtdcOrderField_2_OrderStatus(pOrder); + pField->ExecType = CSecurityFtdcOrderField_2_ExecType(pOrder); + strcpy(pField->OrderID, pOrder->OrderSysID); + strncpy(pField->Text, pOrder->StatusMsg, sizeof(Char256Type)); + } + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + } + else + { + OrderField* pField = nullptr; + pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + + // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 + CSecurityFtdcOrderField_2_OrderField_0(orderId, pOrder, pField); + + // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 + //m_id_platform_order.insert(pair(orderId, pField)); + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryOrder, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + + m_msgQueue->delete_block(pField); + } + + } +} + +void CQueryApi::OnRspQryOrder(CSecurityFtdcOrderField *pOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspQryOrder", pRspInfo, nRequestID, bIsLast)) + { + OnOrder(pOrder, nRequestID, bIsLast); + } +} + +//void CQueryApi::ReqQryTrade() +//{ +// CSecurityFtdcQryTradeField* pBody = (CSecurityFtdcQryTradeField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcQryTradeField)); +// +// strcpy(pBody->BrokerID, m_RspUserLogin.BrokerID); +// strcpy(pBody->InvestorID, m_RspUserLogin.UserID); +// +// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryTradeField, m_msgQueue_Query, this, 0, 0, +// pBody, sizeof(CSecurityFtdcQryTradeField), nullptr, 0, nullptr, 0); +//} + +int CQueryApi::_ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + CSecurityFtdcQryTradeField body = { 0 }; + + strcpy(body.BrokerID, m_RspUserLogin.BrokerID); + strcpy(body.InvestorID, m_RspUserLogin.UserID); + + return m_pApi->ReqQryTrade(&body, ++m_lRequestID); +} + +void CQueryApi::OnTrade(CSecurityFtdcTradeField *pTrade, int nRequestID, bool bIsLast) +{ + if (nullptr == pTrade) + return; + + TradeField* pField = (TradeField*)m_msgQueue->new_block(sizeof(TradeField)); + strcpy(pField->InstrumentID, pTrade->InstrumentID); + strcpy(pField->ExchangeID, pTrade->ExchangeID); + pField->Side = TSecurityFtdcDirectionType_2_OrderSide(pTrade->Direction); + pField->Qty = pTrade->Volume; + pField->Price = atof(pTrade->Price); + pField->OpenClose = TSecurityFtdcOffsetFlagType_2_OpenCloseType(pTrade->OffsetFlag); + pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pTrade->HedgeFlag); + pField->Commission = 0;//TODO收续费以后要计算出来 + pField->Time = GetTime(pTrade->TradeTime); + strcpy(pField->TradeID, pTrade->TradeID); + + if (nRequestID == 0) + { + OrderIDType orderSysId = { 0 }; + sprintf(orderSysId, "%s:%s", pTrade->ExchangeID, pTrade->OrderSysID); + unordered_map::iterator it = m_sysId_orderId.find(orderSysId); + if (it == m_sysId_orderId.end()) + { + // 此成交找不到对应的报单 + //assert(false); + } + else + { + // 找到对应的报单 + strcpy(pField->ID, it->second.c_str()); + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); + + unordered_map::iterator it2 = m_id_platform_order.find(it->second); + if (it2 == m_id_platform_order.end()) + { + // 此成交找不到对应的报单 + //assert(false); + } + else + { + // 更新订单的状态 + // 是否要通知接口 + } + + OnTrade(pField); + } + } + else + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryTrade, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); + } + + // 清理内存 + m_msgQueue->delete_block(pField); +} + +void CQueryApi::OnTrade(TradeField *pTrade) +{ + PositionIDType positionId = { 0 }; + sprintf(positionId, "%s:%s:%d:%d", + pTrade->InstrumentID, pTrade->ExchangeID, TradeField_2_PositionSide(pTrade), pTrade->HedgeFlag); + + PositionField* pField = nullptr; + unordered_map::iterator it = m_id_platform_position.find(positionId); + if (it == m_id_platform_position.end()) + { + pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); + + sprintf(pField->Symbol, "%s.%s", pTrade->InstrumentID, pTrade->ExchangeID); + strcpy(pField->InstrumentID, pTrade->InstrumentID); + strcpy(pField->ExchangeID, pTrade->ExchangeID); + pField->Side = TradeField_2_PositionSide(pTrade); + pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pTrade->HedgeFlag); + + m_id_platform_position.insert(pair(positionId, pField)); + } + else + { + pField = it->second; + } + + if (pTrade->Side == OrderSide::OrderSide_Buy) + { + pField->Position += pTrade->Qty; + pField->TodayPosition += pTrade->Qty; + } + else + { + pField->Position -= pTrade->Qty; + if (pTrade->OpenClose == OpenCloseType::OpenCloseType_CloseToday) + { + pField->TodayPosition -= pTrade->Qty; + } + else + { + pField->HistoryPosition -= pTrade->Qty; + // 如果昨天的被减成负数,从今天开始继续减 + if (pField->HistoryPosition<0) + { + pField->TodayPosition += pField->HistoryPosition; + pField->HistoryPosition = 0; + } + } + + // 计算错误,直接重新查询 + if (pField->Position < 0 || pField->TodayPosition < 0 || pField->HistoryPosition < 0) + { + ReqQueryField body = { 0 }; + ReqQuery(QueryType::QueryType_ReqQryInvestorPosition, &body); + return; + } + } + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, false, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); +} + +void CQueryApi::OnRspQryTrade(CSecurityFtdcTradeField *pTrade, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspQryTrade", pRspInfo, nRequestID, bIsLast)) + { + OnTrade(pTrade, nRequestID, bIsLast); + } +} + +//void CQueryApi::ReqQryInvestor() +//{ +// CSecurityFtdcQryInvestorField* pBody = (CSecurityFtdcQryInvestorField*)m_msgQueue_Query->new_block(sizeof(CSecurityFtdcQryInvestorField)); +// +// strncpy(pBody->BrokerID, m_RspUserLogin.BrokerID, sizeof(TSecurityFtdcBrokerIDType)); +// strncpy(pBody->InvestorID, m_RspUserLogin.UserID, sizeof(TSecurityFtdcInvestorIDType)); +// +// m_msgQueue_Query->Input_NoCopy(RequestType::E_QryInvestorField, m_msgQueue_Query, this, 0, 0, +// pBody, sizeof(CSecurityFtdcQryInvestorField), nullptr, 0, nullptr, 0); +//} + +int CQueryApi::_ReqQryInvestor(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + CSecurityFtdcQryInvestorField body = { 0 }; + + strcpy(body.BrokerID, m_RspUserLogin.BrokerID); + strcpy(body.InvestorID, m_RspUserLogin.UserID); + + return m_pApi->ReqQryInvestor(&body, ++m_lRequestID); +} + +void CQueryApi::OnRspQryInvestor(CSecurityFtdcInvestorField *pInvestor, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) +{ + if (!IsErrorRspInfo("OnRspQryInvestor", pRspInfo, nRequestID, bIsLast)) + { + if (pInvestor) + { + memcpy(&m_Investor, pInvestor, sizeof(CSecurityFtdcInvestorField)); + + InvestorField* pField = (InvestorField*)m_msgQueue->new_block(sizeof(InvestorField)); + + strcpy(pField->BrokerID, pInvestor->BrokerID); + strcpy(pField->InvestorID, pInvestor->InvestorID); + strcpy(pField->InvestorName, pInvestor->InvestorName); + strcpy(pField->IdentifiedCardNo, pInvestor->IdentifiedCardNo); + pField->IdentifiedCardType = TSecurityFtdcIdCardTypeType_2_IdCardType(pInvestor->IdentifiedCardType); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInvestor, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InvestorField), nullptr, 0, nullptr, 0); + } + else + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInvestor, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + } +} diff --git a/QuantBox_LTS_Query_v2/QueryApi.h b/apis/LTS_Query_v2/QueryApi.h similarity index 86% rename from QuantBox_LTS_Query_v2/QueryApi.h rename to apis/LTS_Query_v2/QueryApi.h index f71aca1..f5099bf 100644 --- a/QuantBox_LTS_Query_v2/QueryApi.h +++ b/apis/LTS_Query_v2/QueryApi.h @@ -1,14 +1,16 @@ #pragma once -#include "../include/LTS_v2/SecurityFtdcQueryApi.h" -#include "../include/ApiStruct.h" +#include "../../include/CrossPlatform.h" +#include "../../include/LTS_v2/SecurityFtdcQueryApi.h" +#include "../../include/ApiStruct.h" +#include "../../include/QueueEnum.h" +#ifndef USE_CMAKE #ifdef _WIN64 -#pragma comment(lib, "../include/LTS_v2/win64/securityqueryapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x64.lib") + #pragma comment(lib, "../../include/LTS_v2/win64/securityqueryapi.lib") #else -#pragma comment(lib, "../include/LTS_v2/win32/securityqueryapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") + #pragma comment(lib, "../../include/LTS_v2/win32/securityqueryapi.lib") +#endif #endif #include @@ -30,7 +32,7 @@ class CQueryApi : //ݰ enum RequestType { - E_Init, + E_Init = 100, E_ReqAuthenticateField, E_ReqUserLoginField, @@ -83,19 +85,21 @@ class CQueryApi : //int ReqQuoteAction(CSecurityFtdcQuoteField *pQuote); //int ReqQuoteAction(const string& szId); - void ReqQryTradingAccount(); - void ReqQryInvestorPosition(const string& szInstrumentId, const string& szExchange); - void ReqQryInvestorPositionDetail(const string& szInstrumentId); - void ReqQryInstrument(const string& szInstrumentId, const string& szExchange); - void ReqQryInstrumentCommissionRate(const string& szInstrumentId); - void ReqQryInstrumentMarginRate(const string& szInstrumentId, TSecurityFtdcHedgeFlagType HedgeFlag = SECURITY_FTDC_HF_Speculation); - void ReqQryDepthMarketData(const string& szInstrumentId); - void ReqQrySettlementInfo(const string& szTradingDay); + void ReqQuery(QueryType type, ReqQueryField* pQuery); + + //void ReqQryTradingAccount(); + //void ReqQryInvestorPosition(const string& szInstrumentId, const string& szExchange); + //void ReqQryInvestorPositionDetail(const string& szInstrumentId); + //void ReqQryInstrument(const string& szInstrumentId, const string& szExchange); + //void ReqQryInstrumentCommissionRate(const string& szInstrumentId); + //void ReqQryInstrumentMarginRate(const string& szInstrumentId, TSecurityFtdcHedgeFlagType HedgeFlag = SECURITY_FTDC_HF_Speculation); + //void ReqQryDepthMarketData(const string& szInstrumentId); + //void ReqQrySettlementInfo(const string& szTradingDay); - void ReqQryOrder(); - void ReqQryTrade(); + //void ReqQryOrder(); + //void ReqQryTrade(); - void ReqQryInvestor(); + //void ReqQryInvestor(); private: friend void* __stdcall Query_Q(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); @@ -120,12 +124,13 @@ class CQueryApi : int _ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); //int _ReqQryQuote(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - void OnOrder(CSecurityFtdcOrderField *pOrder, bool bFromQry); - void OnTrade(CSecurityFtdcTradeField *pTrade, bool bFromQry); - void OnTrade(TradeField *pTrade, bool bFromQry); + void OnOrder(CSecurityFtdcOrderField *pOrder, int nRequestID, bool bIsLast); + void OnTrade(CSecurityFtdcTradeField *pTrade, int nRequestID, bool bIsLast); + + void OnTrade(TradeField *pTrade); //Ƿ - bool IsErrorRspInfo(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);//ϢϢ + bool IsErrorRspInfo(const char* szSource, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);//ϢϢ bool IsErrorRspInfo(CSecurityFtdcRspInfoField *pRspInfo);//Ϣ // diff --git a/QuantBox_LTS_Query_v2/ReadMe.txt b/apis/LTS_Query_v2/ReadMe.txt similarity index 100% rename from QuantBox_LTS_Query_v2/ReadMe.txt rename to apis/LTS_Query_v2/ReadMe.txt diff --git a/QuantBox_LTS_Trade_v2/dllmain.cpp b/apis/LTS_Query_v2/dllmain.cpp similarity index 100% rename from QuantBox_LTS_Trade_v2/dllmain.cpp rename to apis/LTS_Query_v2/dllmain.cpp diff --git a/apis/LTS_Query_v2/main.cpp b/apis/LTS_Query_v2/main.cpp new file mode 100644 index 0000000..c28f097 --- /dev/null +++ b/apis/LTS_Query_v2/main.cpp @@ -0,0 +1,62 @@ +#include "stdafx.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" +#include "QueryApi.h" + +inline CQueryApi* GetApi(void* pApi) +{ + return static_cast(pApi); +} + +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) +{ + RequestType rt = (RequestType)type; + switch (rt) + { + case RequestType_GetApiTypes: + return (void*)(ApiType::ApiType_Query | ApiType::ApiType_Instrument); + case RequestType_GetApiVersion: + return (void*)"0.1.0.20151116"; + case RequestType_GetApiName: + return (void*)"LTS2"; + case RequestType_Create: + return new CQueryApi(); + default: + break; + } + + if (pApi1 == nullptr) + { + return nullptr; + } + + CQueryApi* pApi = GetApi(pApi1); + + switch (rt) + { + case RequestType_Release: + delete pApi; + return nullptr; + case RequestType_Register: + pApi->Register(ptr1, ptr2); + break; + case RequestType_Connect: + pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2); + break; + case RequestType_Disconnect: + pApi->Disconnect(); + break; + case QueryType_ReqQryInstrument: + case QueryType_ReqQryInvestorPosition: + case QueryType_ReqQryTradingAccount: + case QueryType_ReqQrySettlementInfo: + case QueryType_ReqQryTrade: + case QueryType_ReqQryOrder: + pApi->ReqQuery((QueryType)type, (ReqQueryField*)ptr1); + break; + default: + break; + } + + return pApi1; +} diff --git a/QuantBox_LTS_Query_v2/stdafx.cpp b/apis/LTS_Query_v2/stdafx.cpp similarity index 100% rename from QuantBox_LTS_Query_v2/stdafx.cpp rename to apis/LTS_Query_v2/stdafx.cpp diff --git a/apis/LTS_Query_v2/stdafx.h b/apis/LTS_Query_v2/stdafx.h new file mode 100644 index 0000000..f3a0737 --- /dev/null +++ b/apis/LTS_Query_v2/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here diff --git a/QuantBox_TongShi_Quote/targetver.h b/apis/LTS_Query_v2/targetver.h similarity index 100% rename from QuantBox_TongShi_Quote/targetver.h rename to apis/LTS_Query_v2/targetver.h diff --git a/QuantBox_LTS_Quote_v2/QuantBox_LTS_Quote.cbp b/apis/LTS_Quote_v2/LTS_Quote.cbp similarity index 100% rename from QuantBox_LTS_Quote_v2/QuantBox_LTS_Quote.cbp rename to apis/LTS_Quote_v2/LTS_Quote.cbp diff --git a/apis/LTS_Quote_v2/LTS_Quote_v2.vcxproj b/apis/LTS_Quote_v2/LTS_Quote_v2.vcxproj new file mode 100644 index 0000000..0b91e03 --- /dev/null +++ b/apis/LTS_Quote_v2/LTS_Quote_v2.vcxproj @@ -0,0 +1,127 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {D4387736-0623-4442-A4AC-AF79239F9419} + Win32Proj + LTS_Quote + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\LTS_v2 + $(ProjectName)_$(PlatformTarget) + + + false + ..\..\bin\$(Configuration)\$(PlatformTarget)\LTS_v2 + $(ProjectName)_$(PlatformTarget) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;LTS_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;LTS_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/apis/LTS_Quote_v2/LTS_Quote_v2.vcxproj.filters b/apis/LTS_Quote_v2/LTS_Quote_v2.vcxproj.filters new file mode 100644 index 0000000..2dec054 --- /dev/null +++ b/apis/LTS_Quote_v2/LTS_Quote_v2.vcxproj.filters @@ -0,0 +1,99 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/QuantBox_LTS_Quote_v2/MdUserApi.cpp b/apis/LTS_Quote_v2/MdUserApi.cpp similarity index 68% rename from QuantBox_LTS_Quote_v2/MdUserApi.cpp rename to apis/LTS_Quote_v2/MdUserApi.cpp index 62ac75f..19eaf6d 100644 --- a/QuantBox_LTS_Quote_v2/MdUserApi.cpp +++ b/apis/LTS_Quote_v2/MdUserApi.cpp @@ -1,21 +1,22 @@ #include "stdafx.h" #include "MdUserApi.h" -#include "../include/QueueEnum.h" -#include "../include/QueueHeader.h" +#include "../../include/QueueEnum.h" -#include "../include/ApiHeader.h" -#include "../include/ApiStruct.h" +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" -#include "../include/toolkit.h" -#include "../include/ApiProcess.h" +#include "../../include/toolkit.h" +#include "../../include/ApiProcess.h" -#include "../QuantBox_Queue/MsgQueue.h" -#ifdef _REMOTE -#include "../QuantBox_Queue/RemoteQueue.h" -#endif +#include "../../include/queue/MsgQueue.h" + +#include "../../include/CSubscribeManager.h" +#include "../../include/synthetic/CSyntheticConfig.h" +#include "../../include/synthetic/CSyntheticManager.h" +#include "../../include/CSyntheticCalculate_DepthMarketDataNField.h" -#include +#include #include #include using namespace std; @@ -47,14 +48,17 @@ CMdUserApi::CMdUserApi(void) m_lRequestID = 0; m_nSleep = 1; + m_pSyntheticConfig = new CSyntheticConfig(); + m_pSyntheticManager = new CSyntheticManager(); + m_pCalculateFactory = new CSyntheticCalculateFactory_XAPI(); + m_pSubscribeManager = new CSubscribeManager(m_pSyntheticConfig, m_pSyntheticManager, m_pCalculateFactory); + // ԼάϢ m_msgQueue = new CMsgQueue(); m_msgQueue_Query = new CMsgQueue(); - m_msgQueue_Query->Register((void*)Query, this); + m_msgQueue_Query->Register(Query); m_msgQueue_Query->StartThread(); - - m_remoteQueue = nullptr; } CMdUserApi::~CMdUserApi(void) @@ -98,8 +102,8 @@ void CMdUserApi::Register(void* pCallback, void* pClass) if (m_msgQueue == nullptr) return; - m_msgQueue_Query->Register((void*)Query,this); - m_msgQueue->Register(pCallback,this); + m_msgQueue_Query->Register(Query); + m_msgQueue->Register((fnOnResponse)pCallback); if (pCallback) { m_msgQueue_Query->StartThread(); @@ -123,7 +127,7 @@ bool CMdUserApi::IsErrorRspInfo(const char* szSource, CSecurityFtdcRspInfoField strcpy(pField->Text, pRspInfo->ErrorMsg); strcpy(pField->Source, szSource); - m_msgQueue->Input_NoCopy(ResponeType::OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); } return bRet; } @@ -166,7 +170,7 @@ int CMdUserApi::_Init() m_pApi = CSecurityFtdcMdApi::CreateFtdcMdApi(pszPath); delete[] pszPath; - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); if (m_pApi) { @@ -190,7 +194,7 @@ int CMdUserApi::_Init() //ʼ m_pApi->Init(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); } return 0; @@ -210,7 +214,7 @@ void CMdUserApi::ReqUserLogin() int CMdUserApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); return m_pApi->ReqUserLogin((CSecurityFtdcReqUserLoginField*)ptr1, ++m_lRequestID); } @@ -220,7 +224,7 @@ void CMdUserApi::Disconnect() if (m_msgQueue_Query) { m_msgQueue_Query->StopThread(); - m_msgQueue_Query->Register(nullptr,nullptr); + m_msgQueue_Query->Register(nullptr); m_msgQueue_Query->Clear(); delete m_msgQueue_Query; m_msgQueue_Query = nullptr; @@ -234,7 +238,7 @@ void CMdUserApi::Disconnect() // ȫֻһ m_msgQueue->Clear(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); // m_msgQueue->Process(); } @@ -243,110 +247,105 @@ void CMdUserApi::Disconnect() if (m_msgQueue) { m_msgQueue->StopThread(); - m_msgQueue->Register(nullptr,nullptr); + m_msgQueue->Register(nullptr); m_msgQueue->Clear(); delete m_msgQueue; m_msgQueue = nullptr; } - // - if (m_remoteQueue) + if (m_pSubscribeManager) + { + delete m_pSubscribeManager; + m_pSubscribeManager = nullptr; + } + if (m_pSyntheticConfig) + { + delete m_pSyntheticConfig; + m_pSyntheticConfig = nullptr; + } + if (m_pSyntheticManager) { - m_remoteQueue->StopThread(); - m_remoteQueue->Register(nullptr, nullptr); - m_remoteQueue->Clear(); - delete m_remoteQueue; - m_remoteQueue = nullptr; + delete m_pSyntheticManager; + m_pSyntheticManager = nullptr; + } + if (m_pCalculateFactory) + { + delete m_pCalculateFactory; + m_pCalculateFactory = nullptr; } } +void CMdUserApi::Subscribe(const string& szInstrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + set ss_new = m_pSubscribeManager->String2Set(szInstrumentIDs.c_str()); + Subscribe(ss_new, szExchangeID); +} -void CMdUserApi::Subscribe(const string& szInstrumentIDs, const string& szExchageID) +void CMdUserApi::Subscribe(const set& instrumentIDs, const string& szExchangeID) { if(nullptr == m_pApi) return; - vector vct; - set st; + if (instrumentIDs.size() == 0) + return; - lock_guard cl(m_csMapInstrumentIDs); + set s_dif = m_pSubscribeManager->Subscribe(instrumentIDs, szExchangeID); + string str_dif = m_pSubscribeManager->Set2String(s_dif); - set _setInstrumentIDs; - map >::iterator it = m_mapInstrumentIDs.find(szExchageID); - if (it != m_mapInstrumentIDs.end()) - { - _setInstrumentIDs = it->second; - } - - char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, 1, _setInstrumentIDs); - m_mapInstrumentIDs[szExchageID] = _setInstrumentIDs; + vector vct; + char* pBuf = m_pSubscribeManager->String2Buf(str_dif.c_str(), vct); - if(vct.size()>0) + if (vct.size() > 0) { //תַ char** pArray = new char*[vct.size()]; - for (size_t j = 0; jSubscribeMarketData(pArray, (int)vct.size(), (char*)(szExchageID.c_str())); + m_pApi->SubscribeMarketData(pArray, (int)vct.size(), (char*)(szExchangeID.c_str())); delete[] pArray; } delete[] pBuf; } -void CMdUserApi::Subscribe(const set& instrumentIDs, const string& szExchageID) +void CMdUserApi::Unsubscribe(const string& szInstrumentIDs, const string& szExchangeID) { - if(nullptr == m_pApi) + if (nullptr == m_pApi) return; - string szInstrumentIDs; - for(set::iterator i=instrumentIDs.begin();i!=instrumentIDs.end();++i) - { - szInstrumentIDs.append(*i); - szInstrumentIDs.append(";"); - } - - if (szInstrumentIDs.length()>1) - { - Subscribe(szInstrumentIDs, szExchageID); - } + set ss_new = m_pSubscribeManager->String2Set(szInstrumentIDs.c_str()); + Unsubscribe(ss_new, szExchangeID); } -void CMdUserApi::Unsubscribe(const string& szInstrumentIDs, const string& szExchageID) +void CMdUserApi::Unsubscribe(const set& instrumentIDs, const string& szExchangeID) { - if(nullptr == m_pApi) + if (nullptr == m_pApi) return; - vector vct; - set st; - - lock_guard cl(m_csMapInstrumentIDs); + if (instrumentIDs.size() == 0) + return; - set _setInstrumentIDs; - map >::iterator it = m_mapInstrumentIDs.find(szExchageID); - if (it != m_mapInstrumentIDs.end()) - { - _setInstrumentIDs = it->second; - } + set s_dif = m_pSubscribeManager->Unsubscribe(instrumentIDs, szExchangeID); + string str_dif = m_pSubscribeManager->Set2String(s_dif); - char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, -1, _setInstrumentIDs); - m_mapInstrumentIDs[szExchageID] = _setInstrumentIDs; + vector vct; + char* pBuf = m_pSubscribeManager->String2Buf(str_dif.c_str(), vct); - if(vct.size()>0) + if (vct.size() > 0) { //תַ char** pArray = new char*[vct.size()]; - for (size_t j = 0; jUnSubscribeMarketData(pArray, (int)vct.size(), (char*)(szExchageID.c_str())); + m_pApi->UnSubscribeMarketData(pArray, (int)vct.size(), (char*)(szExchangeID.c_str())); delete[] pArray; } @@ -355,7 +354,7 @@ void CMdUserApi::Unsubscribe(const string& szInstrumentIDs, const string& szExch void CMdUserApi::OnFrontConnected() { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); //ӳɹԶ¼ ReqUserLogin(); @@ -368,7 +367,7 @@ void CMdUserApi::OnFrontDisconnected(int nReason) pField->RawErrorID = nReason; GetOnFrontDisconnectedMsg(nReason, pField->Text); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); } void CMdUserApi::OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) @@ -385,30 +384,24 @@ void CMdUserApi::OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, C sprintf(pField->SessionID, "%d:%d", pRspUserLogin->FrontID, pRspUserLogin->SessionID); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); //пܶˣǶ¶ - map > mapOld = m_mapInstrumentIDs;//ϴζĵĺԼ - - for (map >::iterator i = mapOld.begin(); i != mapOld.end(); ++i) + set exchanges = m_pSubscribeManager->GetExchanges(); + for (auto exchange = exchanges.begin(); exchange != exchanges.end(); ++exchange) { - string strkey = i->first; - set setValue = i->second; - - Subscribe(setValue, strkey);// + set mapOld = m_pSubscribeManager->GetParentInstruments(exchange->data());//ϴζĵĺԼ + m_pSubscribeManager->Clear(); + Subscribe(mapOld, exchange->data());// } - - //пܶˣǶ¶ - //mapOld = m_setQuoteInstrumentIDs;//ϴζĵĺԼ - //SubscribeQuote(mapOld, "");// } else { pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); } } @@ -423,17 +416,6 @@ void CMdUserApi::OnRspSubMarketData(CSecurityFtdcSpecificInstrumentField *pSpeci if (!IsErrorRspInfo("OnRspSubMarketData", pRspInfo, nRequestID, bIsLast) &&pSpecificInstrument) { - lock_guard cl(m_csMapInstrumentIDs); - - set _setInstrumentIDs; - map >::iterator it = m_mapInstrumentIDs.find(pSpecificInstrument->ExchangeID); - if (it != m_mapInstrumentIDs.end()) - { - _setInstrumentIDs = it->second; - } - - _setInstrumentIDs.insert(pSpecificInstrument->InstrumentID); - m_mapInstrumentIDs[pSpecificInstrument->ExchangeID] = _setInstrumentIDs; } } @@ -443,16 +425,6 @@ void CMdUserApi::OnRspUnSubMarketData(CSecurityFtdcSpecificInstrumentField *pSpe if (!IsErrorRspInfo("OnRspUnSubMarketData", pRspInfo, nRequestID, bIsLast) &&pSpecificInstrument) { - lock_guard cl(m_csMapInstrumentIDs); - - set _setInstrumentIDs; - map >::iterator it = m_mapInstrumentIDs.find(pSpecificInstrument->ExchangeID); - if (it != m_mapInstrumentIDs.end()) - { - _setInstrumentIDs = it->second; - } - _setInstrumentIDs.erase(pSpecificInstrument->InstrumentID); - m_mapInstrumentIDs[pSpecificInstrument->ExchangeID] = _setInstrumentIDs; } } @@ -463,6 +435,7 @@ void CMdUserApi::OnRtnDepthMarketData(CSecurityFtdcDepthMarketDataField *pDepthM strcpy(pField->InstrumentID, pDepthMarketData->InstrumentID); + strcpy(pField->ExchangeID, pDepthMarketData->ExchangeID); pField->Exchange = TSecurityFtdcExchangeIDType_2_ExchangeType(pDepthMarketData->ExchangeID); sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pDepthMarketData->ExchangeID); @@ -542,9 +515,9 @@ void CMdUserApi::OnRtnDepthMarketData(CSecurityFtdcDepthMarketDataField *pDepthM #ifdef _REMOTE if (m_remoteQueue) { - m_remoteQueue->Input_Copy(ResponeType::OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); + m_remoteQueue->Input_Copy(ResponseType::ResponseType_OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); } #endif - m_msgQueue->Input_NoCopy(ResponeType::OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); } diff --git a/QuantBox_LTS_Quote_v2/MdUserApi.h b/apis/LTS_Quote_v2/MdUserApi.h similarity index 68% rename from QuantBox_LTS_Quote_v2/MdUserApi.h rename to apis/LTS_Quote_v2/MdUserApi.h index 6452742..b9fdafd 100644 --- a/QuantBox_LTS_Quote_v2/MdUserApi.h +++ b/apis/LTS_Quote_v2/MdUserApi.h @@ -1,14 +1,15 @@ #pragma once -#include "../include/ApiStruct.h" -#include "../include/LTS_v2/SecurityFtdcMdApi.h" +#include "../../include/CrossPlatform.h" +#include "../../include/ApiStruct.h" +#include "../../include/LTS_v2/SecurityFtdcMdApi.h" +#ifndef USE_CMAKE #ifdef _WIN64 -#pragma comment(lib, "../include/LTS_v2/win64/securitymduserapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x64.lib") + #pragma comment(lib, "../../include/LTS_v2/win64/securitymduserapi.lib") #else -#pragma comment(lib, "../include/LTS_v2/win32/securitymduserapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") + #pragma comment(lib, "../../include/LTS_v2/win32/securitymduserapi.lib") +#endif #endif #include @@ -21,6 +22,11 @@ using namespace std; class CMsgQueue; +class CSubscribeManager; +class CSyntheticConfig; +class CSyntheticManager; +class CSyntheticCalculateFactory; + class CMdUserApi : public CSecurityFtdcMdSpi { @@ -41,11 +47,8 @@ class CMdUserApi : UserInfoField* pUserInfo); void Disconnect(); - void Subscribe(const string& szInstrumentIDs, const string& szExchageID); - void Unsubscribe(const string& szInstrumentIDs, const string& szExchageID); - - //void SubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); - //void UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); + void Subscribe(const string& szInstrumentIDs, const string& szExchangeID); + void Unsubscribe(const string& szInstrumentIDs, const string& szExchangeID); private: friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); @@ -57,8 +60,9 @@ class CMdUserApi : int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); // - void Subscribe(const set& instrumentIDs, const string& szExchageID); - //void SubscribeQuote(const set& instrumentIDs, const string& szExchageID); + void Subscribe(const set& instrumentIDs, const string& szExchangeID); + void Unsubscribe(const set& instrumentIDs, const string& szExchangeID); + virtual void OnFrontConnected(); virtual void OnFrontDisconnected(int nReason); virtual void OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); @@ -68,10 +72,6 @@ class CMdUserApi : virtual void OnRspUnSubMarketData(CSecurityFtdcSpecificInstrumentField *pSpecificInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); virtual void OnRtnDepthMarketData(CSecurityFtdcDepthMarketDataField *pDepthMarketData); - //virtual void OnRspSubForQuoteRsp(CSecurityFtdcSpecificInstrumentField *pSpecificInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRspUnSubForQuoteRsp(CSecurityFtdcSpecificInstrumentField *pSpecificInstrument, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); - //virtual void OnRtnForQuoteRsp(CSecurityFtdcForQuoteRspField *pForQuoteRsp); - //Ƿ bool IsErrorRspInfo(const char* szSource, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);//Ϣ͵Ϣ bool IsErrorRspInfo(CSecurityFtdcRspInfoField *pRspInfo);//ͳϢ @@ -82,8 +82,6 @@ class CMdUserApi : atomic m_lRequestID; //IDÿǰ - map > m_mapInstrumentIDs; //ڶĵĺԼ - map > m_mapQuoteInstrumentIDs; //ڶĵĺԼ CSecurityFtdcMdApi* m_pApi; //API string m_szPath; //ļ· @@ -95,6 +93,9 @@ class CMdUserApi : CMsgQueue* m_msgQueue_Query; void* m_pClass; - CMsgQueue* m_remoteQueue; + CSubscribeManager* m_pSubscribeManager; + CSyntheticConfig* m_pSyntheticConfig; + CSyntheticManager* m_pSyntheticManager; + CSyntheticCalculateFactory* m_pCalculateFactory; }; diff --git a/QuantBox_LTS_Quote_v2/ReadMe.txt b/apis/LTS_Quote_v2/ReadMe.txt similarity index 100% rename from QuantBox_LTS_Quote_v2/ReadMe.txt rename to apis/LTS_Quote_v2/ReadMe.txt diff --git a/QuantBox_Queue/dllmain.cpp b/apis/LTS_Quote_v2/dllmain.cpp similarity index 100% rename from QuantBox_Queue/dllmain.cpp rename to apis/LTS_Quote_v2/dllmain.cpp diff --git a/QuantBox_LTS_Quote_v2/main.cpp b/apis/LTS_Quote_v2/main.cpp similarity index 76% rename from QuantBox_LTS_Quote_v2/main.cpp rename to apis/LTS_Quote_v2/main.cpp index 73c32e0..3a37946 100644 --- a/QuantBox_LTS_Quote_v2/main.cpp +++ b/apis/LTS_Quote_v2/main.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" -#include "../include/ApiHeader.h" - -#include "../include/QueueEnum.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" #include "MdUserApi.h" inline CMdUserApi* GetApi(void* pApi) @@ -14,13 +13,13 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do RequestType rt = (RequestType)type; switch (rt) { - case GetApiType: + case RequestType_GetApiTypes: return (void*)(ApiType::ApiType_MarketData); - case GetApiVersion: + case RequestType_GetApiVersion: return (void*)"0.1.0.20151112"; - case GetApiName: + case RequestType_GetApiName: return (void*)"LTS2"; - case Create: + case RequestType_Create: return new CMdUserApi(); default: break; @@ -34,22 +33,22 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do switch (rt) { - case Release: + case RequestType_Release: delete pApi; return nullptr; - case Register: + case RequestType_Register: pApi->Register(ptr1, ptr2); break; - case Connect: + case RequestType_Connect: pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2); break; - case Disconnect: + case RequestType_Disconnect: pApi->Disconnect(); break; - case Subscribe: + case RequestType_Subscribe: pApi->Subscribe((const char*)ptr1, (const char*)ptr2); break; - case Unsubscribe: + case RequestType_Unsubscribe: pApi->Unsubscribe((const char*)ptr1, (const char*)ptr2); break; //case SubscribeQuote: diff --git a/QuantBox_LTS_Quote_v2/stdafx.cpp b/apis/LTS_Quote_v2/stdafx.cpp similarity index 100% rename from QuantBox_LTS_Quote_v2/stdafx.cpp rename to apis/LTS_Quote_v2/stdafx.cpp diff --git a/QuantBox_LTS_Quote_v2/stdafx.h b/apis/LTS_Quote_v2/stdafx.h similarity index 100% rename from QuantBox_LTS_Quote_v2/stdafx.h rename to apis/LTS_Quote_v2/stdafx.h diff --git a/QuantBox_XAPI/targetver.h b/apis/LTS_Quote_v2/targetver.h similarity index 100% rename from QuantBox_XAPI/targetver.h rename to apis/LTS_Quote_v2/targetver.h diff --git a/QuantBox_LTS_Trade_v2/QuantBox_LTS_Trade.cbp b/apis/LTS_Trade_v2/LTS_Trade.cbp similarity index 100% rename from QuantBox_LTS_Trade_v2/QuantBox_LTS_Trade.cbp rename to apis/LTS_Trade_v2/LTS_Trade.cbp diff --git a/apis/LTS_Trade_v2/LTS_Trade_v2.vcxproj b/apis/LTS_Trade_v2/LTS_Trade_v2.vcxproj new file mode 100644 index 0000000..ed4d6b1 --- /dev/null +++ b/apis/LTS_Trade_v2/LTS_Trade_v2.vcxproj @@ -0,0 +1,115 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {683AECBB-89EB-4692-99C5-A527853326D4} + Win32Proj + LTS_Trade + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\LTS_v2 + $(ProjectName)_$(PlatformTarget) + + + false + ..\..\bin\$(Configuration)\$(PlatformTarget)\LTS_v2 + $(ProjectName)_$(PlatformTarget) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;LTS_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;LTS_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + \ No newline at end of file diff --git a/QuantBox_LTS_Trade_v2/QuantBox_LTS_Trade_v2.vcxproj.filters b/apis/LTS_Trade_v2/LTS_Trade_v2.vcxproj.filters similarity index 90% rename from QuantBox_LTS_Trade_v2/QuantBox_LTS_Trade_v2.vcxproj.filters rename to apis/LTS_Trade_v2/LTS_Trade_v2.vcxproj.filters index 65997a2..19a848d 100644 --- a/QuantBox_LTS_Trade_v2/QuantBox_LTS_Trade_v2.vcxproj.filters +++ b/apis/LTS_Trade_v2/LTS_Trade_v2.vcxproj.filters @@ -30,10 +30,10 @@ Header Files - + Header Files - + Header Files @@ -53,10 +53,10 @@ Source Files - + Source Files - + Source Files diff --git a/QuantBox_LTS_Trade_v2/ReadMe.txt b/apis/LTS_Trade_v2/ReadMe.txt similarity index 100% rename from QuantBox_LTS_Trade_v2/ReadMe.txt rename to apis/LTS_Trade_v2/ReadMe.txt diff --git a/QuantBox_LTS_Trade_v2/TraderApi.cpp b/apis/LTS_Trade_v2/TraderApi.cpp similarity index 73% rename from QuantBox_LTS_Trade_v2/TraderApi.cpp rename to apis/LTS_Trade_v2/TraderApi.cpp index 48a1676..a20f61a 100644 --- a/QuantBox_LTS_Trade_v2/TraderApi.cpp +++ b/apis/LTS_Trade_v2/TraderApi.cpp @@ -1,15 +1,14 @@ #include "stdafx.h" #include "TraderApi.h" -#include "../include/QueueEnum.h" -#include "../include/QueueHeader.h" +#include "../../include/QueueEnum.h" -#include "../include/ApiHeader.h" -#include "../include/ApiStruct.h" +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" -#include "../include/toolkit.h" +#include "../../include/toolkit.h" -#include "../QuantBox_Queue/MsgQueue.h" +#include "../../include/queue/MsgQueue.h" #include "TypeConvert.h" @@ -32,32 +31,21 @@ void CTraderApi::QueryInThread(char type, void* pApi1, void* pApi2, double doubl case E_Init: iRet = _Init(); break; - case E_ReqUserLoginField: - iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - case E_AuthRandCodeField: - iRet = _ReqFetchAuthRandCode(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - break; - //case E_QryTradingAccountField: - // iRet = _ReqQryTradingAccount(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryInvestorPositionField: - // iRet = _ReqQryInvestorPosition(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryInstrumentField: - // iRet = _ReqQryInstrument(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryInvestorField: - // iRet = _ReqQryInvestor(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryOrderField: - // iRet = _ReqQryOrder(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - //case E_QryTradeField: - // iRet = _ReqQryTrade(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); - // break; - default: - break; + } + + if (m_pApi) + { + switch (type) + { + case E_ReqUserLoginField: + iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case E_AuthRandCodeField: + iRet = _ReqFetchAuthRandCode(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + default: + break; + } } if (0 == iRet) @@ -81,8 +69,8 @@ void CTraderApi::Register(void* pCallback, void* pClass) if (m_msgQueue == nullptr) return; - m_msgQueue_Query->Register((void*)Query, this); - m_msgQueue->Register(pCallback, this); + m_msgQueue_Query->Register(Query); + m_msgQueue->Register((fnOnResponse)pCallback); if (pCallback) { m_msgQueue_Query->StartThread(); @@ -105,7 +93,7 @@ CTraderApi::CTraderApi(void) m_msgQueue = new CMsgQueue(); m_msgQueue_Query = new CMsgQueue(); - m_msgQueue_Query->Register((void*)Query, this); + m_msgQueue_Query->Register(Query); m_msgQueue_Query->StartThread(); } @@ -126,7 +114,7 @@ bool CTraderApi::IsErrorRspInfo(const char* szSource, CSecurityFtdcRspInfoField strcpy(pField->Text, pRspInfo->ErrorMsg); strcpy(pField->Source, szSource); - m_msgQueue->Input_NoCopy(ResponeType::OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); } return bRet; } @@ -160,7 +148,7 @@ int CTraderApi::_Init() m_pApi = CSecurityFtdcTraderApi::CreateFtdcTraderApi(pszPath); delete[] pszPath; - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); if (m_pApi) { @@ -187,7 +175,7 @@ int CTraderApi::_Init() if (m_ServerInfo.PrivateTopicResumeTypeSubscribePrivateTopic((SECURITY_TE_RESUME_TYPE)m_ServerInfo.PrivateTopicResumeType); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); //初始化连接 m_pApi->Init(); } @@ -200,7 +188,7 @@ void CTraderApi::Disconnect() if (m_msgQueue_Query) { m_msgQueue_Query->StopThread(); - m_msgQueue_Query->Register(nullptr, nullptr); + m_msgQueue_Query->Register(nullptr); m_msgQueue_Query->Clear(); delete m_msgQueue_Query; m_msgQueue_Query = nullptr; @@ -214,7 +202,7 @@ void CTraderApi::Disconnect() // 全清理,只留最后一个 m_msgQueue->Clear(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); // 主动触发 m_msgQueue->Process(); } @@ -222,7 +210,7 @@ void CTraderApi::Disconnect() if (m_msgQueue) { m_msgQueue->StopThread(); - m_msgQueue->Register(nullptr, nullptr); + m_msgQueue->Register(nullptr); m_msgQueue->Clear(); delete m_msgQueue; m_msgQueue = nullptr; @@ -258,7 +246,7 @@ void CTraderApi::Clear() void CTraderApi::OnFrontConnected() { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); //ReqUserLogin(); ReqFetchAuthRandCode(); @@ -272,7 +260,7 @@ void CTraderApi::OnFrontDisconnected(int nReason) pField->RawErrorID = nReason; GetOnFrontDisconnectedMsg(nReason, pField->Text); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); } void CTraderApi::ReqFetchAuthRandCode() @@ -287,7 +275,7 @@ void CTraderApi::ReqFetchAuthRandCode() int CTraderApi::_ReqFetchAuthRandCode(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorizing, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorizing, 0, nullptr, 0, nullptr, 0, nullptr, 0); return m_pApi->ReqFetchAuthRandCode((CSecurityFtdcAuthRandCodeField*)ptr1, ++m_lRequestID); } @@ -298,7 +286,7 @@ void CTraderApi::OnRspFetchAuthRandCode(CSecurityFtdcAuthRandCodeField *pAuthRan if (!IsErrorRspInfo(pRspInfo) && pAuthRandCode) { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorized, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Authorized, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); ReqUserLogin(pAuthRandCode->RandCode); } @@ -307,7 +295,7 @@ void CTraderApi::OnRspFetchAuthRandCode(CSecurityFtdcAuthRandCodeField *pAuthRan pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); } } @@ -328,7 +316,7 @@ void CTraderApi::ReqUserLogin(TSecurityFtdcAuthCodeType RandCode) int CTraderApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) { - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); return m_pApi->ReqUserLogin((CSecurityFtdcReqUserLoginField*)ptr1, ++m_lRequestID); } @@ -344,7 +332,7 @@ void CTraderApi::OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, C sprintf(pField->SessionID, "%d:%d", pRspUserLogin->FrontID, pRspUserLogin->SessionID); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); // 记下登录信息,可能会用到 memcpy(&m_RspUserLogin,pRspUserLogin,sizeof(CSecurityFtdcRspUserLoginField)); @@ -354,7 +342,7 @@ void CTraderApi::OnRspUserLogin(CSecurityFtdcRspUserLoginField *pRspUserLogin, C //ReqSettlementInfoConfirm(); //ReqQryInvestor(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); if (m_ServerInfo.PrivateTopicResumeType > ResumeType::ResumeType_Restart && (m_ServerInfo.PrivateTopicResumeTypeRawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); } } -int CTraderApi::ReqOrderInsert( +char* CTraderApi::ReqOrderInsert( OrderField* pOrder, int count, - OrderIDType* pInOut) + char* pszLocalIDBuf) { int OrderRef = -1; if (nullptr == m_pApi) - return -1; + return nullptr; CSecurityFtdcInputOrderField body = {0}; @@ -506,10 +494,10 @@ int CTraderApi::ReqOrderInsert( strcpy(pField->LocalID, pField->ID); m_id_platform_order.insert(pair(m_orderInsert_Id, pField)); } - strncpy((char*)pInOut, m_orderInsert_Id, sizeof(OrderIDType)); + strncpy(pszLocalIDBuf, m_orderInsert_Id, sizeof(OrderIDType)); } - return nRet; + return pszLocalIDBuf; } void CTraderApi::OnRspOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) @@ -541,7 +529,7 @@ void CTraderApi::OnRspOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSe pField->Status = OrderStatus::OrderStatus_Rejected; pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); } } @@ -575,34 +563,35 @@ void CTraderApi::OnErrRtnOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, pField->Status = OrderStatus::OrderStatus_Rejected; pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); } } void CTraderApi::OnRtnTrade(CSecurityFtdcTradeField *pTrade) { - OnTrade(pTrade,false); + OnTrade(pTrade, 0, true); } -int CTraderApi::ReqOrderAction(OrderIDType* szIds, int count, OrderIDType* pOutput) +char* CTraderApi::ReqOrderAction(OrderIDType* szIds, int count, char* pzsRtn) { unordered_map::iterator it = m_id_api_order.find(szIds[0]); if (it == m_id_api_order.end()) { - sprintf((char*)pOutput, "%d", -100); - return -100; + sprintf(pzsRtn, "%d", -100); } else { // 找到了订单 - return ReqOrderAction(it->second, count, pOutput); + return ReqOrderAction(it->second, count, pzsRtn); } + + return pzsRtn; } -int CTraderApi::ReqOrderAction(CSecurityFtdcOrderField *pOrder, int count, OrderIDType* pOutput) +char* CTraderApi::ReqOrderAction(CSecurityFtdcOrderField *pOrder, int count, char* pzsRtn) { if (nullptr == m_pApi) - return 0; + return nullptr; CSecurityFtdcInputOrderActionField body = {0}; @@ -634,9 +623,9 @@ int CTraderApi::ReqOrderAction(CSecurityFtdcOrderField *pOrder, int count, Order { memset(m_orderAction_Id, 0, sizeof(OrderIDType)); } - strncpy((char*)pOutput, m_orderAction_Id, sizeof(OrderIDType)); + strncpy(pzsRtn, m_orderAction_Id, sizeof(OrderIDType)); - return nRet; + return pzsRtn; } void CTraderApi::OnRspOrderAction(CSecurityFtdcInputOrderActionField *pInputOrderAction, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) @@ -665,7 +654,7 @@ void CTraderApi::OnRspOrderAction(CSecurityFtdcInputOrderActionField *pInputOrde pField->ExecType = ExecType::ExecType_CancelReject; pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); } } @@ -695,13 +684,13 @@ void CTraderApi::OnErrRtnOrderAction(CSecurityFtdcOrderActionField *pOrderAction pField->ExecType = ExecType::ExecType_CancelReject; pField->RawErrorID = pRspInfo->ErrorID; strncpy(pField->Text, pRspInfo->ErrorMsg, sizeof(Char256Type)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); } } void CTraderApi::OnRtnOrder(CSecurityFtdcOrderField *pOrder) { - OnOrder(pOrder,false); + OnOrder(pOrder, 0, true); } void CTraderApi::OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) @@ -709,7 +698,7 @@ void CTraderApi::OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, IsErrorRspInfo("OnRspError", pRspInfo, nRequestID, bIsLast); } -void CTraderApi::OnOrder(CSecurityFtdcOrderField *pOrder, bool bFromQry) +void CTraderApi::OnOrder(CSecurityFtdcOrderField *pOrder, int nRequestID, bool bIsLast) { if (nullptr == pOrder) return; @@ -744,59 +733,61 @@ void CTraderApi::OnOrder(CSecurityFtdcOrderField *pOrder, bool bFromQry) { // 从API的订单转换成自己的结构体 - - OrderField* pField = nullptr; - unordered_map::iterator it = m_id_platform_order.find(orderId); - if (it == m_id_platform_order.end()) + if (nRequestID == 0) { - // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 - pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + OrderField* pField = nullptr; + unordered_map::iterator it = m_id_platform_order.find(orderId); + if (it == m_id_platform_order.end()) + { + // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 + pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); - strcpy(pField->ID, orderId); - strcpy(pField->LocalID, pField->ID); - strcpy(pField->InstrumentID, pOrder->InstrumentID); - strcpy(pField->ExchangeID, pOrder->ExchangeID); - pField->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pOrder->CombHedgeFlag[0]); - pField->Side = TSecurityFtdcDirectionType_2_OrderSide(pOrder->Direction); - pField->Price = atof(pOrder->LimitPrice); - pField->StopPx = pOrder->StopPrice; - strncpy(pField->Text, pOrder->StatusMsg, sizeof(Char256Type)); - pField->OpenClose = TSecurityFtdcOffsetFlagType_2_OpenCloseType(pOrder->CombOffsetFlag[0]); - pField->Status = CSecurityFtdcOrderField_2_OrderStatus(pOrder); - pField->Qty = pOrder->VolumeTotalOriginal; - pField->Type = CSecurityFtdcOrderField_2_OrderType(pOrder); - pField->TimeInForce = CSecurityFtdcOrderField_2_TimeInForce(pOrder); - pField->ExecType = ExecType::ExecType_New; - strcpy(pField->OrderID, pOrder->OrderSysID); + // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 + CSecurityFtdcOrderField_2_OrderField_0(orderId, pOrder, pField); - // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 - m_id_platform_order.insert(pair(orderId, pField)); + // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 + m_id_platform_order.insert(pair(orderId, pField)); + } + else + { + pField = it->second; + strcpy(pField->ID, orderId); + strcpy(pField->LocalID, pField->ID); + pField->LeavesQty = pOrder->VolumeTotal; + pField->Price = atof(pOrder->LimitPrice); + pField->Status = CSecurityFtdcOrderField_2_OrderStatus(pOrder); + pField->ExecType = CSecurityFtdcOrderField_2_ExecType(pOrder); + strcpy(pField->OrderID, pOrder->OrderSysID); + strncpy(pField->Text, pOrder->StatusMsg, sizeof(Char256Type)); + } + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); } else { - pField = it->second; - strcpy(pField->ID, orderId); - strcpy(pField->LocalID, pField->ID); - pField->LeavesQty = pOrder->VolumeTotal; - pField->Price = atof(pOrder->LimitPrice); - pField->Status = CSecurityFtdcOrderField_2_OrderStatus(pOrder); - pField->ExecType = CSecurityFtdcOrderField_2_ExecType(pOrder); - strcpy(pField->OrderID, pOrder->OrderSysID); - strncpy(pField->Text, pOrder->StatusMsg, sizeof(Char256Type)); - } + OrderField* pField = nullptr; + pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); - m_msgQueue->Input_Copy(ResponeType::OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + // 开盘时发单信息还没有,所以找不到对应的单子,需要进行Order的恢复 + CSecurityFtdcOrderField_2_OrderField_0(orderId, pOrder, pField); + + // 添加到map中,用于其它工具的读取,撤单失败时的再通知等 + //m_id_platform_order.insert(pair(orderId, pField)); + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryOrder, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + + m_msgQueue->delete_block(pField); + } } } -void CTraderApi::OnTrade(CSecurityFtdcTradeField *pTrade, bool bFromQry) +void CTraderApi::OnTrade(CSecurityFtdcTradeField *pTrade, int nRequestID, bool bIsLast) { if (nullptr == pTrade) return; TradeField* pField = (TradeField*)m_msgQueue->new_block(sizeof(TradeField)); - strcpy(pField->InstrumentID, pTrade->InstrumentID); strcpy(pField->ExchangeID, pTrade->ExchangeID); pField->Side = TSecurityFtdcDirectionType_2_OrderSide(pTrade->Direction); @@ -808,39 +799,49 @@ void CTraderApi::OnTrade(CSecurityFtdcTradeField *pTrade, bool bFromQry) pField->Time = GetTime(pTrade->TradeTime); strcpy(pField->TradeID, pTrade->TradeID); - OrderIDType orderSysId = { 0 }; - sprintf(orderSysId, "%s:%s", pTrade->ExchangeID, pTrade->OrderSysID); - unordered_map::iterator it = m_sysId_orderId.find(orderSysId); - if (it == m_sysId_orderId.end()) + if (nRequestID == 0) { - // 此成交找不到对应的报单 - //assert(false); - } - else - { - // 找到对应的报单 - strcpy(pField->ID, it->second.c_str()); - - m_msgQueue->Input_Copy(ResponeType::OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); - - unordered_map::iterator it2 = m_id_platform_order.find(it->second); - if (it2 == m_id_platform_order.end()) + OrderIDType orderSysId = { 0 }; + sprintf(orderSysId, "%s:%s", pTrade->ExchangeID, pTrade->OrderSysID); + unordered_map::iterator it = m_sysId_orderId.find(orderSysId); + if (it == m_sysId_orderId.end()) { // 此成交找不到对应的报单 //assert(false); } else { - // 更新订单的状态 - // 是否要通知接口 - } + // 找到对应的报单 + strcpy(pField->ID, it->second.c_str()); + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); + + unordered_map::iterator it2 = m_id_platform_order.find(it->second); + if (it2 == m_id_platform_order.end()) + { + // 此成交找不到对应的报单 + //assert(false); + } + else + { + // 更新订单的状态 + // 是否要通知接口 + } - // 查询与交易分离,所以本地计算更新持仓的功能失效 - //OnTrade(pField, bFromQry); + // 本地更新持仓的功能失效 + //OnTrade(pField); + } + } + else + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryTrade, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); } + + // 清理内存 + m_msgQueue->delete_block(pField); } -void CTraderApi::OnTrade(TradeField *pTrade, bool bFromQry) +void CTraderApi::OnTrade(TradeField *pTrade) { PositionIDType positionId = { 0 }; sprintf(positionId, "%s:%s:%d:%d", @@ -896,5 +897,5 @@ void CTraderApi::OnTrade(TradeField *pTrade, bool bFromQry) //} } - m_msgQueue->Input_Copy(ResponeType::OnRspQryInvestorPosition, m_msgQueue, m_pClass, false, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, false, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); } \ No newline at end of file diff --git a/QuantBox_LTS_Trade_v2/TraderApi.h b/apis/LTS_Trade_v2/TraderApi.h similarity index 92% rename from QuantBox_LTS_Trade_v2/TraderApi.h rename to apis/LTS_Trade_v2/TraderApi.h index 1b64f01..c15f6c4 100644 --- a/QuantBox_LTS_Trade_v2/TraderApi.h +++ b/apis/LTS_Trade_v2/TraderApi.h @@ -1,14 +1,15 @@ #pragma once -#include "../include/LTS_v2/SecurityFtdcTraderApi.h" -#include "../include/ApiStruct.h" +#include "../../include/CrossPlatform.h" +#include "../../include/LTS_v2/SecurityFtdcTraderApi.h" +#include "../../include/ApiStruct.h" +#ifndef USE_CMAKE #ifdef _WIN64 -#pragma comment(lib, "../include/LTS_v2/win64/securitytraderapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x64.lib") + #pragma comment(lib, "../../include/LTS_v2/win64/securitytraderapi.lib") #else -#pragma comment(lib, "../include/LTS_v2/win32/securitytraderapi.lib") -#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") + #pragma comment(lib, "../../include/LTS_v2/win32/securitytraderapi.lib") +#endif #endif #include @@ -30,7 +31,7 @@ class CTraderApi : //请求数据包类型 enum RequestType { - E_Init, + E_Init = 100, E_ReqAuthenticateField, E_ReqUserLoginField, @@ -67,13 +68,13 @@ class CTraderApi : UserInfoField* pUserInfo); void Disconnect(); - int ReqOrderInsert( + char* ReqOrderInsert( OrderField* pOrder, int count, - OrderIDType* pInOut); + char* pszLocalIDBuf); - int ReqOrderAction(OrderIDType* szIds, int count, OrderIDType* pOutput); - int ReqOrderAction(CSecurityFtdcOrderField *pOrder, int count, OrderIDType* pOutput); + char* ReqOrderAction(OrderIDType* szIds, int count, char* pzsRtn); + char* ReqOrderAction(CSecurityFtdcOrderField *pOrder, int count, char* pzsRtn); int ReqQuoteInsert( int QuoteRef, @@ -120,9 +121,9 @@ class CTraderApi : //int _ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); //int _ReqQryQuote(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); - void OnOrder(CSecurityFtdcOrderField *pOrder, bool bFromQry); - void OnTrade(CSecurityFtdcTradeField *pTrade, bool bFromQry); - void OnTrade(TradeField *pTrade, bool bFromQry); + void OnOrder(CSecurityFtdcOrderField *pOrder, int nRequestID, bool bIsLast); + void OnTrade(CSecurityFtdcTradeField *pTrade, int nRequestID, bool bIsLast); + void OnTrade(TradeField *pTrade); //检查是否出错 bool IsErrorRspInfo(const char* szSource, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);//向消息队列输出信息 diff --git a/QuantBox_LTS_Trade_v2/TypeConvert.cpp b/apis/LTS_Trade_v2/TypeConvert.cpp similarity index 86% rename from QuantBox_LTS_Trade_v2/TypeConvert.cpp rename to apis/LTS_Trade_v2/TypeConvert.cpp index 186afe9..81f5c02 100644 --- a/QuantBox_LTS_Trade_v2/TypeConvert.cpp +++ b/apis/LTS_Trade_v2/TypeConvert.cpp @@ -5,7 +5,7 @@ #include -#include "../include/ChinaStock.h" +#include "../../include/ChinaStock.h" /// OpenQuant FIXһЧ򵥣Ҫô /// һӵij״̬ģµֳɽȫɽ /// EmitAccept,EmitFill @@ -245,7 +245,7 @@ InstrumentType CSecurityFtdcInstrumentField_2_InstrumentType(CSecurityFtdcInstru } if (pIn->ExchangeID[1] == 'Z') { - return InstrumentID_2_InstrumentType_SZE(atoi(pIn->InstrumentID)); + return InstrumentID_2_InstrumentType_SZSE(atoi(pIn->InstrumentID)); } else { @@ -267,7 +267,7 @@ PriceType CSecurityFtdcInstrumentField_2_PriceTick(CSecurityFtdcInstrumentField* if (pIn->ExchangeID[1] == 'Z') { - return InstrumentID_2_PriceTick_SZE(atoi(pIn->InstrumentID)); + return InstrumentID_2_PriceTick_SZSE(atoi(pIn->InstrumentID)); } else { @@ -307,3 +307,26 @@ ExchangeType TSecurityFtdcExchangeIDType_2_ExchangeType(TSecurityFtdcExchangeIDT return ExchangeType::ExchangeType_Undefined; } } + +void CSecurityFtdcOrderField_2_OrderField_0(OrderIDType OrderID, CSecurityFtdcOrderField* pIn, OrderField* pOut) +{ + strcpy(pOut->ID, OrderID); + strcpy(pOut->LocalID, pOut->ID); + strcpy(pOut->InstrumentID, pIn->InstrumentID); + strcpy(pOut->ExchangeID, pIn->ExchangeID); + pOut->HedgeFlag = TSecurityFtdcHedgeFlagType_2_HedgeFlagType(pIn->CombHedgeFlag[0]); + pOut->Side = TSecurityFtdcDirectionType_2_OrderSide(pIn->Direction); + pOut->Price = atof(pIn->LimitPrice); + pOut->StopPx = pIn->StopPrice; + strncpy(pOut->Text, pIn->StatusMsg, sizeof(Char256Type)); + pOut->OpenClose = TSecurityFtdcOffsetFlagType_2_OpenCloseType(pIn->CombOffsetFlag[0]); + pOut->Status = CSecurityFtdcOrderField_2_OrderStatus(pIn); + pOut->Qty = pIn->VolumeTotalOriginal; + pOut->CumQty = pIn->VolumeTraded; + pOut->LeavesQty = pIn->VolumeTotal; + pOut->Type = CSecurityFtdcOrderField_2_OrderType(pIn); + pOut->TimeInForce = CSecurityFtdcOrderField_2_TimeInForce(pIn); + pOut->ExecType = CSecurityFtdcOrderField_2_ExecType(pIn); + strcpy(pOut->OrderID, pIn->OrderSysID); + strncpy(pOut->Text, pIn->StatusMsg, sizeof(Char256Type)); +} diff --git a/QuantBox_LTS_Trade_v2/TypeConvert.h b/apis/LTS_Trade_v2/TypeConvert.h similarity index 83% rename from QuantBox_LTS_Trade_v2/TypeConvert.h rename to apis/LTS_Trade_v2/TypeConvert.h index 107efaa..0b9664b 100644 --- a/QuantBox_LTS_Trade_v2/TypeConvert.h +++ b/apis/LTS_Trade_v2/TypeConvert.h @@ -1,8 +1,8 @@ #pragma once -#include "../include/LTS_v2/SecurityFtdcUserApiDataType.h" -#include "../include/LTS_v2/SecurityFtdcUserApiStruct.h" -#include "../include/ApiStruct.h" +#include "../../include/LTS_v2/SecurityFtdcUserApiDataType.h" +#include "../../include/LTS_v2/SecurityFtdcUserApiStruct.h" +#include "../../include/ApiStruct.h" HedgeFlagType TSecurityFtdcHedgeFlagType_2_HedgeFlagType(TSecurityFtdcHedgeFlagType In); @@ -29,4 +29,6 @@ PriceType CSecurityFtdcInstrumentField_2_PriceTick(CSecurityFtdcInstrumentField* IdCardType TSecurityFtdcIdCardTypeType_2_IdCardType(TSecurityFtdcIdCardTypeType In); -ExchangeType TSecurityFtdcExchangeIDType_2_ExchangeType(TSecurityFtdcExchangeIDType In); \ No newline at end of file +ExchangeType TSecurityFtdcExchangeIDType_2_ExchangeType(TSecurityFtdcExchangeIDType In); + +void CSecurityFtdcOrderField_2_OrderField_0(OrderIDType OrderID, CSecurityFtdcOrderField* pIn, OrderField* pOut); \ No newline at end of file diff --git a/QuantBox_Tdx_Trade/dllmain.cpp b/apis/LTS_Trade_v2/dllmain.cpp similarity index 100% rename from QuantBox_Tdx_Trade/dllmain.cpp rename to apis/LTS_Trade_v2/dllmain.cpp diff --git a/QuantBox_LTS_Trade_v2/main.cpp b/apis/LTS_Trade_v2/main.cpp similarity index 78% rename from QuantBox_LTS_Trade_v2/main.cpp rename to apis/LTS_Trade_v2/main.cpp index 18f21b4..b34cff6 100644 --- a/QuantBox_LTS_Trade_v2/main.cpp +++ b/apis/LTS_Trade_v2/main.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -#include "../include/ApiHeader.h" -#include "../include/QueueEnum.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" #include "TraderApi.h" inline CTraderApi* GetApi(void* pApi) @@ -13,13 +13,13 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do RequestType rt = (RequestType)type; switch (rt) { - case GetApiType: + case RequestType_GetApiTypes: return (void*)(ApiType::ApiType_Trade); - case GetApiVersion: + case RequestType_GetApiVersion: return (void*)"0.2.0.20151116"; - case GetApiName: + case RequestType_GetApiName: return (void*)"LTS2"; - case Create: + case RequestType_Create: return new CTraderApi(); default: break; @@ -34,16 +34,16 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do switch (rt) { - case Release: + case RequestType_Release: delete pApi; return nullptr; - case Register: + case RequestType_Register: pApi->Register(ptr1, ptr2); break; - case Connect: + case RequestType_Connect: pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2); break; - case Disconnect: + case RequestType_Disconnect: pApi->Disconnect(); break; //case ReqQryInstrument: @@ -58,12 +58,12 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do //case ReqQrySettlementInfo: // pApi->ReqQrySettlementInfo((const char*)ptr1); // break; - case ReqOrderInsert: - return (void*)pApi->ReqOrderInsert((OrderField*)ptr1, size1, (OrderIDType*)ptr2); + case RequestType_ReqOrderInsert: + return (void*)pApi->ReqOrderInsert((OrderField*)ptr1, size1, (char*)ptr2); //case ReqQuoteInsert: // return (void*)pApi->ReqQuoteInsert((int)double1, (OrderField*)ptr1, (OrderField*)ptr2); - case ReqOrderAction: - return (void*)pApi->ReqOrderAction((OrderIDType*)ptr1, size1, (OrderIDType*)ptr2); + case RequestType_ReqOrderAction: + return (void*)pApi->ReqOrderAction((OrderIDType*)ptr1, size1, (char*)ptr2); break; default: break; diff --git a/QuantBox_LTS_Trade_v2/stdafx.cpp b/apis/LTS_Trade_v2/stdafx.cpp similarity index 100% rename from QuantBox_LTS_Trade_v2/stdafx.cpp rename to apis/LTS_Trade_v2/stdafx.cpp diff --git a/QuantBox_LTS_Trade_v2/stdafx.h b/apis/LTS_Trade_v2/stdafx.h similarity index 100% rename from QuantBox_LTS_Trade_v2/stdafx.h rename to apis/LTS_Trade_v2/stdafx.h diff --git a/QuantBox_XAPI_TEST/targetver.h b/apis/LTS_Trade_v2/targetver.h similarity index 100% rename from QuantBox_XAPI_TEST/targetver.h rename to apis/LTS_Trade_v2/targetver.h diff --git a/apis/Sgit_Quote/Include.h b/apis/Sgit_Quote/Include.h new file mode 100644 index 0000000..ef5a437 --- /dev/null +++ b/apis/Sgit_Quote/Include.h @@ -0,0 +1,29 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.1.0.20161121" +#define API_NAME "Sgit" +#define DLL_PUBLIC_KEY "" + + +#include "../../include/CrossPlatform.h" +#include "../../include/Sgit/SgitFtdcUserApiDataType.h" +#include "../../include/Sgit/SgitFtdcUserApiStruct.h" +#include "../../include/Sgit/SgitFtdcMdApi.h" + +using namespace fstech; + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/Sgit/win64/sgitquotapi.lib") +#else + #pragma comment(lib, "../../include/Sgit/win32/sgitquotapi.lib") +#endif +#endif + +// +#include "../CTP/include_pub.h" diff --git a/apis/Sgit_Quote/ReadMe.txt b/apis/Sgit_Quote/ReadMe.txt new file mode 100644 index 0000000..f803108 --- /dev/null +++ b/apis/Sgit_Quote/ReadMe.txt @@ -0,0 +1,48 @@ +======================================================================== + DYNAMIC LINK LIBRARY : Sgit_Quote Project Overview +======================================================================== + +AppWizard has created this Sgit_Quote DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your Sgit_Quote application. + + +Sgit_Quote.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +Sgit_Quote.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +Sgit_Quote.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named Sgit_Quote.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/apis/Sgit_Quote/Sgit_Quote.vcxproj b/apis/Sgit_Quote/Sgit_Quote.vcxproj new file mode 100644 index 0000000..9ad3097 --- /dev/null +++ b/apis/Sgit_Quote/Sgit_Quote.vcxproj @@ -0,0 +1,208 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {62BD7F43-395B-4A1E-84AC-64135ECF371D} + Win32Proj + Sgit_Quote + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\Sgit + $(ProjectName)_$(PlatformTarget) + ./;$(IncludePath) + + + true + + + false + ./;$(IncludePath) + ..\..\bin\$(Configuration)\$(PlatformTarget)\Sgit + $(ProjectName)_$(PlatformTarget) + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;SGIT_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + Use + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;SGIT_QUOTE_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;SGIT_QUOTE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_WINDOWS;_USRDLL;SGIT_QUOTE_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/apis/Sgit_Quote/Sgit_Quote.vcxproj.filters b/apis/Sgit_Quote/Sgit_Quote.vcxproj.filters new file mode 100644 index 0000000..df889a5 --- /dev/null +++ b/apis/Sgit_Quote/Sgit_Quote.vcxproj.filters @@ -0,0 +1,108 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/QuantBox_XAPI/dllmain.cpp b/apis/Sgit_Quote/dllmain.cpp similarity index 100% rename from QuantBox_XAPI/dllmain.cpp rename to apis/Sgit_Quote/dllmain.cpp diff --git a/apis/Sgit_Quote/stdafx.cpp b/apis/Sgit_Quote/stdafx.cpp new file mode 100644 index 0000000..94b7db6 --- /dev/null +++ b/apis/Sgit_Quote/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Sgit_Quote.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/apis/Sgit_Quote/stdafx.h b/apis/Sgit_Quote/stdafx.h new file mode 100644 index 0000000..f3a0737 --- /dev/null +++ b/apis/Sgit_Quote/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here diff --git a/apis/Sgit_Quote/targetver.h b/apis/Sgit_Quote/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/apis/Sgit_Quote/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/apis/Sgit_Trade/Include.h b/apis/Sgit_Trade/Include.h new file mode 100644 index 0000000..4786e0e --- /dev/null +++ b/apis/Sgit_Trade/Include.h @@ -0,0 +1,34 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define API_VERSION "0.1.0.20161121" +#define API_NAME "Sgit" +#define DLL_PUBLIC_KEY "30819D300D06092A864886F70D010101050003818B0030818702818100DD88CBCCD46787C55F942428A33ED92F1F4BE6EEDFE382E1C8350451382E7E9774942C8B1B02E12A7D34B9832D21134361F51F400E372097F5CFB71F9655EDD8F6F29EBB35D94C7502C04849485389ABD1BCA977E098327435D62413ABC56637C0638C839A2496714BEE502064DACFF621E1B5E5DA101B3BE8879988E4E8D939020111" + +#include "../../include/CrossPlatform.h" +#include "../../include/Sgit/SgitFtdcUserApiDataType.h" +#include "../../include/Sgit/SgitFtdcUserApiStruct.h" +#include "../../include/Sgit/SgitFtdcTraderApi.h" + +using namespace fstech; + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/Sgit/win64/sgittradeapi.lib") +#else + #pragma comment(lib, "../../include/Sgit/win32/sgittradeapi.lib") +#endif +#endif + +// 是否飞鼠API +#define IS_SGIT_API 1 + +// 条件编译 +#include "../CTP/include_pub.h" + +#undef HAS_ExchangeID_Position +#undef HAS_ExchangeID_Quote diff --git a/apis/Sgit_Trade/ReadMe.txt b/apis/Sgit_Trade/ReadMe.txt new file mode 100644 index 0000000..5058c23 --- /dev/null +++ b/apis/Sgit_Trade/ReadMe.txt @@ -0,0 +1,48 @@ +======================================================================== + DYNAMIC LINK LIBRARY : Sgit_Trade Project Overview +======================================================================== + +AppWizard has created this Sgit_Trade DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your Sgit_Trade application. + + +Sgit_Trade.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +Sgit_Trade.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +Sgit_Trade.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named Sgit_Trade.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/apis/Sgit_Trade/Sgit_Trade.vcxproj b/apis/Sgit_Trade/Sgit_Trade.vcxproj new file mode 100644 index 0000000..b9b91e8 --- /dev/null +++ b/apis/Sgit_Trade/Sgit_Trade.vcxproj @@ -0,0 +1,196 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {B8C6E4A3-3345-4C46-91B2-198EB9D292DB} + Win32Proj + Sgit_Trade + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + ..\..\bin\$(Configuration)\$(PlatformTarget)\Sgit + $(ProjectName)_$(PlatformTarget) + ./;../../include/cryptopp/;$(IncludePath) + + + true + + + false + ..\..\bin\$(Configuration)\$(PlatformTarget)\Sgit + $(ProjectName)_$(PlatformTarget) + ./;../../include/cryptopp/;$(IncludePath) + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;SGIT_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;ENABLE_LICENSE_;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + Use + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;SGIT_TRADE_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;SGIT_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;ENABLE_LICENSE;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_WINDOWS;_USRDLL;SGIT_TRADE_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/apis/Sgit_Trade/Sgit_Trade.vcxproj.filters b/apis/Sgit_Trade/Sgit_Trade.vcxproj.filters new file mode 100644 index 0000000..957604d --- /dev/null +++ b/apis/Sgit_Trade/Sgit_Trade.vcxproj.filters @@ -0,0 +1,72 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/apis/Sgit_Trade/dllmain.cpp b/apis/Sgit_Trade/dllmain.cpp new file mode 100644 index 0000000..69b5891 --- /dev/null +++ b/apis/Sgit_Trade/dllmain.cpp @@ -0,0 +1,19 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/apis/Sgit_Trade/stdafx.cpp b/apis/Sgit_Trade/stdafx.cpp new file mode 100644 index 0000000..24d0859 --- /dev/null +++ b/apis/Sgit_Trade/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Sgit_Trade.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/apis/Sgit_Trade/stdafx.h b/apis/Sgit_Trade/stdafx.h new file mode 100644 index 0000000..56b93a7 --- /dev/null +++ b/apis/Sgit_Trade/stdafx.h @@ -0,0 +1,21 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here +// BOOLEAN与asn.h中的冲突,不得不将asn.h中的改了,希望有人帮忙解决这个问题 +// 已经解决,移动到这就可以了 +#include +#include +#pragma comment(lib, "IPHLPAPI.lib") \ No newline at end of file diff --git a/apis/Sgit_Trade/targetver.h b/apis/Sgit_Trade/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/apis/Sgit_Trade/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/apis/Tdx_Trade/ReadMe.txt b/apis/Tdx_Trade/ReadMe.txt new file mode 100644 index 0000000..8fb6f65 --- /dev/null +++ b/apis/Tdx_Trade/ReadMe.txt @@ -0,0 +1,48 @@ +======================================================================== + DYNAMIC LINK LIBRARY : Tdx_Trade Project Overview +======================================================================== + +AppWizard has created this Tdx_Trade DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your Tdx_Trade application. + + +Tdx_Trade.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +Tdx_Trade.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +Tdx_Trade.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named Tdx_Trade.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/apis/Tdx_Trade/SingleUser.cpp b/apis/Tdx_Trade/SingleUser.cpp new file mode 100644 index 0000000..9cafb9c --- /dev/null +++ b/apis/Tdx_Trade/SingleUser.cpp @@ -0,0 +1,895 @@ +#include "stdafx.h" +#include "SingleUser.h" + +#include "../../include/queue/MsgQueue.h" +#include "TypeConvert.h" +#include "TraderApi.h" + +#define QUERY_TIME_MIN (3) +#define QUERY_TIME_MAX (60) + +int Today(int day) +{ + time_t now = time(0); + now += day * 86400; + struct tm *ptmNow = localtime(&now); + + return (ptmNow->tm_year + 1900) * 10000 + + (ptmNow->tm_mon + 1) * 100 + + ptmNow->tm_mday; +} + +void CreateID(char* pOut, char* pDate, char*pZh, char* wtbh) +{ + if (pDate == nullptr || strlen(pDate) == 0) + { + sprintf(pOut, "%d:%s:%s", Today(0), pZh, wtbh); + } + else + { + sprintf(pOut, "%s:%s:%s", pDate, pZh, wtbh); + } +} + +// 解决创建与删除不在同一dll的问题 +void DeleteStructs(void*** pppStructs) +{ + if (pppStructs == nullptr) + return; + + if (*pppStructs == nullptr) + return; + + void** ppStructs = *pppStructs; + + int i = 0; + while (ppStructs[i] != 0) + { + delete[] ppStructs[i]; + ppStructs[i] = nullptr; + + ++i; + } + + delete[] ppStructs; + *pppStructs = nullptr; +} + +CSingleUser::CSingleUser(CTraderApi* pApi) +{ + m_pApi = pApi; + m_pClient = nullptr; + memset(m_UserID, 0, sizeof(m_UserID)); + + m_ConnectionStatus = ConnectionStatus::ConnectionStatus_Uninitialized; +} + + +CSingleUser::~CSingleUser() +{ +} + +void CSingleUser::OutputQueryTime(time_t t, double db, const char* szSource) +{ + LogField* pField = (LogField*)m_msgQueue->new_block(sizeof(LogField)); + + sprintf(pField->Message, "UserID:%s,Source:%s,Add:%d,Time:%s", m_UserID, szSource, (int)db, ctime(&t)); + + // 去了最后的回车 + int len = strlen(pField->Message); + pField->Message[len - 1] = 0; + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnLog, m_msgQueue, m_pClass, true, 0, pField, sizeof(LogField), nullptr, 0, nullptr, 0); +} + +void CSingleUser::CheckThenQueryOrder(time_t _now) +{ + if (m_ConnectionStatus != ConnectionStatus::ConnectionStatus_Done) + return; + + if (_now > m_QueryOrderTime) + { + double _queryTime = QUERY_TIME_MAX; + m_QueryOrderTime = time(nullptr) + _queryTime; + OutputQueryTime(m_QueryOrderTime, _queryTime, "QueryOrder"); + + ReqQryOrder(); + } +} + +void CSingleUser::CheckThenQueryTrade(time_t _now) +{ + if (m_ConnectionStatus != ConnectionStatus::ConnectionStatus_Done) + return; + + if (_now > m_QueryTradeTime) + { + double _queryTime = QUERY_TIME_MAX; + m_QueryTradeTime = time(nullptr) + _queryTime; + OutputQueryTime(m_QueryTradeTime, _queryTime, "QueryTrade"); + + ReqQryTrade(); + } +} + +void CSingleUser::ReqQryOrder() +{ + // 进行查询 + ReqQueryData_STRUCT query = { 0 }; + query.Client = m_pClient; + strcpy(query.KHH, m_UserID); + query.requestType = REQUEST_DRWT; + query.bAll = false; + m_pApi->ReqQuery(&query); +} + + +void CSingleUser::ReqQryTrade() +{ + // 进行查询 + ReqQueryData_STRUCT query = { 0 }; + query.Client = m_pClient; + strcpy(query.KHH, m_UserID); + query.requestType = REQUEST_DRCJ; + query.bAll = false; + m_pApi->ReqQuery(&query); +} + +int CSingleUser::OnResponse_ReqQryOrder(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + ReqQueryData_STRUCT* pQuery = (ReqQueryData_STRUCT*)pRespone->pContent; + + if (pRespone->pErr) + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = pRespone->pErr->ErrCode; + strcpy(pField->Text, pRespone->pErr->ErrInfo); + strcpy(pField->Source, "OnRespone_ReqQryOrder"); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, 0, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } + + WTLB_STRUCT** ppRS = nullptr; + CharTable2WTLB(pRespone->ppFieldInfo, pRespone->ppResults, &ppRS, pRespone->Client); + + // 操作前清空,按说之前已经清空过一次了 + m_NewOrderList.clear(); + + // 有未完成的,标记为true + bool IsDone = true; + // 有未申报的,标记为true + bool IsNotSent = false; + // 有更新的 + bool IsUpdated = false; + + if (ppRS) + { + int i = 0; + while (ppRS[i]) + { + // 将撤单委托过滤 + if (ppRS[i]->MMBZ_ != MMBZ_Cancel && ppRS[i]->MMBZ_ != MMBZ_Buy_Cancel && ppRS[i]->MMBZ_ != MMBZ_Sell_Cancel) + { + // 需要将它输入到一个地方用于计算,这个是临时的,需要删除 + OrderField* pField = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + + WTLB_2_OrderField_0(ppRS[i], pField); + CreateID(pField->ID, ppRS[i]->WTRQ, ppRS[i]->GDDM, ppRS[i]->WTBH); + pField->Date = ppRS[i]->WTRQ_ == 0 ? Today(0) : ppRS[i]->WTRQ_;//日期为0,重新赋值 + + m_NewOrderList.push_back(pField); + + if (!ZTSM_IsDone(ppRS[i]->ZTSM_)) + { + IsDone = false; + } + if (ZTSM_IsNotSent(ppRS[i]->ZTSM_)) + { + IsNotSent = true; + } + + // 需要将其保存起来,是只保存一次,还是每次都更新呢?个人认为只保存一次即可,反正是用来撤单的 + unordered_map::iterator it = m_pApi->m_id_api_order.find(pField->ID); + if (it == m_pApi->m_id_api_order.end()) + { + WTLB_STRUCT* pWTField = (WTLB_STRUCT*)m_msgQueue->new_block(sizeof(WTLB_STRUCT)); + memcpy(pWTField, ppRS[i], sizeof(WTLB_STRUCT)); + m_pApi->m_id_api_order.insert(pair(pField->ID, pWTField)); + } + else + { + // 如果已经存在,最好还是更新部分,要更新哪些地方呢?参考OnRespone_ReqOrderInsert部分,看哪些没有默认填写 + WTLB_STRUCT* pWTField = (WTLB_STRUCT*)it->second; + if (strlen(pWTField->ZQMC) == 0) + { + memcpy(pWTField, ppRS[i], sizeof(WTLB_STRUCT)); + } + } + } + ++i; + } + } + + // 委托列表 + // 1.新增的都需要输出 + // 2.老的看是否有变化 + ++m_OrderNotUpdateCount; + + int i = 0; + list::iterator it2 = m_OldOrderList.begin(); + for (list::iterator it = m_NewOrderList.begin(); it != m_NewOrderList.end(); ++it) + { + OrderField* pField = *it; + + bool bUpdate = false; + if (i >= m_OldOrderList.size()) + { + bUpdate = true; + } + else + { + // 相同位置的部分 + OrderField* pOldField = *it2; + if (pOldField->LeavesQty != pField->LeavesQty || pOldField->Status != pField->Status) + { + bUpdate = true; + } + } + + if (bUpdate) + { + IsUpdated = true; + m_OrderNotUpdateCount = 0; + + // 如果能找到下单时的委托,就修改后发出来 + unordered_map::iterator it = m_pApi->m_id_platform_order.find(pField->ID); + if (it == m_pApi->m_id_platform_order.end()) + { + // 因为上次生成的可能在后期删了,所以要复制一份 + OrderField* pField_ = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + memcpy(pField_, pField, sizeof(OrderField)); + + m_pApi->m_id_platform_order.insert(pair(pField_->ID, pField_)); + } + else + { + OrderField* pField_ = it->second; + memcpy(pField_, pField, sizeof(OrderField)); + } + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + } + + // 前一个可能为空,移动到下一个时需要注意 + if (it2 != m_OldOrderList.end()) + { + ++it2; + } + + ++i; + } + + if (pQuery->bAll) + { + int i = 0; + int count = m_NewOrderList.size(); + for (list::iterator it = m_NewOrderList.begin(); it != m_NewOrderList.end(); ++it) + { + OrderField* pField = *it; + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryOrder, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + ++i; + } + } + + // 将老数据清理,防止内存泄漏 + for (list::iterator it = m_OldOrderList.begin(); it != m_OldOrderList.end(); ++it) + { + OrderField* pField = *it; + m_msgQueue->delete_block(pField); + } + + // 做交换 + m_OldOrderList.clear(); + m_OldOrderList = m_NewOrderList; + m_NewOrderList.clear(); + + double _queryTime = 0; + if (!IsDone) + { + if (!IsUpdated) + { + // 没有更新,是否要慢点查 + _queryTime = 0.5 * QUERY_TIME_MAX + QUERY_TIME_MIN; + } + + // 有没有完成的,需要定时查询 + if (IsNotSent) + { + // 有没申报的,是否没在交易时间?慢点查 + _queryTime = 0.5 * QUERY_TIME_MAX + QUERY_TIME_MIN; + } + else + { + // 可能是交易时间了,是否需要考虑 + _queryTime = 2 * QUERY_TIME_MIN; + // 可能有些挂单一天都不会成交,挂在这一直导致查太多,加一下查询计数 + if (m_OrderNotUpdateCount >= 3) + { + _queryTime = 0.5 * QUERY_TIME_MAX + QUERY_TIME_MIN; + } + } + } + else + { + // 全完成了,可以不查或慢查 + _queryTime = 5 * QUERY_TIME_MAX; + } + + m_QueryOrderTime = time(nullptr) + _queryTime; + OutputQueryTime(m_QueryOrderTime, _queryTime, "NextQueryOrder_QueryOrder"); + + // 决定成交查询间隔 + if (IsUpdated) + { + // 委托可能是撤单,也有可能是成交了,赶紧查一下 + _queryTime = 0; + m_QueryTradeTime = time(nullptr) + _queryTime; + OutputQueryTime(m_QueryTradeTime, _queryTime, "NextQueryTrade_QueryOrder"); + } + else + { + // 委托没有变化,那成交就没有必要查那么快了 + _queryTime = 5 * QUERY_TIME_MAX; + m_QueryTradeTime = time(nullptr) + _queryTime; + OutputQueryTime(m_QueryTradeTime, _queryTime, "NextQueryTrade_QueryOrder"); + } + + DeleteStructs((void***)&ppRS); + + return 0; +} + + +double GetTradeListQty(list &tradeList, int count) +{ + double Qty = 0; + int i = 0; + for (list::iterator it = tradeList.begin(); it != tradeList.end(); ++it) + { + ++i; + if (i > count) + { + break; + } + + TradeField* pField = *it; + Qty += pField->Qty; + } + return Qty; +} + +void TradeList2TradeMap(list &tradeList, unordered_map &tradeMap) +{ + // 只在这个函数中new和delete应当没有问题 + for (unordered_map::iterator it = tradeMap.begin(); it != tradeMap.end(); ++it) + { + TradeField* pNewField = it->second; + delete[] pNewField; + } + tradeMap.clear(); + + // 将多个合约拼接成 + for (list::iterator it = tradeList.begin(); it != tradeList.end(); ++it) + { + TradeField* pField = *it; + unordered_map::iterator it2 = tradeMap.find(pField->ID); + if (it2 == tradeMap.end()) + { + TradeField* pNewField = new TradeField; + memcpy(pNewField, pField, sizeof(TradeField)); + tradeMap[pField->ID] = pNewField; + } + else + { + TradeField* pNewField = it2->second; + pNewField->Price = pField->Price; + pNewField->Qty += pField->Qty; + } + } +} + +int CSingleUser::OnResponse_ReqQryTrade(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + ReqQueryData_STRUCT* pQuery = (ReqQueryData_STRUCT*)pRespone->pContent; + + if (pRespone->pErr) + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = pRespone->pErr->ErrCode; + strcpy(pField->Text, pRespone->pErr->ErrInfo); + strcpy(pField->Source, "OnRespone_ReqQryTrade"); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, 0, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } + + CJLB_STRUCT** ppRS = nullptr; + CharTable2CJLB(pRespone->ppFieldInfo, pRespone->ppResults, &ppRS, pRespone->Client); + + // 操作前清空,按说之前已经清空过一次了 + m_NewTradeList.clear(); + + if (ppRS) + { + // 利用成交编号的大小来判断正反序 + if (!m_TradeListReverse) + { + int count = GetCountStructs((void**)ppRS); + if (count > 1) + { + // 转成数字的比较,是否会有非数字的情况出现? + long CJBH0 = atol(ppRS[0]->CJBH); + long CJBH1 = atol(ppRS[count - 1]->CJBH); + if (CJBH0 > CJBH1) + { + m_TradeListReverse = true; + } + } + } + + int i = 0; + while (ppRS[i]) + { + // 有部分券商,撤单也计成交了,真无语了,需要过滤 + if (ppRS[i]->CJSL_ <= 0) + { + ++i; + continue; + } + + TradeField* pField = (TradeField*)m_msgQueue->new_block(sizeof(TradeField)); + + CJLB_2_TradeField(ppRS[i], pField); + CreateID(pField->ID, ppRS[i]->CJRQ, ppRS[i]->GDDM, ppRS[i]->WTBH); + pField->Date = ppRS[i]->CJRQ_ == 0 ? Today(0) : ppRS[i]->CJRQ_;//日期为0,重新赋值 + + if (m_TradeListReverse) + { + // 华泰查出来的表后生成的排第一,所以要处理一下 + m_NewTradeList.push_front(pField); + } + else + { + m_NewTradeList.push_back(pField); + } + + ++i; + } + } + + // 新查出来的反而少了,华泰有合并成交的情况,这种如何处理? + // 对同ID的需要累加,有发现累加不对应的,应当处理 + // 同样条数的,也有可能其中的有变化,如何处理? + bool bTryMerge = false; + int OldTradeListCount = m_OldTradeList.size(); + int NewTradeListCount = m_NewTradeList.size(); + + if (NewTradeListCount < OldTradeListCount) + { + // 行数变少了,应当是合并了 + bTryMerge = true; + } + else if (OldTradeListCount == 0) + { + // 如果上一次的为空,不管这次查出来的是合并还是没有合并,都没有关系,当成没合并处理即可 + } + else if (NewTradeListCount == OldTradeListCount) + { + // 行数不变,但有可能是其中的一条部分成交的更新,所以检查一下 + + double OldQty = GetTradeListQty(m_OldTradeList, m_OldTradeList.size()); + double NewQty = GetTradeListQty(m_NewTradeList, m_NewTradeList.size()); + if (NewQty != OldQty) + { + // 同样长度成交量发生了变化,可能是合并的列表其中一个新成交了 + bTryMerge = true; + } + } + else + { + // 行数变多了,只要其中上次的部分有变化就需要检查一下 + double OldQty = GetTradeListQty(m_OldTradeList, m_OldTradeList.size()); + double NewQty = GetTradeListQty(m_NewTradeList, m_NewTradeList.size()); + if (NewQty != OldQty) + { + bTryMerge = true; + } + } + + if (bTryMerge) + { + // 合并列表的处理方法 + // 如果上次是合并,这次就没有必要再生成一次了 + if (m_OldTradeMap.size() == 0 || !m_LastIsMerge) + { + for (unordered_map::iterator it = m_OldTradeMap.begin(); it != m_OldTradeMap.end(); ++it) + { + TradeField* pField = it->second; + delete[] pField; + } + m_OldTradeMap.clear(); + + TradeList2TradeMap(m_OldTradeList, m_OldTradeMap); + } + TradeList2TradeMap(m_NewTradeList, m_NewTradeMap); + CompareTradeMapAndEmit(m_OldTradeMap, m_NewTradeMap); + + // 交换 + for (unordered_map::iterator it = m_OldTradeMap.begin(); it != m_OldTradeMap.end(); ++it) + { + TradeField* pField = it->second; + delete[] pField; + } + m_OldTradeMap.clear(); + m_OldTradeMap = m_NewTradeMap; + m_NewTradeMap.clear(); + m_LastIsMerge = true; + } + else + { + // 普通的处理方法 + CompareTradeListAndEmit(m_OldTradeList, m_NewTradeList); + m_LastIsMerge = false; + } + + if (pQuery->bAll) + { + int i = 0; + int count = m_NewTradeList.size(); + for (list::iterator it = m_NewTradeList.begin(); it != m_NewTradeList.end(); ++it) + { + TradeField* pField = *it; + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryTrade, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); + ++i; + } + } + + // 将老数据清理,防止内存泄漏 + for (list::iterator it = m_OldTradeList.begin(); it != m_OldTradeList.end(); ++it) + { + TradeField* pField = *it; + m_msgQueue->delete_block(pField); + } + + // 做交换 + m_OldTradeList.clear(); + m_OldTradeList = m_NewTradeList; + m_NewTradeList.clear(); + + DeleteStructs((void***)&ppRS); + + return 0; +} + +void CSingleUser::CompareTradeMapAndEmit(unordered_map &oldMap, unordered_map &newMap) +{ + for (unordered_map::iterator it = newMap.begin(); it != newMap.end(); ++it) + { + TradeField* pNewField = it->second; + unordered_map::iterator it2 = oldMap.find(pNewField->ID); + if (it2 == oldMap.end()) + { + // 没找到,是新单 + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pNewField, sizeof(TradeField), nullptr, 0, nullptr, 0); + } + else + { + TradeField* pOldField = it2->second; + int Qty = pNewField->Qty - pOldField->Qty; + if (Qty > 0) + { + // 有变化的单 + TradeField* pField = new TradeField; + memcpy(pField, pNewField, sizeof(TradeField)); + pField->Qty = Qty; + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pNewField, sizeof(TradeField), nullptr, 0, nullptr, 0); + delete[] pField; + } + } + } +} + +void CSingleUser::CompareTradeListAndEmit(list &oldList, list &newList) +{ + int i = 0; + list::iterator it2 = oldList.begin(); + for (list::iterator it = newList.begin(); it != newList.end(); ++it) + { + TradeField* pField = *it; + + bool bUpdate = false; + if (i >= oldList.size()) + { + bUpdate = true; + } + //else + //{ + // // 相同位置的部分 + // TradeField* pOldField = *it2; + // if (pOldField->Qty != pField->Qty) + // { + // bUpdate = true; + // } + //} + + if (bUpdate) + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnTrade, m_msgQueue, m_pClass, 0, 0, pField, sizeof(TradeField), nullptr, 0, nullptr, 0); + } + + // 前一个可能为空,移动到下一个时需要注意 + if (it2 != oldList.end()) + { + ++it2; + } + + ++i; + } +} + + +int CSingleUser::OnResponse_ReqUserLogin(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + if (pRespone->pErr) + { + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + pField->RawErrorID = pRespone->pErr->ErrCode; + strcpy(pField->Text, pRespone->pErr->ErrInfo); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_ConnectionStatus = ConnectionStatus::ConnectionStatus_Disconnected; + m_pApi->RemoveUser((CSingleUser*)pRespone->pUserData_Public); + } + else + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_ConnectionStatus = ConnectionStatus::ConnectionStatus_Logined; + } + + // 查询股东列表,华泰证券可能一开始查会返回非知请求[1122] + GDLB_STRUCT** ppRS = nullptr; + char CPZH[32] = { 0 }; + CharTable2Login(pRespone->ppFieldInfo, pRespone->ppResults, &ppRS, pRespone->Client, nullptr, CPZH); + + int count = GetCountStructs((void**)ppRS); + + if (count > 0) + { + for (int i = 0; i < count; ++i) + { + InvestorField* pField = (InvestorField*)m_msgQueue->new_block(sizeof(InvestorField)); + + GDLB_2_InvestorField(ppRS[i], pField); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInvestor, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(InvestorField), nullptr, 0, nullptr, 0); + } + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_ConnectionStatus = ConnectionStatus::ConnectionStatus_Done; + } + + // 这是由TdxApi.dll创建的 + DeleteStructs((void***)&ppRS); + + return 0; +} + +int CSingleUser::OnResponse_ReqQryInvestor(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + if (pRespone->pErr) + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = pRespone->pErr->ErrCode; + strcpy(pField->Text, pRespone->pErr->ErrInfo); + strcpy(pField->Source, "OnRespone_ReqQryInvestor"); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, 0, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } + + GDLB_STRUCT** ppRS = nullptr; + CharTable2GDLB(pRespone->ppFieldInfo, pRespone->ppResults, &ppRS, pRespone->Client); + + int count = GetCountStructs((void**)ppRS); + + if (count>0) + { + for (int i = 0; i < count; ++i) + { + InvestorField* pField = (InvestorField*)m_msgQueue->new_block(sizeof(InvestorField)); + + GDLB_2_InvestorField(ppRS[i], pField); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInvestor, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(InvestorField), nullptr, 0, nullptr, 0); + } + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + + DeleteStructs((void***)&ppRS); + + return 0; +} + +int CSingleUser::OnResponse_ReqQryTradingAccount(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + if (pRespone->pErr) + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = pRespone->pErr->ErrCode; + strcpy(pField->Text, pRespone->pErr->ErrInfo); + strcpy(pField->Source, "OnRespone_ReqQryTradingAccount"); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, 0, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } + + //if (pRespone->ppResults == nullptr) + //{ + + // return; + //} + + ZJYE_STRUCT** ppRS = nullptr; + CharTable2ZJYE(pRespone->ppFieldInfo, pRespone->ppResults, &ppRS, pRespone->Client); + + int count = GetCountStructs((void**)ppRS); + for (int i = 0; i < count; ++i) + { + AccountField* pField = (AccountField*)m_msgQueue->new_block(sizeof(AccountField)); + + ZJYE_2_AccountField(ppRS[i], pField); + + //// 可能资金账号查不出来,手工填上 + //if (strlen(pField->AccountID) <= 0) + //{ + // // 多账户会有问题 + // strcpy(pField->AccountID, m_pApi->GetAccount()); + //} + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryTradingAccount, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(AccountField), nullptr, 0, nullptr, 0); + } + + DeleteStructs((void***)&ppRS); + + return 0; +} + +int CSingleUser::OnResponse_ReqQryInvestorPosition(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + if (pRespone->pErr) + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = pRespone->pErr->ErrCode; + strcpy(pField->Text, pRespone->pErr->ErrInfo); + strcpy(pField->Source, "OnRespone_ReqQryInvestorPosition"); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, 0, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } + + GFLB_STRUCT** ppRS = nullptr; + CharTable2GFLB(pRespone->ppFieldInfo, pRespone->ppResults, &ppRS, pRespone->Client); + + int count = GetCountStructs((void**)ppRS); + for (int i = 0; i < count; ++i) + { + PositionField* pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); + + // 应当处理一下,可能一个账号对应的有多个,如信用账户 + GFLB_2_PositionField(ppRS[i], pField); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, i == count - 1, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); + } + + DeleteStructs((void***)&ppRS); + + return 0; +} + +int CSingleUser::OnResponse_ReqOrderInsert(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + Order_STRUCT* pTdxOrder = (Order_STRUCT*)pRespone->pContent; + OrderField* pOrder = (OrderField*)pRespone->pUserData_Public2; + + WTLB_STRUCT* pWTOrders = (WTLB_STRUCT*)m_msgQueue->new_block(sizeof(WTLB_STRUCT)); + strcpy(pWTOrders->ZJZH, pTdxOrder->ZJZH); + strcpy(pWTOrders->ZHLB, pTdxOrder->ZHLB_); + strcpy(pWTOrders->ZQDM, pTdxOrder->ZQDM); + strcpy(pWTOrders->GDDM, pTdxOrder->GDDM); + strcpy(pWTOrders->WTBH, pTdxOrder->WTBH); + strcpy(pWTOrders->JYSDM, pTdxOrder->ZHLB_);// FIXME:交易所代码有什么办法搞到吗? + + pWTOrders->Client = m_pClient; + + m_pApi->m_id_api_order.insert(pair(pOrder->LocalID, pWTOrders)); + // 处理错误 + if (pRespone->pErr) + { + pOrder->RawErrorID = pRespone->pErr->ErrCode; + strcpy(pOrder->Text, pRespone->pErr->ErrInfo); + } + + // 处理结果 + if (pRespone->ppResults&&pRespone->ppResults[0 * COL_EACH_ROW + 0]) + { + // 写上柜台的ID,以后将基于此进行定位 + strcpy(pOrder->OrderID, pRespone->ppResults[0 * COL_EACH_ROW + 0]);//订单号 + strcpy(pWTOrders->WTBH, pOrder->OrderID); + CreateID(pOrder->ID, nullptr, pTdxOrder->GDDM, pOrder->OrderID); + + + m_pApi->m_id_api_order.erase(pOrder->LocalID); + m_pApi->m_id_api_order.insert(pair(pOrder->ID, pWTOrders)); + + m_pApi->m_id_platform_order.erase(pOrder->LocalID); + m_pApi->m_id_platform_order.insert(pair(pOrder->ID, pOrder)); + + // 有挂单的,需要进行查询了 + + double _queryTime = QUERY_TIME_MIN; + m_QueryOrderTime = time(nullptr) + _queryTime; + OutputQueryTime(m_QueryOrderTime, _queryTime, "NextQueryOrder_Send"); + } + + // 现在有两个结构体,需要进行操作了 + // 1.通知下单的结果 + // 2.记录下单 + + OrderField* pField = pOrder; + if (pField->RawErrorID != 0) + { + pField->ExecType = ExecType::ExecType_Rejected; + pField->Status = OrderStatus::OrderStatus_Rejected; + } + else + { + pField->ExecType = ExecType::ExecType_New; + pField->Status = OrderStatus::OrderStatus_New; + } + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pField, sizeof(OrderField), nullptr, 0, nullptr, 0); + + return 0; +} + +int CSingleUser::OnResponse_ReqOrderAction(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + WTLB_STRUCT* pTdxOrder = (WTLB_STRUCT*)pRespone->pContent; + OrderField* pOrder = (OrderField*)pRespone->pUserData_Public2; + + if (pRespone->pErr) + { + pOrder->RawErrorID = pRespone->pErr->ErrCode; + strcpy(pOrder->Text, pRespone->pErr->ErrInfo); + + pOrder->ExecType = ExecType::ExecType_CancelReject; + // 注意报单状态问题,交给报单查询来处理 + } + else + { + double _queryTime = QUERY_TIME_MIN; + m_QueryOrderTime = time(nullptr) + _queryTime; + OutputQueryTime(m_QueryOrderTime, _queryTime, "NextQueryOrder_Cancel"); + + // 会不会出现撤单时,当时不知道是否成功撤单,查询才得知没有撤成功? + //ppOrders[i]->ExecType = ExecType::ExecCancelled; + //ppOrders[i]->Status = OrderStatus::Cancelled; + } + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, 0, 0, pOrder, sizeof(OrderField), nullptr, 0, nullptr, 0); + + return 0; +} \ No newline at end of file diff --git a/apis/Tdx_Trade/SingleUser.h b/apis/Tdx_Trade/SingleUser.h new file mode 100644 index 0000000..ab13410 --- /dev/null +++ b/apis/Tdx_Trade/SingleUser.h @@ -0,0 +1,75 @@ +#pragma once + +#include "../../include/Tdx/TdxApi.h" +#include "../../include/ApiStruct.h" + +#include +#include +#include + +using namespace std; + +class CMsgQueue; +class CTraderApi; + +////////////////////////////////////////////////////////////////////////// +// 只是用来维护单账号的信息用 +class CSingleUser +{ +public: + CSingleUser(CTraderApi* pApi); + ~CSingleUser(); + + void CheckThenQueryOrder(time_t _now); + void CheckThenQueryTrade(time_t _now); + + void OutputQueryTime(time_t t, double db, const char* szSource); + + void ReqQryOrder(); + void ReqQryTrade(); + + int OnResponse_ReqQryOrder(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + int OnResponse_ReqQryTrade(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + + int OnResponse_ReqUserLogin(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + int OnResponse_ReqQryInvestor(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + int OnResponse_ReqQryTradingAccount(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + int OnResponse_ReqQryInvestorPosition(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + + int OnResponse_ReqOrderInsert(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + int OnResponse_ReqOrderAction(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + +private: + void CompareTradeMapAndEmit(unordered_map &oldMap, unordered_map &newMap); + void CompareTradeListAndEmit(list &oldList, list &newList); + +private: + CTraderApi* m_pApi; + + + //unordered_map m_id_platform_order; + //unordered_map m_id_api_order; + + list m_OldTradeList; + list m_NewTradeList; + unordered_map m_NewTradeMap; + unordered_map m_OldTradeMap; + + + list m_OldOrderList; + list m_NewOrderList; + + int m_OrderNotUpdateCount; + bool m_TradeListReverse; + bool m_LastIsMerge; + +public: + time_t m_QueryTradeTime; + time_t m_QueryOrderTime; + void* m_pClient; + void* m_pClass; + CMsgQueue* m_msgQueue; + char m_UserID[64]; + ConnectionStatus m_ConnectionStatus; +}; + diff --git a/QuantBox_Tdx_Trade/QuantBox_Tdx_Trade.vcxproj b/apis/Tdx_Trade/Tdx_Trade.vcxproj similarity index 69% rename from QuantBox_Tdx_Trade/QuantBox_Tdx_Trade.vcxproj rename to apis/Tdx_Trade/Tdx_Trade.vcxproj index 5fe1cfe..4699ace 100644 --- a/QuantBox_Tdx_Trade/QuantBox_Tdx_Trade.vcxproj +++ b/apis/Tdx_Trade/Tdx_Trade.vcxproj @@ -13,19 +13,20 @@ {01D3F1DE-99B3-4D41-97C3-F4680CDB980B} Win32Proj - QuantBox_Tdx_Trade + Tdx_Trade + 8.1 DynamicLibrary true - v120 + v141_xp Unicode DynamicLibrary false - v120 + v140 true Unicode @@ -41,30 +42,30 @@ true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\Tdx\x86 + ..\..\bin\$(Configuration)\$(PlatformTarget)\Tdx + $(ProjectName)_$(PlatformTarget) false + ..\..\bin\$(Configuration)\$(PlatformTarget)\Tdx + $(ProjectName)_$(PlatformTarget) Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_TDX_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;TDX_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true Windows true - ..\include\ApiHeader.def + ../../include/ApiHeader.def - xcopy "$(TargetPath)" "$(SolutionDir)XAPI\Tdx\x86\" /Y -xcopy "$(SolutionDir)include\Tdx\win32\*.dll" "$(SolutionDir)XAPI\Tdx\x86\" /Y -xcopy "$(SolutionDir)include\Tdx\win32\*.exe" "$(SolutionDir)XAPI\Tdx\x86\" /Y -xcopy "$(SolutionDir)include\Tdx\win32\*.ini" "$(SolutionDir)XAPI\Tdx\x86\" /Y -xcopy "$(SolutionDir)include\Tdx\win32\*.doc" "$(SolutionDir)XAPI\Tdx\x86\" /Y + + @@ -74,7 +75,7 @@ xcopy "$(SolutionDir)include\Tdx\win32\*.doc" "$(SolutionDir)XAPI\Tdx\x86\" /Y< MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_TDX_TRADE_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;TDX_TRADE_EXPORTS;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -82,34 +83,29 @@ xcopy "$(SolutionDir)include\Tdx\win32\*.doc" "$(SolutionDir)XAPI\Tdx\x86\" /Y< true true true + ../../include/ApiHeader.def - - - + + + + - - - - - - false - - - false - - - + + + + + Create Create diff --git a/QuantBox_Tdx_Trade/QuantBox_Tdx_Trade.vcxproj.filters b/apis/Tdx_Trade/Tdx_Trade.vcxproj.filters similarity index 82% rename from QuantBox_Tdx_Trade/QuantBox_Tdx_Trade.vcxproj.filters rename to apis/Tdx_Trade/Tdx_Trade.vcxproj.filters index c094e00..711d229 100644 --- a/QuantBox_Tdx_Trade/QuantBox_Tdx_Trade.vcxproj.filters +++ b/apis/Tdx_Trade/Tdx_Trade.vcxproj.filters @@ -27,19 +27,19 @@ Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files @@ -56,16 +56,19 @@ Source Files - + + Source Files + + Source Files - + Source Files - + Source Files - + Source Files diff --git a/apis/Tdx_Trade/TraderApi.cpp b/apis/Tdx_Trade/TraderApi.cpp new file mode 100644 index 0000000..845d833 --- /dev/null +++ b/apis/Tdx_Trade/TraderApi.cpp @@ -0,0 +1,798 @@ +#include "stdafx.h" +#include "TraderApi.h" + +#include "../../include/QueueEnum.h" + +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" + +#include "../../include/ApiProcess.h" +#include "../../include/toolkit.h" + +#include "../../include/queue/MsgQueue.h" + +#include "TypeConvert.h" + +#include "../../include/Tdx/tdx_function.h" + +#include +#include + + +void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + // 由内部调用,不用检查是否为空 + CTraderApi* pApi = (CTraderApi*)pApi2; + pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + return nullptr; +} + +void CTraderApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + int iRet = 0; + switch (type) + { + case E_Init: + iRet = _Init(); + break; + case E_Disconnect: + _Disconnect(true); + // 不再循环 + return; + } + + if (m_pApi) + { + switch (type) + { + case E_ReqUserLoginField: + iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case E_InputOrderField: + iRet = _ReqOrderInsert(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case E_InputOrderActionField: + iRet = _ReqOrderAction(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case E_QryDepthMarketDataField: + iRet = _Subscribe(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + + //case QueryType::ReqQryOrder : + //case QueryType::ReqQryTrade: + //case QueryType::ReqQryInvestor: + //case QueryType::ReqQryTradingAccount: + //case QueryType::ReqQryInvestorPosition: + case E_ReqQueryData_STRUCT: + iRet = _ReqQuery(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + + default: + break; + } + } + + if (0 == iRet) + { + //返回成功,填加到已发送池 + m_nSleep = 1; + } + else + { + m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + //失败,按4的幂进行延时,但不超过1s + m_nSleep *= 4; + m_nSleep %= 1023; + } + + // 将时定时查询功能放在查询队列中,这样退出就不会出问题了 + // 由于队列中一直没有东西,所以不会再来触发这个循环,需要隔一定的时间向队列中放一个,最好放在最后 + TestInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + if (m_msgQueue_Query->Size() == 0) + { + m_msgQueue_Query->Input_Copy(E_Heartbeat, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + m_nSleep = 32; + } + + this_thread::sleep_for(chrono::milliseconds(m_nSleep)); +} + +void CTraderApi::TestInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + time_t _now = time(nullptr); + + for (unordered_map::iterator it = m_Client_User_Map.begin(); it != m_Client_User_Map.end(); ++it) + { + CSingleUser* pUser = it->second; + pUser->CheckThenQueryOrder(_now); + pUser->CheckThenQueryTrade(_now); + } +} + +void CTraderApi::OnResponse(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + if (pRespone == nullptr) + return; + + CSingleUser* pUser = (CSingleUser*)pRespone->pUserData_Public; + if (pUser == nullptr) + { + // 这个地方主要是因为Login时立即发送了登录结果出来,这个地方如果改一下也许会好一些 + unordered_map::iterator it = m_Client_User_Map.find(pRespone->Client); + if (it == m_Client_User_Map.end()) + { + pUser = m_pDefaultUser; + } + else + { + pUser = it->second; + } + pRespone->pUserData_Public = pUser; + } + + switch (pRespone->requestType) + { + case 0: + pUser->OnResponse_ReqUserLogin(pApi, pRespone); + break; + case REQUEST_WT: + case REQUEST_ETF_SGSH: + case REQUEST_ZGHS: + case REQUEST_WT_QQ: + pUser->OnResponse_ReqOrderInsert(pApi, pRespone); + break; + case REQUEST_CD: + pUser->OnResponse_ReqOrderAction(pApi, pRespone); + break; + case REQUEST_HQ: + OnResponse_Subscribe(pApi, pRespone); + break; + case REQUEST_GDLB: + pUser->OnResponse_ReqQryInvestor(pApi, pRespone); + break; + case REQUEST_DRWT: + pUser->OnResponse_ReqQryOrder(pApi, pRespone); + break; + case REQUEST_DRCJ: + pUser->OnResponse_ReqQryTrade(pApi, pRespone); + break; + case REQUEST_ZJYE: + pUser->OnResponse_ReqQryTradingAccount(pApi, pRespone); + break; + case REQUEST_GFLB: + pUser->OnResponse_ReqQryInvestorPosition(pApi, pRespone); + break; + default: + break; + } +} + +int CTraderApi::_Init() +{ + if (m_pApi == nullptr) + { + m_pApi = CTdxApi::CreateApi(); + m_pApi->RegisterSpi(this); + } + + Error_STRUCT* pErr = nullptr; + + m_pApi->LoadScript(m_ServerInfo.Address, true, false); + m_pApi->Init(m_ServerInfo.ExtInfoChar128, &pErr); + + if (pErr) + { + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + pField->RawErrorID = pErr->ErrCode; + strcpy(pField->Text, pErr->ErrInfo); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + } + else + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + ReqUserLogin(); + } + + DeleteError(pErr); + + return 0; +} + +void CTraderApi::ReqUserLogin() +{ + if (m_UserInfo_Pos >= m_UserInfo_Count) + return; + + m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} + +int CTraderApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + Error_STRUCT* pErr = nullptr; + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + CSingleUser* pUser = new CSingleUser(this); + pUser->m_pClass = m_pClass; + pUser->m_msgQueue = m_msgQueue; + strcpy(pUser->m_UserID, m_UserInfo.UserID); + m_UserID_User_Map.insert(pair(m_UserInfo.UserID, pUser)); + + if (m_pDefaultUser == nullptr) + { + m_pDefaultUser = pUser; + } + + void* pClient = m_pApi->Login(m_UserInfo.UserID, m_UserInfo.Password, m_UserInfo.ExtInfoChar64, &pErr); + pUser->m_pClient = pClient; + m_Client_User_Map.insert(pair(pClient, pUser)); + + if (pClient) + { + // 有授权信息要输出 + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + if (pErr) + { + pField->RawErrorID = pErr->ErrCode; + strcpy(pField->Text, pErr->ErrInfo); + } + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, pField, sizeof(pField), nullptr, 0, nullptr, 0); + + + // 登录下一个账号 + //++m_UserInfo_Pos; + //ReqUserLogin(); + } + else + { + if (pErr) + { + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + pField->RawErrorID = pErr->ErrCode; + strcpy(pField->Text, pErr->ErrInfo); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + } + } + + DeleteError(pErr); + + return 0; +} + +void CTraderApi::RemoveUser(CSingleUser* pUser) +{ + m_UserID_User_Map.erase(pUser->m_UserID); + m_Client_User_Map.erase(pUser->m_pClient); +} + +void CTraderApi::ReqQuery(QueryType type, ReqQueryField* pQuery) +{ + ReqQueryData_STRUCT query = { 0 }; + strcpy(query.KHH, pQuery->ClientID); + strcpy(query.ZJZH, pQuery->ClientID);//通达信模拟上这样写是否会出问题 + strcpy(query.GDDM, pQuery->AccountID); + strcpy(query.ZQDM, pQuery->InstrumentID); + sprintf_s(query.KSRQ,"%d",pQuery->DateStart); + sprintf_s(query.ZZRQ, "%d", pQuery->DateEnd); + query.bAll = pQuery->Int32ID == -1; + + //printf("===%d,%d", pQuery->Int32ID, query.bAll); + + switch (type) + { + case QueryType_ReqQryInstrument: + break; + case QueryType_ReqQryTradingAccount: + query.requestType = REQUEST_ZJYE; + break; + case QueryType_ReqQryInvestorPosition: + query.requestType = REQUEST_GFLB; + break; + case QueryType::QueryType_ReqQryOrder: + query.requestType = REQUEST_DRWT; + break; + case QueryType::QueryType_ReqQryTrade: + query.requestType = REQUEST_DRCJ; + break; + case QueryType_ReqQryQuote: + break; + case QueryType_ReqQryInstrumentCommissionRate: + break; + case QueryType_ReqQryInstrumentMarginRate: + break; + case QueryType_ReqQrySettlementInfo: + break; + case QueryType_ReqQryInvestor: + query.requestType = REQUEST_GDLB; + break; + case QueryType_ReqQryHistoricalTicks: + break; + case QueryType_ReqQryHistoricalBars: + break; + default: + break; + } + + ReqQuery(&query); + + return; +} + +void CTraderApi::ReqQuery(ReqQueryData_STRUCT* pQuery) +{ + // 直接转发请求,不进行处理 + m_msgQueue_Query->Input_Copy(E_ReqQueryData_STRUCT, m_msgQueue_Query, this, 0, 0, + pQuery, sizeof(ReqQueryData_STRUCT), nullptr, 0, nullptr, 0); + + return; +} + + +int CTraderApi::_ReqQuery(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi == nullptr) + return 0; + + ReqQueryData_STRUCT* pQuery = (ReqQueryData_STRUCT*)ptr1; + + CSingleUser* pUser = Fill_UserID_Client(pQuery->KHH, &pQuery->Client); + RequestResponse_STRUCT* pRequest = m_pApi->MakeQueryData(pQuery); + pRequest->Client = pQuery->Client; + pRequest->pUserData_Public = pUser; + strcpy(pRequest->khh,pQuery->KHH); + + m_pApi->SendRequest(pRequest); + + return 0; +} + + + +CTraderApi::CTraderApi(void) +{ + // 弹出这个只是为了在Python这类的平台中调试,以后可能要关闭 + //AllocConsole(); + //freopen("CON", "r", stdin); + //freopen("CON", "w", stdout); + //freopen("CON", "w", stderr); + //::DeleteMenu(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE, MF_BYCOMMAND); + //printf("===**********************==="); + + m_pIDGenerator = nullptr; + m_pApi = nullptr; + m_lRequestID = 0; + m_nSleep = 1; + + // 自己维护两个消息队列 + m_msgQueue = new CMsgQueue(); + m_msgQueue_Query = new CMsgQueue(); + + m_msgQueue_Query->Register(Query); + m_msgQueue_Query->StartThread(); + + m_pDefaultUser = nullptr; +} + + +CTraderApi::~CTraderApi(void) +{ + _Disconnect(false); +} + +void CTraderApi::Register(void* pCallback, void* pClass) +{ + m_pClass = pClass; + if (m_msgQueue == nullptr) + return; + + m_msgQueue_Query->Register(Query); + m_msgQueue->Register((fnOnResponse)pCallback); + if (pCallback) + { + m_msgQueue_Query->StartThread(); + m_msgQueue->StartThread(); + } + else + { + m_msgQueue_Query->StopThread(); + m_msgQueue->StopThread(); + } +} + +bool CTraderApi::IsErrorRspInfo(const char* szSource, Error_STRUCT *pRspInfo) +{ + bool bRet = ((pRspInfo) && (pRspInfo->ErrType != 0)); + if (bRet) + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = pRspInfo->ErrCode; + strcpy(pField->Text, pRspInfo->ErrInfo); + strcpy(pField->Source, szSource); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, true, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } + return bRet; +} + +void CTraderApi::Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo, + int count) +{ + m_szPath = szPath; + memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); + memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); + + m_pUserInfos = (UserInfoField*)(new char[sizeof(UserInfoField)*count]); + memcpy(m_pUserInfos, pUserInfo, sizeof(UserInfoField)*count); + + m_UserInfo_Pos = 0; + m_UserInfo_Count = count; + + m_pIDGenerator = new CIDGenerator(); + m_pIDGenerator->SetPrefix(m_UserInfo.UserID); + + m_msgQueue_Query->Input_NoCopy(E_Init, m_msgQueue_Query, this, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); +} + +void CTraderApi::Disconnect() +{ + _Disconnect(false); +} + +void CTraderApi::_DisconnectInThread() +{ + m_msgQueue_Query->Input_NoCopy(RequestType::E_Disconnect, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} + +void CTraderApi::_Disconnect(bool IsInQueue) +{ + if (IsInQueue) + { + + } + else + { + if (m_msgQueue_Query) + { + m_msgQueue_Query->StopThread(); + m_msgQueue_Query->Register(nullptr); + m_msgQueue_Query->Clear(); + delete m_msgQueue_Query; + m_msgQueue_Query = nullptr; + } + } + + if(m_pApi) + { + // 还没有登出 + m_pApi->Exit(); + + m_pApi->Release(); + m_pApi = nullptr; + + // 全清理,只留最后一个 + if (m_msgQueue) + { + m_msgQueue->Clear(); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + // 主动触发 + m_msgQueue->Process(); + } + } + + if (m_msgQueue) + { + m_msgQueue->StopThread(); + m_msgQueue->Register(nullptr); + m_msgQueue->Clear(); + delete m_msgQueue; + m_msgQueue = nullptr; + } + + if (m_pIDGenerator) + { + delete m_pIDGenerator; + m_pIDGenerator = nullptr; + } +} + +char* CTraderApi::ReqOrderInsert( + OrderField* pOrder, + int count, + char* pszLocalIDBuf) +{ + memset(pszLocalIDBuf, 0, sizeof(OrderIDType)*count); + + if (count < 1) + return 0; + + OrderField** ppOrders = new OrderField*[count]; + + // 生成本地ID,供上层进行定位使用 + for (int i = 0; i < count; ++i) + { + OrderField* pNewOrder = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + memcpy(pNewOrder, &pOrder[i], sizeof(OrderField)); + + strcpy(pNewOrder->LocalID, m_pIDGenerator->GetIDString()); + strcpy(pNewOrder->ID, pNewOrder->LocalID); + strcat(pszLocalIDBuf, pNewOrder->LocalID); + + if (i (pNewOrder->LocalID, pNewOrder)); + } + + m_msgQueue_Query->Input_Copy(RequestType::E_InputOrderField, m_msgQueue_Query, this, 0, 0, + ppOrders, sizeof(OrderField*)*count, nullptr, 0, nullptr, 0); + + delete[] ppOrders; + + return pszLocalIDBuf; +} + +int CTraderApi::_ReqOrderInsert(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi == nullptr) + return 0; + + // 得到报单指针列表 + OrderField** ppOrders = (OrderField**)ptr1; + int count = (int)size1 / sizeof(OrderField*); + + for (int i = 0; i < count; ++i) + { + Order_STRUCT order = { 0 }; + OrderField_2_Order_STRUCT(ppOrders[i], &order); + + // 主要是账号定位问题 + CSingleUser* pUser = Fill_UserID_Client(order.KHH, &order.Client); + + RequestResponse_STRUCT* pRequest = m_pApi->MakeOrder(&order); + pRequest->pUserData_Public = pUser; + pRequest->pUserData_Public2 = ppOrders[i]; + m_pApi->SendRequest(pRequest); + } + + return 0; +} + +char* CTraderApi::ReqOrderAction(OrderIDType* szId, int count, char* pzsRtn) +{ + memset(pzsRtn, 0, sizeof(OrderIDType)*count); + + OrderField** ppOrders = new OrderField*[count]; + WTLB_STRUCT** ppTdxOrders = new WTLB_STRUCT*[count]; + + for (int i = 0; i < count; ++i) + { + ppOrders[i] = nullptr; + ppTdxOrders[i] = nullptr; + + { + unordered_map::iterator it = m_id_platform_order.find(szId[i]); + if (it != m_id_platform_order.end()) + ppOrders[i] = it->second; + else + { + OrderField* pField = new OrderField(); + ppOrders[i] = pField; + strcpy(pField->ID, szId[i]); + strcpy(pField->Symbol, "*.*"); + strcpy(pField->InstrumentID, "*"); + strcpy(pField->ExchangeID, "*"); + } + } + + { + unordered_map::iterator it = m_id_api_order.find(szId[i]); + if (it != m_id_api_order.end()) + ppTdxOrders[i] = it->second; + else + { + // 找不到对应的ID,需要处理地,不然会报错 + } + } + + if (i < count - 1) + { + strcat(pzsRtn, ";"); + } + } + + m_msgQueue_Query->Input_Copy(RequestType::E_InputOrderActionField, m_msgQueue_Query, this, 0, 0, + ppOrders, sizeof(OrderField*)*count, ppTdxOrders, sizeof(WTLB_STRUCT*)*count, nullptr, 0); + + delete[] ppOrders; + delete[] ppTdxOrders; + + return pzsRtn; +} + +int CTraderApi::_ReqOrderAction(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi == nullptr) + return 0; + + int count = (int)size1 / sizeof(OrderField*); + // 通过ID找到原始结构,用于撤单 + // 通过ID找到通用结构,用于接收回报 + // 这里传过来的的是已经被复制过的内容 + OrderField** ppOrders = (OrderField**)ptr1; + WTLB_STRUCT** ppTdxOrders = (WTLB_STRUCT**)ptr2; + + for (int i = 0; i < count; ++i) + { + if (ppTdxOrders[i] == nullptr) + continue; + + CSingleUser* pUser = Fill_UserID_Client(ppTdxOrders[i]->KHH, &ppTdxOrders[i]->Client); + + RequestResponse_STRUCT* pRequest = m_pApi->MakeCancelOrder(ppTdxOrders[i]); + pRequest->pUserData_Public = pUser; + pRequest->pUserData_Public2 = ppOrders[i]; + m_pApi->SendRequest(pRequest); + } + + return 0; +} + +void CTraderApi::Subscribe(const string& szInstrumentIDs, const string& szExchangeID) +{ + m_msgQueue_Query->Input_Copy(RequestType::E_QryDepthMarketDataField, m_msgQueue_Query, this, 0, 0, + (void*)szInstrumentIDs.c_str(), szInstrumentIDs.length() + 1, (void*)szExchangeID.c_str(), szExchangeID.length() + 1, nullptr, 0); +} + +int CTraderApi::_Subscribe(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi == nullptr) + return 0; + + ReqQueryData_STRUCT query = { 0 }; + + strcpy(query.ZQDM, (char*)ptr1); + query.requestType = REQUEST_HQ; + CSingleUser* pUser = Fill_UserID_Client(query.KHH, &query.Client); + RequestResponse_STRUCT* pRequest = m_pApi->MakeQueryData(&query); + pRequest->pUserData_Public = pUser; + m_pApi->SendRequest(pRequest); + + return 0; +} + +int CTraderApi::OnResponse_Subscribe(CTdxApi* pApi, RequestResponse_STRUCT* pRespone) +{ + HQ_STRUCT** ppRS = nullptr; + CharTable2HQ(pRespone->ppFieldInfo, pRespone->ppResults, &ppRS, pRespone->Client); + + int count = GetCountStructs((void**)ppRS); + + for (int i = 0; i < count; ++i) + { + DepthMarketDataNField* pField = (DepthMarketDataNField*)m_msgQueue->new_block(sizeof(DepthMarketDataNField)+sizeof(DepthField)* 10); + + HQ_STRUCT* pDepthMarketData = ppRS[i]; + + strcpy(pField->InstrumentID, pDepthMarketData->ZQDM); + //pField->Exchange = JYSDM_2_ExchangeType(pDepthMarketData->JYSDM); + + sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, ""); + + // 交易时间 + GetExchangeTime(time(nullptr), &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime); + + + pField->LastPrice = pDepthMarketData->DQJ_; + //pField->Volume = 0; + //pField->Turnover = pDepthMarketData->Turnover; + //pField->OpenInterest = pDepthMarketData->OpenInterest; + //pField->AveragePrice = pDepthMarketData->AveragePrice; + pField->UpperLimitPrice = pDepthMarketData->ZTJG_; + pField->LowerLimitPrice = pDepthMarketData->DTJG_; + + pField->PreClosePrice = pDepthMarketData->ZSJ_; + pField->OpenPrice = pDepthMarketData->JKJ_; + + InitBidAsk(pField); + + do + { + if (pDepthMarketData->BidSize1_ == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice1_, pDepthMarketData->BidSize1_, 0); + + if (pDepthMarketData->BidSize2_ == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice2_, pDepthMarketData->BidSize2_, 0); + + if (pDepthMarketData->BidSize3_ == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice3_, pDepthMarketData->BidSize3_, 0); + + if (pDepthMarketData->BidSize4_ == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice4_, pDepthMarketData->BidSize4_, 0); + + if (pDepthMarketData->BidSize5_ == 0) + break; + AddBid(pField, pDepthMarketData->BidPrice5_, pDepthMarketData->BidSize5_, 0); + } while (false); + + do + { + if (pDepthMarketData->AskSize1_ == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice1_, pDepthMarketData->AskSize1_, 0); + + if (pDepthMarketData->AskSize2_ == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice2_, pDepthMarketData->AskSize2_, 0); + + if (pDepthMarketData->AskSize3_ == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice3_, pDepthMarketData->AskSize3_, 0); + + if (pDepthMarketData->AskSize4_ == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice4_, pDepthMarketData->AskSize4_, 0); + + if (pDepthMarketData->AskSize5_ == 0) + break; + AddAsk(pField, pDepthMarketData->AskPrice5_, pDepthMarketData->AskSize5_, 0); + } while (false); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); + } + + return 0; +} + + +CSingleUser* CTraderApi::Fill_UserID_Client(char* khh, void** Client) +{ + CSingleUser* pUser = nullptr; + if (*Client) + { + unordered_map::iterator it = m_Client_User_Map.find(*Client); + if (it == m_Client_User_Map.end()) + { + pUser = m_pDefaultUser; + } + else + { + pUser = it->second; + } + strcpy(khh, pUser->m_UserID); + } + else + { + unordered_map::iterator it = m_UserID_User_Map.find(khh); + if (it == m_UserID_User_Map.end()) + { + pUser = m_pDefaultUser; + } + else + { + pUser = it->second; + } + *Client = pUser->m_pClient; + } + + return pUser; +} diff --git a/apis/Tdx_Trade/TraderApi.h b/apis/Tdx_Trade/TraderApi.h new file mode 100644 index 0000000..1f9d7e4 --- /dev/null +++ b/apis/Tdx_Trade/TraderApi.h @@ -0,0 +1,185 @@ +#pragma once + +#include "../../include/CrossPlatform.h" +#include "../../include/Tdx/TdxApi.h" +#include "../../include/ApiStruct.h" +#include "../../include/IDGenerator.h" +#include "../../include/QueueEnum.h" + +#ifndef USE_CMAKE +#ifdef _WIN64 + #pragma comment(lib, "../../include/Tdx/win64/TdxApi.lib") +#else + #pragma comment(lib, "../../include/Tdx/win32/TdxApi.lib") +#endif +#endif + +#include "SingleUser.h" + +#include +#include +#include +#include +#include +#include +#include +#include + + + +using namespace std; + +class CMsgQueue; + +/* +多账号支持的问题 +1.由于不同账号查询的时间间隔需要不一样,所以这个交给子对象处理 +2.撤单时只根据一个撤单的ID,所以要在主对象中维护可撤表 +3.股东、股份、资金由于只是回报,并不存储,所以可以写在主对象中,也可以写在子对象中,但有可能以后要维护,还是写在子对象中吧 +4.行情查询,建议直接都通过主连接又快又好 + +*/ +class CTraderApi:public CTdxSpi +{ + //请求数据包类型 + enum RequestType + { + E_Init = 100, + E_Disconnect, + E_ReqUserLoginField, + E_QryInvestorField, + E_InputOrderField, + E_InputOrderActionField, + E_QryOrderField, + E_QryTradeField, + E_QryTradingAccountField, + E_QryInvestorPositionField, + + E_QryDepthMarketDataField, + + + E_SettlementInfoConfirmField, + E_QryInstrumentField, + E_InputQuoteField, + E_InputQuoteActionField, + E_ParkedOrderField, + E_QryInvestorPositionDetailField, + E_QryInstrumentCommissionRateField, + E_QryInstrumentMarginRateField, + E_QrySettlementInfoField, + E_QryQuoteField, + + E_ReqQueryData_STRUCT, + E_Heartbeat, + }; + +public: + //static CTraderApi * pThis; + + CTraderApi(void); + virtual ~CTraderApi(void); + + void Register(void* pCallback, void* pClass); + + void Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo, + int count); + void Disconnect(); + + char* ReqOrderInsert( + OrderField* pOrder, + int count, + char* pszLocalIDBuf); + + char* ReqOrderAction(OrderIDType* szId, int count, char* pzsRtn); + + + void ReqQuery(QueryType type, ReqQueryField* pQuery); + void ReqQuery(ReqQueryData_STRUCT* pQuery); + + //void ReqQryOrder(); + //void ReqQryTrade(); + + void Subscribe(const string& szInstrumentIDs, const string& szExchangeID); + + void RemoveUser(CSingleUser* pUser); + +private: + virtual void OnResponse(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + + friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + virtual void QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + virtual void TestInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + int _Init(); + int _ReqQuery(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + void _Disconnect(bool IsInQueue); + void _DisconnectInThread(); + + //登录请求 + void ReqUserLogin(); + int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + int _ReqQryInvestor(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + /*int _ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + int _ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3);*/ + + int _ReqOrderInsert(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + int _ReqOrderAction(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + /*int _ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + int _ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3);*/ + + int _Subscribe(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + int OnResponse_Subscribe(CTdxApi* pApi, RequestResponse_STRUCT* pRespone); + + + //检查是否出错 + //bool IsErrorRspInfo(Error_STRUCT *pRspInfo, int nRequestID, bool bIsLast);//向消息队列输出信息 + bool IsErrorRspInfo(const char* szSource, Error_STRUCT *pRspInfo);//不输出信息 + //void OutputQueryTime(time_t t, double db,const char* szSource); + + CSingleUser* Fill_UserID_Client(char* khh, void** Client); + +public: + unordered_map m_id_platform_order; + unordered_map m_id_api_order; + +private: + atomic m_lRequestID; //请求ID,得保持自增 + + OrderIDType m_orderInsert_Id; + + mutex m_csOrderRef; + int m_nMaxOrderRef; //报单引用,用于区分报单,保持自增 + + CTdxApi* m_pApi; //交易API + + + string m_szPath; //生成配置文件的路径 + ServerInfoField m_ServerInfo; + UserInfoField m_UserInfo; + + int m_nSleep; + + + + + CMsgQueue* m_msgQueue; //消息队列指针 + CMsgQueue* m_msgQueue_Query; //测试用 + + UserInfoField* m_pUserInfos; + int m_UserInfo_Pos; + int m_UserInfo_Count; + + void* m_pClass; + + CIDGenerator* m_pIDGenerator; + + unordered_map m_Client_User_Map; + unordered_map m_UserID_User_Map; + + CSingleUser* m_pDefaultUser; +}; diff --git a/apis/Tdx_Trade/TypeConvert.cpp b/apis/Tdx_Trade/TypeConvert.cpp new file mode 100644 index 0000000..65cb731 --- /dev/null +++ b/apis/Tdx_Trade/TypeConvert.cpp @@ -0,0 +1,943 @@ +#include "stdafx.h" + +#include +#include +#include + +#include "../../include/Tdx/tdx_enum.h" +#include "../../include/Tdx/tdx_field.h" +#include "../../include/Tdx/tdx_function.h" +#include "../../include/toolkit.h" + +#include "TypeConvert.h" + +////////////////////////////////////////////////////////////////////////// +int ZTSM_str_2_int(char* pIn) +{ + char* pCheng = strstr(pIn, "成"); + char* pChe = strstr(pIn, "撤"); + char* pBu = strstr(pIn, "部"); + + if (pChe) + { + if (pBu) + { + return ZTSM_PartiallyCancelled; + } + return ZTSM_AllCancelled; + } + else if (pCheng) + { + if (pBu) + { + return ZTSM_PartiallyFilled; + } + return ZTSM_AllFilled; + } + + char* pF1 = strstr(pIn, "废"); + char* pF2 = strstr(pIn, "非"); + + if (pF1 || pF2) + { + return ZTSM_Illegal; + } + + char* pDeng = strstr(pIn, "等"); + if (pDeng) + { + return ZTSM_WaitingForReport; + } + + //char* pQ = strstr(pIn, "全"); + //char* pY = strstr(pIn, "已"); + //char* pBao = strstr(pIn, "报"); + + return ZTSM_New; +} + +// 报价方式转,这是根据字符串的特点进行分类 +// TODO:报价方式还有申购,等待后期处理 +int BJFS_str_2_int(char* pIn) +{ + char* pX1 = strstr(pIn, "限"); + + if (pX1 == pIn) + { + // 第一个字是限价 + return WTFS_Limit; + } + else + { + char* pMM = strstr(pIn, "买卖"); + if (pMM) + { + // 华泰返回买卖是表示限价 + return WTFS_Limit; + } + char* pC = strstr(pIn, "撤"); + if (pC) + { + char* p5 = strstr(pIn, "五"); + if (p5) + { + return WTFS_Five_IOC; + } + char* pQ = strstr(pIn, "全"); + if (pQ) + { + return WTFS_FOK; + } + return WTFS_IOC; // 剩 + } + else + { + char* pZ = strstr(pIn, "转"); + if (pZ) + { + return WTFS_Five_Limit; + } + char* pD = strstr(pIn, "对"); + if (pD) + { + return WTFS_Best_Reverse; + } + char* pB = strstr(pIn, "本"); + if (pB) + { + return WTFS_Best_Forward; + } + char* pH = strstr(pIn, "回"); // 回购 + if (pH) + { + return WTFS_Limit; + } + } + + return WTFS_Limit; + } +} + + +///发现不管你下的什么单,只要是特殊的单,买卖标志都是3,所以需要另行处理 +int WTLB_str_2_int(char* pIn) +{ + char* pChe = strstr(pIn, "撤"); + char* pBuy = strstr(pIn, "买"); + if (pBuy) + { + if (pChe) + { + return WTLB_Buy_Cancel; + } + return WTLB_Buy; + } + char* pSell = strstr(pIn, "卖"); + if (pSell) + { + if (pChe) + { + return WTLB_Sell_Cancel; + } + return WTLB_Sell; + } + + + char* pETF = strstr(pIn, "ETF"); + char* pShen = strstr(pIn, "申"); + if (pShen) + { + if (pETF) + { + return WTLB_ETFCreation; + } + return WTLB_LOFCreation; + } + char* pShu = strstr(pIn, "赎"); + if (pShu) + { + if (pETF) + { + return WTLB_ETFRedemption; + } + return WTLB_LOFRedemption; + } + + char* pHe = strstr(pIn, "合"); + if (pHe) + { + return WTLB_Merge; + } + char* pChai = strstr(pIn, "拆"); + if (pChai) + { + return WTLB_Split; + } + + return WTLB_Buy; +} + +////////////////////////////////////////////////////////////////////////// + +void CharTable2WTLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, WTLB_STRUCT*** pppResults, void* Client) +{ + *pppResults = nullptr; + if (ppTable == nullptr) + return; + + int count = GetRowCountTableBody(ppTable); + if (count <= 0) + return; + + WTLB_STRUCT** ppResults = new WTLB_STRUCT*[count + 1](); + ppResults[count] = nullptr; + *pppResults = ppResults; + + int col_147 = GetIndexByFieldID(ppFieldInfos, FIELD_ZTSM); + + for (int i = 0; i < count; ++i) + { + ppResults[i] = new WTLB_STRUCT(); + + int j = 0; + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + while (pRow != 0) + { + char* t = ppTable[i * COL_EACH_ROW + j]; + switch (pRow->FieldID) + { + case FIELD_WTRQ: + strcpy_s(ppResults[i]->WTRQ, t); + break; + case FIELD_WTSJ: + strcpy_s(ppResults[i]->WTSJ, t); + break; + case FIELD_GDDM: + strcpy_s(ppResults[i]->GDDM, t); + break; + case FIELD_ZQDM: + strcpy_s(ppResults[i]->ZQDM, t); + break; + case FIELD_ZQMC: + strcpy_s(ppResults[i]->ZQMC, t); + break; + case FIELD_MMBZ: + strcpy_s(ppResults[i]->MMBZ, t); + break; + case FIELD_WTLB: + strcpy_s(ppResults[i]->WTLB, t); + break; + case FIELD_JYSDM: + strcpy_s(ppResults[i]->JYSDM, t); + break; + case FIELD_WTJG: + strcpy_s(ppResults[i]->WTJG, t); + break; + case FIELD_WTSL: + strcpy_s(ppResults[i]->WTSL, t); + break; + case FIELD_CJJG: + strcpy_s(ppResults[i]->CJJG, t); + break; + case FIELD_CJSL: + strcpy_s(ppResults[i]->CJSL, t); + break; + case FIELD_CDSL: + strcpy_s(ppResults[i]->CDSL, t); + break; + case FIELD_WTBH: + strcpy_s(ppResults[i]->WTBH, t); + break; + case FIELD_BJFS: + strcpy_s(ppResults[i]->BJFS, t); + break; + case FIELD_ZTSM: + strcpy_s(ppResults[i]->ZTSM, t); + break; + case FIELD_DJZJ: + strcpy_s(ppResults[i]->DJZJ, t); + break; + case FIELD_BLXX: + strcpy_s(ppResults[i]->BLXX, t); + break; + case FIELD_WTFS: + strcpy_s(ppResults[i]->WTFS, t); + break; + case FIELD_ZJZH: + strcpy_s(ppResults[i]->ZJZH, t); + break; + case FIELD_ZHLB: + strcpy_s(ppResults[i]->ZHLB, t); + break; + } + ++j; + pRow = ppFieldInfos[j]; + } + + ppResults[i]->WTRQ_ = atoi(ppResults[i]->WTRQ); + ppResults[i]->MMBZ_ = atoi(ppResults[i]->MMBZ); + ppResults[i]->JYSDM_ = atoi(ppResults[i]->JYSDM); + ppResults[i]->WTJG_ = atof(ppResults[i]->WTJG); + ppResults[i]->WTSL_ = atoi(ppResults[i]->WTSL); + ppResults[i]->CJJG_ = atof(ppResults[i]->CJJG); + ppResults[i]->CJSL_ = atoi(ppResults[i]->CJSL); + ppResults[i]->DJZJ_ = atof(ppResults[i]->DJZJ); + ppResults[i]->WTFS_ = atof(ppResults[i]->WTFS); + ppResults[i]->ZHLB_ = atoi(ppResults[i]->ZHLB); + + // 可能没有,怎么办?那就只好不用它了 + ppResults[i]->CDSL_ = atoi(ppResults[i]->CDSL); + + if (strstr(ppResults[i]->WTSJ, ":")) + { + int HH = 0, mm = 0, ss = 0; + GetUpdateTime_HH_mm_ss(ppResults[i]->WTSJ, &HH, &mm, &ss); + ppResults[i]->WTSJ_ = HH * 10000 + mm * 100 + ss; + } + else + { + ppResults[i]->WTSJ_ = atoi(ppResults[i]->WTSJ); + } + + + if (col_147 >= 0) + { + // 第一个的字符,并转成数字,其实也可以全走文本比较的方式,但认为这样更快 + if (ppResults[i]->ZTSM[1] == '-') + { + ppResults[i]->ZTSM_ = ppResults[i]->ZTSM[0] - '0'; + } + else + { + ppResults[i]->ZTSM_ = ZTSM_str_2_int(ppResults[i]->ZTSM); + } + } + else + { + // 信达证券没有状态说明,需要模拟计算出来,这种情况下,撤单数量怎么都要有 + if (ppResults[i]->CDSL_ > 0) + { + ppResults[i]->ZTSM_ = ZTSM_AllCancelled; + } + else if (ppResults[i]->CJSL_ == ppResults[i]->WTSL_) + { + ppResults[i]->ZTSM_ = ZTSM_AllFilled; + } + else if (ppResults[i]->CJSL_ == 0) + { + ppResults[i]->ZTSM_ = ZTSM_New; + } + else + { + ppResults[i]->ZTSM_ = ZTSM_PartiallyFilled; + } + } + + + ppResults[i]->BJFS_ = BJFS_str_2_int(ppResults[i]->BJFS); + ppResults[i]->WTLB_ = WTLB_str_2_int(ppResults[i]->WTLB); + + ppResults[i]->Client = Client; + } +} + +void CharTable2CJLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, CJLB_STRUCT*** pppResults, void* Client) +{ + *pppResults = nullptr; + if (ppTable == nullptr) + return; + + int count = GetRowCountTableBody(ppTable); + if (count <= 0) + return; + + CJLB_STRUCT** ppResults = new CJLB_STRUCT*[count + 1](); + ppResults[count] = nullptr; + *pppResults = ppResults; + + for (int i = 0; i < count; ++i) + { + ppResults[i] = new CJLB_STRUCT(); + + int j = 0; + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + while (pRow != 0) + { + char* t = ppTable[i * COL_EACH_ROW + j]; + switch (pRow->FieldID) + { + case FIELD_CJRQ: + strcpy_s(ppResults[i]->CJRQ, t); + break; + case FIELD_CJSJ: + strcpy_s(ppResults[i]->CJSJ, t); + break; + case FIELD_GDDM: + strcpy_s(ppResults[i]->GDDM, t); + break; + case FIELD_ZQDM: + strcpy_s(ppResults[i]->ZQDM, t); + break; + case FIELD_ZQMC: + strcpy_s(ppResults[i]->ZQMC, t); + break; + case FIELD_MMBZ: + strcpy_s(ppResults[i]->MMBZ, t); + break; + case FIELD_WTLB: + strcpy_s(ppResults[i]->WTLB, t); + break; + case FIELD_CJJG: + strcpy_s(ppResults[i]->CJJG, t); + break; + case FIELD_CJSL: + strcpy_s(ppResults[i]->CJSL, t); + break; + case FIELD_FSJE: + strcpy_s(ppResults[i]->FSJE, t); + break; + case FIELD_SYJE: + strcpy_s(ppResults[i]->SYJE, t); + break; + case FIELD_YJ: + strcpy_s(ppResults[i]->YJ, t); + break; + case FIELD_YHS: + strcpy_s(ppResults[i]->YHS, t); + break; + case FIELD_GHF: + strcpy_s(ppResults[i]->GHF, t); + break; + case FIELD_CJF: + strcpy_s(ppResults[i]->CJF, t); + break; + case FIELD_CJBH: + strcpy_s(ppResults[i]->CJBH, t); + break; + case FIELD_CDBZ: + strcpy_s(ppResults[i]->CDBZ, t); + break; + case FIELD_WTBH: + strcpy_s(ppResults[i]->WTBH, t); + break; + } + ++j; + pRow = ppFieldInfos[j]; + } + + ppResults[i]->CJRQ_ = atoi(ppResults[i]->CJRQ); + ppResults[i]->MMBZ_ = atoi(ppResults[i]->MMBZ); + ppResults[i]->CJJG_ = atof(ppResults[i]->CJJG); + ppResults[i]->CJSL_ = atoi(ppResults[i]->CJSL); + ppResults[i]->SYJE_ = atof(ppResults[i]->SYJE); + ppResults[i]->YJ_ = atof(ppResults[i]->YJ); + ppResults[i]->YHS_ = atof(ppResults[i]->YHS); + ppResults[i]->GHF_ = atof(ppResults[i]->GHF); + ppResults[i]->CJF_ = atof(ppResults[i]->CJF); + ppResults[i]->CDBZ_ = atoi(ppResults[i]->CDBZ); + ppResults[i]->FSJE_ = atof(ppResults[i]->FSJE); + + + if (strstr(ppResults[i]->CJSJ, ":")) + { + int HH = 0, mm = 0, ss = 0; + GetUpdateTime_HH_mm_ss(ppResults[i]->CJSJ, &HH, &mm, &ss); + ppResults[i]->CJSJ_ = HH * 10000 + mm * 100 + ss; + } + else + { + ppResults[i]->CJSJ_ = atoi(ppResults[i]->CJSJ); + } + + ppResults[i]->WTLB_ = WTLB_str_2_int(ppResults[i]->WTLB); + + ppResults[i]->Client = Client; + } +} + +void CharTable2GFLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, GFLB_STRUCT*** pppResults, void* Client) +{ + *pppResults = nullptr; + if (ppTable == nullptr) + return; + + int count = GetRowCountTableBody(ppTable); + if (count <= 0) + return; + + GFLB_STRUCT** ppResults = new GFLB_STRUCT*[count + 1](); + ppResults[count] = nullptr; + *pppResults = ppResults; + + for (int i = 0; i < count; ++i) + { + ppResults[i] = new GFLB_STRUCT(); + + int j = 0; + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + while (pRow != 0) + { + char* t = ppTable[i * COL_EACH_ROW + j]; + switch (pRow->FieldID) + { + case FIELD_ZQDM: + strcpy_s(ppResults[i]->ZQDM, t); + break; + case FIELD_ZQMC: + strcpy_s(ppResults[i]->ZQMC, t); + break; + case FIELD_ZQSL: + strcpy_s(ppResults[i]->ZQSL, t); + break; + case FIELD_KMSL: + strcpy_s(ppResults[i]->KMSL, t); + break; + case FIELD_TBCBJ: + strcpy_s(ppResults[i]->TBCBJ, t); + break; + case FIELD_DQJ: + strcpy_s(ppResults[i]->DQJ, t); + break; + case FIELD_ZXSZ: + strcpy_s(ppResults[i]->ZXSZ, t); + break; + case FIELD_TBFDYK: + strcpy_s(ppResults[i]->TBFDYK, t); + break; + case FIELD_SXYK: + strcpy_s(ppResults[i]->SXYK, t); + break; + case FIELD_CKYKBL: + strcpy_s(ppResults[i]->CKYKBL, t); + break; + case FIELD_DJSL: + strcpy_s(ppResults[i]->DJSL, t); + break; + case FIELD_GDDM: + strcpy_s(ppResults[i]->GDDM, t); + break; + case FIELD_JYSDM: + strcpy_s(ppResults[i]->JYSDM, t); + break; + case FIELD_JYSMC: + strcpy_s(ppResults[i]->JYSMC, t); + break; + case FIELD_BLXX: + strcpy_s(ppResults[i]->BLXX, t); + break; + case FIELD_DQSL: + strcpy_s(ppResults[i]->DQSL, t); + break; + case FIELD_SJSL: + strcpy_s(ppResults[i]->SJSL, t); + break; + } + ++j; + pRow = ppFieldInfos[j]; + } + + ppResults[i]->ZQSL_ = atoi(ppResults[i]->ZQSL); + ppResults[i]->KMSL_ = atoi(ppResults[i]->KMSL); + ppResults[i]->TBCBJ_ = atof(ppResults[i]->TBCBJ); + ppResults[i]->DQJ_ = atof(ppResults[i]->DQJ); + ppResults[i]->ZXSZ_ = atof(ppResults[i]->ZXSZ); + ppResults[i]->DJSL_ = atof(ppResults[i]->DJSL); + ppResults[i]->DQSL_ = atof(ppResults[i]->DQSL); + ppResults[i]->SJSL_ = atof(ppResults[i]->SJSL); + + ppResults[i]->ZQSL_ = max(ppResults[i]->ZQSL_, ppResults[i]->DQSL_); + ppResults[i]->ZQSL_ = max(ppResults[i]->ZQSL_, ppResults[i]->SJSL_); + + ppResults[i]->Client = Client; + } +} + +void CharTable2ZJYE(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, ZJYE_STRUCT*** pppResults, void* Client) +{ + *pppResults = nullptr; + if (ppTable == nullptr) + return; + + int count = GetRowCountTableBody(ppTable); + if (count <= 0) + return; + + ZJYE_STRUCT** ppResults = new ZJYE_STRUCT*[count + 1](); + ppResults[count] = nullptr; + *pppResults = ppResults; + + for (int i = 0; i < count; ++i) + { + ppResults[i] = new ZJYE_STRUCT(); + + int j = 0; + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + while (pRow != 0) + { + char* t = ppTable[i * COL_EACH_ROW + j]; + switch (pRow->FieldID) + { + case FIELD_BZ: + strcpy_s(ppResults[i]->BZ, t); + break; + case FIELD_ZJYE: + strcpy_s(ppResults[i]->ZJYE, t); + break; + case FIELD_KYZJ: + strcpy_s(ppResults[i]->KYZJ, t); + break; + case FIELD_ZZC_310: + strcpy_s(ppResults[i]->ZZC, t); + break; + case FIELD_KQZJ: + strcpy_s(ppResults[i]->KQZJ, t); + break; + case FIELD_ZJZH: + strcpy_s(ppResults[i]->ZJZH, t); + break; + case FIELD_ZXSZ: + strcpy_s(ppResults[i]->ZXSZ, t); + break; + } + ++j; + pRow = ppFieldInfos[j]; + } + + ppResults[i]->ZJYE_ = atof(ppResults[i]->ZJYE); + ppResults[i]->KYZJ_ = atof(ppResults[i]->KYZJ); + ppResults[i]->ZZC_ = atof(ppResults[i]->ZZC); + ppResults[i]->KQZJ_ = atof(ppResults[i]->KQZJ); + ppResults[i]->ZXSZ_ = atof(ppResults[i]->ZXSZ); + + ppResults[i]->Client = Client; + } +} + +////////////////////////////////////////////////////////////////////////// + +OrderType WTFS_2_OrderType(int In) +{ + switch (In) + { + case WTFS_Limit: + return OrderType::OrderType_Limit; + default: + return OrderType::OrderType_Market; + } +} + +TimeInForce WTFS_2_TimeInForce(int In) +{ + switch (In) + { + case WTFS_Limit: + case WTFS_Best_Reverse: + case WTFS_Best_Forward: + return TimeInForce::TimeInForce_Day; + case WTFS_IOC: + case WTFS_Five_IOC: + return TimeInForce::TimeInForce_IOC; + case WTFS_FOK: + return TimeInForce::TimeInForce_FOK; + case WTFS_Five_Limit: + return TimeInForce::TimeInForce_Day; + default: + return TimeInForce::TimeInForce_Day; + } +} + +OrderStatus ZTSM_2_OrderStatus(int In) +{ + switch (In) + { + case ZTSM_NotSent: + return OrderStatus::OrderStatus_PendingNew; + case ZTSM_New: + return OrderStatus::OrderStatus_New; + case ZTSM_Illegal: + return OrderStatus::OrderStatus_Rejected; + case ZTSM_AllFilled: + return OrderStatus::OrderStatus_Filled; + case ZTSM_AllCancelled: + return OrderStatus::OrderStatus_Cancelled; + case ZTSM_PartiallyFilled: + return OrderStatus::OrderStatus_PartiallyFilled; + case ZTSM_WaitingForReport: + return OrderStatus::OrderStatus_New; + default: + return OrderStatus::OrderStatus_NotSent; + } +} + +ExecType ZTSM_2_ExecType(int In) +{ + switch (In) + { + case ZTSM_NotSent: + return ExecType::ExecType_New; + case ZTSM_New: + return ExecType::ExecType_New; + case ZTSM_Illegal: + return ExecType::ExecType_Rejected; + case ZTSM_AllFilled: + case ZTSM_PartiallyFilled: + return ExecType::ExecType_Trade; + case ZTSM_AllCancelled: + case ZTSM_PartiallyCancelled: + return ExecType::ExecType_Cancelled; + case ZTSM_WaitingForReport: + return ExecType::ExecType_New; + default: + return ExecType::ExecType_New; + } +} + +bool ZTSM_IsDone(int In) +{ + switch (In) + { + case ZTSM_Illegal: + case ZTSM_AllFilled: + case ZTSM_AllCancelled: + case ZTSM_PartiallyCancelled: + return true; + } + return false; +} + +bool ZTSM_IsNotSent(int In) +{ + switch (In) + { + case ZTSM_NotSent: + return true; + } + return false; +} + + +// 将买卖方式转成买卖方向 +OrderSide MMBZ_2_OrderSide(int In) +{ + switch (In / 100) + { + case REQUEST_ETF_SGSH: + switch (In % 100) + { + case JYLX_Creation: + return OrderSide::OrderSide_ETFCreation; + case JYLX_Redemption: + return OrderSide::OrderSide_ETFRedemption; + default: + break; + } + break; + case REQUEST_WT: + switch (In % 100) + { + case MMBZ_Buy_Limit: + return OrderSide::OrderSide_Buy; + case MMBZ_Sell_Limit: + return OrderSide::OrderSide_Sell; + case MMBZ_Buy_Market: + return OrderSide::OrderSide_Buy; + case MMBZ_Sell_Market: + return OrderSide::OrderSide_Sell; + case MMBZ_Creation: + return OrderSide::OrderSide_LOFCreation; + case MMBZ_Redemption: + return OrderSide::OrderSide_LOFRedemption; + case MMBZ_Merge: + return OrderSide::OrderSide_Merge; + case MMBZ_Split: + return OrderSide::OrderSide_Split; + default: + break; + } + break; + case REQUEST_ZGHS: + switch (In % 100) + { + case MMBZ_CB_Conv: + return OrderSide::OrderSide_CBConvert; + case MMBZ_CB_Red: + return OrderSide::OrderSide_CBRedemption; + default: + break; + } + break; + default: + break; + } + + return OrderSide::OrderSide_Unknown; +} + +void CJLB_2_TradeField(CJLB_STRUCT* pIn, TradeField* pOut) +{ + //strcpy(pOut->ID, pIn->WTBH);将会被修正 + strcpy(pOut->InstrumentID, pIn->ZQDM); + strcpy(pOut->InstrumentName, pIn->ZQMC); + strcpy(pOut->AccountID, pIn->GDDM); + pOut->Price = pIn->CJJG_; + pOut->Qty = pIn->CJSL_; + pOut->Date = pIn->CJRQ_; + pOut->Time = pIn->CJSJ_; + pOut->Side = MMBZ_2_OrderSide(pIn->WTLB_); + + strcpy(pOut->TradeID, pIn->CJBH); + + pOut->Commission = pIn->YJ_ + pIn->YHS_ + pIn->GHF_ + pIn->CJF_; + + pOut->OpenClose = pOut->Side % 2 == 0 ? OpenCloseType::OpenCloseType_Open : OpenCloseType::OpenCloseType_Close; + pOut->HedgeFlag = HedgeFlagType::HedgeFlagType_Speculation; + +} + +void WTLB_2_OrderField_0(WTLB_STRUCT* pIn, OrderField* pOut) +{ + //strcpy(pOut->ID, pIn->WTBH);//将会被修正 + strcpy(pOut->OrderID, pIn->WTBH); + strcpy(pOut->InstrumentID, pIn->ZQDM); + strcpy(pOut->InstrumentName, pIn->ZQMC); + strcpy(pOut->AccountID, pIn->GDDM); + pOut->Price = pIn->WTJG_; + pOut->Qty = pIn->WTSL_; + pOut->Date = pIn->WTRQ_; + pOut->Time = pIn->WTSJ_; + // 这个地方怎么会这样 + pOut->Side = MMBZ_2_OrderSide(pIn->WTLB_); + + pOut->Type = WTFS_2_OrderType(pIn->BJFS_); + pOut->TimeInForce = WTFS_2_TimeInForce(pIn->BJFS_); + + pOut->Status = ZTSM_2_OrderStatus(pIn->ZTSM_); + pOut->ExecType = ZTSM_2_ExecType(pIn->ZTSM_); + + pOut->OpenClose = pOut->Side % 2 == 0 ? OpenCloseType::OpenCloseType_Open : OpenCloseType::OpenCloseType_Close; + pOut->HedgeFlag = HedgeFlagType::HedgeFlagType_Speculation; + + strcpy(pOut->AccountID, pIn->GDDM); + + pOut->AvgPx = pIn->CJJG_; + pOut->CumQty = pIn->CJSL_; + pOut->LeavesQty = pIn->WTSL_ - pIn->CJSL_ - pIn->CDSL_; + + strcpy(pOut->Text, pIn->ZTSM); +} + +int OrderType_2_WTFS(OrderType In) +{ + switch (In) + { + case OrderType_Market: + case OrderType_Stop: + case OrderType_MarketOnClose: + case OrderType_TrailingStop: + return WTFS_Five_IOC;// 只推荐使用五档模拟市价 + case OrderType_Limit: + case OrderType_StopLimit: + case OrderType_TrailingStopLimit: + return WTFS_Limit; + case OrderType_Pegged: + default: + return WTFS_Limit; + } +} + + +void OrderField_2_Order_STRUCT(OrderField* pIn, Order_STRUCT* pOut) +{ + strcpy(pOut->KHH, pIn->ClientID); + strcpy(pOut->ZJZH, pIn->ClientID);//通达信模拟上是否会出错? + strcpy(pOut->GDDM, pIn->AccountID); + + strcpy(pOut->ZQDM, pIn->InstrumentID); + pOut->Price = pIn->Price; + pOut->Qty = pIn->Qty; + pOut->WTFS = OrderType_2_WTFS(pIn->Type); + pOut->RZRQBS = RZRQBS_NO; + pOut->requestType = REQUEST_WT; + + // 这个地方后期要再改,因为没有处理基金等情况 + switch (pIn->Side) + { + case OrderSide::OrderSide_Buy: + if (pIn->Type == OrderType::OrderType_Market) + pOut->MMBZ = MMBZ_Buy_Market; + else + pOut->MMBZ = MMBZ_Buy_Limit; + break; + case OrderSide::OrderSide_Sell: + if (pIn->Type == OrderType::OrderType_Market) + pOut->MMBZ = MMBZ_Sell_Market; + else + pOut->MMBZ = MMBZ_Sell_Limit; + break; + case OrderSide::OrderSide_LOFCreation: + pOut->MMBZ = MMBZ_Creation; + break; + case OrderSide::OrderSide_LOFRedemption: + pOut->MMBZ = MMBZ_Redemption; + break; + case OrderSide::OrderSide_ETFCreation: + pOut->MMBZ = JYLX_Creation; + pOut->requestType = REQUEST_ETF_SGSH; + break; + case OrderSide::OrderSide_ETFRedemption: + pOut->MMBZ = JYLX_Redemption; + pOut->requestType = REQUEST_ETF_SGSH; + break; + case OrderSide::OrderSide_Merge: + pOut->MMBZ = MMBZ_Merge; + break; + case OrderSide::OrderSide_Split: + pOut->MMBZ = MMBZ_Split; + break; + case OrderSide::OrderSide_CBConvert: + pOut->MMBZ = MMBZ_CB_Conv; + pOut->requestType = REQUEST_ZGHS; + break; + case OrderSide::OrderSide_CBRedemption: + pOut->MMBZ = MMBZ_CB_Red; + pOut->requestType = REQUEST_ZGHS; + break; + } +} + +void GDLB_2_InvestorField(GDLB_STRUCT* pIn, InvestorField* pOut) +{ + strcpy(pOut->InvestorID, pIn->GDDM); + strcpy(pOut->InvestorName, pIn->GDMC); +} + +void ZJYE_2_AccountField(ZJYE_STRUCT* pIn, AccountField* pOut) +{ + strcpy(pOut->AccountID, pIn->ZJZH); + //strcpy(pOut->ClientID, pIn->ZJZH); + + pOut->Available = pIn->KYZJ_; + + // 还有很多不知道如何对应,有可能需要扩展XAPI部分 + pOut->Balance = pIn->ZZC_; + +} + +void GFLB_2_PositionField(GFLB_STRUCT* pIn, PositionField* pOut) +{ + pOut->Side = PositionSide::PositionSide_Long; + pOut->Position = pIn->ZQSL_; + pOut->TodayPosition = pIn->DJSL_; + pOut->HistoryPosition = pIn->KMSL_; + pOut->HedgeFlag = HedgeFlagType::HedgeFlagType_Speculation; + strcpy(pOut->InstrumentName, pIn->ZQMC); + strcpy(pOut->InstrumentID, pIn->ZQDM); + strcpy(pOut->Symbol, pIn->ZQDM); + strcpy(pOut->AccountID, pIn->GDDM); + strcpy(pOut->ExchangeID, pIn->JYSDM); + + + sprintf(pOut->ID, "%s:%s:%d:%d", + pOut->InstrumentID, pOut->ExchangeID, + pOut->Side, pOut->HedgeFlag); +} \ No newline at end of file diff --git a/apis/Tdx_Trade/TypeConvert.h b/apis/Tdx_Trade/TypeConvert.h new file mode 100644 index 0000000..25f71ff --- /dev/null +++ b/apis/Tdx_Trade/TypeConvert.h @@ -0,0 +1,37 @@ +#pragma once + +#include "../../include/ApiStruct.h" + +#include "../../include/Tdx/tdx_struct.h" + +// 两种情况: +// 1.完全重建 +// 2.部分重建 + +void CharTable2WTLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, WTLB_STRUCT*** pppResults, void* Client); + +void CharTable2CJLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, CJLB_STRUCT*** pppResults, void* Client); + +void CharTable2GFLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, GFLB_STRUCT*** pppResults, void* Client); + +void CharTable2ZJYE(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, ZJYE_STRUCT*** pppResults, void* Client); + +// void CharTable2HQ(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, HQ_STRUCT*** pppResults, void* Client, CMsgQueue* pQueue); + +////////////////////////////////////////////////////////////////////////// + + +bool ZTSM_IsDone(int In); +bool ZTSM_IsNotSent(int In); + +void GDLB_2_InvestorField(GDLB_STRUCT* pIn, InvestorField* pOut); +void ZJYE_2_AccountField(ZJYE_STRUCT* pIn, AccountField* pOut); +void GFLB_2_PositionField(GFLB_STRUCT* pIn, PositionField* pOut); + +void CJLB_2_TradeField(CJLB_STRUCT* pIn, TradeField* pOut); + +// +void WTLB_2_OrderField_0(WTLB_STRUCT* pIn, OrderField* pOut); +//void WTLB_2_OrderField_1(WTLB_STRUCT* pIn, OrderField* pOut); + +void OrderField_2_Order_STRUCT(OrderField* pIn, Order_STRUCT* pOut); diff --git a/apis/Tdx_Trade/dllmain.cpp b/apis/Tdx_Trade/dllmain.cpp new file mode 100644 index 0000000..69b5891 --- /dev/null +++ b/apis/Tdx_Trade/dllmain.cpp @@ -0,0 +1,19 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/QuantBox_Tdx_Trade/main.cpp b/apis/Tdx_Trade/main.cpp similarity index 60% rename from QuantBox_Tdx_Trade/main.cpp rename to apis/Tdx_Trade/main.cpp index bba8b4e..b3f29aa 100644 --- a/QuantBox_Tdx_Trade/main.cpp +++ b/apis/Tdx_Trade/main.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -#include "../include/ApiHeader.h" -#include "../include/QueueEnum.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" #include "TraderApi.h" inline CTraderApi* GetApi(void* pApi) @@ -13,13 +13,13 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do RequestType rt = (RequestType)type; switch (rt) { - case GetApiType: + case RequestType_GetApiTypes: return (void*)(ApiType::ApiType_Trade | ApiType::ApiType_MarketData | ApiType::ApiType_Query); - case GetApiVersion: - return (void*)"0.2.0.20151124"; - case GetApiName: + case RequestType_GetApiVersion: + return (void*)"0.4.0.20161026"; + case RequestType_GetApiName: return (void*)"Tdx"; - case Create: + case RequestType_Create: return new CTraderApi(); default: break; @@ -34,41 +34,33 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do switch (rt) { - case Release: + case RequestType_Release: delete pApi; return nullptr; - case Register: + case RequestType_Register: pApi->Register(ptr1, ptr2); break; - case Connect: + case RequestType_Connect: pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2,size2); break; - case Disconnect: + case RequestType_Disconnect: pApi->Disconnect(); break; - case ReqQryOrder: - case ReqQryTrade: - case ReqQryInvestorPosition: - case ReqQryTradingAccount: - case ReqQryInvestor: + case QueryType_ReqQryOrder: + case QueryType_ReqQryTrade: + case QueryType_ReqQryInvestorPosition: + case QueryType_ReqQryTradingAccount: + case QueryType_ReqQryInvestor: + // ⲿõIJѯ pApi->ReqQuery((QueryType)type, (ReqQueryField*)ptr1); break; - /*case ReqQryInstrument: - pApi->ReqQryInstrument((const char*)ptr1, (const char*)ptr2); - break; - case ReqQrySettlementInfo: - pApi->ReqQrySettlementInfo((const char*)ptr1); - break;*/ - case ReqOrderInsert: - return (void*)pApi->ReqOrderInsert((OrderField*)ptr1, size1, (OrderIDType*)ptr2); - case ReqOrderAction: - return (void*)pApi->ReqOrderAction((OrderIDType*)ptr1, size1, (OrderIDType*)ptr2); - case Subscribe: + case RequestType_ReqOrderInsert: + return (void*)pApi->ReqOrderInsert((OrderField*)ptr1, size1, (char*)ptr2); + case RequestType_ReqOrderAction: + return (void*)pApi->ReqOrderAction((OrderIDType*)ptr1, size1, (char*)ptr2); + case RequestType_Subscribe: pApi->Subscribe((const char*)ptr1, (const char*)ptr2); break; - //case Unsubscribe: - // pApi->Unsubscribe((const char*)ptr1, (const char*)ptr2); - // break; default: break; } diff --git a/apis/Tdx_Trade/stdafx.cpp b/apis/Tdx_Trade/stdafx.cpp new file mode 100644 index 0000000..59b3c80 --- /dev/null +++ b/apis/Tdx_Trade/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Tdx_Trade.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/apis/Tdx_Trade/stdafx.h b/apis/Tdx_Trade/stdafx.h new file mode 100644 index 0000000..f3a0737 --- /dev/null +++ b/apis/Tdx_Trade/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here diff --git a/apis/Tdx_Trade/targetver.h b/apis/Tdx_Trade/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/apis/Tdx_Trade/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/QuantBox_TongShi_Quote/DialogStockDrv.cpp b/apis/TongShi_Quote/DialogStockDrv.cpp similarity index 97% rename from QuantBox_TongShi_Quote/DialogStockDrv.cpp rename to apis/TongShi_Quote/DialogStockDrv.cpp index 9f3f4b3..ed7961e 100644 --- a/QuantBox_TongShi_Quote/DialogStockDrv.cpp +++ b/apis/TongShi_Quote/DialogStockDrv.cpp @@ -2,7 +2,7 @@ // #include "stdafx.h" -#include "QuantBox_TongShi_Quote.h" +#include "TongShi_Quote.h" #include "DialogStockDrv.h" #include "afxdialogex.h" diff --git a/QuantBox_TongShi_Quote/DialogStockDrv.h b/apis/TongShi_Quote/DialogStockDrv.h similarity index 100% rename from QuantBox_TongShi_Quote/DialogStockDrv.h rename to apis/TongShi_Quote/DialogStockDrv.h diff --git a/QuantBox_TongShi_Quote/MdUserApi.cpp b/apis/TongShi_Quote/MdUserApi.cpp similarity index 84% rename from QuantBox_TongShi_Quote/MdUserApi.cpp rename to apis/TongShi_Quote/MdUserApi.cpp index f6beb42..a1ba8db 100644 --- a/QuantBox_TongShi_Quote/MdUserApi.cpp +++ b/apis/TongShi_Quote/MdUserApi.cpp @@ -1,18 +1,18 @@ #include "stdafx.h" #include "MdUserApi.h" -#include "../include/QueueEnum.h" +#include "../../include/QueueEnum.h" -#include "../include/ApiHeader.h" -#include "../include/ApiStruct.h" +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" -#include "../include/toolkit.h" -#include "../include/ApiProcess.h" +#include "../../include/toolkit.h" +#include "../../include/ApiProcess.h" -#include "../QuantBox_Queue/MsgQueue.h" +#include "../../include/queue/MsgQueue.h" -#include "../include/XApiC.h" +#include "../../include/XApiC.h" -#include "../include/ChinaStock.h" +#include "../../include/ChinaStock.h" #include "TypeConvert.h" #include @@ -150,7 +150,7 @@ void CMdUserApi::Register(void* pCallback,void* pClass) return; //m_msgQueue_Query->Register((void*)Query,this); - m_msgQueue->Register(pCallback,this); + m_msgQueue->Register((fnOnResponse)pCallback); if (pCallback) { //m_msgQueue_Query->StartThread(); @@ -197,7 +197,7 @@ void CMdUserApi::InitDriver(HWND hWnd, UINT Msg) pField->RawErrorID = GetLastError(); strncpy(pField->Text, X_GetLastError(), sizeof(Char256Type)); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); return; } @@ -210,12 +210,12 @@ void CMdUserApi::InitDriver(HWND hWnd, UINT Msg) pField->RawErrorID = GetLastError(); strncpy(pField->Text, X_GetLastError(), sizeof(Char256Type)); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); return; } - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); m_nInited = m_pfnStock_Init(hWnd, Msg, RCV_WORK_REQUEST);// RCV_WORK_SENDMSG); m_hWnd = hWnd; @@ -269,7 +269,7 @@ void CMdUserApi::Disconnect() if (m_msgQueue) { m_msgQueue->Clear(); - m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); // 主动触发 m_msgQueue->Process(); } @@ -279,7 +279,7 @@ void CMdUserApi::Disconnect() if (m_msgQueue) { m_msgQueue->StopThread(); - m_msgQueue->Register(nullptr,nullptr); + m_msgQueue->Register(nullptr); m_msgQueue->Clear(); delete m_msgQueue; m_msgQueue = nullptr; @@ -306,8 +306,8 @@ void CMdUserApi::OnRspQryInstrument(DepthMarketDataNField* _pField,RCV_REPORT_ST pField->PriceTick = InstrumentID_2_PriceTick_SSE(instrumentInt); break; case SZ_MARKET_EX: - pField->Type = InstrumentID_2_InstrumentType_SZE(instrumentInt); - pField->PriceTick = InstrumentID_2_PriceTick_SZE(instrumentInt); + pField->Type = InstrumentID_2_InstrumentType_SZSE(instrumentInt); + pField->PriceTick = InstrumentID_2_PriceTick_SZSE(instrumentInt); break; case SB_MARKET_EX: pField->Type = InstrumentID_2_InstrumentType_NEEQ(instrumentInt); @@ -317,14 +317,14 @@ void CMdUserApi::OnRspQryInstrument(DepthMarketDataNField* _pField,RCV_REPORT_ST break; } - m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, m_pClass, index >= Count - 1, 0, pField, sizeof(InstrumentField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRspQryInstrument, m_msgQueue, m_pClass, index >= Count - 1, 0, pField, sizeof(InstrumentField), nullptr, 0, nullptr, 0); } bool CMdUserApi::FilterExchangeInstrument(WORD wMarket, int instrument) { // 行情太多,需要过滤 - return (bool)m_msgQueue->Input_Output(ResponeType::OnFilterSubscribe, m_msgQueue, m_pClass, Market_2_ExchangeType(wMarket), 0, nullptr, instrument, nullptr, 0, nullptr, 0); + return (bool)m_msgQueue->Input_Output(ResponseType::ResponseType_OnFilterSubscribe, m_msgQueue, m_pClass, Market_2_ExchangeType(wMarket), 0, nullptr, instrument, nullptr, 0, nullptr, 0); } //行情回调,得保证此函数尽快返回 @@ -414,7 +414,7 @@ void CMdUserApi::OnRtnDepthMarketData(RCV_REPORT_STRUCTEx *pDepthMarketData, int AddAsk(pField, my_round(pDepthMarketData->m_fSellPrice5), pDepthMarketData->m_fSellVolume5 * nLots, 0); } while (false); - m_msgQueue->Input_NoCopy(ResponeType::OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); } void CMdUserApi::StartThread() diff --git a/QuantBox_TongShi_Quote/MdUserApi.h b/apis/TongShi_Quote/MdUserApi.h similarity index 93% rename from QuantBox_TongShi_Quote/MdUserApi.h rename to apis/TongShi_Quote/MdUserApi.h index 9555c92..8943a43 100644 --- a/QuantBox_TongShi_Quote/MdUserApi.h +++ b/apis/TongShi_Quote/MdUserApi.h @@ -2,17 +2,10 @@ #ifndef _USE_32BIT_TIME_T #define _USE_32BIT_TIME_T #endif -#include "../include/ApiStruct.h" +#include "../../include/CrossPlatform.h" +#include "../../include/ApiStruct.h" #include #include "Stockdrv.h" -#include "../include/QueueHeader.h" - - -#ifdef _WIN64 -#pragma comment(lib, "../lib/QuantBox_Queue_x64.lib") -#else -#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") -#endif #include #include @@ -56,11 +49,11 @@ class CMdUserApi void InitDriver(HWND hWnd, UINT Msg); void QuitDriver(); - //void Subscribe(const string& szInstrumentIDs, const string& szExchageID); - //void Unsubscribe(const string& szInstrumentIDs, const string& szExchageID); + //void Subscribe(const string& szInstrumentIDs, const string& szExchangeID); + //void Unsubscribe(const string& szInstrumentIDs, const string& szExchangeID); - //void SubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); - //void UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); + //void SubscribeQuote(const string& szInstrumentIDs, const string& szExchangeID); + //void UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchangeID); private: bool FilterExchangeInstrument(WORD wMarket, int instrument); @@ -84,8 +77,8 @@ class CMdUserApi //int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); // - void Subscribe(const set& instrumentIDs, const string& szExchageID); - void SubscribeQuote(const set& instrumentIDs, const string& szExchageID); + void Subscribe(const set& instrumentIDs, const string& szExchangeID); + void SubscribeQuote(const set& instrumentIDs, const string& szExchangeID); //virtual void OnFrontConnected(); //virtual void OnFrontDisconnected(int nReason); diff --git a/QuantBox_TongShi_Quote/ReadMe.txt b/apis/TongShi_Quote/ReadMe.txt similarity index 78% rename from QuantBox_TongShi_Quote/ReadMe.txt rename to apis/TongShi_Quote/ReadMe.txt index 5496323..69ee960 100644 --- a/QuantBox_TongShi_Quote/ReadMe.txt +++ b/apis/TongShi_Quote/ReadMe.txt @@ -1,47 +1,47 @@ ======================================================================== - MICROSOFT FOUNDATION CLASS LIBRARY : QuantBox_TongShi_Quote Project Overview + MICROSOFT FOUNDATION CLASS LIBRARY : TongShi_Quote Project Overview ======================================================================== -AppWizard has created this QuantBox_TongShi_Quote DLL for you. This DLL not only +AppWizard has created this TongShi_Quote DLL for you. This DLL not only demonstrates the basics of using the Microsoft Foundation classes but is also a starting point for writing your DLL. This file contains a summary of what you will find in each of the files that -make up your QuantBox_TongShi_Quote DLL. +make up your TongShi_Quote DLL. -QuantBox_TongShi_Quote.vcxproj +TongShi_Quote.vcxproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and information about the platforms, configurations, and project features selected with the Application Wizard. -QuantBox_TongShi_Quote.vcxproj.filters +TongShi_Quote.vcxproj.filters This is the filters file for VC++ projects generated using an Application Wizard. It contains information about the association between the files in your project and the filters. This association is used in the IDE to show grouping of files with similar extensions under a specific node (for e.g. ".cpp" files are associated with the "Source Files" filter). -QuantBox_TongShi_Quote.h +TongShi_Quote.h This is the main header file for the DLL. It declares the - CQuantBox_TongShi_QuoteApp class. + CTongShi_QuoteApp class. -QuantBox_TongShi_Quote.cpp - This is the main DLL source file. It contains the class CQuantBox_TongShi_QuoteApp. +TongShi_Quote.cpp + This is the main DLL source file. It contains the class CTongShi_QuoteApp. -QuantBox_TongShi_Quote.rc +TongShi_Quote.rc This is a listing of all of the Microsoft Windows resources that the program uses. It includes the icons, bitmaps, and cursors that are stored in the RES subdirectory. This file can be directly edited in Microsoft Visual C++. -res\QuantBox_TongShi_Quote.rc2 +res\TongShi_Quote.rc2 This file contains resources that are not edited by Microsoft Visual C++. You should place all resources not editable by the resource editor in this file. -QuantBox_TongShi_Quote.def +TongShi_Quote.def This file contains information about the DLL that must be provided to run with Microsoft Windows. It defines parameters such as the name and description of the DLL. It also exports @@ -52,7 +52,7 @@ Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file - named QuantBox_TongShi_Quote.pch and a precompiled types file named StdAfx.obj. + named TongShi_Quote.pch and a precompiled types file named StdAfx.obj. Resource.h This is the standard header file, which defines new resource IDs. diff --git a/QuantBox_TongShi_Quote/Stockdrv.h b/apis/TongShi_Quote/Stockdrv.h similarity index 100% rename from QuantBox_TongShi_Quote/Stockdrv.h rename to apis/TongShi_Quote/Stockdrv.h diff --git a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.cpp b/apis/TongShi_Quote/TongShi_Quote.cpp similarity index 67% rename from QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.cpp rename to apis/TongShi_Quote/TongShi_Quote.cpp index cd93770..a7f82d6 100644 --- a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.cpp +++ b/apis/TongShi_Quote/TongShi_Quote.cpp @@ -1,8 +1,8 @@ -// QuantBox_TongShi_Quote.cpp : Defines the initialization routines for the DLL. +// TongShi_Quote.cpp : Defines the initialization routines for the DLL. // #include "stdafx.h" -#include "QuantBox_TongShi_Quote.h" +#include "TongShi_Quote.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -33,29 +33,29 @@ // details. // -// CQuantBox_TongShi_QuoteApp +// CTongShi_QuoteApp -BEGIN_MESSAGE_MAP(CQuantBox_TongShi_QuoteApp, CWinApp) +BEGIN_MESSAGE_MAP(CTongShi_QuoteApp, CWinApp) END_MESSAGE_MAP() -// CQuantBox_TongShi_QuoteApp construction +// CTongShi_QuoteApp construction -CQuantBox_TongShi_QuoteApp::CQuantBox_TongShi_QuoteApp() +CTongShi_QuoteApp::CTongShi_QuoteApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } -// The one and only CQuantBox_TongShi_QuoteApp object +// The one and only CTongShi_QuoteApp object -CQuantBox_TongShi_QuoteApp theApp; +CTongShi_QuoteApp theApp; -// CQuantBox_TongShi_QuoteApp initialization +// CTongShi_QuoteApp initialization -BOOL CQuantBox_TongShi_QuoteApp::InitInstance() +BOOL CTongShi_QuoteApp::InitInstance() { CWinApp::InitInstance(); diff --git a/apis/TongShi_Quote/TongShi_Quote.h b/apis/TongShi_Quote/TongShi_Quote.h new file mode 100644 index 0000000..5e755ee --- /dev/null +++ b/apis/TongShi_Quote/TongShi_Quote.h @@ -0,0 +1,26 @@ +// TongShi_Quote.h : main header file for the TongShi_Quote DLL +// + +#pragma once + +#ifndef __AFXWIN_H__ + #error "include 'stdafx.h' before including this file for PCH" +#endif + +#include "resource.h" // main symbols + +// CTongShi_QuoteApp +// See TongShi_Quote.cpp for the implementation of this class +// + +class CTongShi_QuoteApp : public CWinApp +{ +public: + CTongShi_QuoteApp(); + +// Overrides +public: + virtual BOOL InitInstance(); + + DECLARE_MESSAGE_MAP() +}; diff --git a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.rc b/apis/TongShi_Quote/TongShi_Quote.rc similarity index 93% rename from QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.rc rename to apis/TongShi_Quote/TongShi_Quote.rc index cbe176c..9f276cd 100644 Binary files a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.rc and b/apis/TongShi_Quote/TongShi_Quote.rc differ diff --git a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj b/apis/TongShi_Quote/TongShi_Quote.vcxproj similarity index 80% rename from QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj rename to apis/TongShi_Quote/TongShi_Quote.vcxproj index ba0ee99..c6e9e89 100644 --- a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj +++ b/apis/TongShi_Quote/TongShi_Quote.vcxproj @@ -12,21 +12,22 @@ {372C0D5E-ED93-4335-849C-65494AE8A17D} - QuantBox_TongShi_Quote + TongShi_Quote MFCDLLProj + 8.1 DynamicLibrary true - v120 + v141_xp Unicode Dynamic DynamicLibrary false - v120 + v140 true Unicode Dynamic @@ -43,10 +44,13 @@ true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\TongShi\x86 + ..\..\bin\$(Configuration)\$(PlatformTarget)\TongShi + $(ProjectName)_$(PlatformTarget) false + ..\..\bin\$(Configuration)\$(PlatformTarget)\TongShi + $(ProjectName)_$(PlatformTarget) @@ -59,7 +63,7 @@ Windows true - ..\include\ApiHeader.def + ../../include/ApiHeader.def false @@ -71,7 +75,8 @@ $(IntDir);%(AdditionalIncludeDirectories) - xcopy "$(TargetPath)" "$(SolutionDir)XAPI\TongShi\x86\" /Y + + @@ -81,7 +86,7 @@ MaxSpeed true true - WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) + WIN32;_WINDOWS;NDEBUG;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -89,7 +94,7 @@ true true true - .\QuantBox_TongShi_Quote.def + ../../include/ApiHeader.def false @@ -105,45 +110,42 @@ - - - - + + + + - Create Create + - - - + + + - + - - - - + - + \ No newline at end of file diff --git a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj.filters b/apis/TongShi_Quote/TongShi_Quote.vcxproj.filters similarity index 80% rename from QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj.filters rename to apis/TongShi_Quote/TongShi_Quote.vcxproj.filters index 28d4929..a834d48 100644 --- a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj.filters +++ b/apis/TongShi_Quote/TongShi_Quote.vcxproj.filters @@ -18,9 +18,6 @@ - - Source Files - Source Files @@ -33,26 +30,26 @@ Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + + Source Files + + Source Files - - Header Files - Header Files @@ -71,26 +68,24 @@ Header Files - + Header Files - + Header Files - + Header Files - + + Header Files + + Header Files - - Resource Files - - - - + Resource Files diff --git a/QuantBox_TongShi_Quote/TypeConvert.cpp b/apis/TongShi_Quote/TypeConvert.cpp similarity index 98% rename from QuantBox_TongShi_Quote/TypeConvert.cpp rename to apis/TongShi_Quote/TypeConvert.cpp index b24b895..2534d1b 100644 --- a/QuantBox_TongShi_Quote/TypeConvert.cpp +++ b/apis/TongShi_Quote/TypeConvert.cpp @@ -25,7 +25,7 @@ char* Market_2_ExchangeID(WORD In) case SH_MARKET_EX: return "SSE"; case SZ_MARKET_EX: - return "SZE"; + return "SZSE"; case HK_MARKET_EX: return "HKEx"; case EB_MARKET_EX: diff --git a/QuantBox_TongShi_Quote/TypeConvert.h b/apis/TongShi_Quote/TypeConvert.h similarity index 83% rename from QuantBox_TongShi_Quote/TypeConvert.h rename to apis/TongShi_Quote/TypeConvert.h index f4e48a8..5665ea3 100644 --- a/QuantBox_TongShi_Quote/TypeConvert.h +++ b/apis/TongShi_Quote/TypeConvert.h @@ -2,7 +2,7 @@ #include #include "Stockdrv.h" -#include "../include/ApiStruct.h" +#include "../../include/ApiStruct.h" ExchangeType Market_2_ExchangeType(WORD In); char* Market_2_ExchangeID(WORD In); diff --git a/QuantBox_TongShi_Quote/main.cpp b/apis/TongShi_Quote/main.cpp similarity index 79% rename from QuantBox_TongShi_Quote/main.cpp rename to apis/TongShi_Quote/main.cpp index ecfbbdf..3f3aa80 100644 --- a/QuantBox_TongShi_Quote/main.cpp +++ b/apis/TongShi_Quote/main.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" -#include "../include/ApiHeader.h" - -#include "../include/QueueEnum.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" #include "MdUserApi.h" inline CMdUserApi* GetApi(void* pApi) @@ -14,13 +13,13 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do RequestType rt = (RequestType)type; switch (rt) { - case GetApiType: + case RequestType_GetApiTypes: return (void*)(ApiType::ApiType_MarketData | ApiType::ApiType_Instrument); - case GetApiVersion: + case RequestType_GetApiVersion: return (void*)"0.2.0.20150419"; - case GetApiName: + case RequestType_GetApiName: return (void*)"TongShi"; - case Create: + case RequestType_Create: return new CMdUserApi(); default: break; @@ -35,18 +34,18 @@ void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, do switch (rt) { - case Release: + case RequestType_Release: delete pApi; return 0; - case Register: + case RequestType_Register: pApi->Register(ptr1,ptr2); break; - case Config: + case RequestType_Config: return (void*)pApi->Config((ConfigInfoField*)ptr1); - case Connect: + case RequestType_Connect: pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2,size2); break; - case Disconnect: + case RequestType_Disconnect: pApi->Disconnect(); break; //case Subscribe: diff --git a/QuantBox_TongShi_Quote/res/QuantBox_TongShi_Quote.rc2 b/apis/TongShi_Quote/res/TongShi_Quote.rc2 similarity index 100% rename from QuantBox_TongShi_Quote/res/QuantBox_TongShi_Quote.rc2 rename to apis/TongShi_Quote/res/TongShi_Quote.rc2 diff --git a/QuantBox_TongShi_Quote/resource.h b/apis/TongShi_Quote/resource.h similarity index 91% rename from QuantBox_TongShi_Quote/resource.h rename to apis/TongShi_Quote/resource.h index 66f6deb..1078804 100644 Binary files a/QuantBox_TongShi_Quote/resource.h and b/apis/TongShi_Quote/resource.h differ diff --git a/QuantBox_TongShi_Quote/stdafx.cpp b/apis/TongShi_Quote/stdafx.cpp similarity index 71% rename from QuantBox_TongShi_Quote/stdafx.cpp rename to apis/TongShi_Quote/stdafx.cpp index 90a86cb..583973f 100644 --- a/QuantBox_TongShi_Quote/stdafx.cpp +++ b/apis/TongShi_Quote/stdafx.cpp @@ -1,5 +1,5 @@ // stdafx.cpp : source file that includes just the standard includes -// QuantBox_TongShi_Quote.pch will be the pre-compiled header +// TongShi_Quote.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" diff --git a/QuantBox_TongShi_Quote/stdafx.h b/apis/TongShi_Quote/stdafx.h similarity index 100% rename from QuantBox_TongShi_Quote/stdafx.h rename to apis/TongShi_Quote/stdafx.h diff --git a/apis/TongShi_Quote/targetver.h b/apis/TongShi_Quote/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/apis/TongShi_Quote/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/apis/UFX_Trade/UFX_Trade.vcxproj b/apis/UFX_Trade/UFX_Trade.vcxproj new file mode 100644 index 0000000..9ec2997 --- /dev/null +++ b/apis/UFX_Trade/UFX_Trade.vcxproj @@ -0,0 +1,125 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {26C43947-9E7A-4B55-8A6D-A0F5222612AA} + Win32Proj + UFX_Trade + 8.1 + + + + DynamicLibrary + true + v141_xp + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + true + $(ProjectName)_$(PlatformTarget) + ..\..\bin\$(Configuration)\$(PlatformTarget)\UFX + + + false + ..\..\bin\$(Configuration)\$(PlatformTarget)\UFX + $(ProjectName)_$(PlatformTarget) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;UFX_TRADE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + ../../include/ApiHeader.def + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;UFX_TRADE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + ../../include/ApiHeader.def + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + \ No newline at end of file diff --git a/apis/UFX_Trade/UFX_Trade.vcxproj.filters b/apis/UFX_Trade/UFX_Trade.vcxproj.filters new file mode 100644 index 0000000..7af607c --- /dev/null +++ b/apis/UFX_Trade/UFX_Trade.vcxproj.filters @@ -0,0 +1,111 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {4c0294d8-bae3-4694-b9e4-2096c0d73fab} + + + {ca9ef0ce-cdf6-46fa-b982-0b371d02580e} + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + O32 + + + O32 + + + O32 + + + ZQ + + + ZQ + + + ZQ + + + O32 + + + Header Files + + + O32 + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + O32 + + + ZQ + + + O32 + + + Source Files + + + O32 + + + Source Files + + + \ No newline at end of file diff --git a/apis/Wind_Quote/MdUserApi.cpp b/apis/Wind_Quote/MdUserApi.cpp new file mode 100644 index 0000000..4617562 --- /dev/null +++ b/apis/Wind_Quote/MdUserApi.cpp @@ -0,0 +1,429 @@ +#include "stdafx.h" +#include "MdUserApi.h" +#include "../../include/QueueEnum.h" + +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" + +#include "../../include/toolkit.h" +#include "../../include/ApiProcess.h" + +#include "../../include/queue/MsgQueue.h" + + + +#include +#include +#include +#include +#include +#include + +using namespace std; + +int Today(int day) +{ + time_t now = time(0); + now += day * 86400; + struct tm *ptmNow = localtime(&now); + + return (ptmNow->tm_year + 1900) * 10000 + + (ptmNow->tm_mon + 1) * 100 + + ptmNow->tm_mday; +} + +void WindGetErrorMessage(LONG errCode, char* buffer, int bufferSize){ + WCHAR errMsg[1024] = { 0 }; + int msgLength = sizeof errMsg; + CWAPIWrapperCpp::getErrorMsg(errCode, eCHN, errMsg, msgLength); + auto strLen = wcslen(errMsg) + 1; + char* str = new char[strLen]; + size_t converted; + wcstombs_s(&converted, str, strLen, errMsg, _TRUNCATE); + strcpy_s(buffer, bufferSize, str); + delete[] str; +} + +void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + // ڲãüǷΪ + CMdUserApi* pApi = (CMdUserApi*)pApi2; + pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + return nullptr; +} + +CMdUserApi::CMdUserApi(void) +{ + pThis = this; + + m_CoInitialized = false; + // ԼάϢ + m_msgQueue = new CMsgQueue(); + m_msgQueue_Query = new CMsgQueue(); + + m_msgQueue_Query->Register(Query); + m_msgQueue_Query->StartThread(); +} + +CMdUserApi::~CMdUserApi(void) +{ + Disconnect(); +} + +void CMdUserApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + int iRet = 0; + switch (type) + { + case Start: + WindStart(); + break; + case Stop: + WindStop(); + break; + case QueryInstrument: + WindQryInstrument(); + break; + default: + break; + } + + this_thread::sleep_for(chrono::milliseconds(1)); +} + +void CMdUserApi::Register(void* pCallback, void* pClass) +{ + m_pClass = pClass; + if (m_msgQueue == nullptr) + return; + + m_msgQueue_Query->Register(Query); + m_msgQueue->Register((fnOnResponse)pCallback); + if (pCallback) + { + m_msgQueue_Query->StartThread(); + m_msgQueue->StartThread(); + } + else + { + m_msgQueue_Query->StopThread(); + m_msgQueue->StopThread(); + } +} + +void CMdUserApi::Connect() +{ + m_msgQueue_Query->Input_NoCopy(RequestType::Start, m_msgQueue_Query, this, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); +} + +void CMdUserApi::WindStart() +{ + // ֻΪ˵ԣԺҪر + AllocConsole(); + freopen("CON", "r", stdin); + freopen("CON", "w", stdout); + freopen("CON", "w", stderr); + ::DeleteMenu(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE, MF_BYCOMMAND); + + if (!m_CoInitialized){ + CoInitialize(nullptr); + m_CoInitialized = true; + } + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + auto errCode = CWAPIWrapperCpp::start(); + if (errCode == 0){ + //m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + else{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + pField->RawErrorID = errCode; + WindGetErrorMessage(errCode, pField->Text, sizeof pField->Text); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + } +} + +void CMdUserApi::WindStop() +{ + if (WindConnected()){ + // ȡ + CWAPIWrapperCpp::cancelRequest(0); + + CWAPIWrapperCpp::stop(); + // ȫֻһ + m_msgQueue->Clear(); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + // + m_msgQueue->Process(); + } + + if (m_CoInitialized){ + CoUninitialize(); + m_CoInitialized = false; + } + + SetEvent(m_ExitEvent); +} + +bool CMdUserApi::WindConnected() +{ + return CWAPIWrapperCpp::isconnected(); +} + +void CMdUserApi::WindQryInstrument() +{ + WindData wd; + WCHAR options[1024]; + _snwprintf_s(options, sizeof options, _TRUNCATE, L"date=%d;sectorId=a001010100000000;field=wind_code,sec_name", Today(0)); + auto errCode = CWAPIWrapperCpp::wset(wd, L"SectorConstituent", options); + if (errCode != 0){ + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + pField->RawErrorID = errCode; + strcpy_s(pField->Source, sizeof pField->Source, "WindQryInstrument"); + WindGetErrorMessage(errCode, pField->Text, sizeof pField->Text); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, 0, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + return; + } + +} + +void CMdUserApi::Disconnect() +{ + // ѯ + if (m_msgQueue_Query) + { + m_ExitEvent = CreateEvent(nullptr, true, false, nullptr); + m_msgQueue_Query->Input_NoCopy(RequestType::Stop, m_msgQueue_Query, this, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); + WaitForSingleObject(m_ExitEvent, INFINITE); + m_msgQueue_Query->StopThread(); + m_msgQueue_Query->Register(nullptr); + m_msgQueue_Query->Clear(); + delete m_msgQueue_Query; + m_msgQueue_Query = nullptr; + } + + // Ӧ + if (m_msgQueue) + { + m_msgQueue->StopThread(); + m_msgQueue->Register(nullptr); + m_msgQueue->Clear(); + delete m_msgQueue; + m_msgQueue = nullptr; + } +} + +CMdUserApi* CMdUserApi::pThis = nullptr; + +LONG WINAPI WindCallback(ULONGLONG reqId, const WindData &wd) +{ + //wsqĻص,ݴڲwdУԶз + + return CMdUserApi::pThis->_WindCallback(reqId, wd); +} + +struct MyWindWsq +{ + double rt_date; + double rt_time; + double rt_last; + double rt_vol; + double rt_oi; + double rt_bid1; + double rt_ask1; + double rt_bsize1; + double rt_asize1; +}; + +string toString(const LPVARIANT data) +{ + string msg; + switch (data->vt & VT_BSTR_BLOB) + { + /*case VT_I4: + msg(_T("%d"), data->intVal); + break; + case VT_I8: + msg.Format(_T("%I64d"), data->llVal); + break; + case VT_R8: + msg.Format(_T("%f"), data->dblVal); + break; + case VT_EMPTY: + msg = _T("NaN"); + break; + case VT_BSTR: + msg.Format(_T("%s"), data->bstrVal); + break; + case VT_DATE: + msg = COleDateTime(data->date).Format(); + break;*/ + default: + break; + } + return msg; +} + + +LONG CMdUserApi::_WindCallback(ULONGLONG reqId, const WindData &wd) +{ + int timeLength = wd.GetTimesLength(); + int codeLength = wd.GetCodesLength(); + int fieldsLength = wd.GetFieldsLength(); + + for (int i = 0; i < codeLength; ++i) + { + //for (int j = 0; j < fieldsLength; ++j) + //{ + // VARIANT data; + // wcout << wd.GetDataItem(0, i, j, data) << endl; + + // wcout << data.vt << endl; + //} + MyWindWsq st = { 0 }; + VARIANT data; + + wd.GetDataItem(0, i, 0, data); + st.rt_date = data.dblVal; + wd.GetDataItem(0, i, 1, data); + st.rt_time = data.dblVal; + wd.GetDataItem(0, i, 2, data); + st.rt_last = data.dblVal; + wd.GetDataItem(0, i, 3, data); + st.rt_vol = data.dblVal; + wd.GetDataItem(0, i, 4, data); + st.rt_oi = data.dblVal; + wd.GetDataItem(0, i, 5, data); + st.rt_bid1 = data.dblVal; + wd.GetDataItem(0, i, 6, data); + st.rt_ask1 = data.dblVal; + wd.GetDataItem(0, i, 7, data); + st.rt_bsize1 = data.dblVal; + wd.GetDataItem(0, i, 8, data); + st.rt_asize1 = data.dblVal; + + //printf("rt_date:%f", st.rt_date); + //printf("rt_time:%f", st.rt_time); + //printf("rt_last:%f", st.rt_last); + //printf("rt_vol:%f", st.rt_vol); + //printf("rt_oi:%f", st.rt_oi); + //printf("rt_bid1:%f", st.rt_bid1); + //printf("rt_ask1:%f", st.rt_ask1); + //printf("rt_bsize1:%f", st.rt_bsize1); + //printf("rt_asize1:%f", st.rt_asize1); + + DepthMarketDataNField* pField = (DepthMarketDataNField*)m_msgQueue->new_block(sizeof(DepthMarketDataNField) + sizeof(DepthField) * 2); + + wstring wstr(wd.GetCodeByIndex(i)); + std::string str(wstr.length(), '\0'); + std::copy(wstr.begin(), wstr.end(), str.begin()); + + sprintf(pField->Symbol, "%s", str.c_str()); + pField->TradingDay = st.rt_date; + pField->ActionDay = st.rt_date; + pField->UpdateTime = st.rt_time; + pField->LastPrice = st.rt_last; + pField->Volume = st.rt_vol; + //pField->Turnover = pDepthMarketData->Turnover; + pField->OpenInterest = st.rt_oi; + //pField->AveragePrice = pDepthMarketData->AveragePrice; + + InitBidAsk(pField); + + do + { + if (st.rt_bsize1 == 0) + break; + AddBid(pField, st.rt_bid1, st.rt_bsize1, 0); + } while (false); + + do + { + if (st.rt_asize1 == 0) + break; + AddAsk(pField, st.rt_ask1, st.rt_asize1, 0); + } while (false); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); + } + + //if (timeLength > 1) + //{ + // if (fieldsLength > 1) + // { + // likeWsdList1(wd); + // } + // else //fieldsLength <= 1 + // { + // if (codeLength >= 1) + // { + // likeWsdList2(wd); + // } + // } + //} + //else if (codeLength > 1)//timeLength <= 1 + //{ + // if (fieldsLength > 1) + // { + // likeWssList(wd); + // } + // else + // { + // likeWsdList2(wd); + // } + //} + //else //timeLength <= 1 && codeLength <=1 + //{ + // likeWssList(wd); + //} + //printf("=================="); + + + return 0; +} + +void CMdUserApi::Subscribe(const string& szInstrumentIDs, const string& szExchangeID) +{ + ULONGLONG reqId = 0; + //WCHAR options[1024]; + //_snwprintf_s(options, sizeof options, _TRUNCATE, L"date=%d;sectorId=a001010100000000;field=wind_code,sec_name", Today(0)); + std::wstring wstr(szInstrumentIDs.length(), L'\0'); + std::copy(szInstrumentIDs.begin(), szInstrumentIDs.end(), wstr.begin()); + + + auto errCode = CWAPIWrapperCpp::wsq(reqId, wstr.c_str(), L"rt_date,rt_time,rt_last,rt_vol,rt_oi,rt_bid1,rt_ask1,rt_bsize1,rt_asize1", WindCallback, L"", TRUE); + if (errCode != 0) { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + pField->RawErrorID = errCode; + strcpy_s(pField->Source, sizeof pField->Source, "wsq"); + WindGetErrorMessage(errCode, pField->Text, sizeof pField->Text); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, 0, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + return; + } + + // ԶĵĺԼŽз + m_map_code_reqId[szInstrumentIDs] = reqId; +} + +void CMdUserApi::Subscribe(const set& instrumentIDs, const string& szExchangeID) +{ + +} + +void CMdUserApi::Unsubscribe(const string& szInstrumentIDs, const string& szExchangeID) +{ + // ͨԼţȻжǷҪٶ + map::iterator it = m_map_code_reqId.find(szInstrumentIDs); + if (it == m_map_code_reqId.end()) + { + + } + else + { + ULONGLONG reqId = it->second; + + CWAPIWrapperCpp::cancelRequest(reqId); + } +} diff --git a/apis/Wind_Quote/MdUserApi.h b/apis/Wind_Quote/MdUserApi.h new file mode 100644 index 0000000..2ae2ed6 --- /dev/null +++ b/apis/Wind_Quote/MdUserApi.h @@ -0,0 +1,81 @@ +#pragma once + +#include "../../include/CrossPlatform.h" +#include "../../include/ApiStruct.h" + +#ifdef _WIN64 + #pragma comment(lib, "../../include/Wind/win64/WAPIWrapperCpp.lib") +#else + #pragma comment(lib, "../../include/Wind/win32/WAPIWrapperCpp.lib") +#endif + +#include +#include +#include +#include +#include +#include + +#include "../../include/Wind/WAPIWrapperCpp.h" + +using namespace std; + +class CMsgQueue; + +class CMdUserApi +{ + enum RequestType + { + Start = 100, + Stop, + QueryInstrument, + }; + +public: + CMdUserApi(void); + virtual ~CMdUserApi(void); + + void Register(void* pCallback, void* pClass); + + void Connect(); + void Disconnect(); + + void Subscribe(const string& szInstrumentIDs, const string& szExchangeID); + void Unsubscribe(const string& szInstrumentIDs, const string& szExchangeID); + +private: + friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + void QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + friend LONG WINAPI WindCallback(ULONGLONG reqId, const WindData &wd); + LONG _WindCallback(ULONGLONG reqId, const WindData &wd); + + void WindStart(); + void WindStop(); + bool WindConnected(); + void WindQryInstrument(); + + // + void Subscribe(const set& instrumentIDs, const string& szExchangeID); + +private: + mutex m_csMapInstrumentIDs; + mutex m_csMapQuoteInstrumentIDs; + + //ڶĵĺԼ + map > m_mapInstrumentIDs; + //ڶĵĺԼ + map > m_mapQuoteInstrumentIDs; + + map m_map_code_reqId; + + //Ϣָ + CMsgQueue* m_msgQueue; + CMsgQueue* m_msgQueue_Query; + void* m_pClass; + bool m_CoInitialized; + HANDLE m_ExitEvent; +public: + static CMdUserApi * pThis; +}; + diff --git a/apis/Wind_Quote/ReadMe.txt b/apis/Wind_Quote/ReadMe.txt new file mode 100644 index 0000000..6591a17 --- /dev/null +++ b/apis/Wind_Quote/ReadMe.txt @@ -0,0 +1,48 @@ +======================================================================== + DYNAMIC LINK LIBRARY : Wind_Quote Project Overview +======================================================================== + +AppWizard has created this Wind_Quote DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your Wind_Quote application. + + +Wind_Quote.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +Wind_Quote.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +Wind_Quote.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named Wind_Quote.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/apis/Wind_Quote/Wind_Quote.rc b/apis/Wind_Quote/Wind_Quote.rc new file mode 100644 index 0000000..deb5a06 Binary files /dev/null and b/apis/Wind_Quote/Wind_Quote.rc differ diff --git a/FakeAPI/FakeAPI.vcxproj b/apis/Wind_Quote/Wind_Quote.vcxproj similarity index 77% rename from FakeAPI/FakeAPI.vcxproj rename to apis/Wind_Quote/Wind_Quote.vcxproj index 82a8f6e..30f721b 100644 --- a/FakeAPI/FakeAPI.vcxproj +++ b/apis/Wind_Quote/Wind_Quote.vcxproj @@ -11,21 +11,23 @@ - {358586C9-A4B8-43E4-8376-59C68F0F6211} + {7B30B57A-6E59-482E-A8A8-5E2D978EA991} Win32Proj - FakeAPI + Wind_Quote + 8.1 DynamicLibrary true - v120 + v141_xp Unicode + false DynamicLibrary false - v120 + v140 true Unicode @@ -41,24 +43,26 @@ true - D:\Program Files (x86)\HailiLive - StockDrv + ..\..\bin\$(Configuration)\$(PlatformTarget)\Wind\ + $(ProjectName)_$(PlatformTarget) false + $(ProjectName)_$(PlatformTarget) + ..\..\bin\$(Configuration)\$(PlatformTarget)\Wind Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;FAKEAPI_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;WIND_QUOTE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true Windows true - export.def + ../../include/ApiHeader.def @@ -68,7 +72,7 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEAPI_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;WIND_QUOTE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -76,19 +80,21 @@ true true true - export.def + ../../include/ApiHeader.def + + - + false @@ -97,21 +103,15 @@ - - + + Create Create - - - - - - - + diff --git a/QuantBox_LTS_Quote_v2/QuantBox_LTS_Quote_v2.vcxproj.filters b/apis/Wind_Quote/Wind_Quote.vcxproj.filters similarity index 86% rename from QuantBox_LTS_Quote_v2/QuantBox_LTS_Quote_v2.vcxproj.filters rename to apis/Wind_Quote/Wind_Quote.vcxproj.filters index da44306..8613090 100644 --- a/QuantBox_LTS_Quote_v2/QuantBox_LTS_Quote_v2.vcxproj.filters +++ b/apis/Wind_Quote/Wind_Quote.vcxproj.filters @@ -24,13 +24,13 @@ Header Files - + Header Files - + Header Files - + Header Files @@ -41,17 +41,19 @@ Source Files - - Source Files - Source Files - + Source Files - + Source Files + + + Resource Files + + \ No newline at end of file diff --git a/apis/Wind_Quote/dllmain.cpp b/apis/Wind_Quote/dllmain.cpp new file mode 100644 index 0000000..69b5891 --- /dev/null +++ b/apis/Wind_Quote/dllmain.cpp @@ -0,0 +1,19 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/apis/Wind_Quote/main.cpp b/apis/Wind_Quote/main.cpp new file mode 100644 index 0000000..0d16b6a --- /dev/null +++ b/apis/Wind_Quote/main.cpp @@ -0,0 +1,60 @@ +#include "stdafx.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" +#include "MdUserApi.h" + +inline CMdUserApi* GetApi(void* pApi) +{ + return static_cast(pApi); +} + +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) +{ + RequestType requestType = (RequestType)type; + switch (requestType) + { + case RequestType_GetApiTypes: + return (void*)(ApiType::ApiType_MarketData | ApiType::ApiType_Instrument); + case RequestType_GetApiVersion: + return (void*)"0.1.0.20160120"; + case RequestType_GetApiName: + return (void*)"Wind"; + case RequestType_Create: + return new CMdUserApi(); + default: + break; + } + + if (pApi1 == nullptr) + { + return nullptr; + } + + CMdUserApi* api = GetApi(pApi1); + + switch (requestType) + { + case RequestType_Release: + delete api; + return nullptr; + case RequestType_Register: + api->Register(ptr1, ptr2); + break; + case RequestType_Connect: + api->Connect(); + break; + case RequestType_Disconnect: + api->Disconnect(); + break; + case RequestType_Subscribe: + api->Subscribe((const char*)ptr1, (const char*)ptr2); + break; + case RequestType_Unsubscribe: + api->Unsubscribe((const char*)ptr1, (const char*)ptr2); + break; + default: + break; + } + + return pApi1; +} diff --git a/apis/Wind_Quote/resource.h b/apis/Wind_Quote/resource.h new file mode 100644 index 0000000..2691c2e Binary files /dev/null and b/apis/Wind_Quote/resource.h differ diff --git a/apis/Wind_Quote/stdafx.cpp b/apis/Wind_Quote/stdafx.cpp new file mode 100644 index 0000000..102800c --- /dev/null +++ b/apis/Wind_Quote/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Wind_Quote.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/apis/Wind_Quote/stdafx.h b/apis/Wind_Quote/stdafx.h new file mode 100644 index 0000000..f3a0737 --- /dev/null +++ b/apis/Wind_Quote/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here diff --git a/apis/Wind_Quote/targetver.h b/apis/Wind_Quote/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/apis/Wind_Quote/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/apis/XTP/Quote/MdUserApi.cpp b/apis/XTP/Quote/MdUserApi.cpp new file mode 100644 index 0000000..6079e96 --- /dev/null +++ b/apis/XTP/Quote/MdUserApi.cpp @@ -0,0 +1,432 @@ +#include "MdUserApi.h" +#include +#include + +#include "../../include/QueueEnum.h" + +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" + +#include "../../include/toolkit.h" +#include "../../include/ApiProcess.h" +#include "../TypeConvert.h" + +#include "../../include/queue/MsgQueue.h" + +#include "../../include/CSubscribeManager.h" +#include "../../include/synthetic/CSyntheticConfig.h" +#include "../../include/synthetic/CSyntheticManager.h" +#include "../../include/CSyntheticCalculate_DepthMarketDataNField.h" + +void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + // ڲãüǷΪ + CMdUserApi* pApi = (CMdUserApi*)pApi2; + pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + return nullptr; +} + +CMdUserApi::CMdUserApi() +{ + m_pApi = nullptr; + m_lRequestID = 0; + m_nSleep = 1; + + m_pSyntheticConfig = new CSyntheticConfig(); + m_pSyntheticManager = new CSyntheticManager(); + m_pCalculateFactory = new CSyntheticCalculateFactory_XAPI(); + m_pSubscribeManager = new CSubscribeManager(m_pSyntheticConfig, m_pSyntheticManager, m_pCalculateFactory); + m_pQuoteSubscribeManager = new CSubscribeManager(m_pSyntheticConfig, m_pSyntheticManager, m_pCalculateFactory); + + // ԼάϢ + m_msgQueue = new CMsgQueue(); + m_msgQueue_Query = new CMsgQueue(); + + m_msgQueue_Query->Register(Query); + m_msgQueue_Query->StartThread(); +} +CMdUserApi::~CMdUserApi() +{ + Disconnect(); +} + +void CMdUserApi::Register(void* pCallback, void* pClass) +{ + m_pClass = pClass; + if (m_msgQueue == nullptr) + return; + + m_msgQueue_Query->Register(Query); + m_msgQueue->Register((fnOnResponse)pCallback); + if (pCallback) + { + m_msgQueue_Query->StartThread(); + m_msgQueue->StartThread(); + } + else + { + m_msgQueue_Query->StopThread(); + m_msgQueue->StopThread(); + } +} +ConfigInfoField* CMdUserApi::Config(ConfigInfoField* pConfigInfo) +{ + return nullptr; +} + +void CMdUserApi::Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo) +{ + m_szPath = szPath; + memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); + memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); + + m_msgQueue_Query->Input_NoCopy(RequestType::E_Init, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} +void CMdUserApi::Disconnect() +{ + // ѯ + if (m_msgQueue_Query) + { + m_msgQueue_Query->StopThread(); + m_msgQueue_Query->Register(nullptr); + m_msgQueue_Query->Clear(); + delete m_msgQueue_Query; + m_msgQueue_Query = nullptr; + } + + if (m_pApi) + { + m_pApi->Release(); + m_pApi = nullptr; + + // ȫֻһ + m_msgQueue->Clear(); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + // + m_msgQueue->Process(); + } + + // Ӧ + if (m_msgQueue) + { + m_msgQueue->StopThread(); + m_msgQueue->Register(nullptr); + m_msgQueue->Clear(); + delete m_msgQueue; + m_msgQueue = nullptr; + } + + if (m_pSubscribeManager) + { + delete m_pSubscribeManager; + m_pSubscribeManager = nullptr; + } + if (m_pSyntheticConfig) + { + delete m_pSyntheticConfig; + m_pSyntheticConfig = nullptr; + } + if (m_pSyntheticManager) + { + delete m_pSyntheticManager; + m_pSyntheticManager = nullptr; + } + if (m_pCalculateFactory) + { + delete m_pCalculateFactory; + m_pCalculateFactory = nullptr; + } +} + +void CMdUserApi::Subscribe(const string& szInstrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + set ss_new = m_pSubscribeManager->String2Set(szInstrumentIDs.c_str()); + Subscribe(ss_new, szExchangeID); +} +void CMdUserApi::Unsubscribe(const string& szInstrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + set ss_new = m_pSubscribeManager->String2Set(szInstrumentIDs.c_str()); + Unsubscribe(ss_new, szExchangeID); +} + +void CMdUserApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + int iRet = 0; + switch (type) + { + case E_Init: + iRet = _Init(); + break; + case E_Disconnect: + Disconnect(); + // ѭ + return; + + } + + if (m_pApi) + { + switch (type) + { + case E_ReqUserLoginField: + iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + default: + break; + } + } + + if (0 == iRet) + { + //سɹӵѷͳ + m_nSleep = 1; + } + else + { + m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + //ʧܣ4ݽʱ1s + m_nSleep *= 4; + m_nSleep %= 1023; + } + this_thread::sleep_for(chrono::milliseconds(m_nSleep)); +} + +int CMdUserApi::_Init() +{ +// char *pszPath = new char[m_szPath.length() + 1024]; +// srand((unsigned int)time(NULL)); +// sprintf(pszPath, "%s/%s/%s/Md/%d/", m_szPath.c_str(), m_ServerInfo.BrokerID, m_UserInfo.UserID, rand()); +// makedirs(pszPath); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + m_pApi = XTP::API::QuoteApi::CreateQuoteApi(m_UserInfo.ExtInfoInt32, m_szPath.c_str()); + + if (m_pApi) + { + m_pApi->RegisterSpi(this); + + // ʼ + m_pApi->SetUDPBufferSize(1024); + m_pApi->SetHeartBeatInterval(15); + + // XTPûеǰýӿڣģǰûӳɹϢ + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + //ӳɹԶ¼ + ReqUserLogin(); + } + + return 0; +} +void CMdUserApi::_DisconnectInThread() +{ + m_msgQueue_Query->Input_NoCopy(RequestType::E_Disconnect, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} + +void CMdUserApi::ReqUserLogin() +{ + m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} +int CMdUserApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + XTP_PROTOCOL_TYPE md_protocol = XTP_PROTOCOL_TCP; + if (m_ServerInfo.IsUsingUdp) + { + md_protocol = XTP_PROTOCOL_UDP; + } + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); + int ret = m_pApi->Login(m_ServerInfo.Address, m_ServerInfo.Port, m_UserInfo.UserID, m_UserInfo.Password, md_protocol); + if (ret == 0) + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + { + set exchanges = m_pSubscribeManager->GetExchanges(); + for (auto exchange = exchanges.begin(); exchange != exchanges.end(); ++exchange) + { + set mapOld = m_pSubscribeManager->GetParentInstruments(exchange->data());//ϴζĵĺԼ + m_pSubscribeManager->Clear(); + Subscribe(mapOld, exchange->data());// + } + } + } + else + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + // Ͽ + _DisconnectInThread(); + } + + return 0; +} + +void CMdUserApi::Subscribe(const set& instrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + if (instrumentIDs.size() == 0) + return; + + m_pSubscribeManager->Subscribe(instrumentIDs, szExchangeID); + + XTP_EXCHANGE_TYPE exchange_type = (XTP_EXCHANGE_TYPE)Str_2_XTPExchangeType(szExchangeID.c_str()); + + char **instruments = (char**)malloc(sizeof(char*) * instrumentIDs.size()); + int i = 0; + for (auto &s : instrumentIDs) + { + instruments[i] = (char*)malloc(s.size() + 1); + strncpy(instruments[i], s.c_str(), s.size()); + instruments[i][s.size()] = '\0'; + } + m_pApi->SubscribeMarketData(instruments, instrumentIDs.size(), exchange_type); + + for (int i = 0; i < instrumentIDs.size(); i++) + { + delete instruments[i]; + } + delete instruments; +} +void CMdUserApi::Unsubscribe(const set& instrumentIDs, const string& szExchangeID) +{ + if (nullptr == m_pApi) + return; + + if (instrumentIDs.size() == 0) + return; + + m_pSubscribeManager->Subscribe(instrumentIDs, szExchangeID); + + XTP_EXCHANGE_TYPE exchange_type; + if (szExchangeID == "SH") + { + exchange_type = XTP_EXCHANGE_SH; + } + else if (szExchangeID == "SZ") + { + exchange_type = XTP_EXCHANGE_SZ; + } + else + { + exchange_type = XTP_EXCHANGE_UNKNOWN; + } + + char **instruments = (char**)malloc(sizeof(char*) * instrumentIDs.size()); + int i = 0; + for (auto &s : instrumentIDs) + { + instruments[i] = (char*)malloc(s.size() + 1); + strncpy(instruments[i], s.c_str(), s.size()); + instruments[i][s.size()] = '\0'; + } + m_pApi->UnSubscribeMarketData(instruments, instrumentIDs.size(), exchange_type); + + for (int i = 0; i < instrumentIDs.size(); i++) + { + delete instruments[i]; + } + delete instruments; +} + +void CMdUserApi::OnDisconnected(int reason) +{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + //ʧܷصϢƴӶɣҪΪͳһ + pField->RawErrorID = reason; + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + + // Ͽ + _DisconnectInThread(); +} + +void CMdUserApi::OnSubMarketData(XTPST *ticker, XTPRI *error_info, bool is_last) +{ + // TODO: +} +void CMdUserApi::OnUnSubMarketData(XTPST *ticker, XTPRI *error_info, bool is_last) +{ + // TODO: +} +void CMdUserApi::OnDepthMarketData(XTPMD *market_data, int64_t bid1_qty[], int32_t bid1_count, int32_t max_bid1_count, int64_t ask1_qty[], int32_t ask1_count, int32_t max_ask1_count) +{ + DepthMarketDataNField* pField = (DepthMarketDataNField*)m_msgQueue->new_block(sizeof(DepthMarketDataNField) + sizeof(DepthField) * 10); + + // + switch (market_data->exchange_id) + { + case XTP_EXCHANGE_SH: + { + strcpy(pField->ExchangeID, "SSE"); + pField->Exchange = ExchangeType::ExchangeType_SSE; + }break; + case XTP_EXCHANGE_SZ: + { + strcpy(pField->ExchangeID, "SZSE"); + pField->Exchange = ExchangeType::ExchangeType_SZSE; + }break; + default: + { + strcpy(pField->ExchangeID, "Undefined"); + pField->Exchange = ExchangeType::ExchangeType_Undefined; + } + } + + // Ʊ + strcpy(pField->Symbol, market_data->ticker); + + // + pField->LastPrice = market_data->last_price; + pField->Volume = market_data->qty; + pField->Turnover = market_data->turnover; + pField->AveragePrice = market_data->avg_price; + + pField->OpenPrice = market_data->open_price; + pField->ClosePrice = market_data->close_price; + pField->HighestPrice = market_data->high_price; + pField->LowestPrice = market_data->low_price; + + pField->UpperLimitPrice = market_data->upper_limit_price; + pField->LowerLimitPrice = market_data->lower_limit_price; + pField->PreClosePrice = market_data->pre_close_price; + pField->PreSettlementPrice = market_data->pre_settl_price; + + InitBidAsk(pField); + + for (int i = 0; i < 10; i++) + { + if (market_data->bid[i] < FLT_EPSILON || market_data->bid_qty[i] < FLT_EPSILON) + { + break; + } + AddBid(pField, market_data->bid[i], market_data->bid_qty[i], 0); + } + + for (int i = 0; i < 10; i++) + { + if (market_data->ask[i] < FLT_EPSILON || market_data->ask_qty[i] < FLT_EPSILON) + { + break; + } + AddAsk(pField, market_data->ask[i], market_data->ask_qty[i], 0); + } + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, pField->Size, nullptr, 0, nullptr, 0); +} \ No newline at end of file diff --git a/apis/XTP/Quote/MdUserApi.h b/apis/XTP/Quote/MdUserApi.h new file mode 100644 index 0000000..a104408 --- /dev/null +++ b/apis/XTP/Quote/MdUserApi.h @@ -0,0 +1,90 @@ +#ifndef XTP_MD_USER_API_H_ +#define XTP_MD_USER_API_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "../../include/ApiStruct.h" +#include "Include.h" + +using namespace std; + +class CMsgQueue; + +class CSubscribeManager; +class CSyntheticConfig; +class CSyntheticManager; +class CSyntheticCalculateFactory; + +class CMdUserApi : public XTP::API::QuoteSpi +{ + enum RequestType + { + E_Init, + E_Disconnect, + E_ReqUserLoginField, + }; + +public: + CMdUserApi(); + ~CMdUserApi(); + + void Register(void* pCallback, void* pClass); + ConfigInfoField* Config(ConfigInfoField* pConfigInfo); + + void Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo); + void Disconnect(); + + void Subscribe(const string& szInstrumentIDs, const string& szExchangeID); + void Unsubscribe(const string& szInstrumentIDs, const string& szExchangeID); + +private: + friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + void QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + int _Init(); + void _DisconnectInThread(); + + //¼ + void ReqUserLogin(); + int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + // + void Subscribe(const set& instrumentIDs, const string& szExchangeID); + void Unsubscribe(const set& instrumentIDs, const string& szExchangeID); + +public: + virtual void OnDisconnected(int reason) override; + + virtual void OnSubMarketData(XTPST *ticker, XTPRI *error_info, bool is_last) override; + virtual void OnUnSubMarketData(XTPST *ticker, XTPRI *error_info, bool is_last) override; + virtual void OnDepthMarketData(XTPMD *market_data, int64_t bid1_qty[], int32_t bid1_count, int32_t max_bid1_count, int64_t ask1_qty[], int32_t ask1_count, int32_t max_ask1_count) override; + +private: + XTP::API::QuoteApi* m_pApi; //API + atomic m_lRequestID; //IDÿǰ + + string m_szPath; //ļ· + ServerInfoField m_ServerInfo; + UserInfoField m_UserInfo; + int m_nSleep; + + CMsgQueue* m_msgQueue; //Ϣָ + CMsgQueue* m_msgQueue_Query; + void* m_pClass; + + CSubscribeManager* m_pSubscribeManager; + CSubscribeManager* m_pQuoteSubscribeManager; + CSyntheticConfig* m_pSyntheticConfig; + CSyntheticManager* m_pSyntheticManager; + CSyntheticCalculateFactory* m_pCalculateFactory; +}; + +#endif diff --git a/apis/XTP/Quote/main.cpp b/apis/XTP/Quote/main.cpp new file mode 100644 index 0000000..4eeea2d --- /dev/null +++ b/apis/XTP/Quote/main.cpp @@ -0,0 +1,73 @@ +#include "stdafx.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" + +#include "MdUserApi.h" + +inline CMdUserApi* GetApi(void* pApi) +{ + return static_cast(pApi); +} + +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) +{ + RequestType rt = (RequestType)type; + switch (rt) + { + case RequestType_GetApiTypes: + return (void*)(ApiType::ApiType_MarketData | ApiType::ApiType_QuoteRequest); + case RequestType_GetApiVersion: + return (void*)API_VERSION; + case RequestType_GetApiName: + return (void*)API_NAME; + case RequestType_Create: + return new CMdUserApi(); + default: + break; + } + + if (pApi1 == nullptr) + { + return nullptr; + } + + CMdUserApi* pApi = GetApi(pApi1); + + switch (rt) + { + case RequestType_Release: + delete pApi; + return 0; + case RequestType_Register: + pApi->Register(ptr1, ptr2); + break; + case RequestType_Config: + return (void*)pApi->Config((ConfigInfoField*)ptr1); + case RequestType_Connect: + pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2); + break; + case RequestType_Disconnect: + pApi->Disconnect(); + break; + case RequestType_Subscribe: + pApi->Subscribe((const char*)ptr1, (const char*)ptr2); + break; + case RequestType_Unsubscribe: + pApi->Unsubscribe((const char*)ptr1, (const char*)ptr2); + break; + +#if HAS_Quote + case RequestType_SubscribeQuote: + pApi->SubscribeQuote((const char*)ptr1, (const char*)ptr2); + break; + case RequestType_UnsubscribeQuote: + pApi->UnsubscribeQuote((const char*)ptr1, (const char*)ptr2); + break; +#endif // HAS_Quote + + default: + break; + } + + return pApi1; +} diff --git a/apis/XTP/Trade/TraderApi.cpp b/apis/XTP/Trade/TraderApi.cpp new file mode 100644 index 0000000..c9d0e46 --- /dev/null +++ b/apis/XTP/Trade/TraderApi.cpp @@ -0,0 +1,726 @@ +#include "TraderApi.h" + +#include "../../include/ApiHeader.h" +#include "../../include/ApiStruct.h" + +#include "../../include/toolkit.h" + +#include "../../include/queue/MsgQueue.h" + +#include "../XTP/TypeConvert.h" + +void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + // ڲãüǷΪ + CTraderApi* pApi = (CTraderApi*)pApi2; + pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + return nullptr; +} + +CTraderApi::CTraderApi() +{ + m_pApi = nullptr; + m_lRequestID = 0; + m_nSleep = 1; + + // ԼάϢ + m_msgQueue = new CMsgQueue(); + m_msgQueue_Query = new CMsgQueue(); + + m_session_id = 0; + + m_msgQueue_Query->Register(Query); + m_msgQueue_Query->StartThread(); +} +CTraderApi::~CTraderApi() +{ + _Disconnect(false); +} + +void CTraderApi::Register(void* pCallback, void* pClass) +{ + m_pClass = pClass; + if (m_msgQueue == nullptr) + return; + + m_msgQueue_Query->Register(Query); + m_msgQueue->Register((fnOnResponse)pCallback); + if (pCallback) + { + m_msgQueue_Query->StartThread(); + m_msgQueue->StartThread(); + } + else + { + m_msgQueue_Query->StopThread(); + m_msgQueue->StopThread(); + } +} + +void CTraderApi::Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo) +{ + m_szPath = szPath; + memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); + memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); + + m_msgQueue_Query->Input_NoCopy(RequestType::E_Init, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} +void CTraderApi::Disconnect() +{ + _Disconnect(false); +} + +void CTraderApi::ReqQuery(QueryType type, ReqQueryField* pQuery) +{ + m_msgQueue_Query->Input_Copy(type, m_msgQueue_Query, this, 0, 0, + pQuery, sizeof(ReqQueryField), nullptr, 0, nullptr, 0); +} + +char* CTraderApi::ReqOrderInsert( + OrderField* pOrder, + int count, + char* pszLocalIDBuf) +{ + int OrderRef = -1; + if (nullptr == m_pApi || m_session_id == 0) + return nullptr; + + XTPOrderInsertInfo body = { 0 }; + + body.order_client_id = ++m_lRequestID; + strncpy(body.ticker, pOrder->Symbol, sizeof(body.ticker)); + body.market = (XTP_MARKET_TYPE)Str_2_XTPMarketType(pOrder->ExchangeID); + body.price = pOrder->Price; + body.stop_price = pOrder->StopPx; + body.quantity = (int64_t)pOrder->Qty; + body.price_type = (XTP_PRICE_TYPE)OrderType_XAPI_2_XTP(pOrder->Type); + body.side = (XTP_SIDE_TYPE)OrderDir_XAPI_2_XTP(pOrder->Side); + body.position_effect = (XTP_POSITION_EFFECT_TYPE)OpenClose_XAPI_2_XTP(pOrder->OpenClose); + + body.business_type = XTP_BUSINESS_TYPE_CASH; + + uint64_t ret = m_pApi->InsertOrder(&body, m_session_id); + CheckError((int)ret, "InsertOrder"); + + return ""; +} + +char* CTraderApi::ReqOrderAction(OrderIDType* szIds, int count, char* pzsRtn) +{ + unordered_map::iterator it = m_id_api_order.find(szIds[0]); + if (it == m_id_api_order.end()) + { + sprintf(pzsRtn, "%d", -100); + } + else + { + return ReqOrderAction(it->second, count, pzsRtn); + } + + return pzsRtn; +} +char* CTraderApi::ReqOrderAction(XTPOrderInfo *pOrder, int count, char* pzsRtn) +{ + if (nullptr == m_pApi) + return 0; + + m_pApi->CancelOrder(pOrder->order_xtp_id, m_session_id); + + strcpy(pzsRtn, ""); + return pzsRtn; +} + +void CTraderApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + int iRet = 0; + switch (type) + { + case E_Init: + iRet = _Init(); + break; + case E_Disconnect: + _Disconnect(true); + // ѭ + return; + } + + if (m_pApi) + { + switch (type) + { + case E_ReqUserLoginField: + iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case E_UserLogoutField: + iRet = _ReqUserLogout(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryTradingAccount: + iRet = _ReqQryTradingAccount(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryInvestorPosition: + iRet = _ReqQryInvestorPosition(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; +// case QueryType::QueryType_ReqQryInstrument: +// iRet = _ReqQryInstrument(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); +// break; +// case QueryType::QueryType_ReqQryInvestor: +// iRet = _ReqQryInvestor(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); +// break; + case QueryType::QueryType_ReqQryOrder: + iRet = _ReqQryOrder(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQryTrade: + iRet = _ReqQryTrade(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + +#ifdef HAS_Quote + case QueryType::QueryType_ReqQryQuote: + iRet = _ReqQryQuote(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; +#endif // HAS_Quote + +#ifdef HAS_Settlement + case E_SettlementInfoConfirmField: + iRet = _ReqSettlementInfoConfirm(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + case QueryType::QueryType_ReqQrySettlementInfo: + iRet = _ReqQrySettlementInfo(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; +#endif // HAS_Settlement + + default: + break; + } + } + + if (0 == iRet) + { + //سɹӵѷͳ + m_nSleep = 1; + } + else + { + m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + //ʧܣ4ݽʱ1s + m_nSleep *= 4; + m_nSleep %= 1023; + } + this_thread::sleep_for(chrono::milliseconds(m_nSleep)); +} + +void CTraderApi::Clear() +{ + for (unordered_map::iterator it = m_id_platform_order.begin(); it != m_id_platform_order.end(); ++it) + delete it->second; + m_id_platform_order.clear(); + + for (unordered_map::iterator it = m_id_api_order.begin(); it != m_id_api_order.end(); ++it) + delete it->second; + m_id_api_order.clear(); + + for (unordered_map::iterator it = m_id_platform_position.begin(); it != m_id_platform_position.end(); ++it) + delete it->second; + m_id_platform_position.clear(); + + for (unordered_map::iterator it = m_id_api_position.begin(); it != m_id_api_position.end(); ++it) + delete it->second; + m_id_api_position.clear(); + +} + +int CTraderApi::_Init() +{ + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + m_pApi = XTP::API::TraderApi::CreateTraderApi(m_UserInfo.ExtInfoInt32, m_szPath.c_str()); + + if (m_pApi) + { + m_pApi->RegisterSpi(this); + + // ʼ + m_pApi->SetHeartBeatInterval(15); + m_pApi->SubscribePublicTopic(XTP_TERT_QUICK); + + // XTP keyXTP뿪ʱxtpԱṩ + m_pApi->SetSoftwareKey(m_UserInfo.ExtInfoChar64); + + // XTPûеǰýӿڣģǰûӳɹϢ + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + //ӳɹԶ¼ + ReqUserLogin(); + } + + return 0; +} +void CTraderApi::_Disconnect(bool IsInQueue) +{ + if (IsInQueue) + {} + else + { + if (m_msgQueue_Query) + { + m_msgQueue_Query->StopThread(); + m_msgQueue_Query->Register(nullptr); + m_msgQueue_Query->Clear(); + delete m_msgQueue_Query; + m_msgQueue_Query = nullptr; + } + } + + if (m_pApi) + { + // ΪθоûеdzɹУ + m_pApi->RegisterSpi(nullptr); + m_pApi->Release(); + m_pApi = nullptr; + + // ȫֻһ + m_msgQueue->Clear(); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + // + m_msgQueue->Process(); + } + + if (m_msgQueue) + { + m_msgQueue->StopThread(); + m_msgQueue->Register(nullptr); + m_msgQueue->Clear(); + delete m_msgQueue; + m_msgQueue = nullptr; + } + + m_lRequestID = 0; + + Clear(); +} +void CTraderApi::_DisconnectInThread() +{ + m_msgQueue_Query->Input_NoCopy(RequestType::E_Disconnect, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} + +void CTraderApi::ReqUserLogin() +{ + m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); +} +int CTraderApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); + auto tmp_session = m_pApi->Login(m_ServerInfo.Address, m_ServerInfo.Port, m_UserInfo.UserID, m_UserInfo.Password, XTP_PROTOCOL_TCP); + if (m_session_id == 0) + { + m_session_id = tmp_session; + } + + if (tmp_session > 0) + { + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Logined, 0, nullptr, 0, nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + else + { + CheckError(tmp_session, "Login"); + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + _DisconnectInThread(); + } + + return 0; +} + +void CTraderApi::ReqUserLogout() +{ + uint64_t* session = (uint64_t*)m_msgQueue_Query->new_block(sizeof(uint64_t)); + *session = m_session_id; + + if (m_msgQueue_Query) + { + m_msgQueue_Query->Input_NoCopy(RequestType::E_UserLogoutField, m_msgQueue_Query, this, 0, 0, + session, sizeof(uint64_t), nullptr, 0, nullptr, 0); + } +} +int CTraderApi::_ReqUserLogout(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi) + { + return m_pApi->Logout(*(uint64_t*)pApi1); + } + return 0; +} + +int CTraderApi::_ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi && m_session_id != 0) + { + return m_pApi->QueryAsset(m_session_id, ++m_lRequestID); + } + return 0; +} +int CTraderApi::_ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi && m_session_id != 0) + { + ReqQueryField *query = (ReqQueryField*)ptr1; + return m_pApi->QueryPosition(query->Symbol, m_session_id, ++m_lRequestID); + } + return 0; +} +int CTraderApi::_ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi == nullptr || m_session_id == 0) + { + return 0; + } + + ReqQueryField *query = (ReqQueryField*)ptr1; + + XTPQueryOrderReq xtp_query = { 0 }; + strncpy(xtp_query.ticker, query->Symbol, sizeof(xtp_query.ticker)); + + if (query->DateStart == 0) + { + xtp_query.begin_time = 0; + } + else + { + xtp_query.begin_time = (int64_t)query->DateStart * 1000000000; + } + + if (query->DateEnd == 0) + { + xtp_query.end_time = 0; + } + else + { + xtp_query.end_time = (int64_t)query->DateEnd * 1000000000; + } + + return m_pApi->QueryOrders(&xtp_query, m_session_id, ++m_lRequestID); +} +int CTraderApi::_ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (m_pApi == nullptr || m_session_id == 0) + { + return 0; + } + + ReqQueryField *query = (ReqQueryField*)ptr1; + XTPQueryTraderReq xtp_query = { 0 }; + strncpy(xtp_query.ticker, query->Symbol, sizeof(xtp_query.ticker)); + + if (query->DateStart == 0) + { + xtp_query.begin_time = 0; + } + else + { + xtp_query.begin_time = (int64_t)query->DateStart * 1000000000; + } + + if (query->DateEnd == 0) + { + xtp_query.end_time = 0; + } + else + { + xtp_query.end_time = (int64_t)query->DateEnd * 1000000000; + } + + return m_pApi->QueryTrades(&xtp_query, m_session_id, ++m_lRequestID); +} + +void CTraderApi::_OnOrderInfo(XTPOrderInfo *order_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) +{ + if (error_info == nullptr || error_info->error_id == 0) + { + OrderIDType orderId = { 0 }; + sprintf(orderId, "%lld:%llu", order_info->insert_time, order_info->order_xtp_id); + OrderIDType orderSydId = { 0 }; + + { + // ԭʼϢڳ + + unordered_map::iterator it = m_id_api_order.find(orderId); + if (it == m_id_api_order.end()) + { + // Ҳ˶ʾµ + XTPOrderInfo* pField = (XTPOrderInfo*)m_msgQueue->new_block(sizeof(XTPOrderInfo)); + memcpy(pField, order_info, sizeof(XTPOrderInfo)); + m_id_api_order.insert(pair(orderId, pField)); + } + else + { + // ҵ˶ + // ҪٸƱһε״ֻ̬Ҫһεڳɣ£ñȽ + XTPOrderInfo* pField = it->second; + memcpy(pField, order_info, sizeof(XTPOrderInfo)); + } + + // SysIDڶɽر붩 + sprintf(orderSydId, "%d:%s:%llu", (int)order_info->market, order_info->ticker, order_info->order_xtp_id); + m_sysId_orderId.insert(pair(orderSydId, orderId)); + } + + { + // APIĶתԼĽṹ + OrderField* pOut = (OrderField*)m_msgQueue->new_block(sizeof(OrderField)); + + strcpy(pOut->ID, orderId); + strcpy(pOut->LocalID, pOut->ID); + sprintf(pOut->OrderID, "%llu", order_info->order_xtp_id); + strcpy(pOut->ExchangeID, XTPMarketType_2_Str(order_info->market)); + strcpy(pOut->Symbol, order_info->ticker); + pOut->Price = order_info->price; + pOut->Qty = (QtyType)order_info->quantity; + pOut->Side = (OrderSide)OrderDir_XTP_2_XAPI(order_info->side); + pOut->OpenClose = (OpenCloseType)OpenClose_XTP_2_XAPI(order_info->position_effect); + pOut->Status = (OrderStatus)OrderStatus_XTP_2_XAPI(order_info->order_status); + pOut->Type = (OrderType)OrderType_XTP_2_XAPI(order_info->order_type); + pOut->CumQty = (QtyType)order_info->qty_traded; + pOut->LeavesQty = (QtyType)order_info->qty_left; + + if (request_id == 0) + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnOrder, m_msgQueue, m_pClass, is_last, 0, pOut, sizeof(OrderField), nullptr, 0, nullptr, 0); + } + else + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryOrder, m_msgQueue, m_pClass, is_last, 0, pOut, sizeof(OrderField), nullptr, 0, nullptr, 0); + } + + + m_msgQueue->delete_block(pOut); + } + } + else + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = error_info->error_id; + strcpy(pField->Text, error_info->error_msg); + strcpy(pField->Source, "OnOrderInfo"); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, true, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } +} +void CTraderApi::_OnTradeInfo(XTPQueryTradeRsp *trade_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) +{ + if (error_info == nullptr || error_info->error_id == 0) + { + TradeField* pOut = (TradeField*)m_msgQueue->new_block(sizeof(TradeField)); + + strcpy(pOut->ExchangeID, XTPMarketType_2_Str(trade_info->market)); + strcpy(pOut->Symbol, trade_info->ticker); + pOut->Price = trade_info->price; + pOut->Qty = (QtyType)trade_info->quantity; + pOut->Side = (OrderSide)OrderDir_XTP_2_XAPI(trade_info->side); + pOut->OpenClose = (OpenCloseType)OpenClose_XTP_2_XAPI(trade_info->position_effect); + strcpy(pOut->TradeID, trade_info->exec_id); + + + OrderIDType orderSysId = { 0 }; + sprintf(orderSysId, "%d:%s:%llu", (int)trade_info->market, trade_info->ticker, trade_info->order_xtp_id); + unordered_map::iterator it = m_sysId_orderId.find(orderSysId); + + if (request_id == 0) + { + if (it == m_sysId_orderId.end()) + { + // ˳ɽҲӦı + //assert(false); + } + else + { + strcpy(pOut->ID, it->second.c_str()); + } + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRtnTrade, m_msgQueue, m_pClass, is_last, 0, pOut, sizeof(TradeField), nullptr, 0, nullptr, 0); + } + else + { + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryTrade, m_msgQueue, m_pClass, is_last, 0, pOut, sizeof(TradeField), nullptr, 0, nullptr, 0); + } + + m_msgQueue->delete_block(pOut); + } + else + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = error_info->error_id; + strcpy(pField->Text, error_info->error_msg); + strcpy(pField->Source, "OnTradeInfo"); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, true, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } +} + +void CTraderApi::OnTrade(TradeField *pTrade) +{ + PositionIDType positionId = { 0 }; + GetPositionID(positionId, pTrade->ExchangeID, pTrade->Symbol, (PositionSide)TradeField_2_PositionSide(pTrade)); + + PositionField* pField = nullptr; + unordered_map::iterator it = m_id_platform_position.find(positionId); + if (it == m_id_platform_position.end()) + { + pField = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); + + strcpy(pField->Symbol, pTrade->InstrumentID); + strcpy(pField->InstrumentID, pTrade->InstrumentID); + strcpy(pField->ExchangeID, pTrade->ExchangeID); + strcpy(pField->AccountID, pTrade->AccountID); + pField->Side = (PositionSide)TradeField_2_PositionSide(pTrade); + pField->HedgeFlag = pTrade->HedgeFlag; + + m_id_platform_position.insert(pair(positionId, pField)); + } + else + { + pField = it->second; + } + + if (pTrade->OpenClose == OpenCloseType::OpenCloseType_Open) + { + pField->Position += pTrade->Qty; + pField->TodayPosition += pTrade->Qty; + } + else + { + pField->Position -= pTrade->Qty; + if (pTrade->OpenClose == OpenCloseType::OpenCloseType_CloseToday) + { + pField->TodayPosition -= pTrade->Qty; + } + else + { + pField->HistoryPosition -= pTrade->Qty; + // ıɸӽ쿪ʼ + if (pField->HistoryPosition < 0) + { + pField->TodayPosition += pField->HistoryPosition; + pField->HistoryPosition = 0; + } + } + + // ֱ²ѯ + if (pField->Position < 0 || pField->TodayPosition < 0 || pField->HistoryPosition < 0) + { + //ReqQryInvestorPosition("", ""); + ReqQueryField body = { 0 }; + ReqQuery(QueryType::QueryType_ReqQryInvestorPosition, &body); + return; + } + } + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, false, 0, pField, sizeof(PositionField), nullptr, 0, nullptr, 0); +} +void CTraderApi::GetPositionID(PositionIDType position_id, const ExchangeIDType exchange_id, const SymbolType symbol, PositionSide dir) +{ + sprintf(position_id, "%s:%s:%d", exchange_id, symbol, dir); +} + +void CTraderApi::CheckError(int ret, const char *fn) +{ + if (ret == 0) + { + XTPRI *xtpri = m_pApi->GetApiLastError(); + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = xtpri->error_id; + strcpy(pField->Text, xtpri->error_msg); + strcpy(pField->Source, fn); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, true, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } +} + +void CTraderApi::OnDisconnected(uint64_t session_id, int reason) +{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + //ʧܷصϢƴӶɣҪΪͳһ + pField->RawErrorID = reason; + m_session_id = 0; + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::ConnectionStatus_Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + + _DisconnectInThread(); +} +void CTraderApi::OnError(XTPRI *error_info) +{} +void CTraderApi::OnOrderEvent(XTPOrderInfo *order_info, XTPRI *error_info, uint64_t session_id) +{ + _OnOrderInfo(order_info, nullptr, 0, true, session_id); +} +void CTraderApi::OnTradeEvent(XTPTradeReport *trade_info, uint64_t session_id) +{ + _OnTradeInfo(trade_info, nullptr, 0, true, session_id); +} +void CTraderApi::OnQueryOrder(XTPQueryOrderRsp *order_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) +{ + _OnOrderInfo(order_info, error_info, request_id, is_last, session_id); +} +void CTraderApi::OnQueryTrade(XTPQueryTradeRsp *trade_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) +{ + _OnTradeInfo(trade_info, error_info, request_id, true, session_id); +} +void CTraderApi::OnQueryPosition(XTPQueryStkPositionRsp *position, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) +{ + if (error_info == nullptr || error_info->error_id == 0) + { + PositionField* pOut = (PositionField*)m_msgQueue->new_block(sizeof(PositionField)); + + strcpy(pOut->ExchangeID, XTPMarketType_2_Str(position->market)); + strcpy(pOut->Symbol, position->ticker); + strcpy(pOut->InstrumentName, position->ticker_name); + pOut->Side = (PositionSide)PositionDir_XTP_2_XAPI(position->position_direction); + pOut->Position = position->total_qty; + pOut->TodayPosition = position->total_qty - position->sellable_qty; + pOut->PositionCost = position->avg_price; + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryInvestorPosition, m_msgQueue, m_pClass, is_last, 0, pOut, sizeof(PositionField), nullptr, 0, nullptr, 0); + m_msgQueue->delete_block(pOut); + } + else + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = error_info->error_id; + strcpy(pField->Text, error_info->error_msg); + strcpy(pField->Source, "OnQueryPosition"); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, true, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } +} +void CTraderApi::OnQueryAsset(XTPQueryAssetRsp *asset, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) +{ + if (error_info == nullptr || error_info->error_id == 0) + { + AccountField* pOut = (AccountField*)m_msgQueue->new_block(sizeof(AccountField)); + + pOut->Balance = asset->total_asset; + pOut->Available = asset->buying_power; + pOut->WithdrawQuota = asset->preferred_amount; + + m_msgQueue->Input_Copy(ResponseType::ResponseType_OnRspQryTradingAccount, m_msgQueue, m_pClass, is_last, 0, pOut, sizeof(AccountField), nullptr, 0, nullptr, 0); + m_msgQueue->delete_block(pOut); + } + else + { + ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField)); + + pField->RawErrorID = error_info->error_id; + strcpy(pField->Text, error_info->error_msg); + strcpy(pField->Source, "OnQueryAsset"); + + m_msgQueue->Input_NoCopy(ResponseType::ResponseType_OnRtnError, m_msgQueue, m_pClass, true, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0); + } +} diff --git a/apis/XTP/Trade/TraderApi.h b/apis/XTP/Trade/TraderApi.h new file mode 100644 index 0000000..d995617 --- /dev/null +++ b/apis/XTP/Trade/TraderApi.h @@ -0,0 +1,165 @@ +#ifndef XTP_TRADE_API_H_ +#define XTP_TRADE_API_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../include/ApiStruct.h" +#include "../../include/QueueEnum.h" + +#include "Include.h" + +using namespace std; + +class CMsgQueue; + +class CTraderApi : public XTP::API::TraderSpi +{ + //ݰ + enum RequestType + { + E_Init = 100, + E_Disconnect, + E_ReqAuthenticateField, + E_ReqUserLoginField, + E_UserLogoutField, + E_SettlementInfoConfirmField, + + E_QryInvestorField, + + E_QryInstrumentField, + + E_InputOrderField, + E_InputOrderActionField, + E_InputQuoteField, + E_InputQuoteActionField, + E_ParkedOrderField, + E_QryTradingAccountField, + E_QryInvestorPositionField, + E_QryInvestorPositionDetailField, + E_QryInstrumentCommissionRateField, + E_QryInstrumentMarginRateField, + E_QryDepthMarketDataField, + E_QrySettlementInfoField, + E_QryOrderField, + E_QryTradeField, + E_QryQuoteField, + }; + +public: + CTraderApi(void); + virtual ~CTraderApi(void); + + void Register(void* pCallback, void* pClass); + + void Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo); + void Disconnect(); + + void ReqQuery(QueryType type, ReqQueryField* pQuery); + + char* ReqOrderInsert( + OrderField* pOrder, + int count, + char* pszLocalIDBuf); + char* ReqOrderAction(OrderIDType* szIds, int count, char* pzsRtn); + char* ReqOrderAction(XTPOrderInfo *pOrder, int count, char* pzsRtn); + +private: + friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + void QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + void Clear(); + + int _Init(); + void _Disconnect(bool IsInQueue); + void _DisconnectInThread(); + + void ReqUserLogin(); + int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + void ReqUserLogout(); + int _ReqUserLogout(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + // ѯʲ + int _ReqQryTradingAccount(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + // ѯֲ + int _ReqQryInvestorPosition(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + // ѯ + int _ReqQryOrder(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + // ѯɽ + int _ReqQryTrade(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + void _OnOrderInfo(XTPOrderInfo *order_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id); + void _OnTradeInfo(XTPQueryTradeRsp *trade_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id); + + void OnTrade(TradeField *pTrade); + + void GetPositionID(PositionIDType position_id, const ExchangeIDType exchange_id, const SymbolType symbol, PositionSide dir); + + void CheckError(int ret, const char *fn); + +public: + + // ͻ˵ij뽻׺̨ͨӶϿʱ + virtual void OnDisconnected(uint64_t session_id, int reason) override; + + // Ӧ + virtual void OnError(XTPRI *error_info) override; + + // ֪ͨ + virtual void OnOrderEvent(XTPOrderInfo *order_info, XTPRI *error_info, uint64_t session_id) override; + + // ɽ֪ͨ + virtual void OnTradeEvent(XTPTradeReport *trade_info, uint64_t session_id) override; + + // ѯӦ + virtual void OnQueryOrder(XTPQueryOrderRsp *order_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) override; + + // ѯɽӦ + virtual void OnQueryTrade(XTPQueryTradeRsp *trade_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) override; + + // ѯͶֲ߳Ӧ + virtual void OnQueryPosition(XTPQueryStkPositionRsp *position, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) override; + + // ѯʽ˻Ӧ + virtual void OnQueryAsset(XTPQueryAssetRsp *asset, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) override; + +private: + XTP::API::TraderApi* m_pApi; // API + std::atomic m_lRequestID; // ID,ñ + + int m_nSleep; + + unordered_map m_id_platform_order; + unordered_map m_id_api_order; + unordered_map m_sysId_orderId; + +#ifdef HAS_Quote + unordered_map m_id_platform_quote; + unordered_map m_id_api_quote; + unordered_map m_sysId_quoteId; +#endif // HAS_Quote + + unordered_map m_id_platform_position; + unordered_map m_id_api_position; + + string m_szPath; + ServerInfoField m_ServerInfo; + UserInfoField m_UserInfo; + + CMsgQueue* m_msgQueue; //Ϣָ + CMsgQueue* m_msgQueue_Query; + void* m_pClass; + + uint64_t m_session_id; +}; + +#endif \ No newline at end of file diff --git a/apis/XTP/Trade/main.cpp b/apis/XTP/Trade/main.cpp new file mode 100644 index 0000000..0a0559a --- /dev/null +++ b/apis/XTP/Trade/main.cpp @@ -0,0 +1,73 @@ +#include "stdafx.h" +#include "../../include/ApiHeader.h" +#include "../../include/QueueEnum.h" +#include "TraderApi.h" + +inline CTraderApi* GetApi(void* pApi) +{ + return static_cast(pApi); +} + +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) +{ + RequestType rt = (RequestType)type; + switch (rt) + { + case RequestType_GetApiTypes: + return (void*)(ApiType::ApiType_Trade | ApiType::ApiType_Instrument | ApiType::ApiType_Query); + case RequestType_GetApiVersion: + return (void*)API_VERSION; + case RequestType_GetApiName: + return (void*)API_NAME; + case RequestType_Create: + return new CTraderApi(); + default: + break; + } + + if (pApi1 == nullptr) + { + return nullptr; + } + + CTraderApi* pApi = GetApi(pApi1); + + switch (rt) + { + case RequestType_Release: + delete pApi; + return nullptr; + case RequestType_Register: + pApi->Register(ptr1, ptr2); + break; + case RequestType_Connect: + pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2); + break; + case RequestType_Disconnect: + pApi->Disconnect(); + break; + case QueryType_ReqQryInstrument: + case QueryType_ReqQryInvestorPosition: + case QueryType_ReqQryTradingAccount: + case QueryType_ReqQrySettlementInfo: + case QueryType_ReqQryTrade: + case QueryType_ReqQryOrder: + pApi->ReqQuery((QueryType)type, (ReqQueryField*)ptr1); + break; + case RequestType_ReqOrderInsert: + return (void*)pApi->ReqOrderInsert((OrderField*)ptr1, size1, (char*)ptr2); + case RequestType_ReqOrderAction: + return (void*)pApi->ReqOrderAction((OrderIDType*)ptr1, size1, (char*)ptr2); +#ifdef HAS_Quote + case RequestType_ReqQuoteInsert: + return pApi->ReqQuoteInsert((QuoteField*)ptr1, (OrderIDType*)ptr2, (OrderIDType*)ptr3); + case RequestType_ReqQuoteAction: + return (void*)pApi->ReqQuoteAction((const char*)ptr1, (OrderIDType*)ptr2); +#endif // HAS_Quote + + default: + break; + } + + return pApi1; +} diff --git a/apis/XTP/TypeConvert.cpp b/apis/XTP/TypeConvert.cpp new file mode 100644 index 0000000..4bdc647 --- /dev/null +++ b/apis/XTP/TypeConvert.cpp @@ -0,0 +1,173 @@ +#include "TypeConvert.h" +#include +#include + +#include "../../include/ApiProcess.h" +#include "../../include/XTP/xtp_api_data_type.h" +// #include "Include.h" + + +const char* XTPExchangeType_2_Str(int xtp_exchange_type) +{ + switch (xtp_exchange_type) + { + case XTP_EXCHANGE_SH: return ExchangeType_2_String(ExchangeType_SSE); + case XTP_EXCHANGE_SZ: return ExchangeType_2_String(ExchangeType_SZSE); + } + return ExchangeType_2_String(ExchangeType_Undefined); +} +const char* XTPMarketType_2_Str(int xtp_market_type) +{ + switch (xtp_market_type) + { + case XTP_MKT_SZ_A: return ExchangeType_2_String(ExchangeType_SSE); + case XTP_MKT_SH_A: return ExchangeType_2_String(ExchangeType_SZSE); + } + return ExchangeType_2_String(ExchangeType_Undefined); +} +int Str_2_XTPExchangeType(const char *exchange_str) +{ + if (strcmp(exchange_str, ExchangeType_2_String(ExchangeType_SSE)) == 0) + { + return XTP_EXCHANGE_SH; + } + if (strcmp(exchange_str, ExchangeType_2_String(ExchangeType_SZSE)) == 0) + { + return XTP_EXCHANGE_SZ; + } + return XTP_EXCHANGE_UNKNOWN; +} +int Str_2_XTPMarketType(const char *market_str) +{ + if (strcmp(market_str, ExchangeType_2_String(ExchangeType_SSE)) == 0) + { + return XTP_MKT_SH_A; + } + if (strcmp(market_str, ExchangeType_2_String(ExchangeType_SZSE)) == 0) + { + return XTP_MKT_SZ_A; + } + return XTP_MKT_UNKNOWN; +} + +int OrderDir_XTP_2_XAPI(int xtp_side) +{ + switch (xtp_side) + { + case XTP_SIDE_BUY: return OrderSide_Buy; + case XTP_SIDE_SELL: return OrderSide_Sell; + } + return OrderSide_Unknown; +} +int OrderDir_XAPI_2_XTP(int side) +{ + switch (side) + { + case OrderSide_Buy: return XTP_SIDE_BUY; + case OrderSide_Sell: return XTP_SIDE_SELL; + } + return XTP_SIDE_UNKNOWN; +} + +int PositionDir_XTP_2_XAPI(int flag) +{ + switch (flag) + { + case XTP_POSITION_DIRECTION_LONG: return PositionSide::PositionSide_Long; + case XTP_POSITION_DIRECTION_SHORT: return PositionSide::PositionSide_Short; + } + + return PositionSide::PositionSide_Long; +} +int PositionDir_XAPI_2_XTP(int flag) +{ + switch (flag) + { + case PositionSide::PositionSide_Long: return XTP_POSITION_DIRECTION_LONG; + case PositionSide::PositionSide_Short: return XTP_POSITION_DIRECTION_SHORT; + } + return XTP_POSITION_DIRECTION_NET; +} + +int OrderType_XTP_2_XAPI(int flag) +{ + switch (flag) + { + case XTP_PRICE_LIMIT: return OrderType_Limit; + case XTP_PRICE_ALL_OR_CANCEL: return OrderType_Market; + } + return OrderType_Market; +} +int OrderType_XAPI_2_XTP(int flag) +{ + switch (flag) + { + case OrderType_Limit: return XTP_PRICE_LIMIT; + case OrderType_Market: return XTP_PRICE_ALL_OR_CANCEL; + } + return XTP_PRICE_ALL_OR_CANCEL; +} + +int OpenClose_XTP_2_XAPI(int flag) +{ + switch (flag) + { + case XTP_POSITION_EFFECT_OPEN: return OpenCloseType_Open; + case XTP_POSITION_EFFECT_CLOSE: return OpenCloseType_Close; + case XTP_POSITION_EFFECT_CLOSETODAY: return OpenCloseType_CloseToday; + } + return XTP_POSITION_EFFECT_UNKNOWN; +} +int OpenClose_XAPI_2_XTP(int flag) +{ + switch (flag) + { + case OpenCloseType_Open: return XTP_POSITION_EFFECT_OPEN; + case OpenCloseType_Close: return XTP_POSITION_EFFECT_CLOSE; + case OpenCloseType_CloseToday: return XTP_POSITION_EFFECT_CLOSETODAY; + } + return XTP_POSITION_EFFECT_INIT; +} + +int OrderStatus_XTP_2_XAPI(int flag) +{ + switch (flag) + { + case XTP_ORDER_STATUS_INIT: return OrderStatus_New; + case XTP_ORDER_STATUS_ALLTRADED: return OrderStatus_Filled; + case XTP_ORDER_STATUS_PARTTRADEDQUEUEING: return OrderStatus_PartiallyFilled; + case XTP_ORDER_STATUS_PARTTRADEDNOTQUEUEING: return OrderStatus_PendingCancel; + case XTP_ORDER_STATUS_CANCELED: return OrderStatus_Cancelled; + case XTP_ORDER_STATUS_REJECTED: return OrderStatus_Rejected; + } + return OrderStatus_NotSent; +} +int OrderStatus_XAPI_2_XTP(int flag) +{ + switch (flag) + { + case OrderStatus_New: return XTP_ORDER_STATUS_INIT; + case OrderStatus_Filled: return XTP_ORDER_STATUS_ALLTRADED; + case OrderStatus_PartiallyFilled: return XTP_ORDER_STATUS_PARTTRADEDQUEUEING; + case OrderStatus_PendingCancel: return XTP_ORDER_STATUS_PARTTRADEDNOTQUEUEING; + case OrderStatus_Cancelled: return XTP_ORDER_STATUS_CANCELED; + case OrderStatus_Rejected: return XTP_ORDER_STATUS_REJECTED; + } + return XTP_ORDER_STATUS_UNKNOWN; +} + +int TradeField_2_PositionSide(TradeField* pIn) +{ + if (pIn->OpenClose == OpenCloseType::OpenCloseType_Open) + { + if (pIn->Side == OrderSide::OrderSide_Buy) + return PositionSide::PositionSide_Long; + return PositionSide::PositionSide_Short; + } + else + { + if (pIn->Side == OrderSide::OrderSide_Buy) + return PositionSide::PositionSide_Short; + return PositionSide::PositionSide_Long; + } +} \ No newline at end of file diff --git a/apis/XTP/TypeConvert.h b/apis/XTP/TypeConvert.h new file mode 100644 index 0000000..c13c842 --- /dev/null +++ b/apis/XTP/TypeConvert.h @@ -0,0 +1,29 @@ +#ifndef TYPE_CONVERT_H_ +#define TYPE_CONVERT_H_ + +struct TradeField; + +const char* XTPExchangeType_2_Str(int xtp_exchange_type); +const char* XTPMarketType_2_Str(int xtp_market_type); + +int Str_2_XTPExchangeType(const char *exchange_str); +int Str_2_XTPMarketType(const char *market_str); + +int OrderDir_XTP_2_XAPI(int xtp_side); +int OrderDir_XAPI_2_XTP(int side); + +int PositionDir_XTP_2_XAPI(int flag); +int PositionDir_XAPI_2_XTP(int flag); + +int OrderType_XTP_2_XAPI(int flag); +int OrderType_XAPI_2_XTP(int flag); + +int OpenClose_XTP_2_XAPI(int flag); +int OpenClose_XAPI_2_XTP(int flag); + +int OrderStatus_XTP_2_XAPI(int flag); +int OrderStatus_XAPI_2_XTP(int flag); + +int TradeField_2_PositionSide(TradeField* pIn); + +#endif \ No newline at end of file diff --git a/apis/XTP_Quote/Include.h b/apis/XTP_Quote/Include.h new file mode 100644 index 0000000..ff2c8cb --- /dev/null +++ b/apis/XTP_Quote/Include.h @@ -0,0 +1,14 @@ +#ifndef XTP_QUOTE_INCLUDE_H_ +#define XTP_QUOTE_INCLUDE_H_ + +#define API_VERSION "1.1.18.13" +#define API_NAME "XTP" +#define DLL_PUBLIC_KEY "" + +#include "../../include/CrossPlatform.h" +#include "../../include/ApiStruct.h" +#include "../../include/XTP/xtp_api_data_type.h" +#include "../../include/XTP/xquote_api_struct.h" +#include "../../include/XTP/xtp_quote_api.h" + +#endif diff --git a/apis/XTP_Quote/stdafx.cpp b/apis/XTP_Quote/stdafx.cpp new file mode 100644 index 0000000..583c612 --- /dev/null +++ b/apis/XTP_Quote/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// QuantBox_CTP_Quote.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/QuantBox_Queue/stdafx.h b/apis/XTP_Quote/stdafx.h similarity index 71% rename from QuantBox_Queue/stdafx.h rename to apis/XTP_Quote/stdafx.h index 8bd96ea..e022385 100644 --- a/QuantBox_Queue/stdafx.h +++ b/apis/XTP_Quote/stdafx.h @@ -13,11 +13,11 @@ // TODO: reference additional headers your program requires here #if defined _WIN32 || WIN32 || _WINDOWS - #include "targetver.h" +#include "targetver.h" - #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - // Windows Header Files: - #include +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include #else - -#endif // defined \ No newline at end of file + +#endif // defined diff --git a/apis/XTP_Quote/targetver.h b/apis/XTP_Quote/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/apis/XTP_Quote/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/apis/XTP_Trade/Include.h b/apis/XTP_Trade/Include.h new file mode 100644 index 0000000..d534b04 --- /dev/null +++ b/apis/XTP_Trade/Include.h @@ -0,0 +1,13 @@ +#ifndef XTP_TRADE_INCLUDE_H_ +#define XTP_TRADE_INCLUDE_H_ + +#define API_VERSION "1.1.18.13" +#define API_NAME "XTP" +#define DLL_PUBLIC_KEY "" + +#include "../../include/CrossPlatform.h" +#include "../../include/ApiStruct.h" +#include "../../include/XTP/xtp_api_data_type.h" +#include "../../include/XTP/xtp_trader_api.h" + +#endif diff --git a/apis/XTP_Trade/stdafx.cpp b/apis/XTP_Trade/stdafx.cpp new file mode 100644 index 0000000..8c2ae11 --- /dev/null +++ b/apis/XTP_Trade/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// QuantBox_CTP_Trade.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/apis/XTP_Trade/stdafx.h b/apis/XTP_Trade/stdafx.h new file mode 100644 index 0000000..e022385 --- /dev/null +++ b/apis/XTP_Trade/stdafx.h @@ -0,0 +1,23 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +//#include "targetver.h" +// +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +//// Windows Header Files: +//#include + +// TODO: reference additional headers your program requires here +#if defined _WIN32 || WIN32 || _WINDOWS +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include +#else + +#endif // defined diff --git a/apis/XTP_Trade/targetver.h b/apis/XTP_Trade/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/apis/XTP_Trade/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..60808b9 --- /dev/null +++ b/build.bat @@ -0,0 +1,3 @@ +md build +cd build +cmake .. \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..cf6a398 --- /dev/null +++ b/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +mkdir build +cd build +cmake .. +make \ No newline at end of file diff --git a/clear.bat b/clear.bat index 2097cb9..612569d 100644 --- a/clear.bat +++ b/clear.bat @@ -1,100 +1,104 @@ rd Debug /S /Q +rd Release /S /Q rd Debug64 /S /Q +rd Release64 /S /Q rd x64 /S /Q rd ipch /S /Q -rd csharp\QuantBox.XAPI\bin /S /Q -rd csharp\QuantBox.XAPI\obj /S /Q +del AllCppProjects.opensdf /S /Q +del AllCppProjects.sdf /S /Q +del AllCppProjects.v12.suo /S /Q /A H + +rd apis\CTP_Quote\Debug /S /Q +rd apis\CTP_Quote\Debug64 /S /Q +rd apis\CTP_Quote\Release /S /Q +rd apis\CTP_Quote\Release64 /S /Q +rd apis\CTP_Quote\x64 /S /Q +rd apis\CTP_Trade\Debug /S /Q +rd apis\CTP_Trade\Debug64 /S /Q +rd apis\CTP_Trade\Release /S /Q +rd apis\CTP_Trade\Release64 /S /Q +rd apis\CTP_Trade\x64 /S /Q +rd apis\CTPZQ_Quote\Debug /S /Q +rd apis\CTPZQ_Quote\Debug64 /S /Q +rd apis\CTPZQ_Quote\Release /S /Q +rd apis\CTPZQ_Quote\Release64 /S /Q +rd apis\CTPZQ_Quote\x64 /S /Q +rd apis\CTPZQ_Trade\Debug /S /Q +rd apis\CTPZQ_Trade\Debug64 /S /Q +rd apis\CTPZQ_Trade\Release /S /Q +rd apis\CTPZQ_Trade\Release64 /S /Q +rd apis\CTPZQ_Trade\x64 /S /Q +rd apis\CTP_SOPT_Trade\Debug /S /Q +rd apis\CTP_SOPT_Trade\Debug64 /S /Q +rd apis\CTP_SOPT_Trade\Release /S /Q +rd apis\CTP_SOPT_Trade\Release64 /S /Q +rd apis\CTP_SOPT_Trade\x64 /S /Q +rd apis\Kingstar_Quote\Debug /S /Q +rd apis\Kingstar_Quote\Release /S /Q +rd apis\Kingstar_Quote\x64 /S /Q +rd apis\Kingstar_Trade\Debug /S /Q +rd apis\Kingstar_Trade\Release /S /Q +rd apis\Kingstar_Trade\x64 /S /Q +rd apis\LTS_Query_v2\Debug /S /Q +rd apis\LTS_Query_v2\Release /S /Q +rd apis\LTS_Query_v2\x64 /S /Q +rd apis\LTS_Quote_v2\Debug /S /Q +rd apis\LTS_Quote_v2\Release /S /Q +rd apis\LTS_Quote_v2\x64 /S /Q +rd apis\LTS_Trade_v2\Debug /S /Q +rd apis\LTS_Trade_v2\Release /S /Q +rd apis\LTS_Trade_v2\x64 /S /Q +rd apis\Tdx_Trade\Debug /S /Q +rd apis\Tdx_Trade\Release /S /Q +rd apis\Tdx_Trade\x64 /S /Q +rd apis\TongShi_Quote\Debug /S /Q +rd apis\TongShi_Quote\Release /S /Q +rd apis\TongShi_Quote\x64 /S /Q +rd apis\Sgit_Quote\Debug /S /Q +rd apis\Sgit_Quote\Debug64 /S /Q +rd apis\Sgit_Quote\Release /S /Q +rd apis\Sgit_Quote\Release64 /S /Q +rd apis\Sgit_Quote\x64 /S /Q +rd apis\Sgit_Trade\Debug /S /Q +rd apis\Sgit_Trade\Debug64 /S /Q +rd apis\Sgit_Trade\Release /S /Q +rd apis\Sgit_Trade\Release64 /S /Q +rd apis\Sgit_Trade\x64 /S /Q +rd apis\ATP_Quote\Debug /S /Q +rd apis\ATP_Quote\Debug64 /S /Q +rd apis\ATP_Quote\Release /S /Q +rd apis\ATP_Quote\Release64 /S /Q +rd apis\ATP_Quote\x64 /S /Q +rd apis\ATP_Trade\Debug /S /Q +rd apis\ATP_Trade\Debug64 /S /Q +rd apis\ATP_Trade\Release /S /Q +rd apis\ATP_Trade\Release64 /S /Q +rd apis\ATP_Trade\x64 /S /Q + +rd apis\Kingstar_Quote\Release64 /S /Q +rd apis\Kingstar_Trade\Release64 /S /Q +rd apis\TongShi_Quote\Release64 /S /Q + +rd common\Queue\Debug /S /Q +rd common\Queue\Release /S /Q +rd common\Queue\x64 /S /Q + +rd tools\FakeAPI\Debug /S /Q +rd tools\FakeAPI\Release /S /Q +rd tools\FakeAPI\x64 /S /Q -rd QuantBox_CTP_Quote\Debug /S /Q -rd QuantBox_CTP_Trade\Debug /S /Q -rd QuantBox_DFITC_Level2\Debug /S /Q -rd QuantBox_Esunny_HistoricalData\Debug /S /Q -rd QuantBox_Femas_Quote\Debug /S /Q -rd QuantBox_Femas_Trade\Debug /S /Q -rd QuantBox_Kingstar_Quote\Debug /S /Q -rd QuantBox_Kingstar_Trade\Debug /S /Q -rd QuantBox_KingstarStock_Trade\Debug /S /Q -rd QuantBox_LTS_Level2\Debug /S /Q -rd QuantBox_LTS_Quote\Debug /S /Q -rd QuantBox_LTS_Trade\Debug /S /Q -rd QuantBox_Queue\Debug /S /Q -rd QuantBox_Kingstar_Quote\Debug /S /Q -rd QuantBox_Kingstar_Trade\Debug /S /Q -rd QuantBox_KingstarGold\Debug /S /Q -rd QuantBox_XSpeed_Quote\Debug /S /Q -rd QuantBox_XSpeed_Trade\Debug /S /Q -rd QuantBox_XSpeedStock_Quote\Debug /S /Q -rd QuantBox_XSpeedStock_Trade\Debug /S /Q -rd QuantBox_ZeroMQ_Quote\Debug /S /Q -rd QuantBox_TongShi_Quote\Debug /S /Q -rd QuantBox_Tdx_Trade\Debug /S /Q -rd QuantBox_LTS_Query_v2\Debug /S /Q -rd QuantBox_LTS_Quote_v2\Debug /S /Q -rd QuantBox_LTS_Trade_v2\Debug /S /Q -rd FakeAPI\Debug /S /Q -rd QuantBox_XAPI\Debug /S /Q -rd QuantBox_XAPI_TEST\Debug /S /Q +rd tests\CPP\Debug /S /Q +rd tests\CPP\Release /S /Q +rd tests\CPP\x64 /S /Q -rd QuantBox_CTP_Quote\Debug64 /S /Q -rd QuantBox_CTP_Trade\Debug64 /S /Q -rd QuantBox_DFITC_Level2\Debug64 /S /Q -rd QuantBox_Esunny_HistoricalData\Debug64 /S /Q -rd QuantBox_Femas_Quote\Debug64 /S /Q -rd QuantBox_Femas_Trade\Debug64 /S /Q -rd QuantBox_Kingstar_Quote\Debug64 /S /Q -rd QuantBox_Kingstar_Trade\Debug64 /S /Q -rd QuantBox_KingstarStock_Trade\Debug64 /S /Q -rd QuantBox_LTS_Level2\Debug64 /S /Q -rd QuantBox_LTS_Quote\Debug64 /S /Q -rd QuantBox_LTS_Trade\Debug64 /S /Q -rd QuantBox_Queue\Debug64 /S /Q -rd QuantBox_Kingstar_Quote\Debug64 /S /Q -rd QuantBox_Kingstar_Trade\Debug64 /S /Q -rd QuantBox_KingstarGold\Debug64 /S /Q -rd QuantBox_XSpeed_Quote\Debug64 /S /Q -rd QuantBox_XSpeed_Trade\Debug64 /S /Q -rd QuantBox_XSpeedStock_Quote\Debug64 /S /Q -rd QuantBox_XSpeedStock_Trade\Debug64 /S /Q +rd languages\CSharp\XAPI_CSharp\bin /S /Q +rd languages\CSharp\XAPI_CSharp\obj /S /Q -rd QuantBox_CTP_Quote\Release /S /Q -rd QuantBox_CTP_Trade\Release /S /Q -rd QuantBox_DFITC_Level2\Release /S /Q -rd QuantBox_Esunny_HistoricalData\Release /S /Q -rd QuantBox_Femas_Quote\Release /S /Q -rd QuantBox_Femas_Trade\Release /S /Q -rd QuantBox_Kingstar_Quote\Release /S /Q -rd QuantBox_Kingstar_Trade\Release /S /Q -rd QuantBox_KingstarStock_Trade\Release /S /Q -rd QuantBox_LTS_Level2\Release /S /Q -rd QuantBox_LTS_Quote\Release /S /Q -rd QuantBox_LTS_Trade\Release /S /Q -rd QuantBox_Queue\Release /S /Q -rd QuantBox_Kingstar_Quote\Release /S /Q -rd QuantBox_Kingstar_Trade\Release /S /Q -rd QuantBox_KingstarGold\Release /S /Q -rd QuantBox_XSpeed_Quote\Release /S /Q -rd QuantBox_XSpeed_Trade\Release /S /Q -rd QuantBox_XSpeedStock_Quote\Release /S /Q -rd QuantBox_XSpeedStock_Trade\Release /S /Q -rd QuantBox_CTP_Quote\x64 /S /Q -rd QuantBox_CTP_Trade\x64 /S /Q -rd QuantBox_DFITC_Level2\x64 /S /Q -rd QuantBox_Esunny_HistoricalData\x64 /S /Q -rd QuantBox_Femas_Quote\x64 /S /Q -rd QuantBox_Femas_Trade\x64 /S /Q -rd QuantBox_Kingstar_Quote\x64 /S /Q -rd QuantBox_Kingstar_Trade\x64 /S /Q -rd QuantBox_KingstarStock_Trade\x64 /S /Q -rd QuantBox_LTS_Level2\x64 /S /Q -rd QuantBox_LTS_Quote\x64 /S /Q -rd QuantBox_LTS_Trade\x64 /S /Q -rd QuantBox_Queue\x64 /S /Q -rd QuantBox_Kingstar_Quote\x64 /S /Q -rd QuantBox_Kingstar_Trade\x64 /S /Q -rd QuantBox_KingstarGold\x64 /S /Q -rd QuantBox_XSpeed_Quote\x64 /S /Q -rd QuantBox_XSpeed_Trade\x64 /S /Q -rd QuantBox_XSpeedStock_Quote\x64 /S /Q -rd QuantBox_XSpeedStock_Trade\x64 /S /Q + + + +rd csharp\QuantBox.XAPI\bin /S /Q +rd csharp\QuantBox.XAPI\obj /S /Q + diff --git a/clearBin.bat b/clearBin.bat new file mode 100644 index 0000000..c044a29 --- /dev/null +++ b/clearBin.bat @@ -0,0 +1,7 @@ +cd bin +del *.exp /S /Q +del *.ilk /S /Q +del *.pdb /S /Q +del *.lib /S /Q + + diff --git a/common/License/License.cpp b/common/License/License.cpp new file mode 100644 index 0000000..6d17677 --- /dev/null +++ b/common/License/License.cpp @@ -0,0 +1,607 @@ +#include "stdafx.h" +#include "License.h" +#include +#pragma comment(lib, "iphlpapi.lib") + +#ifdef ENABLE_LICENSE + +#include +#include + + + +#include "../../include/inirw.h" + +#define APP_NAME_USER "User" +#define KEY_NAME_ACCOUNT "Account" +#define KEY_NAME_USERNAME "UserName" + +#define KEY_NAME_PRODUCT "Product" +#define APP_NAME_LICENSE "License" +#define KEY_NAME_COUNT "Count" +#define KEY_NAME_MAC "MachineID" +#define KEY_NAME_TRIAL "Trial" +#define KEY_NAME_EXPIRE_DATE "ExpireDate" +#define KEY_NAME_SERIAL_NUMBER "SerialNumber" +#define KEY_NAME_INFO "Info" + +using namespace std; + +//// Prints the MAC address stored in a 6 byte array to stdout +//static void PrintMACaddress(unsigned char MACData[]) +//{ +// +//#ifdef PRINTING_TO_CONSOLE_ALLOWED +// +// printf("\nMAC Address: %02X-%02X-%02X-%02X-%02X-%02X\n", +// MACData[0], MACData[1], MACData[2], MACData[3], MACData[4], MACData[5]); +// +//#endif +// +// char string[256]; +// sprintf(string, "%02X-%02X-%02X-%02X-%02X-%02X\n", MACData[0], MACData[1], +// MACData[2], MACData[3], MACData[4], MACData[5]); +// //WriteConstantString("MACaddress", string); +// printf(string); +//} + +// Fetches the MAC address and prints it +//DWORD GetMACaddress() +//{ +// DWORD MACaddress = 0; +// IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information +// // for up to 16 NICs +// DWORD dwBufLen = sizeof(AdapterInfo); // Save memory size of buffer +// +// DWORD dwStatus = GetAdaptersInfo( // Call GetAdapterInfo +// AdapterInfo, // [out] buffer to receive data +// &dwBufLen); // [in] size of receive data buffer +// //assert(dwStatus == ERROR_SUCCESS); // Verify return value is +// // valid, no buffer overflow +// +// PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; // Contains pointer to +// // current adapter info +// do { +// if (MACaddress == 0) +// MACaddress = pAdapterInfo->Address[5] + pAdapterInfo->Address[4] * 256 + +// pAdapterInfo->Address[3] * 256 * 256 + +// pAdapterInfo->Address[2] * 256 * 256 * 256; +// //PrintMACaddress(pAdapterInfo->Address); // Print MAC address +// //memcpy(pAddress1, pAdapterInfo->Address, sizeof(pAdapterInfo->Address)); +// //break; +// pAdapterInfo = pAdapterInfo->Next; // Progress through linked list +// } while (pAdapterInfo); // Terminate if last adapter +// +// return MACaddress; +//} + +// Prints the MAC address stored in a 6 byte array to stdout +static void PrintMACaddress(unsigned char MACData[],char* string) +{ + +#ifdef PRINTING_TO_CONSOLE_ALLOWED + + printf("\nMAC Address: %02X-%02X-%02X-%02X-%02X-%02X\n", + MACData[0], MACData[1], MACData[2], MACData[3], MACData[4], MACData[5]); + +#endif + + //char string[256]; + sprintf(string, "%02X%02X%02X%02X%02X%02X", MACData[0], MACData[1], + MACData[2], MACData[3], MACData[4], MACData[5]); + //WriteConstantString("MACaddress", string); + //printf(string); +} + +DWORD GetMACaddress(char* string) +{ + DWORD MACaddress = 0; + IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information + // for up to 16 NICs + DWORD dwBufLen = sizeof(AdapterInfo); // Save memory size of buffer + + DWORD dwStatus = GetAdaptersInfo( // Call GetAdapterInfo + AdapterInfo, // [out] buffer to receive data + &dwBufLen); // [in] size of receive data buffer + //assert(dwStatus == ERROR_SUCCESS); // Verify return value is + // valid, no buffer overflow + + PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; // Contains pointer to + // current adapter info + do { + if (MACaddress == 0) + MACaddress = pAdapterInfo->Address[5] + pAdapterInfo->Address[4] * 256 + + pAdapterInfo->Address[3] * 256 * 256 + + pAdapterInfo->Address[2] * 256 * 256 * 256; + PrintMACaddress(pAdapterInfo->Address, string); // Print MAC address + //memcpy(pAddress1, pAdapterInfo->Address, sizeof(pAdapterInfo->Address)); + break; + pAdapterInfo = pAdapterInfo->Next; // Progress through linked list + } while (pAdapterInfo); // Terminate if last adapter + + return MACaddress; +} + + +CLicense::CLicense() +{ + memset(m_LicensePath, 0, sizeof(m_LicensePath)); + memset(m_PublicKeyPath, 0, sizeof(m_PublicKeyPath)); + memset(m_PrivateKeyPath, 0, sizeof(m_PrivateKeyPath)); + memset(m_SignaturePath, 0, sizeof(m_SignaturePath)); + memset(m_PublicKeyString, 0, sizeof(m_PublicKeyString)); + memset(m_SignatureString, 0, sizeof(m_SignatureString)); + memset(m_RealMAC, 0, sizeof(m_RealMAC)); + + m_bHasSaved = false; + m_bLoaded = false; + m_bSendOrderFlag = false; + + //sprintf_s(m_RealMAC, "%ld", GetMACaddress()); + GetMACaddress(m_RealMAC); + + CreateDefault(); +} + + +CLicense::~CLicense() +{ +} + +int CLicense::Today(int day) +{ + time_t now = time(0); + now += day * 86400; + struct tm *ptmNow = localtime(&now); + + return (ptmNow->tm_year + 1900) * 10000 + + (ptmNow->tm_mon + 1) * 100 + + ptmNow->tm_mday; +} + +int CLicense::Date(int date, int day) +{ + time_t now = time(0); + struct tm *ptmNow = localtime(&now); + + ptmNow->tm_year = date / 10000 - 1900; + ptmNow->tm_mon = date % 10000 / 100 - 1; + ptmNow->tm_mday = date % 100; + + now = mktime(ptmNow); + + now += day * 86400; + ptmNow = localtime(&now); + + return (ptmNow->tm_year + 1900) * 10000 + + (ptmNow->tm_mon + 1) * 100 + + ptmNow->tm_mday; +} + +void CLicense::GetDllPathByFunctionName(const char* szFunctionName, char* szPath) +{ + HMODULE hModule = nullptr; + GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, szFunctionName, &hModule); + + GetModuleFileNameA(hModule, szPath, MAX_PATH); +} + +void CLicense::SetLicensePath(const char* licPath) +{ + // 授权文件的路径是生成签名和验证都需要,所以最核心 + char szPath[_MAX_PATH] = { 0 }; + char drive[_MAX_DRIVE] = {0}; + char dir[_MAX_DIR] = { 0 }; + char fname[_MAX_FNAME] = { 0 }; + char ext[_MAX_EXT] = { 0 }; + _splitpath(licPath, drive, dir, fname, ext); + _makepath(m_LicensePath, drive, dir, fname, FILE_EXT_LIC); + _makepath(m_PublicKeyPath, drive, dir, fname, FILE_EXT_PUB); + _makepath(m_PrivateKeyPath, drive, dir, fname, FILE_EXT_PRIV); + _makepath(m_SignaturePath, drive, dir, fname, FILE_EXT_SIGN); +} + +void CLicense::SetPublicKeyString(const char* pubKey) +{ + strncpy(m_PublicKeyString, pubKey, sizeof(m_PublicKeyString)); +} + +void CLicense::SetSignatureString(const char* signature) +{ + strncpy(m_SignatureString, signature, sizeof(m_SignatureString)); +} + +bool CLicense::IsTrial() +{ + return (m_Trial == 0 || strlen(m_PublicKeyString) <= 0); +} + +bool CLicense::HasSignature() +{ + return (strlen(m_SignatureString) > 0); +} + +bool CLicense::HasSaved() +{ + return m_bHasSaved; +} + +void CLicense::SetSendOrderFlag(bool flag) +{ + m_bSendOrderFlag = flag; +} + +bool CLicense::GetSendOrderFlag() +{ + return m_bSendOrderFlag; +} + +int CLicense::LoadIni() +{ + m_bLoaded = iniFileLoad(m_LicensePath); + + // 无所谓是否加载成功,反正有默认 + m_ExpireDate = iniGetInt(APP_NAME_LICENSE, KEY_NAME_EXPIRE_DATE, -1); + m_Trial = iniGetInt(APP_NAME_LICENSE, KEY_NAME_TRIAL, 5); + + iniGetString(APP_NAME_USER, KEY_NAME_ACCOUNT, m_Account, sizeof(m_Account), ""); + iniGetString(APP_NAME_USER, KEY_NAME_USERNAME, m_UserName, sizeof(m_UserName), ""); + iniGetString(APP_NAME_LICENSE, KEY_NAME_MAC, m_MAC, sizeof(m_MAC), ""); + + iniFileFree(); + + if (m_bLoaded != 0) + return 0; + + sprintf(m_ErrorInfo, ERROR_CODE_1, m_RealMAC); + m_ErrorCode = 1; + return m_ErrorCode; +} + +void CLicense::AddUser(const char* account, const char* name) +{ + m_UserMap[string(account)] = string(name); +} + +int CLicense::SaveIni() +{ + iniFileLoad(m_LicensePath); + + int bRet = iniSetInt(APP_NAME_LICENSE, KEY_NAME_EXPIRE_DATE, m_ExpireDate, Today(7)); + iniSetInt(APP_NAME_LICENSE, KEY_NAME_TRIAL, m_Trial, 5); + iniSetString(APP_NAME_LICENSE, KEY_NAME_MAC, m_MAC); + + iniSetString(APP_NAME_USER, KEY_NAME_ACCOUNT, m_Account); + iniSetString(APP_NAME_USER, KEY_NAME_USERNAME, m_UserName); + + char szInfo[2048] = { 0 }; + strcat(szInfo, m_RealMAC); + strcat(szInfo, ":"); + for (map::iterator it = m_UserMap.begin(); it != m_UserMap.end(); ++it) + { + strcat(szInfo, it->first.c_str()); + strcat(szInfo, "|"); + strcat(szInfo, it->second.c_str()); + strcat(szInfo, "|"); + } + iniSetString(APP_NAME_USER, KEY_NAME_INFO, szInfo); + iniFileFree(); + + if (bRet != 0) + { + m_bHasSaved = true; + return 0; + } + + sprintf(m_ErrorInfo, ERROR_CODE_11, m_Trial, m_RealMAC); + m_ErrorCode = 11; + return m_ErrorCode; +} + + +void CLicense::CreateDefault() +{ + m_Trial = 5; // 默认5次 + m_ExpireDate = Today(7); // 7天 + m_UserMap.clear(); + m_nCurrentTrial = 0; + + strncpy(m_Account, ".*", sizeof(m_Account)); + strncpy(m_UserName, "", sizeof(m_UserName)); + strncpy(m_MAC, ".*", sizeof(m_MAC)); +} + +int CLicense::GetErrorCodeForSign() +{ + // 认证通过 + m_ErrorCode = 0; + + do + { + // 由于在前面已经有GetErrorCodeForSign()做了签名信息是否存在的检查 + if (!HasSignature()) + { + // 所以这里是以最小授权进行通过 + // 只有试用次数可以检查了 + m_Trial = min(m_Trial, 5); + // 由于在这之前就已经检查过了过期时间了,所以这地方没有必要 + //m_ExpireDate = min(m_ExpireDate, Today(7)); + + m_ErrorCode = 12; + sprintf_s(m_ErrorInfo, ERROR_CODE_12, m_Trial, m_RealMAC); + + break; + } + + string s = LoadStringFromFile(m_LicensePath); + + if (Verify(s.c_str(), m_PublicKeyString, m_SignatureString)) + { + + } + else + { + m_ErrorCode = -2; + strcpy(m_ErrorInfo, ERROR_CODE_2); + break; + } + + } while (false); + + return m_ErrorCode; +} + +int CLicense::GetErrorCodeForMachineID() +{ + // 认证通过 + m_ErrorCode = 0; + + do + { + if (strlen(m_MAC) <= 0) + { + break; + } + // 检查机器码 + regex pattern(m_MAC); + if (!regex_search(m_RealMAC, pattern)) + { + strcpy(m_ErrorInfo, ERROR_CODE_5); + m_ErrorCode = -5; + break; + } + + } while (false); + + return m_ErrorCode; +} + +int CLicense::GetErrorCodeForExpireDate() +{ + // 认证通过 + m_ErrorCode = 0; + + do + { + // 是否过期了 + if (m_ExpireDate < Today(0)) + { + m_ErrorCode = -3; + sprintf(m_ErrorInfo, ERROR_CODE_3, m_ExpireDate); + break; + } + + // 看授权时间是否合要求 + int metion = Date(m_ExpireDate, -15); + if (metion <= Today(0)) + { + m_ErrorCode = 13; + sprintf_s(m_ErrorInfo, ERROR_CODE_13, m_ExpireDate, metion); + break; + } + } while (false); + + return m_ErrorCode; +} + +int CLicense::GetErrorCodeByAccount(const char* account) +{ + // 认证通过 + m_ErrorCode = 0; + + do + { + if (strlen(m_Account) <= 0) + { + break; + } + regex pattern(m_Account); + if (!regex_search(account, pattern)) + { + m_ErrorCode = -4; + sprintf(m_ErrorInfo, ERROR_CODE_4, account); + break; + } + + } while (false); + + return m_ErrorCode; +} + +int CLicense::GetErrorCodeByNameThenAccount(const char* name, const char* account) +{ + // 认证通过 + m_ErrorCode = 0; + + do + { + // 汉字使用正则太复杂,还是改用查找 + if (strlen(m_UserName) <= 0) + { + break; + } + if (nullptr == strstr(m_UserName, name)) + { + m_ErrorCode = -9; + sprintf(m_ErrorInfo, ERROR_CODE_9, name); + break; + } + } while (false); + + return m_ErrorCode; +} + +int CLicense::GetErrorCodeForSendOrder() +{ + do + { + if (!m_bSendOrderFlag) + { + sprintf(m_ErrorInfo, ERROR_CODE_14); + m_ErrorCode = -14; + break; + } + + // 检查次数 + if (m_Trial > 0) + { + if (m_nCurrentTrial >= m_Trial) + { + sprintf(m_ErrorInfo, ERROR_CODE_6, m_Trial); + m_ErrorCode = -6; + break; + } + } + + // 认证通过就加1 + ++m_nCurrentTrial; + + // 认证通过 + m_ErrorCode = 0; + } while (false); + + return m_ErrorCode; +} + +const char* CLicense::GetErrorInfo() +{ + if (m_ErrorCode == 0) + return nullptr; + return m_ErrorInfo; +} + +string CLicense::LoadStringFromFile(const char *filename) +{ + try + { + string result; + FileSource(filename, true, new StringSink(result)); + return result; + } + catch (...) + { + return ""; + } +} + +void CLicense::Sign(const char* message) +{ + if (strlen(message) <= 0) + { + return; + } + if (strlen(m_PrivateKeyPath) <= 0) + { + return; + } + RSASignFileStringFile(m_PrivateKeyPath, message, m_SignaturePath); +} + +bool CLicense::Verify(const char* message, const char* pubKey, const char* signature) +{ + if (strlen(message) <= 0) + { + return false; + } + if (strlen(pubKey) <= 0) + { + return false; + } + + return RSAVerifyStringStringString(pubKey, message, signature); +} + +//------------------------ +// 定义全局的随机数池 +//------------------------ +RandomPool & GlobalRNG() +{ + static RandomPool randomPool; + return randomPool; +} + +void GenerateRSAKey(unsigned int keyLength, const char *privFilename, const char *pubFilename, const char *seed) +{ + RandomPool randPool; + randPool.IncorporateEntropy((byte *)seed, strlen(seed)); + + RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength); + HexEncoder privFile(new FileSink(privFilename)); + priv.DEREncode(privFile); + privFile.MessageEnd(); + + RSAES_OAEP_SHA_Encryptor pub(priv); + HexEncoder pubFile(new FileSink(pubFilename)); + pub.DEREncode(pubFile); + pubFile.MessageEnd(); +} + +string RSAEncryptString(const char *pubFilename, const char *seed, const char *message) +{ + FileSource pubFile(pubFilename, true, new HexDecoder); + RSAES_OAEP_SHA_Encryptor pub(pubFile); + + RandomPool randPool; + randPool.IncorporateEntropy((byte *)seed, strlen(seed)); + + string result; + StringSource(message, true, new PK_EncryptorFilter(randPool, pub, new HexEncoder(new StringSink(result)))); + return result; +} + +string RSADecryptString(const char *privFilename, const char *ciphertext) +{ + FileSource privFile(privFilename, true, new HexDecoder); + RSAES_OAEP_SHA_Decryptor priv(privFile); + + string result; + StringSource(ciphertext, true, new HexDecoder(new PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result)))); + return result; +} + +void RSASignFileStringFile(const char *privFilename, const char *messageFilename, const char *signatureFilename) +{ + FileSource privFile(privFilename, true, new HexDecoder); + RSASS::Signer priv(privFile); + StringSource f(messageFilename, true, new SignerFilter(GlobalRNG(), priv, new HexEncoder(new FileSink(signatureFilename)))); +} + +bool RSAVerifyStringStringString(const char *pubFilename, const char *messageFilename, const char *signatureFilename) +{ + StringSource pubFile(pubFilename, true, new HexDecoder); + RSASS::Verifier pub(pubFile); + + StringSource signatureFile(signatureFilename, true, new HexDecoder); + if (signatureFile.MaxRetrievable() != pub.SignatureLength()) + return false; + SecByteBlock signature(pub.SignatureLength()); + signatureFile.Get(signature, signature.size()); + + VerifierFilter *verifierFilter = new VerifierFilter(pub); + verifierFilter->Put(signature, pub.SignatureLength()); + StringSource f(messageFilename, true, verifierFilter); + + return verifierFilter->GetLastResult(); +} + +#endif diff --git a/common/License/License.h b/common/License/License.h new file mode 100644 index 0000000..9e6c093 --- /dev/null +++ b/common/License/License.h @@ -0,0 +1,172 @@ +#pragma once + +#ifdef ENABLE_LICENSE + +#include +#include +#include +#include +#include + +#include "randpool.h" +#include "rsa.h" +#include "hex.h" +#include "files.h" + +// 1 +#define ERROR_CODE_1 "没有读取到授权文件,将自动生成试用版授权到dll同目录下,机器码为[%s]" +#define ERROR_CODE_2 "授权认证失败" +#define ERROR_CODE_3 "授权过期,过期时间为[%d]" +#define ERROR_CODE_4 "没有[用户号:%s]的授权" +#define ERROR_CODE_5 "机器码验证失败" +#define ERROR_CODE_6 "试用超次数,限制[%d]次" +#define ERROR_CODE_7 "授权产品名不对应" +#define ERROR_CODE_8 "[用户号:%s]授权的[姓名:%s],现获得的为[%s],下单将被拒绝" +#define ERROR_CODE_9 "没有[姓名:%s]的授权" +#define ERROR_CODE_10 "授权范围太广时,到期时间不能过长" +#define ERROR_CODE_11 "写入授权文件失败,请检查是否有权限写入或以管理员方式再次启动。试用次数为[%d],机器码为[%s]" +#define ERROR_CODE_14 "授权失败,无法下单" +// 12 +#define ERROR_CODE_12 "未读取到签名信息,使用最小授权,试用次数为[%d],机器码为[%s]" +#define ERROR_CODE_13 "授权快要过期,请提前申请新的授权。过期时间为[%d],开始提醒日为[%d]" + +#define FILE_EXT_LIC "License" +#define FILE_EXT_PUB "PublicKey" +#define FILE_EXT_PRIV "PrivateKey" +#define FILE_EXT_SIGN "Signature" + +using namespace std; +using namespace CryptoPP; + +#ifdef _DEBUG +#pragma comment(lib, "../../lib/Debug/cryptlib.lib") +#else +#pragma comment(lib, "../../lib/Release/cryptlib.lib") +#endif // DEBUG + + + +void GenerateRSAKey(unsigned int keyLength, const char *privFilename, const char *pubFilename, const char *seed); +string RSAEncryptString(const char *pubFilename, const char *seed, const char *message); +string RSADecryptString(const char *privFilename, const char *ciphertext); +void RSASignFileStringFile(const char *privFilename, const char *messageFilename, const char *signatureFilename); +bool RSAVerifyStringStringString(const char *pubFilename, const char *messageFilename, const char *signatureFilename); + +RandomPool & GlobalRNG(); + +/* +功能说明: +1.没有证书文件时要重新生成,生成的要能直接通过临时认证 +2.有证书文件时,要判断是不是绑定了机器 +3.还有试用检查 +4.没有绑定的时间不能过长 + +应当检查一下,如果是试用版,就可以一直添加新用户和机器码,而正式用户就不可以了,这样就可以记录很多账户了 + +决定多加一些东西 +1.记录一些权限信息.License +2.记录公钥.PublicKey +3.记录签名文件.Signature + +4.记录私钥.PrivateKey + +如何防止用户自己生成公私钥后再签名 +1.公钥不容易改,建议添加到资源中 +2.授权文件可再加一次密后再来签名 + +授权检查的逻辑 +1.所有相关文件都没有,使用临时授权,生成临时授权文件,不生成签名 +2.有授权文件,但没有签名,临时授权与本地授权文件取最小 +3.有授权文件,但签名是错的,直接拒绝 +4.有授权文件,签名也是正确的,按授权文件来 +*/ +class CLicense +{ +public: + CLicense(); + ~CLicense(); + + // 通过导出函数得到当前dll的路径 + void GetDllPathByFunctionName(const char* szFunctionName, char* szPath); + // 设置证书路径,会同时再生成其它路径,这个函数会忽视后缀,生成自己的后缀 + void SetLicensePath(const char* licPath); + + + + int LoadIni(); + int SaveIni(); + + const char* GetErrorInfo(); + int GetErrorCodeForMachineID(); + int GetErrorCodeByAccount(const char* account); + int GetErrorCodeForSign(); + int GetErrorCodeForExpireDate(); + int GetErrorCodeByNameThenAccount(const char* name, const char* account); + int GetErrorCodeForSendOrder(); + + void SetSendOrderFlag(bool flag); + bool GetSendOrderFlag(); + + + int Today(int day); + int Date(int date, int day); + + void AddUser(const char* account, const char* name); + + void CreateDefault(); + + + // 只是简单的加载文件 + string LoadStringFromFile(const char *filename); + + // 对某个字符串进行签名,可以先对此字符串预处理 + void Sign(const char* message); + // 对某个字符串进行验证,可以先对此字符串预处理 + // 公钥可以保存在dll中,不便修改的模式,这样用户 + bool Verify(const char* message, const char* pubKey, const char* signature); + + + // 在进行GetErrorCode时,需要先设置公钥,这样好检查是否正确 + void SetPublicKeyString(const char* pubKey); + void SetSignatureString(const char* signature); + + bool IsTrial(); + bool HasSignature(); + bool HasSaved(); + +public: + char m_LicensePath[260]; + char m_PublicKeyPath[260]; + char m_PrivateKeyPath[260]; + char m_SignaturePath[260]; + + char m_PublicKeyString[1024]; + char m_SignatureString[1024]; + +private: + bool m_bHasSaved; + int m_ExpireDate; + int m_Trial; + int m_nCurrentTrial; + + char m_RealMAC[32]; + + char m_ErrorInfo[256]; + int m_ErrorCode; + + map m_UserMap; + //set m_MacSet; + char m_Account[1024]; + char m_UserName[1024]; + char m_MAC[1024]; + bool m_bLoaded; + + bool m_bHasStarAccount; + bool m_bHasStarUserName; + bool m_bHasStarMAC; + + bool m_bSendOrderFlag; +}; + +#endif + diff --git a/common/License/License.vcxproj b/common/License/License.vcxproj new file mode 100644 index 0000000..641e5a8 --- /dev/null +++ b/common/License/License.vcxproj @@ -0,0 +1,104 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {D3231052-575C-4D58-BA38-2C01B10BF205} + Win32Proj + License + 8.1 + + + + Application + true + v141_xp + MultiByte + + + Application + false + v140 + true + MultiByte + + + + + + + + + + + + + true + ../../include/cryptopp/;$(IncludePath) + D:\AppServ\www\www + + + false + ../../include/cryptopp/;$(IncludePath) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;ENABLE_LICENSE;%(PreprocessorDefinitions) + true + MultiThreadedDebugDLL + + + Console + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;ENABLE_LICENSE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/common/License/License.vcxproj.filters b/common/License/License.vcxproj.filters new file mode 100644 index 0000000..e89217a --- /dev/null +++ b/common/License/License.vcxproj.filters @@ -0,0 +1,48 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/common/License/LicenseMaker.cpp b/common/License/LicenseMaker.cpp new file mode 100644 index 0000000..031152c --- /dev/null +++ b/common/License/LicenseMaker.cpp @@ -0,0 +1,159 @@ +// License.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include +#include + +#include "License.h" + +// BOOLEAN与asn.h中的冲突,不得不将asn.h中的改了,希望有人帮忙解决这个问题 +#include + +// 文件选择信息 +CHAR strFile[MAX_PATH] = { 0 }; +CHAR strFileTitle[MAX_PATH] = { 0 }; + +CHAR strFilter[MAX_PATH] = "*.exe\0*.exe\0TdxW.exe\0TdxW.exe\0Tc.exe\0Tc.exe\0all\0*.*\0"; + +BOOL OpenFileDlg() +{ + OPENFILENAMEA ofn; + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.lpstrFile = strFile; + ofn.lpstrFile[0] = '\0'; + ofn.nMaxFile = sizeof(strFile); + ofn.lpstrFilter = strFilter; + ofn.nFilterIndex = 1; + ofn.lpstrFileTitle = strFileTitle; + ofn.lpstrFileTitle[0] = ('\0'); + ofn.nMaxFileTitle = sizeof(strFileTitle); + ofn.lpstrInitialDir = NULL; + ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; + + return GetOpenFileNameA(&ofn); +} + +void Select1() +{ + char priKey[128] = { 0 }; + char pubKey[128] = { 0 }; + char seed[1024] = { 0 }; + + char fname[64] = { 0 }; + + cout << "请输入文件名,不要带扩展名,系统将自动添加扩展名" << endl; + cin >> fname; + + // 生成 RSA 密钥对 + sprintf_s(priKey, "%s.PrivateKey", fname); // 生成的私钥文件 + sprintf_s(pubKey, "%s.PublicKey", fname); + strcpy(seed, "seed"); + GenerateRSAKey(1024, priKey, pubKey, seed); + + cout << "已经生成在当前目录下,您需要自己修改文件名" << endl; +} + +void Select2() +{ + cout << "选择授权文件:" << endl; + + CLicense license; + + memcpy(strFilter, "*.License\0*.License\0All\0*.*\0", sizeof(strFilter)); + if (OpenFileDlg()) + { + // 设置授权文件 + license.SetLicensePath(strFile); + + string s = license.LoadStringFromFile(strFile); + + // 签名 + license.Sign(s.c_str()); + } + + cout << "签名已经生成,请查看" << endl; +} + +int _tmain(int argc, _TCHAR* argv[]) +{ + //printf("START"); + //return 0; + + // 如果带参数,按参数进行操作 + if (argc == 5) + { + CLicense license; + string s; + + bool bOK1 = false; + bool bOK2 = false; + + int arg = 0; + /* Parse command line arguments. */ + while (++arg < argc) { + if (!strcmp(argv[arg], "--License") || + !strcmp(argv[arg], "--license")) { + license.SetLicensePath(argv[arg + 1]); + bOK1 = true; + } + else if (!strcmp(argv[arg], "--PrivateKey") || + !strcmp(argv[arg], "--privateKey")) { + strcpy(license.m_PrivateKeyPath, argv[arg + 1]); + s = license.LoadStringFromFile(license.m_LicensePath); + bOK2 = true; + } + else { + if (argc > 1) + printf("Invalid command line argument: %s\n", argv[arg]); + } + arg++; + } + + if (bOK1&&bOK2) + { + license.Sign(s.c_str()); + printf("OK"); + } + else + { + printf("NO"); + } + return 1; + } + + cout << "=====授权生成工具v1.0=====" << endl; +SELECT: + cout << "请选择:" << endl; + cout << " 1.生成公钥文件和私钥文件" << endl; // + cout << " 2.使用已有私钥签名文件" << endl;// + cout << " 0.退出" << endl; // + cout << endl; + + int select = _getch(); + cout << (char)select << endl; + switch (select - '0') + { + case 1: + Select1(); + goto SELECT; + break; + case 2: + Select2(); + goto SELECT; + break; + case 0: + break; + default: + goto SELECT; + break; + } + + + printf("按任意键关闭"); + getchar(); + + return 0; +} + diff --git a/common/License/README.md b/common/License/README.md new file mode 100644 index 0000000..0802cbe --- /dev/null +++ b/common/License/README.md @@ -0,0 +1,26 @@ +# License授权模块使用说明 + +## 项目目的 +此开源项目为了鼓励更多的开发人员参与到项目中,商业化部分功能或服务是一条可行的途径。 +如果要进行商业化开发,授权功能必不可少。开发人员自己开发授权模块要耗费不少时间,所以这里直接提供一个示例。
+开发人员只要在自己的代码中嵌入api和部分函数即可。 +同时我们还开源了授权网站的代码www,开发者可以自己部署在服务器上进行授权的分发。 + +## 原理与过程 +* 客户端:分发的授权文件、分发的签名文件、api中嵌入公钥。 + * api利用公钥检查明文与签名是否正确 + * 在签名正确的前提下,比较明文中的记录与当前交易环境是否匹配 +* 服务器:签名生成工具、私钥。 + * 调整好客户提交的授权并生成文件 + * 使用工具和私钥生成签名文件 + +## 编译 +AllCppProjects中将License项目启用,编译报randpool.h找不到。 +到include目录下解压cryptopp.zip到当前文件夹,lib目录下解压cryptlib_vs2015.zip到当前文件夹。 +再次编译可以生成License.exe,这就是由api开发人员使用的生成公私钥和签名的工具。 + + +## 在项目中使用 +在自己的项目中添加License.h和License.cpp等文件,参考CTP中的使用方法 +使用License.exe生成公私钥,将公钥复制到原代码中编译进去,私钥要自己好好保存。 +后期将利用它进行授权的生成。 diff --git a/QuantBox_XAPI_TEST/ReadMe.txt b/common/License/ReadMe.txt similarity index 80% rename from QuantBox_XAPI_TEST/ReadMe.txt rename to common/License/ReadMe.txt index f3d7fde..95da445 100644 --- a/QuantBox_XAPI_TEST/ReadMe.txt +++ b/common/License/ReadMe.txt @@ -1,27 +1,27 @@ ======================================================================== - CONSOLE APPLICATION : QuantBox_XAPI_TEST Project Overview + CONSOLE APPLICATION : License Project Overview ======================================================================== -AppWizard has created this QuantBox_XAPI_TEST application for you. +AppWizard has created this License application for you. This file contains a summary of what you will find in each of the files that -make up your QuantBox_XAPI_TEST application. +make up your License application. -QuantBox_XAPI_TEST.vcxproj +License.vcxproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and information about the platforms, configurations, and project features selected with the Application Wizard. -QuantBox_XAPI_TEST.vcxproj.filters +License.vcxproj.filters This is the filters file for VC++ projects generated using an Application Wizard. It contains information about the association between the files in your project and the filters. This association is used in the IDE to show grouping of files with similar extensions under a specific node (for e.g. ".cpp" files are associated with the "Source Files" filter). -QuantBox_XAPI_TEST.cpp +License.cpp This is the main application source file. ///////////////////////////////////////////////////////////////////////////// @@ -29,7 +29,7 @@ Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file - named QuantBox_XAPI_TEST.pch and a precompiled types file named StdAfx.obj. + named License.pch and a precompiled types file named StdAfx.obj. ///////////////////////////////////////////////////////////////////////////// Other notes: diff --git a/common/License/stdafx.cpp b/common/License/stdafx.cpp new file mode 100644 index 0000000..3ae5257 --- /dev/null +++ b/common/License/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// License.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/common/License/stdafx.h b/common/License/stdafx.h new file mode 100644 index 0000000..88d7581 --- /dev/null +++ b/common/License/stdafx.h @@ -0,0 +1,20 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include +#include + + + +// TODO: reference additional headers your program requires here +// BOOLEAN与asn.h中的冲突,不得不将asn.h中的改了,希望有人帮忙解决这个问题 +// 已经解决,移动到这就可以了 +#include +#include +#pragma comment(lib, "IPHLPAPI.lib") diff --git a/common/License/targetver.h b/common/License/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/common/License/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/common/www/CheckSignin.php b/common/www/CheckSignin.php new file mode 100644 index 0000000..abf0360 --- /dev/null +++ b/common/www/CheckSignin.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/common/www/ConvertCode.vbs b/common/www/ConvertCode.vbs new file mode 100644 index 0000000..60da1cc --- /dev/null +++ b/common/www/ConvertCode.vbs @@ -0,0 +1,113 @@ +'/*=========================================================== +' * Intro ҪתĶļ/ļϵļϼ +' * FileName ConvertCode.vbs +' * Author Florian +' * Version v1.0 +' * WEB http://www.cnblogs.com/fanzhidongyzby +' * Email fanzhidongyzby@163.com +' * LastModify 2014-06-11 00:39:58 +' *==========================================================*/ + +'------------------------------------------------- +'ñ룺Ĭ utf-8 --> gb2312 +'------------------------------------------------- + +SrcCode="utf-8" +DestCode="gb2312" + +'------------------------------------------------- +' +'------------------------------------------------- +' ʹWSH.EchoֱִлᵯҪͨcscript.exeִ + +Set fs = CreateObject("scripting.filesystemobject") +Set objArgs = WScript.Arguments +If objArgs.Count>0 Then + For I = 0 To objArgs.Count - 1 + FileUrl = objArgs(I) + Call ConvertDir(FileUrl) + Next +Else + 'MsgBox "ûļ/ļб룡" + WSH.Echo "NO" + wscript.quit +End If +'MsgBox "תɹ" +WSH.Echo "OK" + +'------------------------------------------------- +':ConvertDir +':Ŀ¼ڵļбת +'------------------------------------------------- + +Function ConvertDir(DirUrl) + If fs.FileExists(DirUrl) Then + Call ConvertFile(DirUrl) + Else + Call SearchDir(DirUrl) + End If +End Function + + +'------------------------------------------------- +':SearchDir +':ݹĿ¼ڵļбת +'------------------------------------------------- + +Function SearchDir(path) + Set folder = fs.getfolder(path) + Set subfolders = folder.subfolders + Set Files = folder.Files + For Each i In Files + Call ConvertFile(i.path) + Next + For Each j In subfolders + Call SearchDir(j.path) + Next +End Function + +'------------------------------------------------- +':ConvertFile +':һļбת +'------------------------------------------------- + +Function ConvertFile(FileUrl) + Call WriteToFile(FileUrl, ReadFile(FileUrl, SrcCode), DestCode) +End Function + +'------------------------------------------------- +':ReadFile +':AdoDb.Streamȡָʽıļ +'------------------------------------------------- + +Function ReadFile(FileUrl, CharSet) + Dim Str + Set stm = CreateObject("Adodb.Stream") + stm.Type = 2 + stm.mode = 3 + stm.charset = CharSet + stm.Open + stm.loadfromfile FileUrl + Str = stm.readtext + stm.Close + Set stm = Nothing + ReadFile = Str +End Function + +'------------------------------------------------- +':WriteToFile +':AdoDb.Streamдָʽıļ +'------------------------------------------------- + +Function WriteToFile (FileUrl, Str, CharSet) + Set stm = CreateObject("Adodb.Stream") + stm.Type = 2 + stm.mode = 3 + stm.charset = CharSet + stm.Open + stm.WriteText Str + stm.SaveToFile FileUrl, 2 + stm.flush + stm.Close + Set stm = Nothing +End Function \ No newline at end of file diff --git a/common/www/DirFileFun.php b/common/www/DirFileFun.php new file mode 100644 index 0000000..a2d5dac --- /dev/null +++ b/common/www/DirFileFun.php @@ -0,0 +1,69 @@ +$elem) { + $content .= "[".$key."]\n"; + foreach ($elem as $key2=>$elem2) { + if(is_array($elem2)) + { + for($i=0;$i$elem) { + if(is_array($elem)) + { + for($i=0;$i \ No newline at end of file diff --git a/common/www/EnumFun.php b/common/www/EnumFun.php new file mode 100644 index 0000000..fd1a1c8 --- /dev/null +++ b/common/www/EnumFun.php @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/common/www/Home.php b/common/www/Home.php new file mode 100644 index 0000000..567de65 --- /dev/null +++ b/common/www/Home.php @@ -0,0 +1,36 @@ + + + + +主页 + + +当前用户: 当前IP: 退出 关于我们 +
+

用户信息

+查看/修改个人信息,修改密码 +
+

产品信息

+查看产品列表,下载与本授权系统配套的DLL +
+

授权信息

+查看授权列表,添加授权 += 2) {?> +
+

审核管理

+审核用户 + + +
+

管理员专区

+审核用户 +查看审核人员列表 +注册用户 +切换用户ID + + + \ No newline at end of file diff --git a/common/www/JSON.php b/common/www/JSON.php new file mode 100644 index 0000000..e196fa5 --- /dev/null +++ b/common/www/JSON.php @@ -0,0 +1,48 @@ + 1000) { + die('possible deep recursion attack'); + } + foreach ($array as $key => $value) { + if (is_array($value)) { + arrayRecursive($array[$key], $function, $apply_to_keys_also); + } else { + $array[$key] = $function($value); + } + + if ($apply_to_keys_also && is_string($key)) { + $new_key = $function($key); + if ($new_key != $key) { + $array[$new_key] = $array[$key]; + unset($array[$key]); + } + } + } + $recursive_counter--; +} + +/************************************************************** + * + * 将数组转换为JSON字符串(兼容中文) + * @param array $array 要转换的数组 + * @return string 转换得到的json字符串 + * @access public + * + *************************************************************/ +function JSON($array) { + arrayRecursive($array, 'urlencode', true); + $json = json_encode($array); + return urldecode($json); +} +?> \ No newline at end of file diff --git a/common/www/Join.php b/common/www/Join.php new file mode 100644 index 0000000..8735dbe --- /dev/null +++ b/common/www/Join.php @@ -0,0 +1,67 @@ +16) +{ + $_SESSION['Error'] = '用户名长度不对'; + header("Location:".getenv("HTTP_REFERER")); + return; +} + +if($_POST['Password'] != $_POST['Password2']) +{ + $_SESSION['Error'] = '两次密码不同!'; + header("Location:".getenv("HTTP_REFERER")); + return; +} + +// 检查用户是否已经存在,因为在有些MDB2上报的错太不靠谱 +$query = 'SELECT * FROM UserInfo WHERE UserID = ' + .$mdb2->quote($_POST['UserID'],"text"); +//echo $query; +$result = $mdb2->query($query); + +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} + +$row = $result->fetchRow(); + +if(!empty($row)) +{ + $_SESSION['Error'] = '用户名已经存在'; + header("Location:".getenv("HTTP_REFERER")); + return; +} + +// 插入用户 +$query = + 'INSERT INTO UserInfo(UserID,Password,' + .'RegisterTime,IP) ' + .' VALUES(' + .$mdb2->quote($_POST['UserID'],"text").',' + .$mdb2->quote(md5($_POST['Password']),"text").',' + .'NOW(),' + .$mdb2->quote($_SERVER['REMOTE_ADDR'],"text").')'; +//echo $query; +$result = $mdb2->query($query); + +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} + +$_SESSION['Error'] = '注册成功,请用新账号登录!'; +header("Location:Signin.php"); +return; +?> \ No newline at end of file diff --git a/common/www/License.exe b/common/www/License.exe new file mode 100644 index 0000000..5924d59 Binary files /dev/null and b/common/www/License.exe differ diff --git a/common/www/LicenseInfoAction.php b/common/www/LicenseInfoAction.php new file mode 100644 index 0000000..b38b38f --- /dev/null +++ b/common/www/LicenseInfoAction.php @@ -0,0 +1,172 @@ +quote($_GET['ID'],"integer") + .' AND Status <4 '; + + // 只能删除自己的吗?管理员可以更新所有的 + if($_SESSION['Right'] <= 2) + { + $query = $query.' AND User1 = '.$mdb2->quote($_SESSION['UserID'],"text"); + } + + $result = $mdb2->query($query); + + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } + + header("Location:".getenv("HTTP_REFERER")); + return; + } +} + +if(get_magic_quotes_gpc()){ + function stripslashes_deep($value){ + $value=is_array($value)?array_map('stripslashes_deep',$value):stripslashes($value); + return $value; + } + $_POST=array_map('stripslashes_deep',$_POST); + $_GET=array_map('stripslashes_deep',$_GET); + $_COOKIE=array_map('stripslashes_deep',$_COOKIE); + $_REQUEST=array_map('stripslashes_deep',$_REQUEST); +} + +$sampleData = array( + 'License' => array( + 'ExpireDate' => $_POST['ExpireDate'], + 'Trial' => $_POST['Trial'], + 'MachineID' => $_POST['MachineID'], + 'Product' => $_POST['Product'], + ), + 'User' => array( + 'Account' => $_POST['Account'], + 'UserName' => $_POST['UserName'], + 'Info' => $_POST['Info'], + )); + +$content1 = json_encode($sampleData); + +// 接收各种提交,进行处理 + +// 1.用户新建一个授权 +// 2.用户编辑授权 +// 3.审核员审核左边 +// 4.审核员审核右边 + +if(isset($_POST['Create'])) +{ + $query = "SELECT COUNT(*) AS NUM_A FROM LicenceInfo WHERE " + ." User1 = ".$mdb2->quote($_SESSION['UserID'],"text") + ." AND Status <3 "; + //echo $query; + $result = $mdb2->query($query); + $row = $result->fetchRow(); + //print_r($row); + //echo $row[strtolower('NUM_A')]; + $count = 5; + if($row[strtolower('NUM_A')]>$count) + { + echo "非审核的授权超过 $count 个,请等部分批准后再新申请"; + return; + } + // 插入用户 + $query = 'INSERT INTO LicenceInfo(' + .'User1,Time1,Content1,' + .'Product,Status,Remark) ' + .' VALUES(' + .$mdb2->quote($_SESSION['UserID'],"text").',' + .'NOW(),' + .$mdb2->quote($content1,"text").',' + .$mdb2->quote($_POST['Product'],"text").',' + .$mdb2->quote("1","text").',' + .$mdb2->quote($_POST['Remark'],"text") + .')'; + + $result = $mdb2->query($query); + + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } + + header("Location:LicenseInfoListView.php"); + return; +} + +if(isset($_POST['Update'])) +{ + $query = 'UPDATE LicenceInfo SET ' + .' Time1 = NOW(),Content1 = ' + .$mdb2->quote($content1,"text") + .' , Remark = ' + .$mdb2->quote($_POST['Remark'],"text") + .' , Status = 1' + .' WHERE ID = ' + .$mdb2->quote($_GET['ID'],"integer"); + + // 只能更新自己的吗?管理员可以更新所有的 + if($_SESSION['Right'] <= 2) + { + $query = $query.' AND User1 = '.$mdb2->quote($_SESSION['UserID'],"text"); + } + + $result = $mdb2->query($query); + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } + + header("Location:".getenv("HTTP_REFERER")); + return; +} + +if(isset($_POST['Review_Left'])||isset($_POST['Review_Right'])) +{ + if(in_array($_POST['Product'],$_SESSION['Products'],true)) + { + + } + else + { + if($_SESSION['Right'] > 2) + { + } + else + { + echo "您没有权限审核此授权信息"; + return; + } + } + + $query = 'UPDATE LicenceInfo SET User2 = ' + .$mdb2->quote($_SESSION['UserID'],"text") + .' , Time2 = NOW(),Content2 = ' + .$mdb2->quote($content1,"text") + .' , Status = ' + .$mdb2->quote($_POST['Status'],"text") + .' , Remark = ' + .$mdb2->quote($_POST['Remark'],"text") + .' WHERE ID = ' + .$mdb2->quote($_GET['ID'],"integer") + .' AND Product = ' + .$mdb2->quote($_POST['Product'],"text") + ; + + $result = $mdb2->query($query); + + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } + + header("Location:".getenv("HTTP_REFERER")); + return; +} +?> \ No newline at end of file diff --git a/common/www/LicenseInfoAdd.php b/common/www/LicenseInfoAdd.php new file mode 100644 index 0000000..937f84c --- /dev/null +++ b/common/www/LicenseInfoAdd.php @@ -0,0 +1,57 @@ +quote($_SESSION['UserID'],"text") + ." AND Status <3 "; +//echo $query; +$result = $mdb2->query($query); +$row = $result->fetchRow(); +//print_r($row); +//echo $row[strtolower('NUM_A')]; +if($row[strtolower('NUM_A')]>$PendingLicenseCount) +{ + echo "未审核的授权超过 $PendingLicenseCount 个,请等部分批准后再新申请"; + return; +} + +$result = $mdb2->query( + 'SELECT * FROM ProductInfo '); +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} +?> + + + +申请授权 + + + +
+

注意:您的申请经过人工审核后才能通过,请准确填写。被打回来后重新填写将耽误双方的时间

+

Product: 产品ID

+

ExpireDate: "/>到期时间,格式:例如20160315

+

Trial: 单次会话下单次数,0表示无限制

+

MachineID: 机器码,如果没有绑定账号就必须绑定机器码,支持正则

+

Account: 登录时所用的客户号,支持正则

+

UserName: 接口登录后所能取到的客户真实姓名,不支持正则

+

Info: 额外信息,一般由审核员填写,会写入到授权文件中

+
+

上面的信息如果不会填写,那就把*.Licence中的文本直接粘贴到下面的备注即可,后面的事交审核人员处理

+

Remark: 备注,需告知审核员的消息

+ +
+ + + \ No newline at end of file diff --git a/common/www/LicenseInfoGenerate.php b/common/www/LicenseInfoGenerate.php new file mode 100644 index 0000000..4c9d6d8 --- /dev/null +++ b/common/www/LicenseInfoGenerate.php @@ -0,0 +1,155 @@ +query( + 'SELECT * FROM LicenceInfo WHERE ' + ." ID = " + .$mdb2->quote($_GET['ID'],"integer") + ); +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} +$row = $result->fetchRow(); + +$product = $row[strtolower('Product')]; + +if(in_array($product,$_SESSION['Products'],true)) +{ +} +else +{ + if($_SESSION['Right'] > 2) + { + } + else if($_SESSION['UserID'] == $row[strtolower('User1')]) + { + } + else + { + echo "您没有下载权限"; + return; + } +} + +if($row[strtolower('Status')]<3) +{ + header("Location:".getenv("HTTP_REFERER")); + return; +} + +$content2 = strval($row[strtolower('Content2')]); + +$path = "temp"; + +if(!file_exists($path)) +{ + mkdir($path); +} + +$result = $mdb2->query( + 'SELECT * FROM UserInfo ' + .' WHERE UserID = ' + .$mdb2->quote($_SESSION['UserID'],"text") + ); + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } +$row2 = $result->fetchRow(); + +if(!empty($row2[strtolower("SessionID")])) +{ + if(session_id() != $row2[strtolower("SessionID")]) + { + $path3 = $path."/".$row2[strtolower("SessionID")]; + my_del_dir($path3); + } +} + +$result = $mdb2->query( + 'UPDATE UserInfo SET SessionID = ' + .$mdb2->quote(session_id(),"text") + .' WHERE UserID = ' + .$mdb2->quote($_SESSION['UserID'],"text") + ); + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } + +$path = $path."/".session_id(); + +if(!file_exists($path)) +{ + mkdir($path); +} +$Product = $row[strtolower("Product")]; +$path1 = "$path/$Product.License"; +$path2 = "$path/$Product.Signature"; + +?> + + +授权生成 + + +"; + + $cmd = "cscript.exe $VbsPath \"$LicensePath\""; + $ret = exec($cmd); + //echo $ret; + if("OK" == $ret) + { + echo "编码转换成功
"; + } + else + { + echo "编码转换失败
"; + return; + } + + echo "下载License文件,请鼠标右键->链接另存为
"; + + $PrivateKeyPath = "$PrivateKeyDir\\$Product\\$Product.PrivateKey"; + + $cmd = "$ExePath --License \"$LicensePath\" --PrivateKey \"$PrivateKeyPath\" "; + $ret = exec($cmd); + // 判断是否执行成功 + if("OK" == $ret) + { + echo "生成签名文件成功
"; + echo "下载Signature文件,请鼠标右键->链接另存为
"; + + // 更新下载状态 + $result = $mdb2->query( + 'UPDATE LicenceInfo SET Status = 4' + .' WHERE ID = ' + .$mdb2->quote($_GET['ID'],"integer") + ); + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } + } + else + { + echo "生成签名文件失败
"; + } +} +else +{ + echo "生成License失败
"; +} + +?> +

请将License文件和Signature文件放到与dll同目录下

+

如果你拿到的授权文件为Xxx.License和Xxx.Signature,但dll名为Xxx_x86.dll,请将两个授权名改为Xxx_x86.License和Xxx_x86.Signature。 +因为有可能授权分发者对x86与x64使用相同的授权

+ + \ No newline at end of file diff --git a/common/www/LicenseInfoListView.php b/common/www/LicenseInfoListView.php new file mode 100644 index 0000000..2f013f2 --- /dev/null +++ b/common/www/LicenseInfoListView.php @@ -0,0 +1,70 @@ +query( + 'SELECT * FROM LicenceInfo WHERE User1 = ' + .$mdb2->quote($_SESSION['UserID'],"text") + ." ORDER BY ID DESC" + ); + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } +?> + + +授权信息列表 + + + +申请新授权 +
+ + + + + + + + + + + + + + fetchRow()) +{ + //$content1 = strval($row[strtolower('Content1')]); + //$content2 = strval($row[strtolower('Content2')]); + $product = $row[strtolower('Product')]; + $status = $row[strtolower('Status')]; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + if($status<4) + { + echo ""; + } + else + { + echo ""; + } + + echo ""; +} +?> +
ID申请人员申请时间审核人员审核时间产品状态备注详情删除
".$row[strtolower('ID')]."".$row[strtolower('User1')]."".$row[strtolower('Time1')]."".$row[strtolower('User2')]."".$row[strtolower('Time2')]."".$product."".EnumStatusToString($status)."".$row[strtolower('Remark')]."查看或下载删除
+ + + \ No newline at end of file diff --git a/common/www/LicenseInfoListView2.php b/common/www/LicenseInfoListView2.php new file mode 100644 index 0000000..9b849f1 --- /dev/null +++ b/common/www/LicenseInfoListView2.php @@ -0,0 +1,108 @@ +query( + 'SELECT * FROM ProductInfo '); +if (PEAR::isError($result2)) { + die("{'Error':'".$result2->getMessage()."'}"); +} + +$query = "SELECT * FROM LicenceInfo WHERE 1=1 "; +if(!empty($_POST['Product'])) +{ + $query = $query." AND Product = ".$mdb2->quote($_POST['Product'],"text"); +} +if(!empty($_POST['Status'])) +{ + $query = $query." AND Status = ".$mdb2->quote($_POST['Status'],"text"); +} +if(!empty($_POST['User1'])) +{ + $query = $query." AND User1 = ".$mdb2->quote($_POST['User1'],"text"); +} +if(!empty($_POST['User2'])) +{ + $query = $query." AND User2 = ".$mdb2->quote($_POST['User2'],"text"); +} +$query = $query." ORDER BY ID DESC"; + +$result = $mdb2->query($query); + +?> + + +授权信息列表 + + + +

您有以下产品的审核权限:

+
+

申请人员:审核人员: +产品: +状态:

+
+
+ + + + + + + + + + + + + + fetchRow()) +{ + if(in_array($product,$_SESSION['Products'],true)) + { + $product = $row[strtolower('Product')]; + $status = $row[strtolower('Status')]; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "";; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } +} +?> +
ID申请人员申请时间审核人员审核时间产品状态备注详情审核
".$row[strtolower('ID')]."".$row[strtolower('User1')]."".$row[strtolower('Time1')]."".$row[strtolower('User2')]."".$row[strtolower('Time2')]."".$product."".EnumStatusToString($status)."".$row[strtolower('Remark')]."查看或下载审核
+ + + \ No newline at end of file diff --git a/common/www/LicenseInfoListView99.php b/common/www/LicenseInfoListView99.php new file mode 100644 index 0000000..b135144 --- /dev/null +++ b/common/www/LicenseInfoListView99.php @@ -0,0 +1,123 @@ +query( + 'SELECT * FROM ProductInfo '); +if (PEAR::isError($result2)) { + die("{'Error':'".$result2->getMessage()."'}"); +} + +$query = "SELECT * FROM LicenceInfo WHERE 1=1 "; +if(!empty($_POST['Product'])) +{ + $query = $query." AND Product = ".$mdb2->quote($_POST['Product'],"text"); +} +if(!empty($_POST['Status'])) +{ + $query = $query." AND Status = ".$mdb2->quote($_POST['Status'],"text"); +} +if(!empty($_POST['User1'])) +{ + $query = $query." AND User1 = ".$mdb2->quote($_POST['User1'],"text"); +} +if(!empty($_POST['User2'])) +{ + $query = $query." AND User2 = ".$mdb2->quote($_POST['User2'],"text"); +} +// 如果是管理员,是可以看到所有的 +if($_SESSION['Right']<=1) +{ + $query = $query." AND User1 = ".$mdb2->quote($_SESSION['UserID'],"text"); +} +$query = $query." ORDER BY ID DESC"; + +// 如果是审核员是可以看到自己能审核的 + +$result = $mdb2->query($query); +?> + + +授权信息列表 + + + +

您有以下产品的审核权限:

+
+

申请人员:审核人员: +产品: +状态:

+
+
+ + + + + + + + + + + + + + + fetchRow()) +{ + //$content1 = strval($row[strtolower('Content1')]); + //$content2 = strval($row[strtolower('Content2')]); + $product = $row[strtolower('Product')]; + $status = $row[strtolower('Status')]; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "";; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + if($status<4) + { + echo ""; + } + else + { + echo ""; + } + + echo ""; +} +?> +
ID申请人员申请时间审核人员审核时间产品状态备注详情审核删除
".$row[strtolower('ID')]."".$row[strtolower('User1')]."".$row[strtolower('Time1')]."".$row[strtolower('User2')]."".$row[strtolower('Time2')]."".$product."".EnumStatusToString($status)."".$row[strtolower('Remark')]."查看或下载审核删除
+ + + \ No newline at end of file diff --git a/common/www/LicenseInfoReview.php b/common/www/LicenseInfoReview.php new file mode 100644 index 0000000..dce3ed9 --- /dev/null +++ b/common/www/LicenseInfoReview.php @@ -0,0 +1,169 @@ +query( + 'SELECT * FROM LicenceInfo WHERE ' + ." ID = " + .$mdb2->quote($_GET['ID'],"integer") + ); +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} +$row = $result->fetchRow(); + +$product = $row[strtolower('Product')]; + +$content1 = strval($row[strtolower('Content1')]); +$content2 = strval($row[strtolower('Content2')]); + +$json_content = json_decode($content1,true); +$json_content2 = json_decode($content2,true); + +if(!empty($content2)) + $json_content = $json_content2; +?> + + + +授权审核 + + + 2) + { + // 管理员是有权限审核的 + } + else + { + echo "您没有权限审核此授权信息"; + return; + } +} +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID产品
申请人员审核人员
申请时间审核时间
申请内容
审核内容
状态备注
+
+"; +echo date(DATE_RFC822,time()); +echo "
";*/ +// 注意时区问题 +$t = time()-strtotime($row[strtolower('Time2')]); + +$show1 = false; +$show2 = false; +$show3 = false; + +// 审核员可以再修改时间后重新审核 +// 考虑到用户可能买了一年的授权,但有可能用了一段时间后又想换绑定的账号 +// 所以一次发三个月授权,每次来这延期即可 +if( +($row[strtolower('Status')]>=3) // 审核通过的和已经下载的都可以改时间 +) +{ + $show2 = true; +} + +if( +($row[strtolower('Status')]<4) // 没有下载的可以直接审核 +||($row[strtolower('Status')]==4 && $t<$ReviewTimeLimit2) // 已经下载的一定时间内可以再审核 +||($_SESSION['Right']==99&& $t<$ReviewTimeLimit99) // 管理员一定时间内可以再审核 +) +{ + $show1 = true; + // 有一个显示了,另一个就不显示 + $show2 = false; +} + +if($show1) +{ +?> +
+

审核内容为空时,将取申请内容自动填写下表

+

Product:

+

ExpireDate: 到期时间,格式:20160315

+

Trial: 单次会话下单次数,0表示无限制

+

MachineID: 机器码,如果没有绑定账号就必须绑定机器码,支持正则

+

Account: 登录时所用的客户号,支持正则

+

UserName: 接口登录后所能取到的客户真实姓名,不支持正则

+

Info: 额外信息,一般由审核员填写,会写入到授权文件中

+
+

状态: 状态信息决定了是否审核完成,用户是否可下载,不要改错了

+

备注: 备注,需告知审核员或用户的消息

+ +
+
+ +
+

审核内容为空时,将取申请内容自动填写下表

+

Product:

+

ExpireDate: 到期时间,格式:20160315

+

Trial: 单次会话下单次数,0表示无限制

+

MachineID: 机器码,如果没有绑定账号就必须绑定机器码,支持正则

+

Account: 登录时所用的客户号,支持正则

+

UserName: 接口登录后所能取到的客户真实姓名,不支持正则

+

Info: 额外信息,一般由审核员填写,会写入到授权文件中

+
+

状态: 状态信息决定了是否审核完成,用户是否可下载,不要改错了

+

备注: 备注,需告知审核员或用户的消息

+ +
+ + + \ No newline at end of file diff --git a/common/www/LicenseInfoView.php b/common/www/LicenseInfoView.php new file mode 100644 index 0000000..8cf82b4 --- /dev/null +++ b/common/www/LicenseInfoView.php @@ -0,0 +1,114 @@ +query( + 'SELECT * FROM LicenceInfo WHERE ' + ." ID = " + .$mdb2->quote($_GET['ID'],"integer") + ); +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} +$row = $result->fetchRow(); + +$product = $row[strtolower('Product')]; + +if(in_array($product,$_SESSION['Products'],true)) +{ +} +else +{ + if($_SESSION['Right'] > 2) + { + } + else if($_SESSION['UserID'] == $row[strtolower('User1')]) + { + } + else + { + echo "您没有权限查看此授权信息"; + return; + } +} + +$content1 = strval($row[strtolower('Content1')]); +$content2 = strval($row[strtolower('Content2')]); + +$json_content1 = json_decode($content1,true); +$json_content2 = json_decode($content2,true); +?> + + +授权信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID产品
申请人员审核人员
申请时间审核时间
申请内容
审核内容
状态备注
+=3) +{ +?> +
+

下载

+

生成授权并下载"?>

+ +
+
+

在没有通过审核人员审核前,是可以再编辑的

+

Product:

+

ExpireDate: 到期时间,格式:例如20160315

+

Trial: 单次会话下单次数,0表示无限制

+

MachineID: 机器码,如果没有绑定账号就必须绑定机器码,支持正则

+

Account: 登录时所用的客户号,支持正则

+

UserName: 接口登录后所能取到的客户真实姓名,不支持正则

+

Info: 额外信息,一般由审核员填写,会写入到授权文件中

+
+

上面的信息如果不会填写,那就把*.Licence中的文本直接粘贴到下面的备注即可,后面的事交审核人员处理

+

备注: 备注,需告知审核员或用户的消息

+ +
+ + + + diff --git a/common/www/Logout.php b/common/www/Logout.php new file mode 100644 index 0000000..2f2a5aa --- /dev/null +++ b/common/www/Logout.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/common/www/ProductInfoListView.php b/common/www/ProductInfoListView.php new file mode 100644 index 0000000..4f258ab --- /dev/null +++ b/common/www/ProductInfoListView.php @@ -0,0 +1,39 @@ +query( + 'SELECT * FROM ProductInfo '); +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} +?> + + +产品信息列表 + + +

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

+
+ + + + + + + fetchRow()) +{ + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; +} +?> +
ID产品名介绍页
".$row[strtolower('ID')]."".$row[strtolower('Name')]."查看并下载
+ + + diff --git a/common/www/Session.php b/common/www/Session.php new file mode 100644 index 0000000..bfef3cd --- /dev/null +++ b/common/www/Session.php @@ -0,0 +1,117 @@ +quote($_SESSION['SWITCH_ID'],"text"); +} +else +{ + // 取账号信息 + $query = 'SELECT * FROM UserInfo WHERE UserID = ' + .$mdb2->quote($_POST['UserID'],"text"); +} + +//echo $query; +$result = $mdb2->query($query); + +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} + +$row = $result->fetchRow(); + +if(empty($row)) +{ + $_SESSION['Error'] = '账号不存在,请检查账号是否填错'; + header("Location:".getenv("HTTP_REFERER")); + return; +} + +if(@$_SESSION['SWITCH']==true) +{ + // 切换账号,不检查密码 +} +else +{ + if(md5($_POST['Password']) != $row[strtolower('Password')]) + { + $_SESSION['Error'] = '密码错误,请检查账号或密码是否填错'; + header("Location:".getenv("HTTP_REFERER")); + return; + } +} + +unset($_SESSION['SWITCH']); +unset($_SESSION['SWITCH_ID']); + +$_SESSION['LOGINED'] = true; +$_SESSION['UserID'] = $row[strtolower('UserID')]; +$_SESSION['ID'] = $row[strtolower('ID')]; +$_SESSION['Password'] = $row[strtolower('Password')]; +$_SESSION['Right'] = $row[strtolower('Right')]; + +// 查找是否有审核权限 +$query = 'SELECT * FROM Product_User2 WHERE User2 = ' + .$mdb2->quote($_SESSION['UserID'],"text"); +//echo $query; +$result = $mdb2->query($query); + +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} + +$Products = array(); +while($row = $result->fetchRow()) +{ + array_push($Products,$row[strtolower('Product')]); +} +$_SESSION['Products'] = $Products; + +// 可以判断一下,只让本机登录的为管理员 +/*if($_SESSION['Right'] == 99) +{ + // 居然有IPv6的问题 + $admin_ips = array('127.0.0.1','::1',''); + if(in_array($_SERVER['REMOTE_ADDR'],$admin_ips,true)) + { + } + else + { + // 降级为审核员 + $_SESSION['Right'] = 2; + } +}*/ + +if($_SESSION['Right'] == 99) +{ + // 通过特殊页面登录成功的管理员才有管理员权限 + //echo (int)$_POST['Token']; + //echo (int)$admin_token; + //return; + // 这个功能与某个管理员登录的php有关联,要改的话得同时改 + if(@$_SESSION['TRY_ADMIN'] == true) + { + } + else + { + // 降级为审核员 + $_SESSION['Right'] = 2; + } +} + +// 会话有效期1小时 +$lifeTime = 3600; +setcookie(session_name(), session_id(), time() + $lifeTime, "/"); + +header("Location: $Homepage"); +return; +?> \ No newline at end of file diff --git a/common/www/Signin.php b/common/www/Signin.php new file mode 100644 index 0000000..4858562 --- /dev/null +++ b/common/www/Signin.php @@ -0,0 +1,26 @@ + + + +登录 + + +
+ +

用户名:

+

密码:

+

+
+注册"; +} +?> + + + \ No newline at end of file diff --git a/common/www/Signin_admin.php b/common/www/Signin_admin.php new file mode 100644 index 0000000..6ecb7cc --- /dev/null +++ b/common/www/Signin_admin.php @@ -0,0 +1,30 @@ + + + +管理员登录 + + +
+ +

用户名:

+

密码:

+

+
+注册"; +} +?> + + + \ No newline at end of file diff --git a/common/www/Signup.php b/common/www/Signup.php new file mode 100644 index 0000000..b145fec --- /dev/null +++ b/common/www/Signup.php @@ -0,0 +1,31 @@ + + + + +注册 + + + + + +
+ +

用户名

+

密码

+

密码2再次输入密码

+

+
+ + \ No newline at end of file diff --git a/common/www/SwitchUserID.php b/common/www/SwitchUserID.php new file mode 100644 index 0000000..6c05ca7 --- /dev/null +++ b/common/www/SwitchUserID.php @@ -0,0 +1,34 @@ + + + + + +主页 + + + +
+

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

+

UserID

+
+ + + \ No newline at end of file diff --git a/common/www/User2ListView.php b/common/www/User2ListView.php new file mode 100644 index 0000000..e8ae056 --- /dev/null +++ b/common/www/User2ListView.php @@ -0,0 +1,43 @@ +query( + 'SELECT * FROM Product_User2 ORDER BY Product'); +if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); +} +?> + + + + +审核人员列表 + + + +

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

+

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

+ + + + + + + fetchRow()) +{ + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; +} +?> +
IDProductUser2
".$row[strtolower('ID')]."".$row[strtolower('Product')]."".$row[strtolower('User2')]."
+ + + \ No newline at end of file diff --git a/common/www/UserInfoAction.php b/common/www/UserInfoAction.php new file mode 100644 index 0000000..992c181 --- /dev/null +++ b/common/www/UserInfoAction.php @@ -0,0 +1,66 @@ +query( + 'UPDATE UserInfo SET Name = ' + .$mdb2->quote($_POST['Name'],"text") + .' , Phone = ' + .$mdb2->quote($_POST['Phone'],"text") + .' , Email = ' + .$mdb2->quote($_POST['Email'],"text") + .' , IM = ' + .$mdb2->quote($_POST['IM'],"text") + .' , Remark = ' + .$mdb2->quote($_POST['Remark'],"text") + .' WHERE ID = ' + .$mdb2->quote($_SESSION['ID'],"integer") + ); + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } + + header("Location:".getenv("HTTP_REFERER")); + return; +} + +if(isset($_POST['ModifyPassword'])) +{ + if($_SESSION['Password'] != md5($_POST['OldPassword'])) + { + $_SESSION['Error'] = '原密错误'; + header("Location:".getenv("HTTP_REFERER")); + return; + } + + if($_POST['NewPassword'] != $_POST['NewPassword2']) + { + $_SESSION['Error'] = '两次密码不相同'; + header("Location:".getenv("HTTP_REFERER")); + return; + } + + if($_SESSION['Password'] == $_POST['NewPassword']) + { + $_SESSION['Error'] = '新密码与原密码相同'; + header("Location:".getenv("HTTP_REFERER")); + return; + } + + $result = $mdb2->query( + 'UPDATE UserInfo SET Password = ' + .$mdb2->quote(md5($_POST['NewPassword']),"text") + .' WHERE ID = ' + .$mdb2->quote($_SESSION['ID'],"integer") + ); + if (PEAR::isError($result)) { + die("{'Error':'".$result->getMessage()."'}"); + } + + header("Location:Logout.php"); + return; +} +?> \ No newline at end of file diff --git a/common/www/UserInfoView.php b/common/www/UserInfoView.php new file mode 100644 index 0000000..2bcec76 --- /dev/null +++ b/common/www/UserInfoView.php @@ -0,0 +1,50 @@ +quote($_SESSION['UserID'],"text"); +$result = $mdb2->query($query); + +$row = $result->fetchRow(); +// 不显示密码 +unset($row[strtolower('Password')]); +?> + + + +个人信息 + + +个人信息
";
+print_r($row);
+echo "
"; +?> +
+
+

修改个人信息

+

以下是用来完善个人信息使用,如已经通过审核可不用修改。请认真填写信息。

+

Name: 真实姓名

+

Phone: 电话,手机号或固定电话都可以

+

Email: 电子邮箱地址

+

QQ: 即时聊天工具,如QQ\微信等

+

Remark: 备注信息,请填写公司、职务等信息

+ +
+
+
+

修改密码

+

修改成功后将不提示,直接跳转到重新登录界面

+ +

原始密码:

+

新密码:

+

确认密码:

+ + +
+ + + \ No newline at end of file diff --git a/common/www/aboutus.php b/common/www/aboutus.php new file mode 100644 index 0000000..34a63c1 --- /dev/null +++ b/common/www/aboutus.php @@ -0,0 +1,12 @@ + + + + +关于 + + +联系我们
+QQ:
+Email:
+ + \ No newline at end of file diff --git a/common/www/config.php b/common/www/config.php new file mode 100644 index 0000000..0c571dd --- /dev/null +++ b/common/www/config.php @@ -0,0 +1,48 @@ +getMessage()."'}"); +} +$mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC); +$mdb2->exec("SET NAMES 'utf8'"); + +//================================================= + + +// 这两个参数用于生成授权使用,需要检查授权是否可用 +$ExePath = "D:\AppServ\www\License.exe"; +$VbsPath = "D:\AppServ\www\ConvertCode.vbs"; +//密钥目录一定不能在网页目录下,不然就被人下载 +$PrivateKeyDir = "D:\AppServ\keys"; + +// 是否开放公众注册 +$OpenSignup = true; + +// 未处理的授权条目上限 +$PendingLicenseCount = 5; + +// 首页,如果改动了首页文件,此处也可能需要改变 +// 目前在Session.php和SwitchUserID.php中出现 +$Homepage = "Home.php"; + +?> \ No newline at end of file diff --git a/common/www/products/CTP_Trade_x86/index.html b/common/www/products/CTP_Trade_x86/index.html new file mode 100644 index 0000000..e4de975 --- /dev/null +++ b/common/www/products/CTP_Trade_x86/index.html @@ -0,0 +1,15 @@ + + + + +介绍 + + +

软件介绍:

+

软件下载:

+

软件安装:

+

售前咨询人员:

+

售后支持服务:

+

价格:

+ + \ No newline at end of file diff --git a/common/www/products/TdxApi/TdxApi.dll b/common/www/products/TdxApi/TdxApi.dll new file mode 100644 index 0000000..3c8d3d2 Binary files /dev/null and b/common/www/products/TdxApi/TdxApi.dll differ diff --git a/common/www/products/TdxApi/index.html b/common/www/products/TdxApi/index.html new file mode 100644 index 0000000..7ce92c8 --- /dev/null +++ b/common/www/products/TdxApi/index.html @@ -0,0 +1,16 @@ + + + + +介绍 + + +

软件介绍:

+

更新日期:20160128

+

软件下载:下载

+

软件安装:

+

售前咨询人员:

+

售后支持服务:

+

价格:

+ + \ No newline at end of file diff --git "a/common/www/\345\256\211\350\243\205\346\226\271\346\263\225.txt" "b/common/www/\345\256\211\350\243\205\346\226\271\346\263\225.txt" new file mode 100644 index 0000000..4157a91 --- /dev/null +++ "b/common/www/\345\256\211\350\243\205\346\226\271\346\263\225.txt" @@ -0,0 +1,14 @@ +1.װpear, php go-pear.php +2.װpear install MDB2 +3.װpear install MDB2#mysql +4.Ŀҳ +5.keysĿ굽ҳĿ¼¡ע⣬Ŀ¼ʣΪĿ¼˽Կ +6.עkeysеĿ¼ݿIJƷ +7.޸config.phpеȨkeyĿ¼License.exe·ǩ +8.޸config.phpеݿϢ +9.עһûadminȻݿUserInfoûRightij9999ΪԱ +10.ProductInfoһProductUrlProduct=CTP_Trader_86Url=/products/TdxApi/index.html +11.עһûxyzRightij22ΪԱ,ȻProduct_User2һProduct=CTP_Trader_86,User2=xyz,ԱCTP_Trader_86Ȩ +12.һȨļĹǷܳɹأغļǷʹá +ΪҳȫUTF-8룬ȨļASCII룬õһvbsUTF-8תASCIIҪú +13.Signin_admin.phpǹԱ¼ҳ棬Աֻͨ¼ǹԱļһҪڸ֪ diff --git "a/common/www/\345\274\200\345\217\221\350\256\241\345\210\222.txt" "b/common/www/\345\274\200\345\217\221\350\256\241\345\210\222.txt" new file mode 100644 index 0000000..6dd6a40 --- /dev/null +++ "b/common/www/\345\274\200\345\217\221\350\256\241\345\210\222.txt" @@ -0,0 +1,5 @@ +һ׶: +1.ûύȨϢ +2.˹༭ +3.ṩ +4.ṩ֧ܣûԱЭ \ No newline at end of file diff --git "a/common/www/\350\241\250\347\273\223\346\236\204.txt" "b/common/www/\350\241\250\347\273\223\346\236\204.txt" new file mode 100644 index 0000000..efa9fe7 --- /dev/null +++ "b/common/www/\350\241\250\347\273\223\346\236\204.txt" @@ -0,0 +1,85 @@ +-- phpMyAdmin SQL Dump +-- version 2.10.3 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: Jan 22, 2016 at 09:55 AM +-- Server version: 5.0.51 +-- PHP Version: 5.2.6 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + +-- +-- Database: `test` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `licenceinfo` +-- + +CREATE TABLE `LicenceInfo` ( + `ID` int(10) unsigned NOT NULL auto_increment, + `User1` varchar(20) NOT NULL, + `Time1` datetime NOT NULL, + `Content1` varchar(1024) NOT NULL, + `User2` varchar(20) default NULL, + `Time2` datetime default NULL, + `Content2` varchar(1024) default NULL, + `Product` varchar(64) NOT NULL, + `Status` varchar(32) NOT NULL, + `Remark` varchar(256) default NULL, + PRIMARY KEY (`ID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='ȨϢ'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `productinfo` +-- + +CREATE TABLE `ProductInfo` ( + `ID` int(11) NOT NULL auto_increment, + `Name` varchar(20) NOT NULL, + `Url` varchar(260) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE KEY `Name` (`Name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='ƷϢ'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `product_user2` +-- + +CREATE TABLE `Product_User2` ( + `ID` int(11) NOT NULL auto_increment, + `Product` varchar(64) NOT NULL, + `User2` varchar(20) NOT NULL, + PRIMARY KEY (`ID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Ȩϵ'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `userinfo` +-- + +CREATE TABLE `UserInfo` ( + `ID` int(10) unsigned NOT NULL auto_increment, + `UserID` varchar(20) NOT NULL, + `Password` varchar(40) NOT NULL, + `Name` varchar(16) NOT NULL, + `Phone` varchar(16) default NULL, + `Email` varchar(40) default NULL, + `IM` varchar(64) default NULL, + `RegisterTime` datetime NOT NULL, + `IP` varchar(40) NOT NULL, + `Status` varchar(20) NOT NULL, + `Right` tinyint(4) NOT NULL, + `SessionID` varchar(40) default NULL, + `Remark` varchar(1024) default NULL, + PRIMARY KEY (`ID`), + UNIQUE KEY `UserID` (`UserID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='ûϢ'; diff --git a/conf.sh b/conf.sh new file mode 100755 index 0000000..53d1476 --- /dev/null +++ b/conf.sh @@ -0,0 +1,2 @@ +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/Workspaces/XAPI2/common/Queue:~/Workspaces/XAPI2/apis/CTP:~/Workspaces/XAPI2/include/CTP/linux64 +export MALLOC_CHECK_=0 diff --git a/csharp/QuantBox.XAPI/Interface/IXApi.cs b/csharp/QuantBox.XAPI/Interface/IXApi.cs deleted file mode 100644 index 207bfe8..0000000 --- a/csharp/QuantBox.XAPI/Interface/IXApi.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; - - -namespace QuantBox.XAPI.Interface -{ - public interface IXApi - { - DelegateOnConnectionStatus OnConnectionStatus { get; set; } - DelegateOnRtnError OnRtnError { get; set; } - DelegateOnLog OnLog { get; set; } - - - void Connect(); - void Disconnect(); - - void ReqQuery(QueryType type, ref ReqQueryField query); - - ApiType GetApiType { get;} - string GetApiName { get;} - string GetApiVersion { get;} - } - - public interface IXMarketData - { - DelegateOnRtnDepthMarketData OnRtnDepthMarketData{ get; set; } - void Subscribe(string szInstrument, string szExchange); - void Unsubscribe(string szInstrument, string szExchange); - } - - public interface IXInstrument - { - DelegateOnRspQryInstrument OnRspQryInstrument { get; set; } - } - - public interface IXQuery - { - DelegateOnRspQryTradingAccount OnRspQryTradingAccount { get; set; } - DelegateOnRspQryInvestorPosition OnRspQryInvestorPosition { get; set; } - DelegateOnRspQrySettlementInfo OnRspQrySettlementInfo { get; set; } - - DelegateOnRspQryOrder OnRspQryOrder { get; set; } - DelegateOnRspQryTrade OnRspQryTrade { get; set; } - DelegateOnRspQryQuote OnRspQryQuote { get; set; } - } - - public interface IXTrade - { - DelegateOnRtnOrder OnRtnOrder { get; set; } - DelegateOnRtnTrade OnRtnTrade { get; set; } - DelegateOnRtnQuote OnRtnQuote { get; set; } - - - void SendOrder(ref OrderField[] orders, out string[] OrderRefs); - void CancelOrder(string[] szId,out string[] errs); - void SendQuote(ref QuoteField quote,out string AskRef,out string BidRef); - void CancelQuote(string szId,out string err); - } - - public interface IXHistoricalData - { - DelegateOnRspQryHistoricalTicks OnRspQryHistoricalTicks { get; set; } - DelegateOnRspQryHistoricalBars OnRspQryHistoricalBars { get; set; } - - //int ReqQryHistoricalTicks(ref HistoricalDataRequestField request); - //int ReqQryHistoricalBars(ref HistoricalDataRequestField request); - } -} diff --git a/csharp/QuantBox.XAPI/QuantBox.XAPI_Linux.csproj b/csharp/QuantBox.XAPI/QuantBox.XAPI_Linux.csproj deleted file mode 100644 index 48f1af2..0000000 --- a/csharp/QuantBox.XAPI/QuantBox.XAPI_Linux.csproj +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Debug - AnyCPU - {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB} - Exe - Properties - QuantBox.XAPI - QuantBox.XAPI - v4.5 - 512 - - - true - full - false - ..\bin\Debug - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - ..\..\packages\NLog.3.2.1\lib\net45\NLog.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/design.md b/design.md new file mode 100644 index 0000000..17c4343 --- /dev/null +++ b/design.md @@ -0,0 +1,96 @@ +# XAPI2设计文档 + +## 支持的API +目前想支持的: +* CTP 期货交易 +* CTPZQ +* LTS 股票交易 +* Femas 期货交易 +* Kingstar +* KingstarGold 上海黄金交易所的接口 +* SPTrader 想干的经纪公司基本都用这个 + +以后再说的: +* XSpeed +* XSpeed_Stock + + +## 设计中需要解决的问题 + +####1. 在`ApiStruct.h`中的结构体的命名 + +在[`ApiStruct.h`](https://github.com/QuantBox/XAPI2/blob/master/include/ApiStruct.h)中很多结构体的名称以Field结尾,比如`PositionField`。但是在C++中,结构体中的元素才叫做field,结构体名称不叫Field。 + +建议修改:把结构体的名称中的Field后缀去掉,比如`PositionField`更名为`Position`。这样从C++的概念上才正确,其次代码因为结构体的名称变短会更易读。 + +####2. [CXApi类](https://github.com/QuantBox/XAPI2/blob/master/include/XApiCpp.h)中的回调函数中的int size1参数 +在这些回调函数中,有个参数`int size1`,似乎和业务不相关。 + +解决方案:(来自伍侃)回调函数的参数风格按照CTP回调函数的风格来修改:在回调函数中,参数为先是数据相关的,然后是一个错误,然后是一个`isLast`。 + +####3. 枚举类型`ExchangeType` +在[`ApiEnum.h`](https://github.com/QuantBox/XAPI2/blob/master/include/ApiEnum.h)中定义了`ExchangeType`枚举类型。但是在[CXApiCpp.h](https://github.com/QuantBox/XAPI2/blob/master/include/XApiCpp.h)中,有些地方使用的是`ExchangeType`,比如回调函数`OnFilterSubscribe`。但是有些地方使用的是以字符串指定的交易所,比如函数`Subscribe`,`Unsubscribe`,`ReqQryInstrument`和`ReqQryInvestorPosition`。从减少混淆的角度出发,应该统一使用`ExchangeType`来引用交易所。 + +建议修改:所有需要交易所的地方都使用ExchangeType。 + +####4. 结构体DepthMarketDataNField的名称 +在[`ApiStruct.h`](https://github.com/QuantBox/XAPI2/blob/master/include/ApiStruct.h)中定义了结构体`DepthMarketDataNField`。在XAPI2中并没有找到`DepthMarketDataField`,是否可以把其中的N去掉,并且去掉Field后缀(见问题1)。 + +建议修改:把`DepthMarketNDataField`重命名为`DepthMarketData`。 + +####5. 是否需要增加一个OnRspQryOrder的回调函数 +现在有一个OnRtnOrder,是否需要增加一个OnRspQryOrder? +问题:OnRspQryOrder是响应哪个request的回调函数?OnRspQryOrder在什么情况下会被调用? +同样,是否要增加一个OnRspQryTrade的回调函数? + +####6. 对于股票的只有查询,没有主动回报的功能的API,可能查询委托功能会交给用户 +这是什么意思? + +####8. OrderField.ID在什么范围内能保证ID的唯一性 +关于`OrderField.ID`,因为是字符串,如果把它变长一点,`yyyy-mm-dd:HHMMSS:SessionID:FrontID:OrderRef`,这样让ID在历史上都是唯一的,而且依然有实际意义(而不是像UUID)。用户只需要在其前面加上策略的名称,就能做到整个策略组合ID历史唯一。 + +修改建议:如上,伍侃反馈:同意,以后改。 +新问题:通过查询进行订单的恢复,报单的时间可能没办法恢复成功,特别是在秒部分,本地下单时间与柜台转的时间基本上无法对应上。 + + +####9. 撤单的问题 +1.撤单一定要指定FrontID:SessionID:OrderRef,好像还要指定别的东西,但实在不记得了是哪些了 +2.FrontID与SessionID不一定是本次会话的,而必须是发单时会话的值,也就是断线后重连,要撤上次的单必需用上次的值 +3.所以我一般是在重新登录时,查询委托列表,然后要撤单时通过这个列表把撤单的结构体全写上 + +首先,我下单时会返回一个FrontID:SessionID:OrderRef字符串 +撤单时通过这个字符串查一个map,找到对应的委托,然后撤单 + +存在的问题 +1.断线时再重连,由于下单太多,这个表可能要返回很久 +2.这时立即撤单会由于表没有更新完,撤单失败 + + +####10. 下单时的问题 +1.主要是批量下单时的结构体如何设计 +2.目前的方法是SendOrders(OrderField[] orders,out string[] orderref) +这个存在的问题是stirng[]中的string是一种比较复杂的类型,不同语言或框架中都有可能不一样,再对其[]就更复杂了,还要out。。。 +3.批量下单时,不一定每个单子都能下成功,如何通过string[]或别的方式来区分成功与失败呢? +4.我以前的方法是int SendOrders(order),登录时得到FrontID:SessionID,然后返回的int与FrontID:SessionID拼起来,就是一个唯一的字符串 +后来因为Femas必须前面填充为0,填满共12个。这样FrontID:SessionID:OrderRef实际拼接方法可能就各不一样 +后来又改成char* SendOrders(order),也就是一开始就是传出的唯一的字符串,但这种方法需要解决内存释放的问题 + +所有现在需要大家共同设计一下SendOrders与CacelOrders。 + +####[已解决] 11. XAPI2的目录结构 +目录中的项目名称不应该包括QuantBox前缀,因为没有必要,同时QuantBox是一个比XAPI2更大的概念。 + +解决方案:已经去掉了前缀。 + +####[已解决] 12. XAPI2的编译输出路径 +XAPI2中各项目的输出路径都应该同一放到一个文件夹中。 + +解决方案:所有编译输出放在XAPI2\bin中,其中子目录结构举例:XAPI2\bin\Debug\x64\CTP\($solution)_($project)_($arch).dll。 + +#### 13. XAPI与XAPI2名称的使用 +在XAPI2中的各项目中,XAPI和XAPI2不应该视为可混用(interchangable)。XAPI应该仅用来表达与之前XAPI相关的内容(如果有的话),否则应该一律使用XAPI2。 + +比如在C#的接口中,名称空间应该是QuantBox.XAPI2,而不是QuantBox.XAPI。 + +#### 14. 消息队列MessageQueue对远程推送数据的支持 +MessageQueue需要能够将数据通过不同的消息中间件(zeromq, Rabbitmq)推送到其它地方(其它机器,网络)中的能力。考虑的解决方案为:将CMsgQueue中的回调函数m_fnOnResponse从一个回调函数扩展成一组回调函数,然后实现一些回调函数,可以向zeromq或Rabbitmq中发送数据。这样可以做到各种数据分发底层实现的低耦合。用户可以随意增加和替换。zeromq在网络中断的时候不负责消息丢失的维护,Rabbitmq则负责。所以,zeromq发送行情数据类的消息应该够用,Rabbitmq可能比较适合发送交易类的消息。 diff --git a/example/cpp/CTP/example_ctp.cpp b/example/cpp/CTP/example_ctp.cpp new file mode 100644 index 0000000..f74cf28 --- /dev/null +++ b/example/cpp/CTP/example_ctp.cpp @@ -0,0 +1,211 @@ +#if defined WINDOWS || _WIN32 +#include +#else +#include +#endif + +#include +#include +#include + +#include "../../../include/XApiCpp.h" + +#ifndef USE_CMAKE +#ifdef _WIN64 +#pragma comment(lib, "../../lib/XAPI_CPP_x64.lib") +#else +#pragma comment(lib, "../../lib/XAPI_CPP_x86.lib") +#endif +#endif + +class CXSpiImpl :public CXSpi +{ +public: + CXSpiImpl() :CXSpi() + { + count = 0; + } + + virtual void OnConnectionStatus(CXApi* pApi, ConnectionStatus status, RspUserLoginField* pUserLogin, int size1) + { + printf("%d\r\n", status); + if (pUserLogin) + { + printf("%s\r\n", pUserLogin->Text); + } + if (status == ConnectionStatus::ConnectionStatus_Done) + { + if ((pApi->GetApiTypes() & ApiType::ApiType_MarketData) == ApiType::ApiType_MarketData) + { + // õǰʱ + time_t rawtime; + struct tm * timeinfo; + time(&rawtime); + timeinfo = localtime(&rawtime); + int mon = timeinfo->tm_mon; + char buf[64] = { 0 }; + for (int i = 0; i < 12; ++i) + { + int x = mon + i; + int a = x / 12; + int b = x % 12; + sprintf(buf, "IF%d%02d", (1900 + timeinfo->tm_year + a) % 100, b + 1); + pApi->Subscribe(buf, ""); + sprintf(buf, "TF%d%02d", (1900 + timeinfo->tm_year + a) % 100, b + 1); + pApi->Subscribe(buf, ""); + } + } + } + } + virtual void OnRtnError(CXApi* pApi, ErrorField* pError) {}; + + virtual void OnRtnDepthMarketDataN(CXApi* pApi, DepthMarketDataNField* pMarketData) + { + printf("%s,%f,%d\r\n", pMarketData->Symbol, pMarketData->LastPrice, ++count); + + int size = sizeof(DepthField); + char* pBid = ((char*)pMarketData) + sizeof(DepthMarketDataNField); + int AskCount = (pMarketData->Size - sizeof(DepthMarketDataNField)) / size - pMarketData->BidCount; + char* pAsk = ((char*)pMarketData) + sizeof(DepthMarketDataNField) + pMarketData->BidCount*size; + for (int i = 0; i < pMarketData->BidCount; ++i) + { + DepthField* pDF = (DepthField*)(pBid + i * size); + printf("%d,%f,%d,%d\r\n", i, pDF->Price, pDF->Size, pDF->Count); + } + for (int i = 0; i < AskCount; ++i) + { + DepthField* pDF = (DepthField*)(pAsk + i * size); + printf("%d,%f,%d,%d\r\n", i, pDF->Price, pDF->Size, pDF->Count); + } + } + + virtual void OnRtnQuoteRequest(CXApi* pApi, QuoteRequestField* pQuoteRequest) {}; + + virtual void OnRspQryInstrument(CXApi* pApi, InstrumentField* pInstrument, int size1, bool bIsLast) {}; + virtual void OnRspQryTradingAccount(CXApi* pApi, AccountField* pAccount, int size1, bool bIsLast) {}; + virtual void OnRspQryInvestorPosition(CXApi* pApi, PositionField* pPosition, int size1, bool bIsLast) + { + printf("%s,%s\r\n", pPosition->InstrumentName, pPosition->InstrumentID); + } + virtual void OnRspQrySettlementInfo(CXApi* pApi, SettlementInfoField* pSettlementInfo, int size1, bool bIsLast) {}; + virtual void OnRspQryInvestor(CXApi* pApi, InvestorField* pInvestor, int size1, bool bIsLast) {}; + + + + virtual void OnRtnOrder(CXApi* pApi, OrderField* pOrder) + { + printf("%d,%s\r\n", pOrder->RawErrorID, pOrder->Text); + } + virtual void OnRtnTrade(CXApi* pApi, TradeField* pTrade) {}; + virtual void OnRtnQuote(CXApi* pApi, QuoteField* pQuote) {}; + + virtual void OnRspQryHistoricalTicks(CXApi* pApi, TickField* pTicks, int size1, HistoricalDataRequestField* pRequest, int size2, bool bIsLast) {}; + virtual void OnRspQryHistoricalBars(CXApi* pApi, BarField* pBars, int size1, HistoricalDataRequestField* pRequest, int size2, bool bIsLast) {}; + + virtual bool OnFilterSubscribe(CXApi* pApi, ExchangeType exchange, int instrument_part1, int instrument_part2, int instrument_part3, char* pInstrument) + { + // Ϊ0ʱֻжϽ + // Ϊ + if (instrument_part1 == 0) + // ֻҪϺڣ + return exchange != ExchangeType::ExchangeType_NEEQ; + + //type = ExchangeType::SZSE; + //double1 = 399300; + + int prefix1 = instrument_part1 / 100000; + int prefix3 = instrument_part1 / 1000; + switch (exchange) + { + case ExchangeType::ExchangeType_SSE: + return (prefix1 == 6); + case ExchangeType::ExchangeType_SZSE: + return (prefix1 == 0) || (prefix3 == 300); + default: + break; + } + + return true; + } +public: + //CXApi* m_pApi; + int count; +}; + +int main(int argc, char* argv[]) +{ + CXSpiImpl* p = new CXSpiImpl(); +#if _WIN32 +#if _WIN64 + char DLLPath1[250] = "CTP_Quote_x64.dll"; + char DLLPath2[250] = "CTP_Trade_x64.dll"; +#else + char DLLPath1[250] = "CTP_Quote_x86.dll"; + char DLLPath2[250] = "CTP_Trade_x86.dll"; +#endif +#else + char DLLPath1[1024] = "libCTP_Quote.so"; + char DLLPath2[1024] = "libCTP_Trade.so"; +// char dir_path[512] = {0}; +// char DLLPath1[1024] = {0}; +// char DLLPath2[1024] = {0}; +// +// if (getcwd(dir_path, sizeof(dir_path)) == NULL) +// { +// return 1; +// } +// snprintf(DLLPath1, sizeof(DLLPath1), "%s/libCTP_Quote.so", dir_path); +// snprintf(DLLPath2, sizeof(DLLPath2), "%s/libCTP_Trade.so", dir_path); +#endif + + ServerInfoField m_ServerInfo1 = { 0 }; + ServerInfoField m_ServerInfo2 = { 0 }; + UserInfoField m_UserInfo = { 0 }; + + strcpy(m_ServerInfo1.BrokerID, "4040"); + strcpy(m_ServerInfo1.Address, "tcp://yhzx-front1.yhqh.com:41213;tcp://yhzx-front3.yhqh.com:41213"); + + strcpy(m_ServerInfo2.BrokerID, "4040"); + strcpy(m_ServerInfo2.Address, "tcp://yhzx-front1.yhqh.com:51205;tcp://yhzx-front3.yhqh.com:52205"); + + strcpy(m_UserInfo.UserID, "00000025"); + strcpy(m_UserInfo.Password, "123456"); + + + + while (true) + { + CXApi* pApi1 = CXApi::CreateApi(DLLPath1); + CXApi* pApi2 = CXApi::CreateApi(DLLPath2); + + if (!pApi1->Init()) + { + printf("%s\r\n", pApi1->GetLastError()); + pApi1->Disconnect(); + break; + } + + if (!pApi2->Init()) + { + printf("%s\r\n", pApi2->GetLastError()); + pApi2->Disconnect(); + break; + } + + pApi1->RegisterSpi(p); + pApi1->Connect("./", &m_ServerInfo1, &m_UserInfo, 1); + printf("ѾִConnect\n"); + + pApi2->RegisterSpi(p); + pApi2->Connect("./", &m_ServerInfo2, &m_UserInfo, 1); + printf("ѾִConnect\n"); + getchar(); + + pApi1->Disconnect(); + pApi2->Disconnect(); + printf("ѾִDisconnect"); + //getchar(); + } + + return 0; +} diff --git a/example/cpp/XTP/example_xtp.cpp b/example/cpp/XTP/example_xtp.cpp new file mode 100644 index 0000000..4f44caf --- /dev/null +++ b/example/cpp/XTP/example_xtp.cpp @@ -0,0 +1,343 @@ +#if defined WINDOWS || _WIN32 +#include +#else +#include +#endif +#include +#include +#include +#include +#include + +#include "../../../include/XApiCpp.h" + +static const char *szExchange_SH = "SSE"; +static const char *szExchange_SZ = "SZSE"; + +class CXSpiImpl : public CXSpi +{ +public: + CXSpiImpl() + : CXSpi() + { + client_id_ = 1; + } + + virtual void OnRtnError(CXApi* pApi, ErrorField* pError) + { + std::cout << "OnRtnError: " + << pError->Source << ", " + << pError->RawErrorID << ", " + << pError->Text << std::endl; + } + + virtual void OnConnectionStatus(CXApi* pApi, ConnectionStatus status, RspUserLoginField* pUserLogin, int size1) + { + std::cout << "connection status: " << status << std::endl; + if (status == ConnectionStatus::ConnectionStatus_Done) + { + if ((pApi->GetApiTypes() & ApiType::ApiType_MarketData) == ApiType::ApiType_MarketData) + { + on_quote_ready(pApi); + } + else if ((pApi->GetApiTypes() & ApiType::ApiType_Trade) == ApiType::ApiType_Trade) + { + on_trade_ready(pApi); + } + } + } + + virtual void OnRtnDepthMarketDataN(CXApi* pApi, DepthMarketDataNField* pMarketData) + { + std::cout << "{" + << "'msg': 'OnRtnDepthMarketDataN', " + << "'exchangeID': '" << pMarketData->ExchangeID << "', " + << "'exchangeEnum': " << pMarketData->Exchange << ", " + << "'symbol': '" << pMarketData->Symbol << "', " + << "'last_price': " << pMarketData->LastPrice << ", " + << "'volume': " << pMarketData->Volume << ", " + << "'turnover': " << pMarketData->Turnover << ", " + << "'avg_price': " << pMarketData->AveragePrice << ", " + << "'open_price': " << pMarketData->OpenPrice << ", " + << "'close_price': " << pMarketData->ClosePrice << ", " + << "'high_price': " << pMarketData->HighestPrice << ", " + << "'low_price': " << pMarketData->LowestPrice << ", " + << "'upper_limit_price': " << pMarketData->UpperLimitPrice << ", " + << "'lower_limit_price': " << pMarketData->LowerLimitPrice << ", " + << "'pre_close_price': " << pMarketData->PreClosePrice << ", " + << "'pre_settle_price': " << pMarketData->PreSettlementPrice << ", "; + + int size = sizeof(DepthField); + char* pBid = ((char*)pMarketData) + sizeof(DepthMarketDataNField); + int AskCount = (pMarketData->Size - sizeof(DepthMarketDataNField)) / size - pMarketData->BidCount; + char* pAsk = ((char*)pMarketData) + sizeof(DepthMarketDataNField) + pMarketData->BidCount*size; + + std::cout << "'bids': ["; + for (int i = 0; i < pMarketData->BidCount; i++) + { + DepthField* pDF = (DepthField*)(pBid + i * size); + std::cout << "[" << pDF->Price << ", " << pDF->Size << "]"; + if (i != pMarketData->BidCount - 1) + { + std::cout << ", "; + } + } + std::cout << "], "; + + std::cout << "'asks': ["; + for (int i = 0; i < pMarketData->BidCount; i++) + { + DepthField* pDF = (DepthField*)(pAsk + i * size); + std::cout << "[" << pDF->Price << ", " << pDF->Size << "]"; + if (i != pMarketData->BidCount - 1) + { + std::cout << ", "; + } + } + std::cout << "]"; + + std::cout << "}" << std::endl; + } + + virtual void OnRspQryTradingAccount(CXApi* pApi, AccountField* pAccount, int size1, bool bIsLast) + { + print_account(pAccount); + } + virtual void OnRspQryInvestorPosition(CXApi* pApi, PositionField* pPosition, int size1, bool bIsLast) + { + print_position(pPosition); + } + + virtual void OnRspQryOrder(CXApi* pApi, OrderField* pOrder, int size1, bool bIsLast) + { + print_order(pOrder); + } + virtual void OnRspQryTrade(CXApi* pApi, TradeField* pTrade, int size1, bool bIsLast) + { + print_trade(pTrade); + } + + virtual void OnRtnOrder(CXApi* pApi, OrderField* pOrder) + { + print_order(pOrder); + } + virtual void OnRtnTrade(CXApi* pApi, TradeField* pTrade) + { + print_trade(pTrade); + } + +private: + void on_quote_ready(CXApi* pApi) + { + std::cout << "XTP Quote Api Ready" << std::endl; + + char *symbols[] = { + "600090", + "600887", + }; + int count = sizeof(symbols) / sizeof(char*) - 1; + + std::string buf = ""; + for (int i = 0; i < count; i++) + { + buf.append(symbols[i]); + if (i != count - 1) + { + buf.append(";"); + } + } + pApi->Subscribe(buf.c_str(), szExchange_SH); + } + void on_trade_ready(CXApi* pApi) + { + std::cout << "XTP Trade Api Ready" << std::endl; + + // query trading account + ReqQueryField query_account = { 0 }; + pApi->ReqQuery(QueryType::QueryType_ReqQryTradingAccount, &query_account); + + // query position + ReqQueryField query_position = { 0 }; + pApi->ReqQuery(QueryType::QueryType_ReqQryInvestorPosition, &query_position); + + // query orders + ReqQueryField query_order = { 0 }; + query_order.DateStart = 20180101; + query_order.DateEnd = 20191231; + pApi->ReqQuery(QueryType::QueryType_ReqQryOrder, &query_order); + + // query trades + ReqQueryField query_trade = { 0 }; + query_trade.DateStart = 20180101; + query_trade.DateEnd = 20191231; + pApi->ReqQuery(QueryType::QueryType_ReqQryTrade, &query_trade); + +// // insert order +// OrderField order = { 0 }; +// strcpy(order.ExchangeID, szExchange_SH); +// strcpy(order.Symbol, "600090"); +// order.Price = 5.5; +// order.Qty = 200; +// order.Type = OrderType::OrderType_Limit; +// order.Side = OrderSide::OrderSide_Buy; +// pApi->SendOrder(&order, 1, nullptr); + } + + void print_order(OrderField* pOrder) + { + if (pOrder == nullptr) + { + return; + } + + std::cout << "{" + << "'msg': 'order', " + << "'order_id': '" << pOrder->ID << "', " + << "'local_id': '" << pOrder->LocalID << "', " + << "'order_id': '" << pOrder->OrderID << "', " + << "'exchange': '" << pOrder->ExchangeID << "', " + << "'symbol': '" << pOrder->Symbol << "', " + << "'price': '" << pOrder->Price << ", " + << "'vol': " << pOrder->Qty << ", " + << "'dir': " << pOrder->Side << ", " + << "'open_close': " << pOrder->OpenClose << ", " + << "'status': " << pOrder->Status << ", " + << "'type': " << pOrder->Type << ", " + << "'traded': " << pOrder->CumQty << ", " + << "'left': " << pOrder->LeavesQty + << "}" << std::endl; + } + void print_trade(TradeField* pTrade) + { + if (pTrade == nullptr) + { + return; + } + + std::cout << "{" + << "'msg': 'trade', " + << "'order_id': '" << pTrade->ID << "', " + << "'trade_id': '" << pTrade->TradeID << "', " + << "'exchange': '" << pTrade->ExchangeID << "', " + << "'symbol': '" << pTrade->Symbol << "', " + << "'price': '" << pTrade->Price << ", " + << "'vol': " << pTrade->Qty << ", " + << "'dir': " << pTrade->Side << ", " + << "'open_close': " << pTrade->OpenClose + << "}" << std::endl; + } + void print_account(AccountField* pAccount) + { + if (pAccount == nullptr) + { + return; + } + + std::cout << "{" + << "'msg': 'account', " + << "'balance': " << pAccount->Balance << ", " + << "'available': " << pAccount->Available << ", " + << "'withdraw_quota': " << pAccount->WithdrawQuota + << "}" << std::endl; + } + void print_position(PositionField* position) + { + if (position == nullptr) + { + return; + } + + std::cout << "{" + << "'msg': 'position', " + << "'exchange': '" << position->ExchangeID << "', " + << "'symbol': '" << position->Symbol << "', " + << "'dir': '" << position->Side << ", " + << "'position': " << position->Position << ", " + << "'sellable': " << position->Position - position->TodayPosition << ", " + << "'avg_price': " << position->PositionCost + << "}" << std::endl; + } + +public: + int client_id_; +}; + +int main(int argc, char *argv[]) +{ + CXSpiImpl* p = new CXSpiImpl(); + +#if _WIN32 + #if _WIN64 + char shared_lib_quote[250] = "XTP_Quote_x64.dll"; + char shared_lib_trade[250] = "XTP_Trade_x64.dll"; + #else + char shared_lib_quote[250] = "XTP_Quote_x86.dll"; + char shared_lib_trade[250] = "XTP_Trade_x86.dll"; + #endif +#else + char shared_lib_quote[1024] = "libXTP_Quote.so"; + char shared_lib_trade[1024] = "libXTP_Trade.so"; + // char dir_path[512] = {0}; + // char shared_lib_quote[1024] = {0}; + // char shared_lib_trade[1024] = {0}; + + // if (getcwd(dir_path, sizeof(dir_path)) == NULL) + // { + // return 1; + // } + // snprintf(shared_lib_quote, "%s/%s", dir_path, "libXTP_Quote.so"); + // snprintf(shared_lib_trade, "%s/%s", dir_path, "libXTP_Trade.so"); +#endif + + ServerInfoField quote_server_info = { 0 }; + ServerInfoField trade_server_info = { 0 }; + UserInfoField user_info = { 0 }; + + strcpy(quote_server_info.Address, "120.27.164.138"); + quote_server_info.IsUsingUdp = false; + quote_server_info.Port = 6002; + + strcpy(trade_server_info.Address, "120.27.164.69"); + trade_server_info.Port = 6001; + + // ע⣬Ҫûkey + strcpy(user_info.UserID, "userid"); // û + strcpy(user_info.Password, "password"); // + user_info.ExtInfoInt32 = p->client_id_; // Զ client_id + strcpy(user_info.ExtInfoChar64, "xxxxxxxx"); // key + + CXApi* p_api_quote = CXApi::CreateApi(shared_lib_quote); + CXApi* p_api_trade = CXApi::CreateApi(shared_lib_trade); + + if (!p_api_quote->Init()) + { + printf("%s\r\n", p_api_quote->GetLastError()); + p_api_quote->Disconnect(); + return 1; + } + + if (!p_api_trade->Init()) + { + printf("%s\r\n", p_api_trade->GetLastError()); + p_api_trade->Disconnect(); + return 1; + } + + p_api_quote->RegisterSpi(p); + p_api_quote->Connect("./", "e_server_info, &user_info, 0); + printf("QuoteѾִConnect\n"); + + p_api_trade->RegisterSpi(p); + p_api_trade->Connect("./", &trade_server_info, &user_info, 0); + printf("TradeѾִConnect\n"); + + getchar(); + + p_api_quote->Disconnect(); + printf("QuoteѾִDisconnect"); + + p_api_trade->Disconnect(); + printf("TradeѾִDisconnect"); + + return 0; +} diff --git a/include/ATP/ThostFtdcMdApi.h b/include/ATP/ThostFtdcMdApi.h new file mode 100644 index 0000000..9af915f --- /dev/null +++ b/include/ATP/ThostFtdcMdApi.h @@ -0,0 +1,158 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcMdApi.h +///@brief ˿ͻ˽ӿ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCMDAPI_H) +#define THOST_FTDCMDAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ThostFtdcUserApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_MD_API_EXPORT +#define MD_API_EXPORT __declspec(dllexport) +#else +#define MD_API_EXPORT __declspec(dllimport) +#endif +#else +#define MD_API_EXPORT +#endif + +class CThostFtdcMdSpi +{ +public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡӦ + virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡѯӦ + virtual void OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) {}; + + ///ѯ֪ͨ + virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {}; +}; + +class MD_API_EXPORT CThostFtdcMdApi +{ +public: + ///MdApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + ///modify for udp marketdata + static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp=false, const bool bIsMulticast=false); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcMdSpi *pSpi) = 0; + + ///顣 + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeMarketData(char *ppInstrumentID[], int nCount) = 0; + + ///˶顣 + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeMarketData(char *ppInstrumentID[], int nCount) = 0; + + ///ѯۡ + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0; + + ///˶ѯۡ + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0; + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; +protected: + ~CThostFtdcMdApi(){}; +}; + +#endif diff --git a/include/ATP/ThostFtdcTraderApi.h b/include/ATP/ThostFtdcTraderApi.h new file mode 100644 index 0000000..f1aaefb --- /dev/null +++ b/include/ATP/ThostFtdcTraderApi.h @@ -0,0 +1,584 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcTraderApi.h +///@brief ˿ͻ˽ӿ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCTRADERAPI_H) +#define THOST_FTDCTRADERAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ThostFtdcUserApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_TRADER_API_EXPORT +#define TRADER_API_EXPORT __declspec(dllexport) +#else +#define TRADER_API_EXPORT __declspec(dllimport) +#endif +#else +#define TRADER_API_EXPORT +#endif + +class CThostFtdcTraderSpi +{ +public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + ///ͻ֤Ӧ + virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ûӦ + virtual void OnRspUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ʽ˻Ӧ + virtual void OnRspTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ԥ¼Ӧ + virtual void OnRspParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ԥ񳷵¼Ӧ + virtual void OnRspParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ󱨵Ӧ + virtual void OnRspQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ͷ߽ȷӦ + virtual void OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ɾԤӦ + virtual void OnRspRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ɾԤ񳷵Ӧ + virtual void OnRspRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ִ¼Ӧ + virtual void OnRspExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ִӦ + virtual void OnRspExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ¼Ӧ + virtual void OnRspForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///۲Ӧ + virtual void OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯɽӦ + virtual void OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳Ӧ + virtual void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʽ˻Ӧ + virtual void OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶӦ + virtual void OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯױӦ + virtual void OnRspQryTradingCode(CThostFtdcTradingCodeField *pTradingCode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼ֤Ӧ + virtual void OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchange(CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷӦ + virtual void OnRspQryProduct(CThostFtdcProductField *pProduct, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶ߽Ӧ + virtual void OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯתӦ + virtual void OnRspQryTransferBank(CThostFtdcTransferBankField *pTransferBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionDetail(CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͻ֪ͨӦ + virtual void OnRspQryNotice(CThostFtdcNoticeField *pNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯϢȷӦ + virtual void OnRspQrySettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionCombineDetail(CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤ϵͳ͹˾ʽ˻ԿӦ + virtual void OnRspQryCFMMCTradingAccountKey(CThostFtdcCFMMCTradingAccountKeyField *pCFMMCTradingAccountKey, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯֵ۵ϢӦ + virtual void OnRspQryEWarrantOffset(CThostFtdcEWarrantOffsetField *pEWarrantOffset, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶƷ/Ʒֱ֤Ӧ + virtual void OnRspQryInvestorProductGroupMargin(CThostFtdcInvestorProductGroupMarginField *pInvestorProductGroupMargin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤Ӧ + virtual void OnRspQryExchangeMarginRate(CThostFtdcExchangeMarginRateField *pExchangeMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤Ӧ + virtual void OnRspQryExchangeMarginRateAdjust(CThostFtdcExchangeMarginRateAdjustField *pExchangeMarginRateAdjust, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchangeRate(CThostFtdcExchangeRateField *pExchangeRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԱȨӦ + virtual void OnRspQrySecAgentACIDMap(CThostFtdcSecAgentACIDMapField *pSecAgentACIDMap, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨ׳ɱӦ + virtual void OnRspQryOptionInstrTradeCost(CThostFtdcOptionInstrTradeCostField *pOptionInstrTradeCost, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨԼӦ + virtual void OnRspQryOptionInstrCommRate(CThostFtdcOptionInstrCommRateField *pOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯִӦ + virtual void OnRspQryExecOrder(CThostFtdcExecOrderField *pExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯѯӦ + virtual void OnRspQryForQuote(CThostFtdcForQuoteField *pForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯתˮӦ + virtual void OnRspQryTransferSerial(CThostFtdcTransferSerialField *pTransferSerial, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯǩԼϵӦ + virtual void OnRspQryAccountregister(CThostFtdcAccountregisterField *pAccountregister, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnOrder(CThostFtdcOrderField *pOrder) {}; + + ///ɽ֪ͨ + virtual void OnRtnTrade(CThostFtdcTradeField *pTrade) {}; + + ///¼ر + virtual void OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ر + virtual void OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///Լ״̬֪ͨ + virtual void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) {}; + + ///֪ͨ + virtual void OnRtnTradingNotice(CThostFtdcTradingNoticeInfoField *pTradingNoticeInfo) {}; + + ///ʾУ + virtual void OnRtnErrorConditionalOrder(CThostFtdcErrorConditionalOrderField *pErrorConditionalOrder) {}; + + ///ִ֪ͨ + virtual void OnRtnExecOrder(CThostFtdcExecOrderField *pExecOrder) {}; + + ///ִ¼ر + virtual void OnErrRtnExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ִر + virtual void OnErrRtnExecOrderAction(CThostFtdcExecOrderActionField *pExecOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯ¼ر + virtual void OnErrRtnForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo) {}; + + ///֪ͨ + virtual void OnRtnQuote(CThostFtdcQuoteField *pQuote) {}; + + ///¼ر + virtual void OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo) {}; + + ///۲ر + virtual void OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯ֪ͨ + virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {}; + + ///֤û + virtual void OnRtnCFMMCTradingAccountToken(CThostFtdcCFMMCTradingAccountTokenField *pCFMMCTradingAccountToken) {}; + + ///ѯǩԼӦ + virtual void OnRspQryContractBank(CThostFtdcContractBankField *pContractBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԤӦ + virtual void OnRspQryParkedOrder(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԤ񳷵Ӧ + virtual void OnRspQryParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֪ͨӦ + virtual void OnRspQryTradingNotice(CThostFtdcTradingNoticeField *pTradingNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ͹˾ײӦ + virtual void OnRspQryBrokerTradingParams(CThostFtdcBrokerTradingParamsField *pBrokerTradingParams, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ͹˾㷨Ӧ + virtual void OnRspQryBrokerTradingAlgos(CThostFtdcBrokerTradingAlgosField *pBrokerTradingAlgos, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯû + virtual void OnRspQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///зʽתڻ֪ͨ + virtual void OnRtnFromBankToFutureByBank(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///зڻʽת֪ͨ + virtual void OnRtnFromFutureToBankByBank(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///зתڻ֪ͨ + virtual void OnRtnRepealFromBankToFutureByBank(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///зڻת֪ͨ + virtual void OnRtnRepealFromFutureToBankByBank(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻʽתڻ֪ͨ + virtual void OnRtnFromBankToFutureByFuture(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///ڻڻʽת֪ͨ + virtual void OnRtnFromFutureToBankByFuture(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///ϵͳʱڻֹתڻдϺ̷ص֪ͨ + virtual void OnRtnRepealFromBankToFutureByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ϵͳʱڻֹڻתдϺ̷ص֪ͨ + virtual void OnRtnRepealFromFutureToBankByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻѯ֪ͨ + virtual void OnRtnQueryBankBalanceByFuture(CThostFtdcNotifyQueryAccountField *pNotifyQueryAccount) {}; + + ///ڻʽתڻر + virtual void OnErrRtnBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻڻʽתдر + virtual void OnErrRtnFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ϵͳʱڻֹתڻر + virtual void OnErrRtnRepealBankToFutureByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ϵͳʱڻֹڻתдر + virtual void OnErrRtnRepealFutureToBankByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻѯر + virtual void OnErrRtnQueryBankBalanceByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻתڻдϺ̷ص֪ͨ + virtual void OnRtnRepealFromBankToFutureByFuture(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻڻתдϺ̷ص֪ͨ + virtual void OnRtnRepealFromFutureToBankByFuture(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻʽתڻӦ + virtual void OnRspFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ڻڻʽתӦ + virtual void OnRspFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ڻѯӦ + virtual void OnRspQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///зڿ֪ͨ + virtual void OnRtnOpenAccountByBank(CThostFtdcOpenAccountField *pOpenAccount) {}; + + ///з֪ͨ + virtual void OnRtnCancelAccountByBank(CThostFtdcCancelAccountField *pCancelAccount) {}; + + ///з˺֪ͨ + virtual void OnRtnChangeAccountByBank(CThostFtdcChangeAccountField *pChangeAccount) {}; +}; + +class TRADER_API_EXPORT CThostFtdcTraderApi +{ +public: + ///TraderApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + static CThostFtdcTraderApi *CreateFtdcTraderApi(const char *pszFlowPath = ""); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcTraderSpi *pSpi) = 0; + + ///˽ + ///@param nResumeType ˽شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼˽ + ///@remark ÷ҪInitǰá򲻻յ˽ݡ + virtual void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///Ĺ + ///@param nResumeType شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼󹫹 + ///@remark ÷ҪInitǰá򲻻յݡ + virtual void SubscribePublicTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///ͻ֤ + virtual int ReqAuthenticate(CThostFtdcReqAuthenticateField *pReqAuthenticateField, int nRequestID) = 0; + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; + + ///û + virtual int ReqUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, int nRequestID) = 0; + + ///ʽ˻ + virtual int ReqTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, int nRequestID) = 0; + + ///¼ + virtual int ReqOrderInsert(CThostFtdcInputOrderField *pInputOrder, int nRequestID) = 0; + + ///Ԥ¼ + virtual int ReqParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, int nRequestID) = 0; + + ///Ԥ񳷵¼ + virtual int ReqParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, int nRequestID) = 0; + + /// + virtual int ReqOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, int nRequestID) = 0; + + ///ѯ󱨵 + virtual int ReqQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, int nRequestID) = 0; + + ///Ͷ߽ȷ + virtual int ReqSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, int nRequestID) = 0; + + ///ɾԤ + virtual int ReqRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, int nRequestID) = 0; + + ///ɾԤ񳷵 + virtual int ReqRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, int nRequestID) = 0; + + ///ִ¼ + virtual int ReqExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, int nRequestID) = 0; + + ///ִ + virtual int ReqExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, int nRequestID) = 0; + + ///ѯ¼ + virtual int ReqForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, int nRequestID) = 0; + + ///¼ + virtual int ReqQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, int nRequestID) = 0; + + ///۲ + virtual int ReqQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryOrder(CThostFtdcQryOrderField *pQryOrder, int nRequestID) = 0; + + ///ѯɽ + virtual int ReqQryTrade(CThostFtdcQryTradeField *pQryTrade, int nRequestID) = 0; + + ///ѯͶֲ߳ + virtual int ReqQryInvestorPosition(CThostFtdcQryInvestorPositionField *pQryInvestorPosition, int nRequestID) = 0; + + ///ѯʽ˻ + virtual int ReqQryTradingAccount(CThostFtdcQryTradingAccountField *pQryTradingAccount, int nRequestID) = 0; + + ///ѯͶ + virtual int ReqQryInvestor(CThostFtdcQryInvestorField *pQryInvestor, int nRequestID) = 0; + + ///ѯױ + virtual int ReqQryTradingCode(CThostFtdcQryTradingCodeField *pQryTradingCode, int nRequestID) = 0; + + ///ѯԼ֤ + virtual int ReqQryInstrumentMarginRate(CThostFtdcQryInstrumentMarginRateField *pQryInstrumentMarginRate, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrumentCommissionRate(CThostFtdcQryInstrumentCommissionRateField *pQryInstrumentCommissionRate, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchange(CThostFtdcQryExchangeField *pQryExchange, int nRequestID) = 0; + + ///ѯƷ + virtual int ReqQryProduct(CThostFtdcQryProductField *pQryProduct, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrument(CThostFtdcQryInstrumentField *pQryInstrument, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryDepthMarketData(CThostFtdcQryDepthMarketDataField *pQryDepthMarketData, int nRequestID) = 0; + + ///ѯͶ߽ + virtual int ReqQrySettlementInfo(CThostFtdcQrySettlementInfoField *pQrySettlementInfo, int nRequestID) = 0; + + ///ѯת + virtual int ReqQryTransferBank(CThostFtdcQryTransferBankField *pQryTransferBank, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionDetail(CThostFtdcQryInvestorPositionDetailField *pQryInvestorPositionDetail, int nRequestID) = 0; + + ///ѯͻ֪ͨ + virtual int ReqQryNotice(CThostFtdcQryNoticeField *pQryNotice, int nRequestID) = 0; + + ///ѯϢȷ + virtual int ReqQrySettlementInfoConfirm(CThostFtdcQrySettlementInfoConfirmField *pQrySettlementInfoConfirm, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionCombineDetail(CThostFtdcQryInvestorPositionCombineDetailField *pQryInvestorPositionCombineDetail, int nRequestID) = 0; + + ///ѯ֤ϵͳ͹˾ʽ˻Կ + virtual int ReqQryCFMMCTradingAccountKey(CThostFtdcQryCFMMCTradingAccountKeyField *pQryCFMMCTradingAccountKey, int nRequestID) = 0; + + ///ѯֵ۵Ϣ + virtual int ReqQryEWarrantOffset(CThostFtdcQryEWarrantOffsetField *pQryEWarrantOffset, int nRequestID) = 0; + + ///ѯͶƷ/Ʒֱ֤ + virtual int ReqQryInvestorProductGroupMargin(CThostFtdcQryInvestorProductGroupMarginField *pQryInvestorProductGroupMargin, int nRequestID) = 0; + + ///ѯ֤ + virtual int ReqQryExchangeMarginRate(CThostFtdcQryExchangeMarginRateField *pQryExchangeMarginRate, int nRequestID) = 0; + + ///ѯ֤ + virtual int ReqQryExchangeMarginRateAdjust(CThostFtdcQryExchangeMarginRateAdjustField *pQryExchangeMarginRateAdjust, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchangeRate(CThostFtdcQryExchangeRateField *pQryExchangeRate, int nRequestID) = 0; + + ///ѯԱȨ + virtual int ReqQrySecAgentACIDMap(CThostFtdcQrySecAgentACIDMapField *pQrySecAgentACIDMap, int nRequestID) = 0; + + ///ѯȨ׳ɱ + virtual int ReqQryOptionInstrTradeCost(CThostFtdcQryOptionInstrTradeCostField *pQryOptionInstrTradeCost, int nRequestID) = 0; + + ///ѯȨԼ + virtual int ReqQryOptionInstrCommRate(CThostFtdcQryOptionInstrCommRateField *pQryOptionInstrCommRate, int nRequestID) = 0; + + ///ѯִ + virtual int ReqQryExecOrder(CThostFtdcQryExecOrderField *pQryExecOrder, int nRequestID) = 0; + + ///ѯѯ + virtual int ReqQryForQuote(CThostFtdcQryForQuoteField *pQryForQuote, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryQuote(CThostFtdcQryQuoteField *pQryQuote, int nRequestID) = 0; + + ///ѯתˮ + virtual int ReqQryTransferSerial(CThostFtdcQryTransferSerialField *pQryTransferSerial, int nRequestID) = 0; + + ///ѯǩԼϵ + virtual int ReqQryAccountregister(CThostFtdcQryAccountregisterField *pQryAccountregister, int nRequestID) = 0; + + ///ѯǩԼ + virtual int ReqQryContractBank(CThostFtdcQryContractBankField *pQryContractBank, int nRequestID) = 0; + + ///ѯԤ + virtual int ReqQryParkedOrder(CThostFtdcQryParkedOrderField *pQryParkedOrder, int nRequestID) = 0; + + ///ѯԤ񳷵 + virtual int ReqQryParkedOrderAction(CThostFtdcQryParkedOrderActionField *pQryParkedOrderAction, int nRequestID) = 0; + + ///ѯ֪ͨ + virtual int ReqQryTradingNotice(CThostFtdcQryTradingNoticeField *pQryTradingNotice, int nRequestID) = 0; + + ///ѯ͹˾ײ + virtual int ReqQryBrokerTradingParams(CThostFtdcQryBrokerTradingParamsField *pQryBrokerTradingParams, int nRequestID) = 0; + + ///ѯ͹˾㷨 + virtual int ReqQryBrokerTradingAlgos(CThostFtdcQryBrokerTradingAlgosField *pQryBrokerTradingAlgos, int nRequestID) = 0; + + ///ѯû + virtual int ReqQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, int nRequestID) = 0; + + ///ڻʽתڻ + virtual int ReqFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID) = 0; + + ///ڻڻʽת + virtual int ReqFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID) = 0; + + ///ڻѯ + virtual int ReqQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, int nRequestID) = 0; +protected: + ~CThostFtdcTraderApi(){}; +}; + +#endif diff --git a/include/ATP/ThostFtdcUserApiDataType.h b/include/ATP/ThostFtdcUserApiDataType.h new file mode 100644 index 0000000..ff3e1ee --- /dev/null +++ b/include/ATP/ThostFtdcUserApiDataType.h @@ -0,0 +1,6272 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcUserApiDataType.h +///@brief ˿ͻ˽ӿʹõҵ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#ifndef THOST_FTDCDATATYPE_H +#define THOST_FTDCDATATYPE_H + +enum THOST_TE_RESUME_TYPE +{ + THOST_TERT_RESTART = 0, + THOST_TERT_RESUME, + THOST_TERT_QUICK +}; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTraderIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDTypeһͶߴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerIDTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerAbbrTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerNameTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeInstIDTypeһԼڽĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderRefTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderRefType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParticipantIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParticipantIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserIDTypeһû +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserIDType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPasswordType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDTypeһױ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarketIDTypeһг +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMarketIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductNameTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeAbbrTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMacAddressTypeһMacַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMacAddressType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSystemIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangePropertyTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EXP_Normal '0' +///ݳɽɱ +#define THOST_FTDC_EXP_GenOrderByTrade '1' + +typedef char TThostFtdcExchangePropertyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLongTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLongTimeType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentNameTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementGroupIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettlementGroupIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSysIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeIDTypeһɽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandTypeTypeһDB +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommandTypeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPAddressTypeһIPַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIPAddressType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPPortTypeһIP˿ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcIPPortType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductInfoTypeһƷϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProtocolInfoTypeһЭϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProtocolInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessUnitTypeһҵԪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessUnitType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepositSeqNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDepositSeqNoType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdentifiedCardNoTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIdentifiedCardNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdCardTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֯ +#define THOST_FTDC_ICT_EID '0' +///й֤ +#define THOST_FTDC_ICT_IDCard '1' +///֤ +#define THOST_FTDC_ICT_OfficerIDCard '2' +///֤ +#define THOST_FTDC_ICT_PoliceIDCard '3' +///ʿ֤ +#define THOST_FTDC_ICT_SoldierIDCard '4' +///ڲ +#define THOST_FTDC_ICT_HouseholdRegister '5' +/// +#define THOST_FTDC_ICT_Passport '6' +///̨֤ +#define THOST_FTDC_ICT_TaiwanCompatriotIDCard '7' +///֤ +#define THOST_FTDC_ICT_HomeComingCard '8' +///Ӫҵִպ +#define THOST_FTDC_ICT_LicenseNo '9' +///˰ǼǺ/˰ID +#define THOST_FTDC_ICT_TaxNo 'A' +///۰ľڵ֤ͨ +#define THOST_FTDC_ICT_HMMainlandTravelPermit 'B' +///̨½֤ͨ +#define THOST_FTDC_ICT_TwMainlandTravelPermit 'C' +/// +#define THOST_FTDC_ICT_DrivingLicense 'D' +///籣ID +#define THOST_FTDC_ICT_SocialID 'F' +///֤ +#define THOST_FTDC_ICT_LocalID 'G' +///ҵǼ֤ +#define THOST_FTDC_ICT_BusinessRegistration 'H' +///۰Ծ֤ +#define THOST_FTDC_ICT_HKMCIDCard 'I' +///֤ +#define THOST_FTDC_ICT_OtherCard 'x' + +typedef char TThostFtdcIdCardTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderLocalIDTypeһر +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderLocalIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserNameTypeһû +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPartyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPartyNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorMsgTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcErrorMsgType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldNameTypeһֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFieldNameType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldContentTypeһֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFieldContentType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemNameTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSystemNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContentTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcContentType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IR_All '1' +///Ͷ +#define THOST_FTDC_IR_Group '2' +///һͶ +#define THOST_FTDC_IR_Single '3' + +typedef char TThostFtdcInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepartmentRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_DR_All '1' +///ܹ֯ +#define THOST_FTDC_DR_Group '2' +///һͶ +#define THOST_FTDC_DR_Single '3' + +typedef char TThostFtdcDepartmentRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataSyncStatusTypeһͬ״̬ +///////////////////////////////////////////////////////////////////////// +///δͬ +#define THOST_FTDC_DS_Asynchronous '1' +///ͬ +#define THOST_FTDC_DS_Synchronizing '2' +///ͬ +#define THOST_FTDC_DS_Synchronized '3' + +typedef char TThostFtdcDataSyncStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerDataSyncStatusTypeһ͹˾ͬ״̬ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_BDS_Synchronized '1' +///ͬ +#define THOST_FTDC_BDS_Synchronizing '2' + +typedef char TThostFtdcBrokerDataSyncStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeConnectStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_ECS_NoConnection '1' +///ѾԼѯ +#define THOST_FTDC_ECS_QryInstrumentSent '2' +///ѾȡϢ +#define THOST_FTDC_ECS_GotInformation '9' + +typedef char TThostFtdcExchangeConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderConnectStatusTypeһԱ״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_TCS_NotConnected '1' +///Ѿ +#define THOST_FTDC_TCS_Connected '2' +///ѾԼѯ +#define THOST_FTDC_TCS_QryInstrumentSent '3' +///˽ +#define THOST_FTDC_TCS_SubPrivateFlow '4' + +typedef char TThostFtdcTraderConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionCodeTypeһܴ +///////////////////////////////////////////////////////////////////////// +///첽 +#define THOST_FTDC_FC_DataAsync '1' +///ǿûdz +#define THOST_FTDC_FC_ForceUserLogout '2' +///û +#define THOST_FTDC_FC_UserPasswordUpdate '3' +///͹˾ +#define THOST_FTDC_FC_BrokerPasswordUpdate '4' +///Ͷ߿ +#define THOST_FTDC_FC_InvestorPasswordUpdate '5' +/// +#define THOST_FTDC_FC_OrderInsert '6' +/// +#define THOST_FTDC_FC_OrderAction '7' +///ͬϵͳ +#define THOST_FTDC_FC_SyncSystemData '8' +///ͬ͹˾ +#define THOST_FTDC_FC_SyncBrokerData '9' +///ͬ͹˾ +#define THOST_FTDC_FC_BachSyncBrokerData 'A' +///ѯ +#define THOST_FTDC_FC_SuperQuery 'B' +///Ԥ񱨵 +#define THOST_FTDC_FC_ParkedOrderInsert 'C' +///Ԥ񱨵 +#define THOST_FTDC_FC_ParkedOrderAction 'D' +///̬ͬ +#define THOST_FTDC_FC_SyncOTP 'E' +///ɾδ֪ +#define THOST_FTDC_FC_DeleteOrder 'F' + +typedef char TThostFtdcFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerFunctionCodeTypeһ͹˾ܴ +///////////////////////////////////////////////////////////////////////// +///ǿûdz +#define THOST_FTDC_BFC_ForceUserLogout '1' +///û +#define THOST_FTDC_BFC_UserPasswordUpdate '2' +///ͬ͹˾ +#define THOST_FTDC_BFC_SyncBrokerData '3' +///ͬ͹˾ +#define THOST_FTDC_BFC_BachSyncBrokerData '4' +/// +#define THOST_FTDC_BFC_OrderInsert '5' +/// +#define THOST_FTDC_BFC_OrderAction '6' +///ȫѯ +#define THOST_FTDC_BFC_AllQuery '7' +///ϵͳܣ/dz/޸ +#define THOST_FTDC_BFC_log 'a' +///ѯѯݣԼȳ +#define THOST_FTDC_BFC_BaseQry 'b' +///ײѯɽί +#define THOST_FTDC_BFC_TradeQry 'c' +///׹ܣ +#define THOST_FTDC_BFC_Trade 'd' +///ת +#define THOST_FTDC_BFC_Virement 'e' +///ռ +#define THOST_FTDC_BFC_Risk 'f' +///ѯ/ѯỰ˵ +#define THOST_FTDC_BFC_Session 'g' +///֪ͨ +#define THOST_FTDC_BFC_RiskNoticeCtl 'h' +///֪ͨ +#define THOST_FTDC_BFC_RiskNotice 'i' +///쿴͹˾ʽȨ +#define THOST_FTDC_BFC_BrokerDeposit 'j' +///ʽѯ +#define THOST_FTDC_BFC_QueryFund 'k' +///ѯ +#define THOST_FTDC_BFC_QueryOrder 'l' +///ɽѯ +#define THOST_FTDC_BFC_QueryTrade 'm' +///ֲֲѯ +#define THOST_FTDC_BFC_QueryPosition 'n' +///ѯ +#define THOST_FTDC_BFC_QueryMarketData 'o' +///û¼ѯ +#define THOST_FTDC_BFC_QueryUserEvent 'p' +///֪ͨѯ +#define THOST_FTDC_BFC_QueryRiskNotify 'q' +///ѯ +#define THOST_FTDC_BFC_QueryFundChange 'r' +///ͶϢѯ +#define THOST_FTDC_BFC_QueryInvestor 's' +///ױѯ +#define THOST_FTDC_BFC_QueryTradingCode 't' +///ǿƽ +#define THOST_FTDC_BFC_ForceClose 'u' +///ѹ +#define THOST_FTDC_BFC_PressTest 'v' +///Ȩ淴 +#define THOST_FTDC_BFC_RemainCalc 'w' +///ֱֲָ֤ +#define THOST_FTDC_BFC_NetPositionInd 'x' +///Ԥ +#define THOST_FTDC_BFC_RiskPredict 'y' +///ݵ +#define THOST_FTDC_BFC_DataExport 'z' +///ָ +#define THOST_FTDC_BFC_RiskTargetSetup 'A' +///Ԥ +#define THOST_FTDC_BFC_MarketDataWarn 'B' +///ҵ֪ͨѯ +#define THOST_FTDC_BFC_QryBizNotice 'C' +///ҵ֪ͨģ +#define THOST_FTDC_BFC_CfgBizNotice 'D' +///̬ͬ +#define THOST_FTDC_BFC_SyncOTP 'E' +///ҵ֪ͨ +#define THOST_FTDC_BFC_SendBizNotice 'F' +///ռ׼ +#define THOST_FTDC_BFC_CfgRiskLevelStd 'G' +///նӦ +#define THOST_FTDC_BFC_TbCommand 'H' +///ɾδ֪ +#define THOST_FTDC_BFC_DeleteOrder 'J' +///Ԥ񱨵 +#define THOST_FTDC_BFC_ParkedOrderInsert 'K' +///Ԥ񱨵 +#define THOST_FTDC_BFC_ParkedOrderAction 'L' + +typedef char TThostFtdcBrokerFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_OAS_Submitted 'a' +///Ѿ +#define THOST_FTDC_OAS_Accepted 'b' +///Ѿܾ +#define THOST_FTDC_OAS_Rejected 'c' + +typedef char TThostFtdcOrderActionStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ȫɽ +#define THOST_FTDC_OST_AllTraded '0' +///ֳɽڶ +#define THOST_FTDC_OST_PartTradedQueueing '1' +///ֳɽڶ +#define THOST_FTDC_OST_PartTradedNotQueueing '2' +///δɽڶ +#define THOST_FTDC_OST_NoTradeQueueing '3' +///δɽڶ +#define THOST_FTDC_OST_NoTradeNotQueueing '4' +/// +#define THOST_FTDC_OST_Canceled '5' +///δ֪ +#define THOST_FTDC_OST_Unknown 'a' +///δ +#define THOST_FTDC_OST_NotTouched 'b' +///Ѵ +#define THOST_FTDC_OST_Touched 'c' + +typedef char TThostFtdcOrderStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSubmitStatusTypeһύ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_OSS_InsertSubmitted '0' +///Ѿύ +#define THOST_FTDC_OSS_CancelSubmitted '1' +///޸Ѿύ +#define THOST_FTDC_OSS_ModifySubmitted '2' +///Ѿ +#define THOST_FTDC_OSS_Accepted '3' +///Ѿܾ +#define THOST_FTDC_OSS_InsertRejected '4' +///Ѿܾ +#define THOST_FTDC_OSS_CancelRejected '5' +///ĵѾܾ +#define THOST_FTDC_OSS_ModifyRejected '6' + +typedef char TThostFtdcOrderSubmitStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ճֲ +#define THOST_FTDC_PSD_Today '1' +///ʷֲ +#define THOST_FTDC_PSD_History '2' + +typedef char TThostFtdcPositionDateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateTypeTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ʹʷֲ +#define THOST_FTDC_PDT_UseHistory '1' +///ʹʷֲ +#define THOST_FTDC_PDT_NoUseHistory '2' + +typedef char TThostFtdcPositionDateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRoleTypeһ׽ɫ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ER_Broker '1' +///Ӫ +#define THOST_FTDC_ER_Host '2' +/// +#define THOST_FTDC_ER_Maker '3' + +typedef char TThostFtdcTradingRoleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductClassTypeһƷ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_PC_Futures '1' +///ڻȨ +#define THOST_FTDC_PC_Options '2' +/// +#define THOST_FTDC_PC_Combination '3' +/// +#define THOST_FTDC_PC_Spot '4' +///ת +#define THOST_FTDC_PC_EFP '5' +///ֻȨ +#define THOST_FTDC_PC_SpotOption '6' + +typedef char TThostFtdcProductClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstLifePhaseTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_IP_NotStart '0' +/// +#define THOST_FTDC_IP_Started '1' +///ͣ +#define THOST_FTDC_IP_Pause '2' +/// +#define THOST_FTDC_IP_Expired '3' + +typedef char TThostFtdcInstLifePhaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_D_Buy '0' +/// +#define THOST_FTDC_D_Sell '1' + +typedef char TThostFtdcDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionTypeTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ֲ +#define THOST_FTDC_PT_Net '1' +///ۺϳֲ +#define THOST_FTDC_PT_Gross '2' + +typedef char TThostFtdcPositionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPosiDirectionTypeһֲֶշ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PD_Net '1' +///ͷ +#define THOST_FTDC_PD_Long '2' +///ͷ +#define THOST_FTDC_PD_Short '3' + +typedef char TThostFtdcPosiDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysSettlementStatusTypeһϵͳ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_SS_NonActive '1' +/// +#define THOST_FTDC_SS_Startup '2' +/// +#define THOST_FTDC_SS_Operating '3' +/// +#define THOST_FTDC_SS_Settlement '4' +/// +#define THOST_FTDC_SS_SettlementFinished '5' + +typedef char TThostFtdcSysSettlementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRatioAttrTypeһ +///////////////////////////////////////////////////////////////////////// +///׷ +#define THOST_FTDC_RA_Trade '0' +/// +#define THOST_FTDC_RA_Settlement '1' + +typedef char TThostFtdcRatioAttrType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_HF_Speculation '1' +/// +#define THOST_FTDC_HF_Arbitrage '2' +///ױ +#define THOST_FTDC_HF_Hedge '3' + +typedef char TThostFtdcHedgeFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_BHF_Speculation '1' +/// +#define THOST_FTDC_BHF_Arbitrage '2' +///ױ +#define THOST_FTDC_BHF_Hedge '3' + +typedef char TThostFtdcBillHedgeFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDTypeTypeһױ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_CIDT_Speculation '1' +/// +#define THOST_FTDC_CIDT_Arbitrage '2' +///ױ +#define THOST_FTDC_CIDT_Hedge '3' + +typedef char TThostFtdcClientIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderPriceTypeTypeһ۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OPT_AnyPrice '1' +///޼ +#define THOST_FTDC_OPT_LimitPrice '2' +///ż +#define THOST_FTDC_OPT_BestPrice '3' +///¼ +#define THOST_FTDC_OPT_LastPrice '4' +///¼۸ϸ1ticks +#define THOST_FTDC_OPT_LastPricePlusOneTicks '5' +///¼۸ϸ2ticks +#define THOST_FTDC_OPT_LastPricePlusTwoTicks '6' +///¼۸ϸ3ticks +#define THOST_FTDC_OPT_LastPricePlusThreeTicks '7' +///һ +#define THOST_FTDC_OPT_AskPrice1 '8' +///һ۸ϸ1ticks +#define THOST_FTDC_OPT_AskPrice1PlusOneTicks '9' +///һ۸ϸ2ticks +#define THOST_FTDC_OPT_AskPrice1PlusTwoTicks 'A' +///һ۸ϸ3ticks +#define THOST_FTDC_OPT_AskPrice1PlusThreeTicks 'B' +///һ +#define THOST_FTDC_OPT_BidPrice1 'C' +///һ۸ϸ1ticks +#define THOST_FTDC_OPT_BidPrice1PlusOneTicks 'D' +///һ۸ϸ2ticks +#define THOST_FTDC_OPT_BidPrice1PlusTwoTicks 'E' +///һ۸ϸ3ticks +#define THOST_FTDC_OPT_BidPrice1PlusThreeTicks 'F' + +typedef char TThostFtdcOrderPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetFlagTypeһƽ־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OF_Open '0' +///ƽ +#define THOST_FTDC_OF_Close '1' +///ǿƽ +#define THOST_FTDC_OF_ForceClose '2' +///ƽ +#define THOST_FTDC_OF_CloseToday '3' +///ƽ +#define THOST_FTDC_OF_CloseYesterday '4' +///ǿ +#define THOST_FTDC_OF_ForceOff '5' +///ǿƽ +#define THOST_FTDC_OF_LocalForceClose '6' + +typedef char TThostFtdcOffsetFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseReasonTypeһǿƽԭ +///////////////////////////////////////////////////////////////////////// +///ǿƽ +#define THOST_FTDC_FCC_NotForceClose '0' +///ʽ +#define THOST_FTDC_FCC_LackDeposit '1' +///ͻ +#define THOST_FTDC_FCC_ClientOverPositionLimit '2' +///Ա +#define THOST_FTDC_FCC_MemberOverPositionLimit '3' +///ֲַ +#define THOST_FTDC_FCC_NotMultiple '4' +///Υ +#define THOST_FTDC_FCC_Violation '5' +/// +#define THOST_FTDC_FCC_Other '6' +///Ȼٽ +#define THOST_FTDC_FCC_PersonDeliv '7' + +typedef char TThostFtdcForceCloseReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ORDT_Normal '0' +/// +#define THOST_FTDC_ORDT_DeriveFromQuote '1' +/// +#define THOST_FTDC_ORDT_DeriveFromCombination '2' +///ϱ +#define THOST_FTDC_ORDT_Combination '3' +/// +#define THOST_FTDC_ORDT_ConditionalOrder '4' +/// +#define THOST_FTDC_ORDT_Swap '5' + +typedef char TThostFtdcOrderTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeConditionTypeһЧ +///////////////////////////////////////////////////////////////////////// +///ɣ +#define THOST_FTDC_TC_IOC '1' +///Ч +#define THOST_FTDC_TC_GFS '2' +///Ч +#define THOST_FTDC_TC_GFD '3' +///ָǰЧ +#define THOST_FTDC_TC_GTD '4' +///ǰЧ +#define THOST_FTDC_TC_GTC '5' +///ϾЧ +#define THOST_FTDC_TC_GFA '6' + +typedef char TThostFtdcTimeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeConditionTypeһɽ +///////////////////////////////////////////////////////////////////////// +///κ +#define THOST_FTDC_VC_AV '1' +///С +#define THOST_FTDC_VC_MV '2' +///ȫ +#define THOST_FTDC_VC_CV '3' + +typedef char TThostFtdcVolumeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContingentConditionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CC_Immediately '1' +///ֹ +#define THOST_FTDC_CC_Touch '2' +///ֹӮ +#define THOST_FTDC_CC_TouchProfit '3' +///Ԥ +#define THOST_FTDC_CC_ParkedOrder '4' +///¼۴ +#define THOST_FTDC_CC_LastPriceGreaterThanStopPrice '5' +///¼۴ڵ +#define THOST_FTDC_CC_LastPriceGreaterEqualStopPrice '6' +///¼С +#define THOST_FTDC_CC_LastPriceLesserThanStopPrice '7' +///¼Сڵ +#define THOST_FTDC_CC_LastPriceLesserEqualStopPrice '8' +///һ۴ +#define THOST_FTDC_CC_AskPriceGreaterThanStopPrice '9' +///һ۴ڵ +#define THOST_FTDC_CC_AskPriceGreaterEqualStopPrice 'A' +///һС +#define THOST_FTDC_CC_AskPriceLesserThanStopPrice 'B' +///һСڵ +#define THOST_FTDC_CC_AskPriceLesserEqualStopPrice 'C' +///һ۴ +#define THOST_FTDC_CC_BidPriceGreaterThanStopPrice 'D' +///һ۴ڵ +#define THOST_FTDC_CC_BidPriceGreaterEqualStopPrice 'E' +///һС +#define THOST_FTDC_CC_BidPriceLesserThanStopPrice 'F' +///һСڵ +#define THOST_FTDC_CC_BidPriceLesserEqualStopPrice 'H' + +typedef char TThostFtdcContingentConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActionFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +///ɾ +#define THOST_FTDC_AF_Delete '0' +///޸ +#define THOST_FTDC_AF_Modify '3' + +typedef char TThostFtdcActionFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRightTypeһȨ +///////////////////////////////////////////////////////////////////////// +///Խ +#define THOST_FTDC_TR_Allow '0' +///ֻƽ +#define THOST_FTDC_TR_CloseOnly '1' +///ܽ +#define THOST_FTDC_TR_Forbidden '2' + +typedef char TThostFtdcTradingRightType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSourceTypeһԴ +///////////////////////////////////////////////////////////////////////// +///Բ +#define THOST_FTDC_OSRC_Participant '0' +///ԹԱ +#define THOST_FTDC_OSRC_Administrator '1' + +typedef char TThostFtdcOrderSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTypeTypeһɽ +///////////////////////////////////////////////////////////////////////// +///ϳֲֲΪһֲ,ʼӦ͵ijֲ +#define THOST_FTDC_TRDT_SplitCombination '#' +///ͨɽ +#define THOST_FTDC_TRDT_Common '0' +///Ȩִ +#define THOST_FTDC_TRDT_OptionsExecution '1' +///OTCɽ +#define THOST_FTDC_TRDT_OTC '2' +///תɽ +#define THOST_FTDC_TRDT_EFPDerived '3' +///ɽ +#define THOST_FTDC_TRDT_CombinationDerived '4' + +typedef char TThostFtdcTradeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceSourceTypeһɽԴ +///////////////////////////////////////////////////////////////////////// +///ǰɽ +#define THOST_FTDC_PSRC_LastPrice '0' +///ίм +#define THOST_FTDC_PSRC_Buy '1' +///ίм +#define THOST_FTDC_PSRC_Sell '2' + +typedef char TThostFtdcPriceSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentStatusTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +///ǰ +#define THOST_FTDC_IS_BeforeTrading '0' +///ǽ +#define THOST_FTDC_IS_NoTrading '1' +/// +#define THOST_FTDC_IS_Continous '2' +///Ͼ۱ +#define THOST_FTDC_IS_AuctionOrdering '3' +///Ͼۼ۸ƽ +#define THOST_FTDC_IS_AuctionBalance '4' +///Ͼ۴ +#define THOST_FTDC_IS_AuctionMatch '5' +/// +#define THOST_FTDC_IS_Closed '6' + +typedef char TThostFtdcInstrumentStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstStatusEnterReasonTypeһƷֽ뽻״̬ԭ +///////////////////////////////////////////////////////////////////////// +///Զл +#define THOST_FTDC_IER_Automatic '1' +///ֶл +#define THOST_FTDC_IER_Manual '2' +///۶ +#define THOST_FTDC_IER_Fuse '3' + +typedef char TThostFtdcInstStatusEnterReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionRefTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcOrderActionRefType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstallCountTypeһװ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcInstallCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstallIDTypeһװ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcInstallIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcErrorIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSettlementIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFrontIDTypeһǰñ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFrontIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSessionIDTypeһỰ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSessionIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSequenceNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandNoTypeһDB +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCommandNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMillisecTypeһʱ䣨룩 +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMillisecType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeMultipleTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcVolumeMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingSegmentSNTypeһ׽׶α +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradingSegmentSNType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRequestIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRequestIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYearTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcYearType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMonthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBoolTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBoolType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcPriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombOffsetFlagTypeһϿƽ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombOffsetFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombHedgeFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRatioTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcRatioType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLargeVolumeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcLargeVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceSeriesTypeһϵк +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcSequenceSeriesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommPhaseNoTypeһͨѶʱα +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcCommPhaseNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceLabelTypeһб +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSequenceLabelType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUnderlyingMultipleTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcUnderlyingMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriorityTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcPriorityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContractCodeTypeһͬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcContractCodeType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCityTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCityType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsStockTypeһǷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIsStockType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcChannelTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcChannelType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAddressTypeһͨѶַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAddressType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcZipCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcZipCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTelephoneTypeһϵ绰 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTelephoneType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFaxTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFaxType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMobileTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMobileType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEMailTypeһʼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEMailType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMemoTypeһע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMemoType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCompanyCodeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCompanyCodeType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWebsiteTypeһվַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWebsiteType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTaxNoTypeһ˰ǼǺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTaxNoType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBatchStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δϴ +#define THOST_FTDC_BS_NoUpload '1' +///ϴ +#define THOST_FTDC_BS_Uploaded '2' +///ʧ +#define THOST_FTDC_BS_Failed '3' + +typedef char TThostFtdcBatchStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyIDTypeһԴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLicenseNoTypeһӪҵִպ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLicenseNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentIDTypeһ˴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentGroupIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentGroupIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentGroupNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentGroupNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnStyleTypeһƷַʽ +///////////////////////////////////////////////////////////////////////// +///Ʒ +#define THOST_FTDC_RS_All '1' +///Ʒ +#define THOST_FTDC_RS_ByProduct '2' + +typedef char TThostFtdcReturnStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnPatternTypeһģʽ +///////////////////////////////////////////////////////////////////////// +///ɽ +#define THOST_FTDC_RP_ByVolume '1' +/// +#define THOST_FTDC_RP_ByFeeOnHand '2' + +typedef char TThostFtdcReturnPatternType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnLevelTypeһ +///////////////////////////////////////////////////////////////////////// +///1 +#define THOST_FTDC_RL_Level1 '1' +///2 +#define THOST_FTDC_RL_Level2 '2' +///3 +#define THOST_FTDC_RL_Level3 '3' +///4 +#define THOST_FTDC_RL_Level4 '4' +///5 +#define THOST_FTDC_RL_Level5 '5' +///6 +#define THOST_FTDC_RL_Level6 '6' +///7 +#define THOST_FTDC_RL_Level7 '7' +///8 +#define THOST_FTDC_RL_Level8 '8' +///9 +#define THOST_FTDC_RL_Level9 '9' + +typedef char TThostFtdcReturnLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnStandardTypeһ׼ +///////////////////////////////////////////////////////////////////////// +///ֽ׶η +#define THOST_FTDC_RSD_ByPeriod '1' +///ijһ׼ +#define THOST_FTDC_RSD_ByStandard '2' + +typedef char TThostFtdcReturnStandardType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMortgageTypeTypeһѺ +///////////////////////////////////////////////////////////////////////// +///ʳ +#define THOST_FTDC_MT_Out '0' +/// +#define THOST_FTDC_MT_In '1' + +typedef char TThostFtdcMortgageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorSettlementParamIDTypeһͶ߽ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_ISPI_MortgageRatio '4' +///֤㷨 +#define THOST_FTDC_ISPI_MarginWay '5' +///㵥ǷѺ +#define THOST_FTDC_ISPI_BillDeposit '9' + +typedef char TThostFtdcInvestorSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeSettlementParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_ESPI_MortgageRatio '1' +///ʽ +#define THOST_FTDC_ESPI_OtherFundItem '2' +///ʽ뽻 +#define THOST_FTDC_ESPI_OtherFundImport '3' +///нͿý +#define THOST_FTDC_ESPI_CFFEXMinPrepa '6' +///֣㷽ʽ +#define THOST_FTDC_ESPI_CZCESettlementType '7' +///ȡʽ +#define THOST_FTDC_ESPI_ExchDelivFeeMode '9' +///Ͷ߽ȡʽ +#define THOST_FTDC_ESPI_DelivFeeMode '0' +///֣ϳֱֲ֤ȡʽ +#define THOST_FTDC_ESPI_CZCEComMarginType 'A' +///֤ǷŻ +#define THOST_FTDC_ESPI_DceComMarginType 'B' +///ֵȨ֤Żݱ +#define THOST_FTDC_ESPI_OptOutDisCountRate 'a' +///ͱϵ +#define THOST_FTDC_ESPI_OptMiniGuarantee 'b' + +typedef char TThostFtdcExchangeSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemParamIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +///ͶߴС +#define THOST_FTDC_SPI_InvestorIDMinLength '1' +///ͶʺŴС +#define THOST_FTDC_SPI_AccountIDMinLength '2' +///Ͷ߿Ĭϵ¼Ȩ +#define THOST_FTDC_SPI_UserRightLogon '3' +///Ͷ߽׽㵥ɽܷʽ +#define THOST_FTDC_SPI_SettlementBillTrade '4' +///ͳһ½ױ뷽ʽ +#define THOST_FTDC_SPI_TradingCode '5' +///Ƿжϴδ˵ijͷʽ +#define THOST_FTDC_SPI_CheckFund '6' +///ǷģȨ +#define THOST_FTDC_SPI_CommModelRight '7' +///Ƿñ֤ģȨ +#define THOST_FTDC_SPI_MarginModelRight '9' +///Ƿ淶ûܼ +#define THOST_FTDC_SPI_IsStandardActive '8' +///ϴĽļ· +#define THOST_FTDC_SPI_UploadSettlementFile 'U' +///ϱ֤ļ· +#define THOST_FTDC_SPI_DownloadCSRCFile 'D' +///ɵĽ㵥ļ· +#define THOST_FTDC_SPI_SettlementBillFile 'S' +///֤ļʶ +#define THOST_FTDC_SPI_CSRCOthersFile 'C' +///ͶƬ· +#define THOST_FTDC_SPI_InvestorPhoto 'P' +///ȫᾭ͹˾ϴļ· +#define THOST_FTDC_SPI_CSRCData 'R' +///¼뷽ʽ +#define THOST_FTDC_SPI_InvestorPwdModel 'I' +///Ͷнļ· +#define THOST_FTDC_SPI_CFFEXInvestorSettleFile 'F' +///Ͷߴ뷽ʽ +#define THOST_FTDC_SPI_InvestorIDType 'a' +///߻Ȩ +#define THOST_FTDC_SPI_FreezeMaxReMain 'r' +///زʵʱϳ +#define THOST_FTDC_SPI_IsSync 'A' +///Ȩ +#define THOST_FTDC_SPI_RelieveOpenLimit 'O' +///Ƿ淶û +#define THOST_FTDC_SPI_IsStandardFreeze 'X' +///֣Ƿ񿪷Ʒױ +#define THOST_FTDC_SPI_CZCENormalProductHedge 'B' + +typedef char TThostFtdcSystemParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeParamIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +///ϵͳ㷨 +#define THOST_FTDC_TPID_EncryptionStandard 'E' +///ϵͳ㷨 +#define THOST_FTDC_TPID_RiskMode 'R' +///ϵͳ㷨Ƿȫ 0- 1- +#define THOST_FTDC_TPID_RiskModeGlobal 'G' +///㷨 +#define THOST_FTDC_TPID_modeEncode 'P' +///۸Сλ +#define THOST_FTDC_TPID_tickMode 'T' +///ûỰ +#define THOST_FTDC_TPID_SingleUserSessionMaxNum 'S' +///¼ʧ +#define THOST_FTDC_TPID_LoginFailMaxNum 'L' +///Ƿǿ֤ +#define THOST_FTDC_TPID_IsAuthForce 'A' + +typedef char TThostFtdcTradeParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementParamValueTypeһֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettlementParamValueType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCounterIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCounterIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorGroupNameTypeһͶ߷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorGroupNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrandCodeTypeһƺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrandCodeType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWarehouseTypeһֿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWarehouseType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductDateType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGradeTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcGradeType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClassifyTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClassifyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPositionType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYieldlyTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcYieldlyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWeightTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWeightType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubEntryFundNoTypeһʽˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSubEntryFundNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileIDTypeһļʶ +///////////////////////////////////////////////////////////////////////// +///ʽ +#define THOST_FTDC_FI_SettlementFund 'F' +///ɽ +#define THOST_FTDC_FI_Trade 'T' +///Ͷֲ߳ +#define THOST_FTDC_FI_InvestorPosition 'P' +///Ͷ߷ʽ +#define THOST_FTDC_FI_SubEntryFund 'O' +///ϳֲ +#define THOST_FTDC_FI_CZCECombinationPos 'C' +///ϱ֤ +#define THOST_FTDC_FI_CSRCData 'R' +///֣ƽ˽ +#define THOST_FTDC_FI_CZCEClose 'L' +///֣ƽ˽ +#define THOST_FTDC_FI_CZCENoClose 'N' +///ֲϸ +#define THOST_FTDC_FI_PositionDtl 'D' +///Ȩִļ +#define THOST_FTDC_FI_OptionStrike 'S' +///۱ȶļ +#define THOST_FTDC_FI_SettlementPriceComparison 'M' +///dzֱֲ䶯ϸ +#define THOST_FTDC_FI_NonTradePosChange 'B' + +typedef char TThostFtdcFileIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFileNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileTypeTypeһļϴ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FUT_Settlement '0' +///˶ +#define THOST_FTDC_FUT_Check '1' + +typedef char TThostFtdcFileTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileFormatTypeһļʽ +///////////////////////////////////////////////////////////////////////// +///ıļ(.txt) +#define THOST_FTDC_FFT_Txt '0' +///ѹļ(.zip) +#define THOST_FTDC_FFT_Zip '1' +///DBFļ(.dbf) +#define THOST_FTDC_FFT_DBF '2' + +typedef char TThostFtdcFileFormatType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileUploadStatusTypeһļ״̬ +///////////////////////////////////////////////////////////////////////// +///ϴɹ +#define THOST_FTDC_FUS_SucceedUpload '1' +///ϴʧ +#define THOST_FTDC_FUS_FailedUpload '2' +///ɹ +#define THOST_FTDC_FUS_SucceedLoad '3' +///벿ֳɹ +#define THOST_FTDC_FUS_PartSucceedLoad '4' +///ʧ +#define THOST_FTDC_FUS_FailedLoad '5' + +typedef char TThostFtdcFileUploadStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferDirectionTypeһƲַ +///////////////////////////////////////////////////////////////////////// +///Ƴ +#define THOST_FTDC_TD_Out '0' +/// +#define THOST_FTDC_TD_In '1' + +typedef char TThostFtdcTransferDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUploadModeTypeһϴļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUploadModeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountIDTypeһͶʺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAccountIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankFlagTypeһͳһʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankFlagType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenNameTypeһ˻Ŀ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOpenNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenBankTypeһ˻Ŀ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOpenBankType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPublishPathTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPublishPathType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperatorIDType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthCountTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMonthCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAdvanceMonthArrayTypeһ·ǰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAdvanceMonthArrayType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDateExprTypeһڱʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDateExprType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDExprTypeһԼʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDExprType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentNameExprTypeһԼƱʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentNameExprType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSpecialCreateRuleTypeһĴ +///////////////////////////////////////////////////////////////////////// +///ûⴴ +#define THOST_FTDC_SC_NoSpecialRule '0' +/// +#define THOST_FTDC_SC_NoSpringFestival '1' + +typedef char TThostFtdcSpecialCreateRuleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBasisPriceTypeTypeһƻ׼ +///////////////////////////////////////////////////////////////////////// +///һԼ +#define THOST_FTDC_IPT_LastSettlement '1' +///һԼ̼ +#define THOST_FTDC_IPT_LaseClose '2' + +typedef char TThostFtdcBasisPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductLifePhaseTypeһƷ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_PLP_Active '1' +///Ծ +#define THOST_FTDC_PLP_NonActive '2' +///ע +#define THOST_FTDC_PLP_Canceled '3' + +typedef char TThostFtdcProductLifePhaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeliveryModeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///ֽ𽻸 +#define THOST_FTDC_DM_CashDeliv '1' +///ʵサ +#define THOST_FTDC_DM_CommodityDeliv '2' + +typedef char TThostFtdcDeliveryModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLogLevelTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLogLevelType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessNameTypeһ洢 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperationMemoTypeһժҪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperationMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundIOTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FIOT_FundIO '1' +///ת +#define THOST_FTDC_FIOT_Transfer '2' +///ڻ +#define THOST_FTDC_FIOT_SwapCurrency '3' + +typedef char TThostFtdcFundIOTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundTypeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_FT_Deposite '1' +///ʽ +#define THOST_FTDC_FT_ItemFund '2' +///˾ +#define THOST_FTDC_FT_Company '3' +///ʽת +#define THOST_FTDC_FT_InnerTransfer '4' + +typedef char TThostFtdcFundTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FD_In '1' +/// +#define THOST_FTDC_FD_Out '2' + +typedef char TThostFtdcFundDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundStatusTypeһʽ״̬ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_FS_Record '1' +///Ѹ +#define THOST_FTDC_FS_Check '2' +///ѳ +#define THOST_FTDC_FS_Charge '3' + +typedef char TThostFtdcFundStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillNoTypeһƱݺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBillNoType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillNameTypeһƱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBillNameType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPublishStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PS_None '1' +///ڷ +#define THOST_FTDC_PS_Publishing '2' +///ѷ +#define THOST_FTDC_PS_Published '3' + +typedef char TThostFtdcPublishStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueIDTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueIDType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueTypeTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueLabelTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueLabelType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueResultTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueResultType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemStatusTypeһϵͳ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_ES_NonActive '1' +/// +#define THOST_FTDC_ES_Startup '2' +///׿ʼʼ +#define THOST_FTDC_ES_Initialize '3' +///ɳʼ +#define THOST_FTDC_ES_Initialized '4' +///пʼ +#define THOST_FTDC_ES_Close '5' +/// +#define THOST_FTDC_ES_Closed '6' +/// +#define THOST_FTDC_ES_Settlement '7' + +typedef char TThostFtdcSystemStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ʼ +#define THOST_FTDC_STS_Initialize '0' +/// +#define THOST_FTDC_STS_Settlementing '1' +///ѽ +#define THOST_FTDC_STS_Settlemented '2' +/// +#define THOST_FTDC_STS_Finished '3' + +typedef char TThostFtdcSettlementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntTypeTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntFromTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntFromType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntToTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntToType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionIDTypeһܴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionIDType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionValueCodeTypeһܱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionValueCodeType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleIDTypeһɫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRoleIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleNameTypeһɫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRoleNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDescriptionTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDescriptionType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombineIDTypeһϱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombineIDType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombineTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombineTypeType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CT_Person '0' +/// +#define THOST_FTDC_CT_Company '1' +///Ͷʻ +#define THOST_FTDC_CT_Fund '2' +///ⷨ +#define THOST_FTDC_CT_SpecialOrgan '3' +///ʹܻ +#define THOST_FTDC_CT_Asset '4' + +typedef char TThostFtdcInvestorTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerTypeTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +///׻Ա +#define THOST_FTDC_BT_Trade '0' +///׽Ա +#define THOST_FTDC_BT_TradeSettle '1' + +typedef char TThostFtdcBrokerTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskLevelTypeһյȼ +///////////////////////////////////////////////////////////////////////// +///ͷտͻ +#define THOST_FTDC_FAS_Low '1' +///ͨͻ +#define THOST_FTDC_FAS_Normal '2' +///עͻ +#define THOST_FTDC_FAS_Focus '3' +///տͻ +#define THOST_FTDC_FAS_Risk '4' + +typedef char TThostFtdcRiskLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFeeAcceptStyleTypeһȡʽ +///////////////////////////////////////////////////////////////////////// +///ȡ +#define THOST_FTDC_FAS_ByTrade '1' +///ȡ +#define THOST_FTDC_FAS_ByDeliv '2' +/// +#define THOST_FTDC_FAS_None '3' +///ָȡ +#define THOST_FTDC_FAS_FixFee '4' + +typedef char TThostFtdcFeeAcceptStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PWDT_Trade '1' +///ʽ +#define THOST_FTDC_PWDT_Account '2' + +typedef char TThostFtdcPasswordTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAlgorithmTypeһӯ㷨 +///////////////////////////////////////////////////////////////////////// +///ӯ +#define THOST_FTDC_AG_All '1' +///ӯƣ +#define THOST_FTDC_AG_OnlyLost '2' +///ӯƣ +#define THOST_FTDC_AG_OnlyGain '3' +///ӯ +#define THOST_FTDC_AG_None '4' + +typedef char TThostFtdcAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIncludeCloseProfitTypeһǷƽӯ +///////////////////////////////////////////////////////////////////////// +///ƽӯ +#define THOST_FTDC_ICP_Include '0' +///ƽӯ +#define THOST_FTDC_ICP_NotInclude '2' + +typedef char TThostFtdcIncludeCloseProfitType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAllWithoutTradeTypeһǷܿ +///////////////////////////////////////////////////////////////////////// +///޲޳ɽܿ +#define THOST_FTDC_AWT_Enable '0' +///ܿ +#define THOST_FTDC_AWT_Disable '2' +///޲ֲܿ +#define THOST_FTDC_AWT_NoHoldEnable '3' + +typedef char TThostFtdcAllWithoutTradeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommentTypeһӯ㷨˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommentType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVersionTypeһ汾 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcVersionType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeCodeTypeһ״ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeSerialType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSerialNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradeSerialNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureIDTypeһڻ˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankIDTypeһд +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankBrchIDTypeһзĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankBrchIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankBranchIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankBranchIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperNoTypeһ׹Ա +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperNoType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeviceIDTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDeviceIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRecordNumTypeһ¼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRecordNumType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccountTypeһڻʽ˺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccountType[22]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFuturePwdFlagTypeһʽ˶Ա־ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_FPWD_UnCheck '0' +///˶ +#define THOST_FTDC_FPWD_Check '1' + +typedef char TThostFtdcFuturePwdFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferTypeTypeһת +///////////////////////////////////////////////////////////////////////// +///תڻ +#define THOST_FTDC_TT_BankToFuture '0' +///ڻת +#define THOST_FTDC_TT_FutureToBank '1' + +typedef char TThostFtdcTransferTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccPwdTypeһڻʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccPwdType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyCodeType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRetCodeTypeһӦ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRetCodeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRetInfoTypeһӦϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRetInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeAmtTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUseAmtTypeһп +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUseAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFetchAmtTypeһпȡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFetchAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferValidFlagTypeһתЧ־ +///////////////////////////////////////////////////////////////////////// +///Чʧ +#define THOST_FTDC_TVF_Invalid '0' +///Ч +#define THOST_FTDC_TVF_Valid '1' +/// +#define THOST_FTDC_TVF_Reverse '2' + +typedef char TThostFtdcTransferValidFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCertCodeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCertCodeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReasonTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_RN_CD '0' +///ʽ; +#define THOST_FTDC_RN_ZT '1' +/// +#define THOST_FTDC_RN_QT '2' + +typedef char TThostFtdcReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundProjectIDTypeһʽĿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFundProjectIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSexTypeһԱ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_SEX_None '0' +/// +#define THOST_FTDC_SEX_Man '1' +///Ů +#define THOST_FTDC_SEX_Woman '2' + +typedef char TThostFtdcSexType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProfessionTypeһְҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProfessionType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNationalTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNationalType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProvinceTypeһʡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProvinceType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRegionTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRegionType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCountryTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCountryType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLicenseNOTypeһӪҵִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLicenseNOType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCompanyTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCompanyTypeType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessScopeTypeһӪΧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessScopeType[1001]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCapitalCurrencyTypeһעʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCapitalCurrencyType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserTypeTypeһû +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_UT_Investor '0' +///Ա +#define THOST_FTDC_UT_Operator '1' +///Ա +#define THOST_FTDC_UT_SuperUser '2' + +typedef char TThostFtdcUserTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_RATETYPE_MarginRate '2' + +typedef char TThostFtdcRateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNoteTypeTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +///׽㵥 +#define THOST_FTDC_NOTETYPE_TradeSettleBill '1' +///׽± +#define THOST_FTDC_NOTETYPE_TradeSettleMonth '2' +///׷ӱ֤֪ͨ +#define THOST_FTDC_NOTETYPE_CallMarginNotes '3' +///ǿƽ֪ͨ +#define THOST_FTDC_NOTETYPE_ForceCloseNotes '4' +///ɽ֪ͨ +#define THOST_FTDC_NOTETYPE_TradeNotes '5' +///֪ͨ +#define THOST_FTDC_NOTETYPE_DelivNotes '6' + +typedef char TThostFtdcNoteTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementStyleTypeһ㵥ʽ +///////////////////////////////////////////////////////////////////////// +///ն +#define THOST_FTDC_SBS_Day '1' +///ʶԳ +#define THOST_FTDC_SBS_Volume '2' + +typedef char TThostFtdcSettlementStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerDNSTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerDNSType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSentenceTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSentenceType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementBillTypeTypeһ㵥 +///////////////////////////////////////////////////////////////////////// +///ձ +#define THOST_FTDC_ST_Day '0' +///± +#define THOST_FTDC_ST_Month '1' + +typedef char TThostFtdcSettlementBillTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserRightTypeTypeһͻȨ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_URT_Logon '1' +///ת +#define THOST_FTDC_URT_Transfer '2' +///ʼĽ㵥 +#define THOST_FTDC_URT_EMail '3' +///㵥 +#define THOST_FTDC_URT_Fax '4' +/// +#define THOST_FTDC_URT_ConditionOrder '5' + +typedef char TThostFtdcUserRightTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginPriceTypeTypeһ֤۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_MPT_PreSettlementPrice '1' +///¼ +#define THOST_FTDC_MPT_SettlementPrice '2' +///ɽ +#define THOST_FTDC_MPT_AveragePrice '3' +///ּ +#define THOST_FTDC_MPT_OpenPrice '4' + +typedef char TThostFtdcMarginPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillGenStatusTypeһ㵥״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_BGS_None '0' +/// +#define THOST_FTDC_BGS_NoGenerated '1' +/// +#define THOST_FTDC_BGS_Generated '2' + +typedef char TThostFtdcBillGenStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAlgoTypeTypeһ㷨 +///////////////////////////////////////////////////////////////////////// +///ֲִ㷨 +#define THOST_FTDC_AT_HandlePositionAlgo '1' +///Ѱұ֤㷨 +#define THOST_FTDC_AT_FindMarginRateAlgo '2' + +typedef char TThostFtdcAlgoTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandlePositionAlgoIDTypeһֲִ㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HPA_Base '1' +///Ʒ +#define THOST_FTDC_HPA_DCE '2' +///֣Ʒ +#define THOST_FTDC_HPA_CZCE '3' + +typedef char TThostFtdcHandlePositionAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFindMarginRateAlgoIDTypeһѰұ֤㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FMRA_Base '1' +///Ʒ +#define THOST_FTDC_FMRA_DCE '2' +///֣Ʒ +#define THOST_FTDC_FMRA_CZCE '3' + +typedef char TThostFtdcFindMarginRateAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandleTradingAccountAlgoIDTypeһʽ㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HTAA_Base '1' +///Ʒ +#define THOST_FTDC_HTAA_DCE '2' +///֣Ʒ +#define THOST_FTDC_HTAA_CZCE '3' + +typedef char TThostFtdcHandleTradingAccountAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPersonTypeTypeһϵ +///////////////////////////////////////////////////////////////////////// +///ָµ +#define THOST_FTDC_PST_Order '1' +///Ȩ +#define THOST_FTDC_PST_Open '2' +///ʽ +#define THOST_FTDC_PST_Fund '3' +///㵥ȷ +#define THOST_FTDC_PST_Settlement '4' +/// +#define THOST_FTDC_PST_Company '5' +///˴ +#define THOST_FTDC_PST_Corporation '6' +///Ͷϵ +#define THOST_FTDC_PST_LinkMan '7' +///ֻʲ +#define THOST_FTDC_PST_Ledger '8' +///У +#define THOST_FTDC_PST_Trustee '9' +///Уܻ˴ +#define THOST_FTDC_PST_TrusteeCorporation 'A' +///УܻȨ +#define THOST_FTDC_PST_TrusteeOpen 'B' +///Уܻϵ +#define THOST_FTDC_PST_TrusteeContact 'C' +///Ȼ˲ο֤ +#define THOST_FTDC_PST_ForeignerRefer 'D' +///˴ο֤ +#define THOST_FTDC_PST_CorporationRefer 'E' + +typedef char TThostFtdcPersonTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQueryInvestorRangeTypeһѯΧ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_QIR_All '1' +///ѯ +#define THOST_FTDC_QIR_Group '2' +///һͶ +#define THOST_FTDC_QIR_Single '3' + +typedef char TThostFtdcQueryInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorRiskStatusTypeһͶ߷״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IRS_Normal '1' +/// +#define THOST_FTDC_IRS_Warn '2' +///׷ +#define THOST_FTDC_IRS_Call '3' +///ǿƽ +#define THOST_FTDC_IRS_Force '4' +///쳣 +#define THOST_FTDC_IRS_Exception '5' + +typedef char TThostFtdcInvestorRiskStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLegIDTypeһȱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLegIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLegMultipleTypeһȳ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLegMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcImplyLevelTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcImplyLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearAccountType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganNOTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganNOType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearbarchIDTypeһ˻к +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearbarchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventTypeTypeһû¼ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_UET_Login '1' +///dz +#define THOST_FTDC_UET_Logout '2' +///׳ɹ +#define THOST_FTDC_UET_Trading '3' +///ʧ +#define THOST_FTDC_UET_TradingError '4' +///޸ +#define THOST_FTDC_UET_UpdatePassword '5' +///ͻ֤ +#define THOST_FTDC_UET_Authenticate '6' +/// +#define THOST_FTDC_UET_Other '9' + +typedef char TThostFtdcUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventInfoTypeһû¼Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserEventInfoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCloseStyleTypeһƽַʽ +///////////////////////////////////////////////////////////////////////// +///ȿƽ +#define THOST_FTDC_ICS_Close '0' +///ƽƽ +#define THOST_FTDC_ICS_CloseToday '1' + +typedef char TThostFtdcCloseStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStatModeTypeһͳƷʽ +///////////////////////////////////////////////////////////////////////// +///---- +#define THOST_FTDC_SM_Non '0' +///Լͳ +#define THOST_FTDC_SM_Instrument '1' +///Ʒͳ +#define THOST_FTDC_SM_Product '2' +///Ͷͳ +#define THOST_FTDC_SM_Investor '3' + +typedef char TThostFtdcStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParkedOrderStatusTypeһԤ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PAOS_NotSend '1' +///ѷ +#define THOST_FTDC_PAOS_Send '2' +///ɾ +#define THOST_FTDC_PAOS_Deleted '3' + +typedef char TThostFtdcParkedOrderStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParkedOrderIDTypeһԤ񱨵 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParkedOrderIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParkedOrderActionIDTypeһԤ񳷵 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParkedOrderActionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirDealStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ڴ +#define THOST_FTDC_VDS_Dealing '1' +///ɹ +#define THOST_FTDC_VDS_DeaclSucceed '2' + +typedef char TThostFtdcVirDealStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrgSystemIDTypeһԭϵͳ +///////////////////////////////////////////////////////////////////////// +///ۺϽƽ̨ +#define THOST_FTDC_ORGS_Standard '0' +///ʢϵͳ +#define THOST_FTDC_ORGS_ESunny '1' +///˴V6ϵͳ +#define THOST_FTDC_ORGS_KingStarV6 '2' + +typedef char TThostFtdcOrgSystemIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirTradeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VTS_NaturalDeal '0' +///ɹ +#define THOST_FTDC_VTS_SucceedEnd '1' +///ʧܽ +#define THOST_FTDC_VTS_FailedEND '2' +///쳣 +#define THOST_FTDC_VTS_Exception '3' +///˹쳣 +#define THOST_FTDC_VTS_ManualDeal '4' +///ͨѶ쳣 ˹ +#define THOST_FTDC_VTS_MesException '5' +///ϵͳ˹ +#define THOST_FTDC_VTS_SysException '6' + +typedef char TThostFtdcVirTradeStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirBankAccTypeTypeһʻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VBAT_BankBook '1' +/// +#define THOST_FTDC_VBAT_BankCard '2' +///ÿ +#define THOST_FTDC_VBAT_CreditCard '3' + +typedef char TThostFtdcVirBankAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementStatusTypeһʻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VMS_Natural '0' +/// +#define THOST_FTDC_VMS_Canceled '9' + +typedef char TThostFtdcVirementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementAvailAbilityTypeһЧ־ +///////////////////////////////////////////////////////////////////////// +///δȷ +#define THOST_FTDC_VAA_NoAvailAbility '0' +///Ч +#define THOST_FTDC_VAA_AvailAbility '1' +/// +#define THOST_FTDC_VAA_Repeal '2' + +typedef char TThostFtdcVirementAvailAbilityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementTradeCodeTypeһ״ +///////////////////////////////////////////////////////////////////////// +///зʽתڻ +#define THOST_FTDC_VTC_BankBankToFuture '102001' +///зڻʽת +#define THOST_FTDC_VTC_BankFutureToBank '102002' +///ڻʽתڻ +#define THOST_FTDC_VTC_FutureBankToFuture '202001' +///ڻڻʽת +#define THOST_FTDC_VTC_FutureFutureToBank '202002' + +typedef char TThostFtdcVirementTradeCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoTypeNameTypeһӰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoTypeNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoTypeIDTypeһӰʹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoTypeIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoNameTypeһӰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoNameType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTopicIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTopicIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReportTypeIDTypeһױͱʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcReportTypeIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCharacterIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCharacterIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLParamIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInvestorTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInvestorTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLIdCardTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLIdCardTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradeDirectTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradeDirectType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradeModelTypeһʽʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradeModelType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLParamIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLOpParamValueTypeһҵֵ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcAMLOpParamValueType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCustomerCardTypeTypeһͻ֤/֤ļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCustomerCardTypeType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionNameTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLDistrictIDTypeһڻڵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLDistrictIDType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLRelationShipTypeһڻ׵Ĺϵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLRelationShipType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionTypeTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionIDTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLAccountTypeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradingTypeTypeһ׷ʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradingTypeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTransactClassTypeһ֧׷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTransactClassType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCapitalIOTypeһʽոʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCapitalIOType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSiteTypeһ׵ص +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSiteType[10]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCapitalPurposeTypeһʽ; +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCapitalPurposeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLReportTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLReportTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSerialNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSerialNoType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLStatusType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLGenStatusTypeһAmlɷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_GEN_Program '0' +///˹ +#define THOST_FTDC_GEN_HandWork '1' + +typedef char TThostFtdcAMLGenStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSeqCodeTypeһҵʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSeqCodeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLFileNameTypeһAMLļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLFileNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLMoneyTypeһϴǮʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcAMLMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLFileAmountTypeһϴǮʽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcAMLFileAmountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCKeyTypeһԿ(֤) +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCFMMCKeyType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCTokenTypeһ(֤) +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCFMMCTokenType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCKeyKindTypeһ̬Կ(֤) +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CFMMCKK_REQUEST 'R' +///CFMMCԶ +#define THOST_FTDC_CFMMCKK_AUTO 'A' +///CFMMCֶ +#define THOST_FTDC_CFMMCKK_MANUAL 'M' + +typedef char TThostFtdcCFMMCKeyKindType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLReportNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLReportNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIndividualNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIndividualNameType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyIDTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustNumberTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCustNumberType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganCodeType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSuperOrganCodeTypeһϼ,ڻ˾ܲ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSuperOrganCodeType[12]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubBranchIDTypeһ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSubBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubBranchNameTypeһ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSubBranchNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchNetCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBranchNetCodeType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchNetNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBranchNetNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganFlagTypeһʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankCodingForFutureTypeһжڻ˾ı +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankCodingForFutureType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankReturnCodeTypeһжԷĶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankReturnCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPlateReturnCodeTypeһתƽ̨ԷĶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPlateReturnCodeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankSubBranchIDTypeһз֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankSubBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureBranchIDTypeһڻ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnCodeTypeһش +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcReturnCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorCodeTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperatorCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearDepIDTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearDepIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearBrchIDTypeһʻк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearBrchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearNameTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountNameTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvDepIDTypeһͶ˺Ż +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvDepIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvBrchIDTypeһͶк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvBrchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMessageFormatVersionTypeһϢʽ汾 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMessageFormatVersionType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDigestTypeһժҪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDigestType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthenticDataTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthenticDataType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPasswordKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccountNameTypeһڻʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccountNameType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMobilePhoneTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMobilePhoneType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureMainKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureMainKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureWorkKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureWorkKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureTransKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureTransKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankMainKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankMainKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankWorkKeyTypeһйԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankWorkKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankTransKeyTypeһдԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankTransKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankServerDescriptionTypeһзϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankServerDescriptionType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAddInfoTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAddInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDescrInfoForReturnCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDescrInfoForReturnCodeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCountryCodeTypeһҴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCountryCodeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPlateSerialTypeһƽ̨ˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcPlateSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankSerialType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCorrectSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCorrectSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureSerialTypeһڻ˾ˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFutureSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplicationIDTypeһӦñʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcApplicationIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankProxyIDTypeһдʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBankProxyIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTCoreIDTypeһתʺϵͳʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBTCoreIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServerPortTypeһ˿ں +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServerPortType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepealedTimesTypeһѾ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRepealedTimesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepealTimeIntervalTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRepealTimeIntervalType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTotalTimesTypeһÿۼתʴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTotalTimesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTRequestIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBTRequestIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeAmountTypeһ׽Ԫ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcTradeAmountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustFeeTypeһӦտͻãԪ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCustFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureFeeTypeһӦڻ˾ãԪ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcFutureFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSingleMaxAmtTypeһ޶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcSingleMaxAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSingleMinAmtTypeһ޶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcSingleMinAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTotalAmtTypeһÿۼתʶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcTotalAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCertificationTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_CFT_IDCard '0' +/// +#define THOST_FTDC_CFT_Passport '1' +///֤ +#define THOST_FTDC_CFT_OfficerIDCard '2' +///ʿ֤ +#define THOST_FTDC_CFT_SoldierIDCard '3' +///֤ +#define THOST_FTDC_CFT_HomeComingCard '4' +///ڲ +#define THOST_FTDC_CFT_HouseholdRegister '5' +///Ӫҵִպ +#define THOST_FTDC_CFT_LicenseNo '6' +///֤֯ +#define THOST_FTDC_CFT_InstitutionCodeCard '7' +///ʱӪҵִպ +#define THOST_FTDC_CFT_TempLicenseNo '8' +///ҵǼ֤ +#define THOST_FTDC_CFT_NoEnterpriseLicenseNo '9' +///֤ +#define THOST_FTDC_CFT_OtherCard 'x' +///ܲ +#define THOST_FTDC_CFT_SuperDepAgree 'a' + +typedef char TThostFtdcCertificationTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileBusinessCodeTypeһļҵ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBC_Others '0' +///ת˽ϸ +#define THOST_FTDC_FBC_TransferDetails '1' +///ͻ˻״̬ +#define THOST_FTDC_FBC_CustAccStatus '2' +///˻ཻϸ +#define THOST_FTDC_FBC_AccountTradeDetails '3' +///ڻ˻Ϣϸ +#define THOST_FTDC_FBC_FutureAccountChangeInfoDetails '4' +///ͻʽ̨ϸ +#define THOST_FTDC_FBC_CustMoneyDetail '5' +///ͻϢϸ +#define THOST_FTDC_FBC_CustCancelAccountInfo '6' +///ͻʽ˽ +#define THOST_FTDC_FBC_CustMoneyResult '7' +///쳣ļ +#define THOST_FTDC_FBC_OthersExceptionResult '8' +///ͻϢϸ +#define THOST_FTDC_FBC_CustInterestNetMoneyDetails '9' +///ͻʽϸ +#define THOST_FTDC_FBC_CustMoneySendAndReceiveDetails 'a' +///˴ʽջ +#define THOST_FTDC_FBC_CorporationMoneyTotal 'b' +///ʽջ +#define THOST_FTDC_FBC_MainbodyMoneyTotal 'c' +///ܷƽ +#define THOST_FTDC_FBC_MainPartMonitorData 'd' +///б +#define THOST_FTDC_FBC_PreparationMoney 'e' +///Эʽ +#define THOST_FTDC_FBC_BankMoneyMonitorData 'f' + +typedef char TThostFtdcFileBusinessCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCashExchangeCodeTypeһ㳮־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CEC_Exchange '1' +/// +#define THOST_FTDC_CEC_Cash '2' + +typedef char TThostFtdcCashExchangeCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYesNoIndicatorTypeһǻʶ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_YNI_Yes '0' +/// +#define THOST_FTDC_YNI_No '1' + +typedef char TThostFtdcYesNoIndicatorType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBanlanceTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ǰ +#define THOST_FTDC_BLT_CurrentMoney '0' +/// +#define THOST_FTDC_BLT_UsableMoney '1' +///ȡ +#define THOST_FTDC_BLT_FetchableMoney '2' +/// +#define THOST_FTDC_BLT_FreezeMoney '3' + +typedef char TThostFtdcBanlanceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGenderTypeһԱ +///////////////////////////////////////////////////////////////////////// +///δ֪״̬ +#define THOST_FTDC_GD_Unknown '0' +/// +#define THOST_FTDC_GD_Male '1' +///Ů +#define THOST_FTDC_GD_Female '2' + +typedef char TThostFtdcGenderType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFeePayFlagTypeһ֧־ +///////////////////////////////////////////////////////////////////////// +///淽֧ +#define THOST_FTDC_FPF_BEN '0' +///ɷͷ֧ +#define THOST_FTDC_FPF_OUR '1' +///ɷͷ֧ķã淽֧ܵķ +#define THOST_FTDC_FPF_SHA '2' + +typedef char TThostFtdcFeePayFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPassWordKeyTypeTypeһԿ +///////////////////////////////////////////////////////////////////////// +///Կ +#define THOST_FTDC_PWKT_ExchangeKey '0' +///Կ +#define THOST_FTDC_PWKT_PassWordKey '1' +///MACԿ +#define THOST_FTDC_PWKT_MACKey '2' +///Կ +#define THOST_FTDC_PWKT_MessageKey '3' + +typedef char TThostFtdcPassWordKeyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTPassWordTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ѯ +#define THOST_FTDC_PWT_Query '0' +///ȡ +#define THOST_FTDC_PWT_Fetch '1' +///ת +#define THOST_FTDC_PWT_Transfer '2' +/// +#define THOST_FTDC_PWT_Trade '3' + +typedef char TThostFtdcFBTPassWordTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTEncryModeTypeһܷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EM_NoEncry '0' +///DES +#define THOST_FTDC_EM_DES '1' +///3DES +#define THOST_FTDC_EM_3DES '2' + +typedef char TThostFtdcFBTEncryModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankRepealFlagTypeһг־ +///////////////////////////////////////////////////////////////////////// +///Զ +#define THOST_FTDC_BRF_BankNotNeedRepeal '0' +///дԶ +#define THOST_FTDC_BRF_BankWaitingRepeal '1' +///Զ +#define THOST_FTDC_BRF_BankBeenRepealed '2' + +typedef char TThostFtdcBankRepealFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerRepealFlagTypeһ̳־ +///////////////////////////////////////////////////////////////////////// +///Զ +#define THOST_FTDC_BRORF_BrokerNotNeedRepeal '0' +///̴Զ +#define THOST_FTDC_BRORF_BrokerWaitingRepeal '1' +///Զ +#define THOST_FTDC_BRORF_BrokerBeenRepealed '2' + +typedef char TThostFtdcBrokerRepealFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstitutionTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TS_Bank '0' +/// +#define THOST_FTDC_TS_Future '1' +///ȯ +#define THOST_FTDC_TS_Store '2' + +typedef char TThostFtdcInstitutionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastFragmentTypeһƬ־ +///////////////////////////////////////////////////////////////////////// +///Ƭ +#define THOST_FTDC_LF_Yes '0' +///Ƭ +#define THOST_FTDC_LF_No '1' + +typedef char TThostFtdcLastFragmentType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccStatusTypeһ˻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_BAS_Normal '0' +/// +#define THOST_FTDC_BAS_Freeze '1' +///ʧ +#define THOST_FTDC_BAS_ReportLoss '2' + +typedef char TThostFtdcBankAccStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoneyAccountStatusTypeһʽ˻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_MAS_Normal '0' +/// +#define THOST_FTDC_MAS_Cancel '1' + +typedef char TThostFtdcMoneyAccountStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcManageStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ָ +#define THOST_FTDC_MSS_Point '0' +///Ԥָ +#define THOST_FTDC_MSS_PrePoint '1' +///ָ +#define THOST_FTDC_MSS_CancelPoint '2' + +typedef char TThostFtdcManageStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemTypeTypeһӦϵͳ +///////////////////////////////////////////////////////////////////////// +///ת +#define THOST_FTDC_SYT_FutureBankTransfer '0' +///֤ת +#define THOST_FTDC_SYT_StockBankTransfer '1' +/// +#define THOST_FTDC_SYT_TheThirdPartStore '2' + +typedef char TThostFtdcSystemTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTxnEndFlagTypeһתʻת־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TEF_NormalProcessing '0' +///ɹ +#define THOST_FTDC_TEF_Success '1' +///ʧܽ +#define THOST_FTDC_TEF_Failed '2' +///쳣 +#define THOST_FTDC_TEF_Abnormal '3' +///˹쳣 +#define THOST_FTDC_TEF_ManualProcessedForException '4' +///ͨѶ쳣 ˹ +#define THOST_FTDC_TEF_CommuFailedNeedManualProcess '5' +///ϵͳ˹ +#define THOST_FTDC_TEF_SysErrorNeedManualProcess '6' + +typedef char TThostFtdcTxnEndFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessStatusTypeһתʷ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PSS_NotProcess '0' +///ʼ +#define THOST_FTDC_PSS_StartProcess '1' +/// +#define THOST_FTDC_PSS_Finished '2' + +typedef char TThostFtdcProcessStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustTypeTypeһͻ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CUSTT_Person '0' +/// +#define THOST_FTDC_CUSTT_Institution '1' + +typedef char TThostFtdcCustTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTTransferDirectionTypeһתʷ +///////////////////////////////////////////////////////////////////////// +///תڻ +#define THOST_FTDC_FBTTD_FromBankToFuture '1' +///ڻת +#define THOST_FTDC_FBTTD_FromFutureToBank '2' + +typedef char TThostFtdcFBTTransferDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenOrDestroyTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OOD_Open '1' +/// +#define THOST_FTDC_OOD_Destroy '0' + +typedef char TThostFtdcOpenOrDestroyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAvailabilityFlagTypeһЧ־ +///////////////////////////////////////////////////////////////////////// +///δȷ +#define THOST_FTDC_AVAF_Invalid '0' +///Ч +#define THOST_FTDC_AVAF_Valid '1' +/// +#define THOST_FTDC_AVAF_Repeal '2' + +typedef char TThostFtdcAvailabilityFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_OT_Bank '1' +///ǰ +#define THOST_FTDC_OT_Future '2' +///תƽ̨ +#define THOST_FTDC_OT_PlateForm '9' + +typedef char TThostFtdcOrganTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganLevelTypeһ +///////////////////////////////////////////////////////////////////////// +///лܲ +#define THOST_FTDC_OL_HeadQuarters '1' +///зĻڻ˾Ӫҵ +#define THOST_FTDC_OL_Branch '2' + +typedef char TThostFtdcOrganLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProtocalIDTypeһЭ +///////////////////////////////////////////////////////////////////////// +///Э +#define THOST_FTDC_PID_FutureProtocal '0' +///Э +#define THOST_FTDC_PID_ICBCProtocal '1' +///ũЭ +#define THOST_FTDC_PID_ABCProtocal '2' +///йЭ +#define THOST_FTDC_PID_CBCProtocal '3' +///Э +#define THOST_FTDC_PID_CCBProtocal '4' +///Э +#define THOST_FTDC_PID_BOCOMProtocal '5' +///תƽ̨Э +#define THOST_FTDC_PID_FBTPlateFormProtocal 'X' + +typedef char TThostFtdcProtocalIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcConnectModeTypeһ׽ӷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CM_ShortConnect '0' +/// +#define THOST_FTDC_CM_LongConnect '1' + +typedef char TThostFtdcConnectModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncModeTypeһ׽ͨŷʽ +///////////////////////////////////////////////////////////////////////// +///첽 +#define THOST_FTDC_SRM_ASync '0' +///ͬ +#define THOST_FTDC_SRM_Sync '1' + +typedef char TThostFtdcSyncModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccTypeTypeһʺ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_BAT_BankBook '1' +/// +#define THOST_FTDC_BAT_SavingCard '2' +///ÿ +#define THOST_FTDC_BAT_CreditCard '3' + +typedef char TThostFtdcBankAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccTypeTypeһڻ˾ʺ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_FAT_BankBook '1' +/// +#define THOST_FTDC_FAT_SavingCard '2' +///ÿ +#define THOST_FTDC_FAT_CreditCard '3' + +typedef char TThostFtdcFutureAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OS_Ready '0' +///ǩ +#define THOST_FTDC_OS_CheckIn '1' +///ǩ +#define THOST_FTDC_OS_CheckOut '2' +///ļ +#define THOST_FTDC_OS_CheckFileArrived '3' +/// +#define THOST_FTDC_OS_CheckDetail '4' +/// +#define THOST_FTDC_OS_DayEndClean '5' +///ע +#define THOST_FTDC_OS_Invalid '9' + +typedef char TThostFtdcOrganStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCCBFeeModeTypeһշģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CCBFM_ByAmount '1' +///¿ +#define THOST_FTDC_CCBFM_ByMonth '2' + +typedef char TThostFtdcCCBFeeModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommApiTypeTypeһͨѶAPI +///////////////////////////////////////////////////////////////////////// +///ͻ +#define THOST_FTDC_CAPIT_Client '1' +/// +#define THOST_FTDC_CAPIT_Server '2' +///ϵͳUserApi +#define THOST_FTDC_CAPIT_UserApi '3' + +typedef char TThostFtdcCommApiTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServiceIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceLineNoTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServiceLineNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcServiceNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLinkStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿ +#define THOST_FTDC_LS_Connected '1' +///û +#define THOST_FTDC_LS_Disconnected '2' + +typedef char TThostFtdcLinkStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommApiPointerTypeһͨѶAPIָ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCommApiPointerType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPwdFlagTypeһ˶Ա־ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_BPWDF_NoCheck '0' +///ĺ˶ +#define THOST_FTDC_BPWDF_BlankCheck '1' +///ĺ˶ +#define THOST_FTDC_BPWDF_EncryptCheck '2' + +typedef char TThostFtdcPwdFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSecuAccTypeTypeһڻʺ +///////////////////////////////////////////////////////////////////////// +///ʽʺ +#define THOST_FTDC_SAT_AccountID '1' +///ʽ𿨺 +#define THOST_FTDC_SAT_CardID '2' +///Ϻɶʺ +#define THOST_FTDC_SAT_SHStockholderID '3' +///ڹɶʺ +#define THOST_FTDC_SAT_SZStockholderID '4' + +typedef char TThostFtdcSecuAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferStatusTypeһת˽״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TRFS_Normal '0' +/// +#define THOST_FTDC_TRFS_Repealed '1' + +typedef char TThostFtdcTransferStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSponsorTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SPTYPE_Broker '0' +/// +#define THOST_FTDC_SPTYPE_Bank '1' + +typedef char TThostFtdcSponsorTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReqRspTypeTypeһӦ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_REQRSP_Request '0' +///Ӧ +#define THOST_FTDC_REQRSP_Response '1' + +typedef char TThostFtdcReqRspTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTUserEventTypeTypeһתû¼ +///////////////////////////////////////////////////////////////////////// +///ǩ +#define THOST_FTDC_FBTUET_SignIn '0' +///תڻ +#define THOST_FTDC_FBTUET_FromBankToFuture '1' +///ڻת +#define THOST_FTDC_FBTUET_FromFutureToBank '2' +/// +#define THOST_FTDC_FBTUET_OpenAccount '3' +/// +#define THOST_FTDC_FBTUET_CancelAccount '4' +///˻ +#define THOST_FTDC_FBTUET_ChangeAccount '5' +///תڻ +#define THOST_FTDC_FBTUET_RepealFromBankToFuture '6' +///ڻת +#define THOST_FTDC_FBTUET_RepealFromFutureToBank '7' +///ѯ˻ +#define THOST_FTDC_FBTUET_QueryBankAccount '8' +///ѯڻ˻ +#define THOST_FTDC_FBTUET_QueryFutureAccount '9' +///ǩ +#define THOST_FTDC_FBTUET_SignOut 'A' +///Կͬ +#define THOST_FTDC_FBTUET_SyncKey 'B' +/// +#define THOST_FTDC_FBTUET_Other 'Z' + +typedef char TThostFtdcFBTUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankIDByBankTypeһԼı +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankIDByBankType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankOperNoTypeһвԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankOperNoType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankCustNoTypeһпͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankCustNoType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBOPSeqNoTypeһк +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDBOPSeqNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTableNameTypeһFBT +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTableNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPKNameTypeһFBT +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPKNameType[201]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPKValueTypeһFBTֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPKValueType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBOperationTypeһ¼ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_DBOP_Insert '0' +/// +#define THOST_FTDC_DBOP_Update '1' +///ɾ +#define THOST_FTDC_DBOP_Delete '2' + +typedef char TThostFtdcDBOperationType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncFlagTypeһͬ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_SYNF_Yes '0' +///δͬ +#define THOST_FTDC_SYNF_No '1' + +typedef char TThostFtdcSyncFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTargetIDTypeһͬĿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTargetIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncTypeTypeһͬ +///////////////////////////////////////////////////////////////////////// +///һͬ +#define THOST_FTDC_SYNT_OneOffSync '0' +///ʱͬ +#define THOST_FTDC_SYNT_TimerSync '1' +///ʱȫͬ +#define THOST_FTDC_SYNT_TimerFullSync '2' + +typedef char TThostFtdcSyncTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBETimeTypeһֻʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBETimeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankNoTypeһк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBECertNoTypeһƾ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBECertNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExDirectionTypeһ㷽 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBEDIR_Settlement '0' +///ۻ +#define THOST_FTDC_FBEDIR_Sale '1' + +typedef char TThostFtdcExDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankAccountType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankAccountNameTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankAccountNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEAmtTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcFBEAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBusinessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEPostScriptTypeһ㸽 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEPostScriptType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBERemarkTypeһ㱸ע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBERemarkType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExRateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcExRateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEResultFlagTypeһɹ־ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_FBERES_Success '0' +///˻ +#define THOST_FTDC_FBERES_InsufficientBalance '1' +///׽δ֪ +#define THOST_FTDC_FBERES_UnknownTrading '8' +///ʧ +#define THOST_FTDC_FBERES_Fail 'x' + +typedef char TThostFtdcFBEResultFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBERtnMsgTypeһ㷵Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBERtnMsgType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEExtendMsgTypeһչϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEExtendMsgType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBusinessSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBusinessSerialType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBESystemSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBESystemSerialType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBETotalExCntTypeһ㽻ܱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBETotalExCntType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEExchStatusTypeһ㽻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBEES_Normal '0' +///ط +#define THOST_FTDC_FBEES_ReExchange '1' + +typedef char TThostFtdcFBEExchStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEFileFlagTypeһļ־ +///////////////////////////////////////////////////////////////////////// +///ݰ +#define THOST_FTDC_FBEFG_DataPackage '0' +///ļ +#define THOST_FTDC_FBEFG_File '1' + +typedef char TThostFtdcFBEFileFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEAlreadyTradeTypeһѽױ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FBEAT_NotTrade '0' +///ѽ +#define THOST_FTDC_FBEAT_Trade '1' + +typedef char TThostFtdcFBEAlreadyTradeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEOpenBankTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEOpenBankType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEUserEventTypeTypeһڻû¼ +///////////////////////////////////////////////////////////////////////// +///ǩ +#define THOST_FTDC_FBEUET_SignIn '0' +/// +#define THOST_FTDC_FBEUET_Exchange '1' +///ط +#define THOST_FTDC_FBEUET_ReExchange '2' +///˻ѯ +#define THOST_FTDC_FBEUET_QueryBankAccount '3' +///ϸѯ +#define THOST_FTDC_FBEUET_QueryExchDetial '4' +///ܲѯ +#define THOST_FTDC_FBEUET_QueryExchSummary '5' +///ʲѯ +#define THOST_FTDC_FBEUET_QueryExchRate '6' +///ļ֪ͨ +#define THOST_FTDC_FBEUET_CheckBankAccount '7' +///ǩ +#define THOST_FTDC_FBEUET_SignOut '8' +/// +#define THOST_FTDC_FBEUET_Other 'Z' + +typedef char TThostFtdcFBEUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEFileNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBatchSerialTypeһκ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBatchSerialType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEReqFlagTypeһ㷢ͱ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FBERF_UnProcessed '0' +///ȴ +#define THOST_FTDC_FBERF_WaitSend '1' +///ͳɹ +#define THOST_FTDC_FBERF_SendSuccess '2' +///ʧ +#define THOST_FTDC_FBERF_SendFailed '3' +///ȴط +#define THOST_FTDC_FBERF_WaitReSend '4' + +typedef char TThostFtdcFBEReqFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNotifyClassTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_NC_NOERROR '0' +///ʾ +#define THOST_FTDC_NC_Warn '1' +///׷ +#define THOST_FTDC_NC_Call '2' +///ǿƽ +#define THOST_FTDC_NC_Force '3' +/// +#define THOST_FTDC_NC_CHUANCANG '4' +///쳣 +#define THOST_FTDC_NC_Exception '5' + +typedef char TThostFtdcNotifyClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNofityInfoTypeһͻ֪ͨϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRiskNofityInfoType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseSceneIdTypeһǿƽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcForceCloseSceneIdType[24]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseTypeTypeһǿƽ +///////////////////////////////////////////////////////////////////////// +///ֹǿƽ +#define THOST_FTDC_FCT_Manual '0' +///һͶ߸ǿƽ +#define THOST_FTDC_FCT_Single '1' +///Ͷ߸ǿƽ +#define THOST_FTDC_FCT_Group '2' + +typedef char TThostFtdcForceCloseTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDsTypeһƷ,+ָ,cu+zn +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDsType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNotifyMethodTypeһ֪ͨ; +///////////////////////////////////////////////////////////////////////// +///ϵͳ֪ͨ +#define THOST_FTDC_RNM_System '0' +///֪ͨ +#define THOST_FTDC_RNM_SMS '1' +///ʼ֪ͨ +#define THOST_FTDC_RNM_EMail '2' +///˹֪ͨ +#define THOST_FTDC_RNM_Manual '3' + +typedef char TThostFtdcRiskNotifyMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNotifyStatusTypeһ֪ͨ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_RNS_NotGen '0' +///δ +#define THOST_FTDC_RNS_Generated '1' +///ʧ +#define THOST_FTDC_RNS_SendError '2' +///ѷδ +#define THOST_FTDC_RNS_SendOk '3' +///ѽδȷ +#define THOST_FTDC_RNS_Received '4' +///ȷ +#define THOST_FTDC_RNS_Confirmed '5' + +typedef char TThostFtdcRiskNotifyStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskUserEventTypeһû¼ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_RUE_ExportData '0' + +typedef char TThostFtdcRiskUserEventType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParamNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamValueTypeһֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParamValueType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcConditionalOrderSortTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ʹ¼ +#define THOST_FTDC_COST_LastPriceAsc '0' +///ʹ¼۽ +#define THOST_FTDC_COST_LastPriceDesc '1' +///ʹ +#define THOST_FTDC_COST_AskPriceAsc '2' +///ʹ۽ +#define THOST_FTDC_COST_AskPriceDesc '3' +///ʹ +#define THOST_FTDC_COST_BidPriceAsc '4' +///ʹ۽ +#define THOST_FTDC_COST_BidPriceDesc '5' + +typedef char TThostFtdcConditionalOrderSortTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSendTypeTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UOAST_NoSend '0' +///ѷ +#define THOST_FTDC_UOAST_Sended '1' +/// +#define THOST_FTDC_UOAST_Generated '2' +///ʧ +#define THOST_FTDC_UOAST_SendFail '3' +///ճɹ +#define THOST_FTDC_UOAST_Success '4' +///ʧ +#define THOST_FTDC_UOAST_Fail '5' +///ȡ +#define THOST_FTDC_UOAST_Cancel '6' + +typedef char TThostFtdcSendTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDStatusTypeһױ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UOACS_NoApply '1' +///ύ +#define THOST_FTDC_UOACS_Submited '2' +///ѷ +#define THOST_FTDC_UOACS_Sended '3' +/// +#define THOST_FTDC_UOACS_Success '4' +///ܾ +#define THOST_FTDC_UOACS_Refuse '5' +///ѳ +#define THOST_FTDC_UOACS_Cancel '6' + +typedef char TThostFtdcClientIDStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIndustryIDTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIndustryIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionIDTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcQuestionIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionContentTypeһϢ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcQuestionContentType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionIDTypeһѡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOptionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionContentTypeһѡ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOptionContentType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionTypeTypeһϢ +///////////////////////////////////////////////////////////////////////// +///ѡ +#define THOST_FTDC_QT_Radio '1' +///ѡ +#define THOST_FTDC_QT_Option '2' +/// +#define THOST_FTDC_QT_Blank '3' + +typedef char TThostFtdcQuestionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessIDTypeһҵˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSeqNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSeqNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAProcessStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAProcessStatusType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessTypeTypeһ̹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_BT_Request '1' +///Ӧ +#define THOST_FTDC_BT_Response '2' +///֪ͨ +#define THOST_FTDC_BT_Notice '3' + +typedef char TThostFtdcBusinessTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCfmmcReturnCodeTypeһķ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_CRC_Success '0' +///ÿͻѾڴ +#define THOST_FTDC_CRC_Working '1' +///пͻϼʧ +#define THOST_FTDC_CRC_InfoFail '2' +///ʵƼʧ +#define THOST_FTDC_CRC_IDCardFail '3' +/// +#define THOST_FTDC_CRC_OtherFail '4' + +typedef char TThostFtdcCfmmcReturnCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExReturnCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcExReturnCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientTypeTypeһͻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CfMMCCT_All '0' +/// +#define THOST_FTDC_CfMMCCT_Person '1' +///λ +#define THOST_FTDC_CfMMCCT_Company '2' +/// +#define THOST_FTDC_CfMMCCT_Other '3' +///ⷨ +#define THOST_FTDC_CfMMCCT_SpecialOrgan '4' +///ʹܻ +#define THOST_FTDC_CfMMCCT_Asset '5' + +typedef char TThostFtdcClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeIDTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///Ϻڻ +#define THOST_FTDC_EIDT_SHFE 'S' +///֣Ʒ +#define THOST_FTDC_EIDT_CZCE 'Z' +///Ʒ +#define THOST_FTDC_EIDT_DCE 'D' +///йڻ +#define THOST_FTDC_EIDT_CFFEX 'J' +///ϺԴĹɷ޹˾ +#define THOST_FTDC_EIDT_INE 'N' + +typedef char TThostFtdcExchangeIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExClientIDTypeTypeһױ +///////////////////////////////////////////////////////////////////////// +///ױ +#define THOST_FTDC_ECIDT_Hedge '1' +/// +#define THOST_FTDC_ECIDT_Arbitrage '2' +///Ͷ +#define THOST_FTDC_ECIDT_Speculation '3' + +typedef char TThostFtdcExClientIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientClassifyTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientClassifyType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAOrganTypeTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAOrganTypeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOACountryCodeTypeһҴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOACountryCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAreaCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAreaCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFuturesIDTypeһΪͻĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFuturesIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffmcDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffmcDateType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffmcTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffmcTimeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNocIDTypeһ֯ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNocIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUpdateFlagTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UF_NoUpdate '0' +///ȫϢɹ +#define THOST_FTDC_UF_Success '1' +///ȫϢʧ +#define THOST_FTDC_UF_Fail '2' +///½ױɹ +#define THOST_FTDC_UF_TCSuccess '3' +///½ױʧ +#define THOST_FTDC_UF_TCFail '4' +///Ѷ +#define THOST_FTDC_UF_Cancel '5' + +typedef char TThostFtdcUpdateFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyOperateIDTypeһ붯 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AOID_OpenInvestor '1' +///޸Ϣ +#define THOST_FTDC_AOID_ModifyIDCard '2' +///޸һϢ +#define THOST_FTDC_AOID_ModifyNoIDCard '3' +///뽻ױ +#define THOST_FTDC_AOID_ApplyTradingCode '4' +///ױ +#define THOST_FTDC_AOID_CancelTradingCode '5' +/// +#define THOST_FTDC_AOID_CancelInvestor '6' +///˻ +#define THOST_FTDC_AOID_FreezeAccount '8' +///˻ +#define THOST_FTDC_AOID_ActiveFreezeAccount '9' + +typedef char TThostFtdcApplyOperateIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyStatusIDTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δȫ +#define THOST_FTDC_ASID_NoComplete '1' +///ύ +#define THOST_FTDC_ASID_Submited '2' +/// +#define THOST_FTDC_ASID_Checked '3' +///Ѿܾ +#define THOST_FTDC_ASID_Refused '4' +///ɾ +#define THOST_FTDC_ASID_Deleted '5' + +typedef char TThostFtdcApplyStatusIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSendMethodTypeһͷʽ +///////////////////////////////////////////////////////////////////////// +///ļ +#define THOST_FTDC_UOASM_ByAPI '1' +///ӷ +#define THOST_FTDC_UOASM_ByFile '2' + +typedef char TThostFtdcSendMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEventTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEventTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEventModeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EvM_ADD '1' +///޸ +#define THOST_FTDC_EvM_UPDATE '2' +///ɾ +#define THOST_FTDC_EvM_DELETE '3' +/// +#define THOST_FTDC_EvM_CHECK '4' +/// +#define THOST_FTDC_EvM_COPY '5' +///ע +#define THOST_FTDC_EvM_CANCEL '6' +/// +#define THOST_FTDC_EvM_Reverse '7' + +typedef char TThostFtdcEventModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAAutoSendTypeһͳһԶ +///////////////////////////////////////////////////////////////////////// +///ԶͲ +#define THOST_FTDC_UOAA_ASR '1' +///ԶͣԶ +#define THOST_FTDC_UOAA_ASNR '2' +///ԶͣԶ +#define THOST_FTDC_UOAA_NSAR '3' +///ԶͣҲԶ +#define THOST_FTDC_UOAA_NSR '4' + +typedef char TThostFtdcUOAAutoSendType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQueryDepthTypeһѯ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcQueryDepthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataCenterIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDataCenterIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFlowIDTypeһID +///////////////////////////////////////////////////////////////////////// +///Ͷ߶ӦͶ +#define THOST_FTDC_EvM_InvestorGroupFlow '1' +///Ͷ +#define THOST_FTDC_EvM_InvestorRate '2' +///Ͷģϵ +#define THOST_FTDC_EvM_InvestorCommRateModel '3' + +typedef char TThostFtdcFlowIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckLevelTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///㼶 +#define THOST_FTDC_CL_Zero '0' +///һ +#define THOST_FTDC_CL_One '1' +/// +#define THOST_FTDC_CL_Two '2' + +typedef char TThostFtdcCheckLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCheckNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckStatusTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_CHS_Init '0' +/// +#define THOST_FTDC_CHS_Checking '1' +///Ѹ +#define THOST_FTDC_CHS_Checked '2' +///ܾ +#define THOST_FTDC_CHS_Refuse '3' +/// +#define THOST_FTDC_CHS_Cancel '4' + +typedef char TThostFtdcCheckStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUsedStatusTypeһЧ״̬ +///////////////////////////////////////////////////////////////////////// +///δЧ +#define THOST_FTDC_CHU_Unused '0' +///Ч +#define THOST_FTDC_CHU_Used '1' +///Чʧ +#define THOST_FTDC_CHU_Fail '2' + +typedef char TThostFtdcUsedStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTemplateNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRateTemplateNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyStringTypeһڲѯͶֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyStringType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAcountOriginTypeһ˻Դ +///////////////////////////////////////////////////////////////////////// +///ֹ¼ +#define THOST_FTDC_BAO_ByAccProperty '0' +///ת +#define THOST_FTDC_BAO_ByFBTransfer '1' + +typedef char TThostFtdcBankAcountOriginType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthBillTradeSumTypeһ㵥±ɽܷʽ +///////////////////////////////////////////////////////////////////////// +///ͬͬԼ +#define THOST_FTDC_MBTS_ByInstrument '0' +///ͬͬԼͬ۸ +#define THOST_FTDC_MBTS_ByDayInsPrc '1' +///ͬԼ +#define THOST_FTDC_MBTS_ByDayIns '2' + +typedef char TThostFtdcMonthBillTradeSumType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTTradeCodeEnumTypeһڽ״ö +///////////////////////////////////////////////////////////////////////// +///зתڻ +#define THOST_FTDC_FTC_BankLaunchBankToBroker '102001' +///ڻתڻ +#define THOST_FTDC_FTC_BrokerLaunchBankToBroker '202001' +///зڻת +#define THOST_FTDC_FTC_BankLaunchBrokerToBank '102002' +///ڻڻת +#define THOST_FTDC_FTC_BrokerLaunchBrokerToBank '202002' + +typedef char TThostFtdcFBTTradeCodeEnumType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTemplateIDTypeһģʹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRateTemplateIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskRateTypeһն +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRiskRateType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimestampTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTimestampType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDRuleNameTypeһŶι +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDRuleNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDRuleExprTypeһŶιʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDRuleExprType[513]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastDriftTypeһϴOTPƯֵ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLastDriftType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastSuccessTypeһϴOTPɹֵ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLastSuccessType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthKeyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialNumberTypeһк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSerialNumberType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPTypeTypeһ̬ +///////////////////////////////////////////////////////////////////////// +///޶̬ +#define THOST_FTDC_OTP_NONE '0' +///ʱ +#define THOST_FTDC_OTP_TOTP '1' + +typedef char TThostFtdcOTPTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPVendorsIDTypeһ̬ṩ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOTPVendorsIDType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPVendorsNameTypeһ̬ṩ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOTPVendorsNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPStatusTypeһ̬״̬ +///////////////////////////////////////////////////////////////////////// +///δʹ +#define THOST_FTDC_OTPS_Unused '0' +///ʹ +#define THOST_FTDC_OTPS_Used '1' +///ע +#define THOST_FTDC_OTPS_Disuse '2' + +typedef char TThostFtdcOTPStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerUserTypeTypeһù˾û +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_BUT_Investor '1' +///Ա +#define THOST_FTDC_BUT_BrokerUser '2' + +typedef char TThostFtdcBrokerUserTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureTypeTypeһڻ +///////////////////////////////////////////////////////////////////////// +///Ʒڻ +#define THOST_FTDC_FUTT_Commodity '1' +///ڻ +#define THOST_FTDC_FUTT_Financial '2' + +typedef char TThostFtdcFutureTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundEventTypeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///ת޶ +#define THOST_FTDC_FET_Restriction '0' +///ת޶ +#define THOST_FTDC_FET_TodayRestriction '1' +///ˮ +#define THOST_FTDC_FET_Transfer '2' +///ʽ𶳽 +#define THOST_FTDC_FET_Credit '3' +///Ͷ߿ʽ +#define THOST_FTDC_FET_InvestorWithdrawAlm '4' +///ʻת޶ +#define THOST_FTDC_FET_BankRestriction '5' +///ǩԼ˻ +#define THOST_FTDC_FET_Accountregister '6' +/// +#define THOST_FTDC_FET_ExchangeFundIO '7' +///Ͷ߳ +#define THOST_FTDC_FET_InvestorFundIO '8' + +typedef char TThostFtdcFundEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountSourceTypeTypeһʽ˻Դ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_AST_FBTransfer '0' +///ֹ¼ +#define THOST_FTDC_AST_ManualEntry '1' + +typedef char TThostFtdcAccountSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCodeSourceTypeTypeһױԴ +///////////////////////////////////////////////////////////////////////// +///ͳһ(ѹ淶) +#define THOST_FTDC_CST_UnifyAccount '0' +///ֹ¼(δ淶) +#define THOST_FTDC_CST_ManualEntry '1' + +typedef char TThostFtdcCodeSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserRangeTypeһԱΧ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_UR_All '0' +///һԱ +#define THOST_FTDC_UR_Single '1' + +typedef char TThostFtdcUserRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeSpanTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTimeSpanType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcImportSequenceIDTypeһ̬Ƶα +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcImportSequenceIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcByGroupTypeһͳƱͻͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Ͷͳ +#define THOST_FTDC_BG_Investor '2' +///ͳ +#define THOST_FTDC_BG_Group '1' + +typedef char TThostFtdcByGroupType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSumStatModeTypeһͳƱΧͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Լͳ +#define THOST_FTDC_TSSM_Instrument '1' +///Ʒͳ +#define THOST_FTDC_TSSM_Product '2' +///ͳ +#define THOST_FTDC_TSSM_Exchange '3' + +typedef char TThostFtdcTradeSumStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcComTypeTypeһϳɽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcComTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductIDTypeһƷʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductNameTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductMemoTypeһƷ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductMemoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCCancelFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCCancelFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCDateType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCInvestorNameTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCInvestorNameType[201]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOpenInvestorNameTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOpenInvestorNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCInvestorIDTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCInvestorIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCIdentifiedCardNoTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCIdentifiedCardNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCClientIDTypeһױ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCClientIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCBankFlagTypeһбʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCBankFlagType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCBankAccountType[23]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOpenNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOpenNameType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMemoTypeһ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMemoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTimeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTradeIDTypeһɽˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTradeIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCExchangeInstIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMortgageNameTypeһѺƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMortgageNameType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCReasonTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCReasonType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsSettlementTypeһǷΪǽԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIsSettlementType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCPriceTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCPriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOptionsTypeTypeһȨ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOptionsTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCStrikePriceTypeһִм +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCStrikePriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTargetProductIDTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTargetProductIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTargetInstrIDTypeһĺԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTargetInstrIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommModelNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommModelNameType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommModelMemoTypeһģ屸ע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommModelMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExprSetModeTypeһڱʽ +///////////////////////////////////////////////////////////////////////// +///й +#define THOST_FTDC_ESM_Relative '1' +/// +#define THOST_FTDC_ESM_Typical '2' + +typedef char TThostFtdcExprSetModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +///˾׼ +#define THOST_FTDC_RIR_All '1' +///ģ +#define THOST_FTDC_RIR_Model '2' +///һͶ +#define THOST_FTDC_RIR_Single '3' + +typedef char TThostFtdcRateInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentBrokerIDTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentBrokerIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDRIdentityIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDRIdentityIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDRIdentityNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDRIdentityNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBLinkIDTypeһDBLinkʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDBLinkIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncDataStatusTypeһϵͳͬ״̬ +///////////////////////////////////////////////////////////////////////// +///δͬ +#define THOST_FTDC_SDS_Initialize '0' +///ͬ +#define THOST_FTDC_SDS_Settlementing '1' +///ͬ +#define THOST_FTDC_SDS_Settlemented '2' + +typedef char TThostFtdcSyncDataStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSourceTypeһɽԴ +///////////////////////////////////////////////////////////////////////// +///Խͨر +#define THOST_FTDC_TSRC_NORMAL '0' +///Բѯ +#define THOST_FTDC_TSRC_QUERY '1' + +typedef char TThostFtdcTradeSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFlexStatModeTypeһƷԼͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Ʒͳ +#define THOST_FTDC_FSM_Product '1' +///ͳ +#define THOST_FTDC_FSM_Exchange '2' +///ͳ +#define THOST_FTDC_FSM_All '3' + +typedef char TThostFtdcFlexStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcByInvestorRangeTypeһͶ߷ΧͳƷʽ +///////////////////////////////////////////////////////////////////////// +///ͳ +#define THOST_FTDC_BIR_Property '1' +///ͳ +#define THOST_FTDC_BIR_All '2' + +typedef char TThostFtdcByInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSRiskRateTypeһն +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSRiskRateType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceNo12Typeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSequenceNo12Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PIR_All '1' +///Ͷ +#define THOST_FTDC_PIR_Property '2' +///һͶ +#define THOST_FTDC_PIR_Single '3' + +typedef char TThostFtdcPropertyInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileStatusTypeһļ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FIS_NoCreate '0' +/// +#define THOST_FTDC_FIS_Created '1' +///ʧ +#define THOST_FTDC_FIS_Failed '2' + +typedef char TThostFtdcFileStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileGenStyleTypeһļɷʽ +///////////////////////////////////////////////////////////////////////// +///· +#define THOST_FTDC_FGS_FileTransmit '0' +/// +#define THOST_FTDC_FGS_FileGen '1' + +typedef char TThostFtdcFileGenStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysOperModeTypeһϵͳ־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SoM_Add '1' +///޸ +#define THOST_FTDC_SoM_Update '2' +///ɾ +#define THOST_FTDC_SoM_Delete '3' +/// +#define THOST_FTDC_SoM_Copy '4' +/// +#define THOST_FTDC_SoM_AcTive '5' +///ע +#define THOST_FTDC_SoM_CanCel '6' +/// +#define THOST_FTDC_SoM_ReSet '7' + +typedef char TThostFtdcSysOperModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysOperTypeTypeһϵͳ־ +///////////////////////////////////////////////////////////////////////// +///޸IJԱ +#define THOST_FTDC_SoT_UpdatePassword '0' +///Աܹ֯ϵ +#define THOST_FTDC_SoT_UserDepartment '1' +///ɫ +#define THOST_FTDC_SoT_RoleManager '2' +///ɫ +#define THOST_FTDC_SoT_RoleFunction '3' +/// +#define THOST_FTDC_SoT_BaseParam '4' +///òԱ +#define THOST_FTDC_SoT_SetUserID '5' +///ûɫ +#define THOST_FTDC_SoT_SetUserRole '6' +///ûIP +#define THOST_FTDC_SoT_UserIpRestriction '7' +///ܹ֯ +#define THOST_FTDC_SoT_DepartmentManager '8' +///ܹ֯ѯิ +#define THOST_FTDC_SoT_DepartmentCopy '9' +///ױ +#define THOST_FTDC_SoT_Tradingcode 'A' +///Ͷ״̬ά +#define THOST_FTDC_SoT_InvestorStatus 'B' +///ͶȨ޹ +#define THOST_FTDC_SoT_InvestorAuthority 'C' +/// +#define THOST_FTDC_SoT_PropertySet 'D' +///Ͷ +#define THOST_FTDC_SoT_ReSetInvestorPasswd 'E' +///Ͷ߸Ϣά +#define THOST_FTDC_SoT_InvestorPersonalityInfo 'F' + +typedef char TThostFtdcSysOperTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCDataQueyTypeTypeһϱݲѯ +///////////////////////////////////////////////////////////////////////// +///ѯǰձ͵ +#define THOST_FTDC_CSRCQ_Current '0' +///ѯʷ͵Ĵ͹˾ +#define THOST_FTDC_CSRCQ_History '1' + +typedef char TThostFtdcCSRCDataQueyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFreezeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_FRS_Normal '1' +/// +#define THOST_FTDC_FRS_Freeze '0' + +typedef char TThostFtdcFreezeStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStandardStatusTypeһ淶״̬ +///////////////////////////////////////////////////////////////////////// +///ѹ淶 +#define THOST_FTDC_STST_Standard '0' +///δ淶 +#define THOST_FTDC_STST_NonStandard '1' + +typedef char TThostFtdcStandardStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCFreezeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCFreezeStatusType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightParamTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///߻ +#define THOST_FTDC_RPT_Freeze '1' +///߻ +#define THOST_FTDC_RPT_FreezeActive '2' +///Ȩ +#define THOST_FTDC_RPT_OpenLimit '3' +///Ȩ +#define THOST_FTDC_RPT_RelieveOpenLimit '4' + +typedef char TThostFtdcRightParamTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightTemplateIDTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRightTemplateIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightTemplateNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRightTemplateNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataStatusTypeһϴǮ˱״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMLDS_Normal '0' +///ɾ +#define THOST_FTDC_AMLDS_Deleted '1' + +typedef char TThostFtdcDataStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCheckStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_AMLCHS_Init '0' +/// +#define THOST_FTDC_AMLCHS_Checking '1' +///Ѹ +#define THOST_FTDC_AMLCHS_Checked '2' +///ܾϱ +#define THOST_FTDC_AMLCHS_RefuseReport '3' + +typedef char TThostFtdcAMLCheckStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlDateTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMLDT_DrawDay '0' +/// +#define THOST_FTDC_AMLDT_TouchDay '1' + +typedef char TThostFtdcAmlDateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlCheckLevelTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///㼶 +#define THOST_FTDC_AMLCL_CheckLevel0 '0' +///һ +#define THOST_FTDC_AMLCL_CheckLevel1 '1' +/// +#define THOST_FTDC_AMLCL_CheckLevel2 '2' +/// +#define THOST_FTDC_AMLCL_CheckLevel3 '3' + +typedef char TThostFtdcAmlCheckLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlCheckFlowTypeһϴǮݳȡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAmlCheckFlowType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDataTypeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExportFileTypeTypeһļ +///////////////////////////////////////////////////////////////////////// +///CSV +#define THOST_FTDC_EFT_CSV '0' +///Excel +#define THOST_FTDC_EFT_EXCEL '1' +///DBF +#define THOST_FTDC_EFT_DBF '2' + +typedef char TThostFtdcExportFileTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ǰ׼ +#define THOST_FTDC_SMT_Before '1' +/// +#define THOST_FTDC_SMT_Settlement '2' +///˶ +#define THOST_FTDC_SMT_After '3' +/// +#define THOST_FTDC_SMT_Settlemented '4' + +typedef char TThostFtdcSettleManagerTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerIDTypeһô +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettleManagerIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettleManagerNameType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerLevelTypeһõȼ +///////////////////////////////////////////////////////////////////////// +///Ҫ +#define THOST_FTDC_SML_Must '1' +/// +#define THOST_FTDC_SML_Alarm '2' +///ʾ +#define THOST_FTDC_SML_Prompt '3' +/// +#define THOST_FTDC_SML_Ignore '4' + +typedef char TThostFtdcSettleManagerLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerGroupTypeһģ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_SMG_Exhcange '1' +///ڲ˶ +#define THOST_FTDC_SMG_ASP '2' +///ϱݺ˶ +#define THOST_FTDC_SMG_CSRC '3' + +typedef char TThostFtdcSettleManagerGroupType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckResultMemoTypeһ˶Խ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCheckResultMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionUrlTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionUrlType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthInfoTypeһͻ֤Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthCodeTypeһͻ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLimitUseTypeTypeһֵʹ +///////////////////////////////////////////////////////////////////////// +///ظʹ +#define THOST_FTDC_LUT_Repeatable '1' +///ظʹ +#define THOST_FTDC_LUT_Unrepeatable '2' + +typedef char TThostFtdcLimitUseTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataResourceTypeһԴ +///////////////////////////////////////////////////////////////////////// +///ϵͳ +#define THOST_FTDC_DAR_Settle '1' +/// +#define THOST_FTDC_DAR_Exchange '2' +/// +#define THOST_FTDC_DAR_CSRC '3' + +typedef char TThostFtdcDataResourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_MGT_ExchMarginRate '0' +///Ͷ֤߱ +#define THOST_FTDC_MGT_InstrMarginRate '1' +///Ͷ߽ױ֤ +#define THOST_FTDC_MGT_InstrMarginRateTrade '2' + +typedef char TThostFtdcMarginTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActiveTypeTypeһЧ +///////////////////////////////////////////////////////////////////////// +///Ч +#define THOST_FTDC_ACT_Intraday '1' +///Ч +#define THOST_FTDC_ACT_Long '2' + +typedef char TThostFtdcActiveTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginRateTypeTypeһͻ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_MRT_Exchange '1' +///Ͷ֤߱ +#define THOST_FTDC_MRT_Investor '2' +///Ͷ߽ױ֤ +#define THOST_FTDC_MRT_InvestorTrade '3' + +typedef char TThostFtdcMarginRateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBackUpStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δɱ +#define THOST_FTDC_BUS_UnBak '0' +/// +#define THOST_FTDC_BUS_BakUp '1' +///ɱ +#define THOST_FTDC_BUS_BakUped '2' +///ʧ +#define THOST_FTDC_BUS_BakFail '3' + +typedef char TThostFtdcBackUpStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInitSettlementTypeһʼ״̬ +///////////////////////////////////////////////////////////////////////// +///ʼδʼ +#define THOST_FTDC_SIS_UnInitialize '0' +///ʼ +#define THOST_FTDC_SIS_Initialize '1' +///ʼ +#define THOST_FTDC_SIS_Initialized '2' + +typedef char TThostFtdcInitSettlementType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReportStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δɱ +#define THOST_FTDC_SRS_NoCreate '0' +/// +#define THOST_FTDC_SRS_Create '1' +///ɱ +#define THOST_FTDC_SRS_Created '2' +///ɱʧ +#define THOST_FTDC_SRS_CreateFail '3' + +typedef char TThostFtdcReportStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSaveStatusTypeһݹ鵵״̬ +///////////////////////////////////////////////////////////////////////// +///鵵δ +#define THOST_FTDC_SSS_UnSaveData '0' +///鵵 +#define THOST_FTDC_SSS_SaveDatad '1' + +typedef char TThostFtdcSaveStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettArchiveStatusTypeһȷݹ鵵״̬ +///////////////////////////////////////////////////////////////////////// +///δ鵵 +#define THOST_FTDC_SAS_UnArchived '0' +///ݹ鵵 +#define THOST_FTDC_SAS_Archiving '1' +///ѹ鵵 +#define THOST_FTDC_SAS_Archived '2' +///鵵ʧ +#define THOST_FTDC_SAS_ArchiveFail '3' + +typedef char TThostFtdcSettArchiveStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCTPTypeTypeһCTPϵͳ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_CTPT_Unkown '0' +/// +#define THOST_FTDC_CTPT_MainCenter '1' +/// +#define THOST_FTDC_CTPT_BackUp '2' + +typedef char TThostFtdcCTPTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcToolIDTypeһߴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcToolIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcToolNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcToolNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCloseDealTypeTypeһƽִ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CDT_Normal '0' +///Ͷƽ +#define THOST_FTDC_CDT_SpecFirst '1' + +typedef char TThostFtdcCloseDealTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMortgageFundUseRangeTypeһѺʽ÷Χ +///////////////////////////////////////////////////////////////////////// +///ʹ +#define THOST_FTDC_MFUR_None '0' +///ڱ֤ +#define THOST_FTDC_MFUR_Margin '1' +///ѡӯ֤ +#define THOST_FTDC_MFUR_All '2' + +typedef char TThostFtdcMortgageFundUseRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyUnitTypeһֵλ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCurrencyUnitType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeRateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcExchangeRateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSpecProductTypeTypeһƷ +///////////////////////////////////////////////////////////////////////// +///֣ױƷ +#define THOST_FTDC_SPT_CzceHedge '1' +///ѺƷ +#define THOST_FTDC_SPT_IneForeignCurrency '2' +///߿ƽֲƷ +#define THOST_FTDC_SPT_DceOpenClose '3' + +typedef char TThostFtdcSpecProductTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortgageTypeTypeһѺ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_FMT_Mortgage '1' +/// +#define THOST_FTDC_FMT_Redemption '2' + +typedef char TThostFtdcFundMortgageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountSettlementParamIDTypeһͶ˻ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_ASPI_BaseMargin '1' +///Ȩ׼ +#define THOST_FTDC_ASPI_LowestInterest '2' + +typedef char TThostFtdcAccountSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyNameType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySignTypeһַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencySignType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortDirectionTypeһѺ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FMD_In '1' +///ʳ +#define THOST_FTDC_FMD_Out '2' + +typedef char TThostFtdcFundMortDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessClassTypeһ +///////////////////////////////////////////////////////////////////////// +///ӯ +#define THOST_FTDC_BT_Profit '0' +/// +#define THOST_FTDC_BT_Loss '1' +/// +#define THOST_FTDC_BT_Other 'Z' + +typedef char TThostFtdcBusinessClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSwapSourceTypeTypeһԴ +///////////////////////////////////////////////////////////////////////// +///ֹ +#define THOST_FTDC_SST_Manual '0' +///Զ +#define THOST_FTDC_SST_Automatic '1' + +typedef char TThostFtdcSwapSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrExDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CED_Settlement '0' +///ۻ +#define THOST_FTDC_CED_Sale '1' + +typedef char TThostFtdcCurrExDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySwapStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_CSS_Entry '1' +/// +#define THOST_FTDC_CSS_Approve '2' +///Ѿܾ +#define THOST_FTDC_CSS_Refuse '3' +///ѳ +#define THOST_FTDC_CSS_Revoke '4' +///ѷ +#define THOST_FTDC_CSS_Send '5' +///ɹ +#define THOST_FTDC_CSS_Success '6' +///ʧ +#define THOST_FTDC_CSS_Failure '7' + +typedef char TThostFtdcCurrencySwapStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrExchCertNoTypeһƾ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrExchCertNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBatchSerialNoTypeһκ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBatchSerialNoType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReqFlagTypeһ㷢ͱ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_REQF_NoSend '0' +///ͳɹ +#define THOST_FTDC_REQF_SendSuccess '1' +///ʧ +#define THOST_FTDC_REQF_SendFailed '2' +///ȴط +#define THOST_FTDC_REQF_WaitReSend '3' + +typedef char TThostFtdcReqFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcResFlagTypeһ㷵سɹ־ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_RESF_Success '0' +///˻ +#define THOST_FTDC_RESF_InsuffiCient '1' +///׽δ֪ +#define THOST_FTDC_RESF_UnKnown '8' + +typedef char TThostFtdcResFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPageControlTypeһҳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPageControlType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRecordCountTypeһ¼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRecordCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySwapMemoTypeһȷϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencySwapMemoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExStatusTypeһ޸״̬ +///////////////////////////////////////////////////////////////////////// +///޸ǰ +#define THOST_FTDC_EXS_Before '0' +///޸ĺ +#define THOST_FTDC_EXS_After '1' + +typedef char TThostFtdcExStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientRegionTypeһͻ +///////////////////////////////////////////////////////////////////////// +///ڿͻ +#define THOST_FTDC_CR_Domestic '1' +///۰̨ͻ +#define THOST_FTDC_CR_GMT '2' +///ͻ +#define THOST_FTDC_CR_Foreign '3' + +typedef char TThostFtdcClientRegionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWorkPlaceTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWorkPlaceType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessPeriodTypeһӪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessPeriodType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWebSiteTypeһַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWebSiteType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAIdCardTypeTypeһͳһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAIdCardTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientModeTypeһģʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientModeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorFullNameTypeһͶȫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorFullNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOABrokerIDTypeһнID +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOABrokerIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAZipCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAZipCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAEMailTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAEMailType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOldCityTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOldCityType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCorporateIdentifiedCardNoTypeһ˴֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCorporateIdentifiedCardNoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHasBoardTypeһǷж» +///////////////////////////////////////////////////////////////////////// +///û +#define THOST_FTDC_HB_No '0' +/// +#define THOST_FTDC_HB_Yes '1' + +typedef char TThostFtdcHasBoardType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStartModeTypeһģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SM_Normal '1' +///Ӧ +#define THOST_FTDC_SM_Emerge '2' +///ָ +#define THOST_FTDC_SM_Restore '3' + +typedef char TThostFtdcStartModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTemplateTypeTypeһģ +///////////////////////////////////////////////////////////////////////// +///ȫ +#define THOST_FTDC_TPT_Full '1' +/// +#define THOST_FTDC_TPT_Increment '2' +/// +#define THOST_FTDC_TPT_BackUp '3' + +typedef char TThostFtdcTemplateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLoginModeTypeһ¼ģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_LM_Trade '0' +///ת +#define THOST_FTDC_LM_Transfer '1' + +typedef char TThostFtdcLoginModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPromptTypeTypeһʾ +///////////////////////////////////////////////////////////////////////// +///Լ +#define THOST_FTDC_CPT_Instrument '1' +///ֶ֤Ч +#define THOST_FTDC_CPT_Margin '2' + +typedef char TThostFtdcPromptTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLedgerManageIDTypeһֻʲ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLedgerManageIDType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestVarietyTypeһͶƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestVarietyType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLedgerManageBankTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLedgerManageBankType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffexDepartmentNameTypeһӪҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffexDepartmentNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffexDepartmentCodeTypeһӪҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffexDepartmentCodeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHasTrusteeTypeһǷй +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HT_Yes '1' +///û +#define THOST_FTDC_HT_No '0' + +typedef char TThostFtdcHasTrusteeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMemo1Typeһ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMemo1Type[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrCFullNameTypeһʲҵڻ˾ȫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrCFullNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrApprovalNOTypeһʲҵĺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrApprovalNOType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrMgrNameTypeһʲҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrMgrNameType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMT_Bank '1' +///֤ȯ˾ +#define THOST_FTDC_AMT_Securities '2' +///˾ +#define THOST_FTDC_AMT_Fund '3' +///չ˾ +#define THOST_FTDC_AMT_Insurance '4' +///й˾ +#define THOST_FTDC_AMT_Trust '5' +/// +#define THOST_FTDC_AMT_Other '9' + +typedef char TThostFtdcAmTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCAmTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCAmTypeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCFundIOTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CFIOT_FundIO '0' +///ڻ +#define THOST_FTDC_CFIOT_SwapCurrency '1' + +typedef char TThostFtdcCSRCFundIOTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCusAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +///ڻ˻ +#define THOST_FTDC_CAT_Futures '1' +///ڻʹҵµʹܽ˻ +#define THOST_FTDC_CAT_AssetmgrFuture '2' +///ۺʹҵµڻʹй˻ +#define THOST_FTDC_CAT_AssetmgrTrustee '3' +///ۺʹҵµʽת˻ +#define THOST_FTDC_CAT_AssetmgrTransfer '4' + +typedef char TThostFtdcCusAccountTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCNationalTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCNationalType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCSecAgentIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCSecAgentIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLanguageTypeTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_LT_Chinese '1' +///Ӣ +#define THOST_FTDC_LT_English '2' + +typedef char TThostFtdcLanguageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmAccountTypeһͶ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAmAccountType[23]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrClientTypeTypeһʲͻ +///////////////////////////////////////////////////////////////////////// +///ʹܿͻ +#define THOST_FTDC_AMCT_Person '1' +///λʹܿͻ +#define THOST_FTDC_AMCT_Organ '2' +///ⵥλʹܿͻ +#define THOST_FTDC_AMCT_SpecialOrgan '4' + +typedef char TThostFtdcAssetmgrClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_ASST_Futures '3' +///ۺ +#define THOST_FTDC_ASST_SpecialOrgan '4' + +typedef char TThostFtdcAssetmgrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOMTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOMType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEInstLifePhaseTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSHFEInstLifePhaseType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEProductClassTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSHFEProductClassType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceDecimalTypeһ۸Сλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPriceDecimalType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInTheMoneyFlagTypeһƽֵȨ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInTheMoneyFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckInstrTypeTypeһԼȽ +///////////////////////////////////////////////////////////////////////// +///Լ +#define THOST_FTDC_CIT_HasExch '0' +///Լϵͳ +#define THOST_FTDC_CIT_HasATP '1' +///ԼȽϲһ +#define THOST_FTDC_CIT_HasDiff '2' + +typedef char TThostFtdcCheckInstrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeliveryTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ֹ +#define THOST_FTDC_DT_HandDeliv '1' +///ڽ +#define THOST_FTDC_DT_PersonDeliv '2' + +typedef char TThostFtdcDeliveryTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBigMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcBigMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMaxMarginSideAlgorithmTypeһ֤߱㷨 +///////////////////////////////////////////////////////////////////////// +///ʹô֤߱㷨 +#define THOST_FTDC_MMSA_NO '0' +///ʹô֤߱㷨 +#define THOST_FTDC_MMSA_YES '1' + +typedef char TThostFtdcMaxMarginSideAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDAClientTypeTypeһʲͻ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CACT_Person '0' +/// +#define THOST_FTDC_CACT_Company '1' +/// +#define THOST_FTDC_CACT_Other '2' + +typedef char TThostFtdcDAClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinInstrIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombinInstrIDType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinSettlePriceTypeһȽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombinSettlePriceType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDCEPriorityTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDCEPriorityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeGroupIDTypeһɽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradeGroupIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsCheckPrepaTypeһǷУ鿪ʽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcIsCheckPrepaType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAAssetmgrTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_UOAAT_Futures '1' +///ۺ +#define THOST_FTDC_UOAAT_SpecialOrgan '2' + +typedef char TThostFtdcUOAAssetmgrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDirectionEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Buy +#define THOST_FTDC_DEN_Buy '0' +///Sell +#define THOST_FTDC_DEN_Sell '1' + +typedef char TThostFtdcDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetFlagEnTypeһƽ־ +///////////////////////////////////////////////////////////////////////// +///Position Opening +#define THOST_FTDC_OFEN_Open '0' +///Position Close +#define THOST_FTDC_OFEN_Close '1' +///Forced Liquidation +#define THOST_FTDC_OFEN_ForceClose '2' +///Close Today +#define THOST_FTDC_OFEN_CloseToday '3' +///Close Prev. +#define THOST_FTDC_OFEN_CloseYesterday '4' +///Forced Reduction +#define THOST_FTDC_OFEN_ForceOff '5' +///Local Forced Liquidation +#define THOST_FTDC_OFEN_LocalForceClose '6' + +typedef char TThostFtdcOffsetFlagEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHedgeFlagEnTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Speculation +#define THOST_FTDC_HFEN_Speculation '1' +///Arbitrage +#define THOST_FTDC_HFEN_Arbitrage '2' +///Hedge +#define THOST_FTDC_HFEN_Hedge '3' + +typedef char TThostFtdcHedgeFlagEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundIOTypeEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Deposit/Withdrawal +#define THOST_FTDC_FIOTEN_FundIO '1' +///Bank-Futures Transfer +#define THOST_FTDC_FIOTEN_Transfer '2' +///Bank-Futures FX Exchange +#define THOST_FTDC_FIOTEN_SwapCurrency '3' + +typedef char TThostFtdcFundIOTypeEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundTypeEnTypeһʽ +///////////////////////////////////////////////////////////////////////// +///Bank Deposit +#define THOST_FTDC_FTEN_Deposite '1' +///Payment/Fee +#define THOST_FTDC_FTEN_ItemFund '2' +///Brokerage Adj +#define THOST_FTDC_FTEN_Company '3' +///Internal Transfer +#define THOST_FTDC_FTEN_InnerTransfer '4' + +typedef char TThostFtdcFundTypeEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundDirectionEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Deposit +#define THOST_FTDC_FDEN_In '1' +///Withdrawal +#define THOST_FTDC_FDEN_Out '2' + +typedef char TThostFtdcFundDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortDirectionEnTypeһѺ +///////////////////////////////////////////////////////////////////////// +///Pledge +#define THOST_FTDC_FMDEN_In '1' +///Redemption +#define THOST_FTDC_FMDEN_Out '2' + +typedef char TThostFtdcFundMortDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSwapBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSwapBusinessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionsTypeTypeһȨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CP_CallOptions '1' +/// +#define THOST_FTDC_CP_PutOptions '2' + +typedef char TThostFtdcOptionsTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeModeTypeһִзʽ +///////////////////////////////////////////////////////////////////////// +///ŷʽ +#define THOST_FTDC_STM_Continental '0' +///ʽ +#define THOST_FTDC_STM_American '1' +///Ľ +#define THOST_FTDC_STM_Bermuda '2' + +typedef char TThostFtdcStrikeModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeTypeTypeһִ +///////////////////////////////////////////////////////////////////////// +///Գ +#define THOST_FTDC_STT_Hedge '0' +///ƥִ +#define THOST_FTDC_STT_Match '1' + +typedef char TThostFtdcStrikeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyTypeTypeһнȨִ +///////////////////////////////////////////////////////////////////////// +///ִ +#define THOST_FTDC_APPT_NotStrikeNum '4' + +typedef char TThostFtdcApplyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGiveUpDataSourceTypeһִԴ +///////////////////////////////////////////////////////////////////////// +///ϵͳ +#define THOST_FTDC_GUDS_Gen '0' +///ֹ +#define THOST_FTDC_GUDS_Hand '1' + +typedef char TThostFtdcGiveUpDataSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderSysIDTypeһִϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExecOrderSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecResultTypeһִн +///////////////////////////////////////////////////////////////////////// +///ûִ +#define THOST_FTDC_OER_NoExec 'n' +///Ѿȡ +#define THOST_FTDC_OER_Canceled 'c' +///ִгɹ +#define THOST_FTDC_OER_OK '0' +///Ȩֲֲ +#define THOST_FTDC_OER_NoPosition '1' +///ʽ𲻹 +#define THOST_FTDC_OER_NoDeposit '2' +///Ա +#define THOST_FTDC_OER_NoParticipant '3' +///ͻ +#define THOST_FTDC_OER_NoClient '4' +///Լ +#define THOST_FTDC_OER_NoInstrument '6' +///ûִȨ +#define THOST_FTDC_OER_NoRight '7' +/// +#define THOST_FTDC_OER_InvalidVolume '8' +///û㹻ʷɽ +#define THOST_FTDC_OER_NoEnoughHistoryTrade '9' +///δ֪ +#define THOST_FTDC_OER_Unknown 'a' + +typedef char TThostFtdcExecResultType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeSequenceTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcStrikeSequenceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeTimeTypeһִʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcStrikeTimeType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinationTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_COMBT_Future '0' +///ֱ۲BUL +#define THOST_FTDC_COMBT_BUL '1' +///ֱ۲BER +#define THOST_FTDC_COMBT_BER '2' +///ʽ +#define THOST_FTDC_COMBT_STD '3' +///ʽ +#define THOST_FTDC_COMBT_STG '4' +/// +#define THOST_FTDC_COMBT_PRT '5' + +typedef char TThostFtdcCombinationTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionRoyaltyPriceTypeTypeһȨȨ۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ORPT_PreSettlementPrice '1' +///ּ +#define THOST_FTDC_ORPT_OpenPrice '4' + +typedef char TThostFtdcOptionRoyaltyPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBalanceAlgorithmTypeһȨ㷨 +///////////////////////////////////////////////////////////////////////// +///Ȩֵӯ +#define THOST_FTDC_BLAG_Default '1' +///Ȩֵ +#define THOST_FTDC_BLAG_IncludeOptValLost '2' + +typedef char TThostFtdcBalanceAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActionTypeTypeһִ +///////////////////////////////////////////////////////////////////////// +///ִ +#define THOST_FTDC_ACTP_Exec '1' +/// +#define THOST_FTDC_ACTP_Abandon '2' + +typedef char TThostFtdcActionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForQuoteStatusTypeһѯ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_FQST_Submitted 'a' +///Ѿ +#define THOST_FTDC_FQST_Accepted 'b' +///Ѿܾ +#define THOST_FTDC_FQST_Rejected 'c' + +typedef char TThostFtdcForQuoteStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuotStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_QTST_Unknown 'a' +///Ѿ +#define THOST_FTDC_QTST_Accepted 'b' +///Ѿ +#define THOST_FTDC_QTST_Canceled 'c' + +typedef char TThostFtdcQuotStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcValueMethodTypeһȡֵʽ +///////////////////////////////////////////////////////////////////////// +///ֵ +#define THOST_FTDC_VM_Absolute '0' +/// +#define THOST_FTDC_VM_Ratio '1' + +typedef char TThostFtdcValueMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderPositionFlagTypeһȨȨǷڻͷı +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EOPF_Reserve '0' +/// +#define THOST_FTDC_EOPF_UnReserve '1' + +typedef char TThostFtdcExecOrderPositionFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderCloseFlagTypeһȨȨɵͷǷԶƽ +///////////////////////////////////////////////////////////////////////// +///Զƽ +#define THOST_FTDC_EOCF_AutoClose '0' +///Զƽ +#define THOST_FTDC_EOCF_NotToClose '1' + +typedef char TThostFtdcExecOrderCloseFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductTypeTypeһƷ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_PTE_Futures '1' +///Ȩ +#define THOST_FTDC_PTE_Options '2' + +typedef char TThostFtdcProductTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCZCEUploadFileNameTypeһ֣ļ +///////////////////////////////////////////////////////////////////////// +///^\d{8}_zz_\d{4} +#define THOST_FTDC_CUFN_CUFN_O 'O' +///^\d{8}ɽ +#define THOST_FTDC_CUFN_CUFN_T 'T' +///^\d{8}ȳֱֲnew +#define THOST_FTDC_CUFN_CUFN_P 'P' +///^\d{8}ƽ˽ +#define THOST_FTDC_CUFN_CUFN_N 'N' +///^\d{8}ƽֱ +#define THOST_FTDC_CUFN_CUFN_L 'L' +///^\d{8}ʽ +#define THOST_FTDC_CUFN_CUFN_F 'F' +///^\d{8}ϳֱֲ +#define THOST_FTDC_CUFN_CUFN_C 'C' +///^\d{8}֤ +#define THOST_FTDC_CUFN_CUFN_M 'M' + +typedef char TThostFtdcCZCEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDCEUploadFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +///^\d{8}_dl_\d{3} +#define THOST_FTDC_DUFN_DUFN_O 'O' +///^\d{8}_ɽ +#define THOST_FTDC_DUFN_DUFN_T 'T' +///^\d{8}_ֱֲ +#define THOST_FTDC_DUFN_DUFN_P 'P' +///^\d{8}_ʽ +#define THOST_FTDC_DUFN_DUFN_F 'F' +///^\d{8}_Żϳֲϸ +#define THOST_FTDC_DUFN_DUFN_C 'C' +///^\d{8}_ֲϸ +#define THOST_FTDC_DUFN_DUFN_D 'D' +///^\d{8}_֤ +#define THOST_FTDC_DUFN_DUFN_M 'M' +///^\d{8}_Ȩִб +#define THOST_FTDC_DUFN_DUFN_S 'S' + +typedef char TThostFtdcDCEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEUploadFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +///^\d{4}_\d{8}_\d{8}_DailyFundChg +#define THOST_FTDC_SUFN_SUFN_O 'O' +///^\d{4}_\d{8}_\d{8}_Trade +#define THOST_FTDC_SUFN_SUFN_T 'T' +///^\d{4}_\d{8}_\d{8}_SettlementDetail +#define THOST_FTDC_SUFN_SUFN_P 'P' +///^\d{4}_\d{8}_\d{8}_Capital +#define THOST_FTDC_SUFN_SUFN_F 'F' + +typedef char TThostFtdcSHFEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFFEXUploadFileNameTypeһнļ +///////////////////////////////////////////////////////////////////////// +///^\d{4}_SG\d{1}_\d{8}_\d{1}_Trade +#define THOST_FTDC_CFUFN_SUFN_T 'T' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_SettlementDetail +#define THOST_FTDC_CFUFN_SUFN_P 'P' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_Capital +#define THOST_FTDC_CFUFN_SUFN_F 'F' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_OptionExec +#define THOST_FTDC_CFUFN_SUFN_S 'S' + +typedef char TThostFtdcCFFEXUploadFileNameType; + +#endif diff --git a/include/ATP/ThostFtdcUserApiStruct.h b/include/ATP/ThostFtdcUserApiStruct.h new file mode 100644 index 0000000..1505859 --- /dev/null +++ b/include/ATP/ThostFtdcUserApiStruct.h @@ -0,0 +1,7452 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcUserApiStruct.h +///@brief ˿ͻ˽ӿʹõҵݽṹ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCSTRUCT_H) +#define THOST_FTDCSTRUCT_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ThostFtdcUserApiDataType.h" + +///Ϣַ +struct CThostFtdcDisseminationField +{ + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///к + TThostFtdcSequenceNoType SequenceNo; +}; + +///û¼ +struct CThostFtdcReqUserLoginField +{ + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///նIPַ + TThostFtdcIPAddressType ClientIPAddress; +}; + +///û¼Ӧ +struct CThostFtdcRspUserLoginField +{ + /// + TThostFtdcDateType TradingDay; + ///¼ɹʱ + TThostFtdcTimeType LoginTime; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Դʱ + TThostFtdcTimeType INETime; +}; + +///ûdz +struct CThostFtdcUserLogoutField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ǿƽԱ˳ +struct CThostFtdcForceUserLogoutField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ͻ֤ +struct CThostFtdcReqAuthenticateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤ + TThostFtdcAuthCodeType AuthCode; +}; + +///ͻ֤Ӧ +struct CThostFtdcRspAuthenticateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; +}; + +///ͻ֤Ϣ +struct CThostFtdcAuthenticationInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤Ϣ + TThostFtdcAuthInfoType AuthInfo; + ///ǷΪ֤ + TThostFtdcBoolType IsResult; +}; + +///תʱͷ +struct CThostFtdcTransferHeaderField +{ + ///汾ţ1.0 + TThostFtdcVersionType Version; + ///״룬 + TThostFtdcTradeCodeType TradeCode; + ///ڣʽyyyymmdd + TThostFtdcTradeDateType TradeDate; + ///ʱ䣬ʽhhmmss + TThostFtdcTradeTimeType TradeTime; + ///ˮţN/A + TThostFtdcTradeSerialType TradeSerial; + ///ڻ˾룬 + TThostFtdcFutureIDType FutureID; + ///д룬ݲѯеõ + TThostFtdcBankIDType BankID; + ///зĴ룬ݲѯеõ + TThostFtdcBankBrchIDType BankBrchID; + ///ԱN/A + TThostFtdcOperNoType OperNo; + ///豸ͣN/A + TThostFtdcDeviceIDType DeviceID; + ///¼N/A + TThostFtdcRecordNumType RecordNum; + ///ỰţN/A + TThostFtdcSessionIDType SessionID; + ///ţN/A + TThostFtdcRequestIDType RequestID; +}; + +///ʽתڻTradeCode=202001 +struct CThostFtdcTransferBankToFutureReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ʽתڻӦ +struct CThostFtdcTransferBankToFutureRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ڻʽתTradeCode=202002 +struct CThostFtdcTransferFutureToBankReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ڻʽתӦ +struct CThostFtdcTransferFutureToBankRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ѯʽTradeCode=204002 +struct CThostFtdcTransferQryBankReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ѯʽӦ +struct CThostFtdcTransferQryBankRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + /// + TThostFtdcMoneyType TradeAmt; + ///п + TThostFtdcMoneyType UseAmt; + ///пȡ + TThostFtdcMoneyType FetchAmt; + /// + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ѯнϸTradeCode=204999 +struct CThostFtdcTransferQryDetailReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; +}; + +///ѯнϸӦ +struct CThostFtdcTransferQryDetailRspField +{ + /// + TThostFtdcDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///ڻˮ + TThostFtdcTradeSerialNoType FutureSerial; + ///ڻ˾ + TThostFtdcFutureIDType FutureID; + ///ʽʺ + TThostFtdcFutureAccountType FutureAccount; + ///ˮ + TThostFtdcTradeSerialNoType BankSerial; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + ///˺ + TThostFtdcBankAccountType BankAccount; + ///֤ + TThostFtdcCertCodeType CertCode; + ///Ҵ + TThostFtdcCurrencyCodeType CurrencyCode; + /// + TThostFtdcMoneyType TxAmount; + ///Ч־ + TThostFtdcTransferValidFlagType Flag; +}; + +///ӦϢ +struct CThostFtdcRspInfoField +{ + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +/// +struct CThostFtdcExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcExchangeNameType ExchangeName; + /// + TThostFtdcExchangePropertyType ExchangeProperty; +}; + +///Ʒ +struct CThostFtdcProductField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductNameType ProductName; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceType PriceTick; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///ֲ + TThostFtdcPositionTypeType PositionType; + ///ֲ + TThostFtdcPositionDateTypeType PositionDateType; + ///ƽִ + TThostFtdcCloseDealTypeType CloseDealType; + ///ױ + TThostFtdcCurrencyIDType TradeCurrencyID; + ///Ѻʽ÷Χ + TThostFtdcMortgageFundUseRangeType MortgageFundUseRange; + ///Ʒ + TThostFtdcInstrumentIDType ExchangeProductID; + ///ԼƷ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; +}; + +///Լ +struct CThostFtdcInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentNameType InstrumentName; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + /// + TThostFtdcYearType DeliveryYear; + /// + TThostFtdcMonthType DeliveryMonth; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceType PriceTick; + /// + TThostFtdcDateType CreateDate; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcDateType ExpireDate; + ///ʼ + TThostFtdcDateType StartDelivDate; + /// + TThostFtdcDateType EndDelivDate; + ///Լ״̬ + TThostFtdcInstLifePhaseType InstLifePhase; + ///ǰǷ + TThostFtdcBoolType IsTrading; + ///ֲ + TThostFtdcPositionTypeType PositionType; + ///ֲ + TThostFtdcPositionDateTypeType PositionDateType; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatio; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatio; + ///Ƿʹô֤߱㷨 + TThostFtdcMaxMarginSideAlgorithmType MaxMarginSideAlgorithm; + ///Ʒ + TThostFtdcInstrumentIDType UnderlyingInstrID; + ///ִм + TThostFtdcPriceType StrikePrice; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType; + ///ԼƷ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; + /// + TThostFtdcCombinationTypeType CombinationType; +}; + +///͹˾ +struct CThostFtdcBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ + TThostFtdcBrokerAbbrType BrokerAbbr; + ///͹˾ + TThostFtdcBrokerNameType BrokerName; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///Ա +struct CThostFtdcTraderField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallCountType InstallCount; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///Ͷ +struct CThostFtdcInvestorField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcDateType OpenDate; + ///ֻ + TThostFtdcMobileType Mobile; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ױ +struct CThostFtdcTradingCodeField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; +}; + +///Ա;͹˾ձ +struct CThostFtdcPartBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///û +struct CThostFtdcSuperUserField +{ + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + /// + TThostFtdcPasswordType Password; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///ûȨ +struct CThostFtdcSuperUserFunctionField +{ + ///û + TThostFtdcUserIDType UserID; + ///ܴ + TThostFtdcFunctionCodeType FunctionCode; +}; + +///Ͷ +struct CThostFtdcInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ߷ + TThostFtdcInvestorGroupNameType InvestorGroupName; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ϴѺ + TThostFtdcMoneyType PreMortgage; + ///ϴö + TThostFtdcMoneyType PreCredit; + ///ϴδ + TThostFtdcMoneyType PreDeposit; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///Ϣ + TThostFtdcMoneyType InterestBase; + ///Ϣ + TThostFtdcMoneyType Interest; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + ///ʽ + TThostFtdcMoneyType Available; + ///ȡʽ + TThostFtdcMoneyType WithdrawQuota; + ///׼ + TThostFtdcMoneyType Reserve; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ö + TThostFtdcMoneyType Credit; + ///Ѻ + TThostFtdcMoneyType Mortgage; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///Ͷ߽֤ + TThostFtdcMoneyType DeliveryMargin; + ///֤ + TThostFtdcMoneyType ExchangeDeliveryMargin; + ///ڻ׼ + TThostFtdcMoneyType ReserveBalance; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ϴλ + TThostFtdcMoneyType PreFundMortgageIn; + ///ϴλʳ + TThostFtdcMoneyType PreFundMortgageOut; + /// + TThostFtdcMoneyType FundMortgageIn; + ///ʳ + TThostFtdcMoneyType FundMortgageOut; + ///Ѻ + TThostFtdcMoneyType FundMortgageAvailable; + ///Ѻҽ + TThostFtdcMoneyType MortgageableFund; + ///Ʒռñ֤ + TThostFtdcMoneyType SpecProductMargin; + ///Ʒᱣ֤ + TThostFtdcMoneyType SpecProductFrozenMargin; + ///Ʒ + TThostFtdcMoneyType SpecProductCommission; + ///Ʒ + TThostFtdcMoneyType SpecProductFrozenCommission; + ///Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfit; + ///Ʒƽӯ + TThostFtdcMoneyType SpecProductCloseProfit; + ///ݳֲӯ㷨Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfitByAlg; + ///Ʒ֤ + TThostFtdcMoneyType SpecProductExchangeMargin; +}; + +///Ͷֲ߳ +struct CThostFtdcInvestorPositionField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcPositionDateType PositionDate; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ճֲ + TThostFtdcVolumeType Position; + ///ͷ + TThostFtdcVolumeType LongFrozen; + ///ͷ + TThostFtdcVolumeType ShortFrozen; + ///ֶ + TThostFtdcMoneyType LongFrozenAmount; + ///ֶ + TThostFtdcMoneyType ShortFrozenAmount; + /// + TThostFtdcVolumeType OpenVolume; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ֽ + TThostFtdcMoneyType OpenAmount; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ֲֳɱ + TThostFtdcMoneyType PositionCost; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ֳɱ + TThostFtdcMoneyType OpenCost; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///ϳɽγɵijֲ + TThostFtdcVolumeType CombPosition; + ///϶ͷ + TThostFtdcVolumeType CombLongFrozen; + ///Ͽͷ + TThostFtdcVolumeType CombShortFrozen; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///ճֲ + TThostFtdcVolumeType TodayPosition; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ִж + TThostFtdcVolumeType StrikeFrozen; + ///ִж + TThostFtdcMoneyType StrikeFrozenAmount; + ///ִж + TThostFtdcVolumeType AbandonFrozen; +}; + +///Լ֤ +struct CThostFtdcInstrumentMarginRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; +}; + +///Լ +struct CThostFtdcInstrumentCommissionRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; +}; + +/// +struct CThostFtdcDepthMarketDataField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; + ///վ + TThostFtdcPriceType AveragePrice; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +///ͶߺԼȨ +struct CThostFtdcInstrumentTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ȩ + TThostFtdcTradingRightType TradingRight; +}; + +///͹˾û +struct CThostFtdcBrokerUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + ///û + TThostFtdcUserTypeType UserType; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///Ƿʹ + TThostFtdcBoolType IsUsingOTP; +}; + +///͹˾û +struct CThostFtdcBrokerUserPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; +}; + +///͹˾ûȨ +struct CThostFtdcBrokerUserFunctionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///͹˾ܴ + TThostFtdcBrokerFunctionCodeType BrokerFunctionCode; +}; + +///Ա̻ +struct CThostFtdcTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ϯλɽ + TThostFtdcTradeIDType MaxTradeID; + ///ϯλ󱨵 + TThostFtdcReturnCodeType MaxOrderMessageReference; +}; + +///Ͷ߽ +struct CThostFtdcSettlementInfoField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType Content; +}; + +///Լ֤ʵ +struct CThostFtdcInstrumentMarginRateAdjustField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; +}; + +///֤ +struct CThostFtdcExchangeMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; +}; + +///֤ʵ +struct CThostFtdcExchangeMarginRateAdjustField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///潻Ͷ߶ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///潻Ͷ߶ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///潻Ͷ߿ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///潻Ͷ߿ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ExchLongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ExchLongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ExchShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ExchShortMarginRatioByVolume; + ///潻Ͷ߶ͷ֤ + TThostFtdcRatioType NoLongMarginRatioByMoney; + ///潻Ͷ߶ͷ֤ + TThostFtdcMoneyType NoLongMarginRatioByVolume; + ///潻Ͷ߿ͷ֤ + TThostFtdcRatioType NoShortMarginRatioByMoney; + ///潻Ͷ߿ͷ֤ + TThostFtdcMoneyType NoShortMarginRatioByVolume; +}; + +/// +struct CThostFtdcExchangeRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Դֵλ + TThostFtdcCurrencyUnitType FromCurrencyUnit; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; + /// + TThostFtdcExchangeRateType ExchangeRate; +}; + +/// +struct CThostFtdcSettlementRefField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; +}; + +///ǰʱ +struct CThostFtdcCurrentTimeField +{ + ///ǰ + TThostFtdcDateType CurrDate; + ///ǰʱ + TThostFtdcTimeType CurrTime; + ///ǰʱ䣨룩 + TThostFtdcMillisecType CurrMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +///ͨѶ׶ +struct CThostFtdcCommPhaseField +{ + /// + TThostFtdcDateType TradingDay; + ///ͨѶʱα + TThostFtdcCommPhaseNoType CommPhaseNo; + ///ϵͳ + TThostFtdcSystemIDType SystemID; +}; + +///¼Ϣ +struct CThostFtdcLoginInfoField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + /// + TThostFtdcPasswordType Password; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///Դʱ + TThostFtdcTimeType INETime; +}; + +///¼Ϣ +struct CThostFtdcLogoutAllField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; +}; + +///ǰ״̬ +struct CThostFtdcFrontStatusField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///û +struct CThostFtdcUserPasswordUpdateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; +}; + +///뱨 +struct CThostFtdcInputOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///־ + TThostFtdcBoolType IsSwapOrder; +}; + +/// +struct CThostFtdcOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ + TThostFtdcVolumeType ZCETotalTradedVolume; + ///־ + TThostFtdcBoolType IsSwapOrder; +}; + +/// +struct CThostFtdcExchangeOrderField +{ + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; +}; + +///ʧ +struct CThostFtdcExchangeOrderInsertErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///뱨 +struct CThostFtdcInputOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +/// +struct CThostFtdcOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +/// +struct CThostFtdcExchangeOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; +}; + +///ʧ +struct CThostFtdcExchangeOrderActionErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ɽ +struct CThostFtdcExchangeTradeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ɽԴ + TThostFtdcTradeSourceType TradeSource; +}; + +///ɽ +struct CThostFtdcTradeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ɽԴ + TThostFtdcTradeSourceType TradeSource; +}; + +///ûỰ +struct CThostFtdcUserSessionField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ѯ󱨵 +struct CThostFtdcQueryMaxOrderVolumeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; +}; + +///Ͷ߽ȷϢ +struct CThostFtdcSettlementInfoConfirmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ȷ + TThostFtdcDateType ConfirmDate; + ///ȷʱ + TThostFtdcTimeType ConfirmTime; +}; + +///ͬ +struct CThostFtdcSyncDepositField +{ + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcMoneyType Deposit; + ///Ƿǿƽ + TThostFtdcBoolType IsForce; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///Ѻͬ +struct CThostFtdcSyncFundMortgageField +{ + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Ѻ + TThostFtdcMoneyType MortgageAmount; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; +}; + +///͹˾ͬ +struct CThostFtdcBrokerSyncField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ͬеͶ +struct CThostFtdcSyncingInvestorField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcDateType OpenDate; + ///ֻ + TThostFtdcMobileType Mobile; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ͬеĽ״ +struct CThostFtdcSyncingTradingCodeField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; +}; + +///ͬеͶ߷ +struct CThostFtdcSyncingInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ߷ + TThostFtdcInvestorGroupNameType InvestorGroupName; +}; + +///ͬеĽ˺ +struct CThostFtdcSyncingTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ϴѺ + TThostFtdcMoneyType PreMortgage; + ///ϴö + TThostFtdcMoneyType PreCredit; + ///ϴδ + TThostFtdcMoneyType PreDeposit; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///Ϣ + TThostFtdcMoneyType InterestBase; + ///Ϣ + TThostFtdcMoneyType Interest; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + ///ʽ + TThostFtdcMoneyType Available; + ///ȡʽ + TThostFtdcMoneyType WithdrawQuota; + ///׼ + TThostFtdcMoneyType Reserve; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ö + TThostFtdcMoneyType Credit; + ///Ѻ + TThostFtdcMoneyType Mortgage; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///Ͷ߽֤ + TThostFtdcMoneyType DeliveryMargin; + ///֤ + TThostFtdcMoneyType ExchangeDeliveryMargin; + ///ڻ׼ + TThostFtdcMoneyType ReserveBalance; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ϴλ + TThostFtdcMoneyType PreFundMortgageIn; + ///ϴλʳ + TThostFtdcMoneyType PreFundMortgageOut; + /// + TThostFtdcMoneyType FundMortgageIn; + ///ʳ + TThostFtdcMoneyType FundMortgageOut; + ///Ѻ + TThostFtdcMoneyType FundMortgageAvailable; + ///Ѻҽ + TThostFtdcMoneyType MortgageableFund; + ///Ʒռñ֤ + TThostFtdcMoneyType SpecProductMargin; + ///Ʒᱣ֤ + TThostFtdcMoneyType SpecProductFrozenMargin; + ///Ʒ + TThostFtdcMoneyType SpecProductCommission; + ///Ʒ + TThostFtdcMoneyType SpecProductFrozenCommission; + ///Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfit; + ///Ʒƽӯ + TThostFtdcMoneyType SpecProductCloseProfit; + ///ݳֲӯ㷨Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfitByAlg; + ///Ʒ֤ + TThostFtdcMoneyType SpecProductExchangeMargin; +}; + +///ͬеͶֲ߳ +struct CThostFtdcSyncingInvestorPositionField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcPositionDateType PositionDate; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ճֲ + TThostFtdcVolumeType Position; + ///ͷ + TThostFtdcVolumeType LongFrozen; + ///ͷ + TThostFtdcVolumeType ShortFrozen; + ///ֶ + TThostFtdcMoneyType LongFrozenAmount; + ///ֶ + TThostFtdcMoneyType ShortFrozenAmount; + /// + TThostFtdcVolumeType OpenVolume; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ֽ + TThostFtdcMoneyType OpenAmount; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ֲֳɱ + TThostFtdcMoneyType PositionCost; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ֳɱ + TThostFtdcMoneyType OpenCost; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///ϳɽγɵijֲ + TThostFtdcVolumeType CombPosition; + ///϶ͷ + TThostFtdcVolumeType CombLongFrozen; + ///Ͽͷ + TThostFtdcVolumeType CombShortFrozen; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///ճֲ + TThostFtdcVolumeType TodayPosition; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ִж + TThostFtdcVolumeType StrikeFrozen; + ///ִж + TThostFtdcMoneyType StrikeFrozenAmount; + ///ִж + TThostFtdcVolumeType AbandonFrozen; +}; + +///ͬеĺԼ֤ +struct CThostFtdcSyncingInstrumentMarginRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; +}; + +///ͬеĺԼ +struct CThostFtdcSyncingInstrumentCommissionRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; +}; + +///ͬеĺԼȨ +struct CThostFtdcSyncingInstrumentTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ȩ + TThostFtdcTradingRightType TradingRight; +}; + +///ѯ +struct CThostFtdcQryOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ѯɽ +struct CThostFtdcQryTradeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + ///ʼʱ + TThostFtdcTimeType TradeTimeStart; + ///ʱ + TThostFtdcTimeType TradeTimeEnd; +}; + +///ѯͶֲ߳ +struct CThostFtdcQryInvestorPositionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯʽ˻ +struct CThostFtdcQryTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯͶ +struct CThostFtdcQryInvestorField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ѯױ +struct CThostFtdcQryTradingCodeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; +}; + +///ѯͶ +struct CThostFtdcQryInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯԼ֤ +struct CThostFtdcQryInstrumentMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯ +struct CThostFtdcQryInstrumentCommissionRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯԼȨ +struct CThostFtdcQryInstrumentTradingRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯ͹˾ +struct CThostFtdcQryBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯԱ +struct CThostFtdcQryTraderField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯûȨ +struct CThostFtdcQrySuperUserFunctionField +{ + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯûỰ +struct CThostFtdcQryUserSessionField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ͹˾Ա +struct CThostFtdcQryPartBrokerField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; +}; + +///ѯǰ״̬ +struct CThostFtdcQryFrontStatusField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; +}; + +///ѯ +struct CThostFtdcQryExchangeOrderField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯ +struct CThostFtdcQryOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ +struct CThostFtdcQryExchangeOrderActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯû +struct CThostFtdcQrySuperUserField +{ + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ +struct CThostFtdcQryExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯƷ +struct CThostFtdcQryProductField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; +}; + +///ѯԼ +struct CThostFtdcQryInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; +}; + +///ѯ +struct CThostFtdcQryDepthMarketDataField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯ͹˾û +struct CThostFtdcQryBrokerUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ͹˾ûȨ +struct CThostFtdcQryBrokerUserFunctionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯԱ̻ +struct CThostFtdcQryTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯˮ +struct CThostFtdcQrySyncDepositField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; +}; + +///ѯͶ߽ +struct CThostFtdcQrySettlementInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; +}; + +///ѯ֤ +struct CThostFtdcQryExchangeMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯ֤ +struct CThostFtdcQryExchangeMarginRateAdjustField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯ +struct CThostFtdcQryExchangeRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; +}; + +///ѯѺˮ +struct CThostFtdcQrySyncFundMortgageField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; +}; + +///ѯ +struct CThostFtdcQryHisOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; +}; + +///ǰȨԼС֤ +struct CThostFtdcOptionInstrMiniMarginField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///λ֣ȨԼС֤ + TThostFtdcMoneyType MinMargin; + ///ȡֵʽ + TThostFtdcValueMethodType ValueMethod; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; +}; + +///ǰȨԼ֤ϵ +struct CThostFtdcOptionInstrMarginAdjustField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷͷ֤ϵ + TThostFtdcRatioType SShortMarginRatioByMoney; + ///Ͷͷ֤ϵ + TThostFtdcMoneyType SShortMarginRatioByVolume; + ///ֵͷ֤ϵ + TThostFtdcRatioType HShortMarginRatioByMoney; + ///ֵͷ֤ϵ + TThostFtdcMoneyType HShortMarginRatioByVolume; + ///ͷ֤ϵ + TThostFtdcRatioType AShortMarginRatioByMoney; + ///ͷ֤ϵ + TThostFtdcMoneyType AShortMarginRatioByVolume; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; +}; + +///ǰȨԼѵϸ +struct CThostFtdcOptionInstrCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///ִ + TThostFtdcRatioType StrikeRatioByMoney; + ///ִ + TThostFtdcRatioType StrikeRatioByVolume; +}; + +///Ȩ׳ɱ +struct CThostFtdcOptionInstrTradeCostField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType FixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType MiniMargin; + ///ȨԼȨ + TThostFtdcMoneyType Royalty; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType ExchFixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType ExchMiniMargin; +}; + +///Ȩ׳ɱѯ +struct CThostFtdcQryOptionInstrTradeCostField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ + TThostFtdcPriceType InputPrice; + ///ļ۸,0 + TThostFtdcPriceType UnderlyingPrice; +}; + +///Ȩʲѯ +struct CThostFtdcQryOptionInstrCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ָָֻ +struct CThostFtdcIndexPriceField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ָֻ̼ + TThostFtdcPriceType ClosePrice; +}; + +///ִ +struct CThostFtdcInputExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; +}; + +///ִ +struct CThostFtdcInputExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ִ +struct CThostFtdcExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerExecOrderSeq; +}; + +///ִ +struct CThostFtdcExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ִѯ +struct CThostFtdcQryExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ִϢ +struct CThostFtdcExchangeExecOrderField +{ + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; +}; + +///ִѯ +struct CThostFtdcQryExchangeExecOrderField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ִѯ +struct CThostFtdcQryExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ִ +struct CThostFtdcExchangeExecOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; +}; + +///ִѯ +struct CThostFtdcQryExchangeExecOrderActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ִ +struct CThostFtdcErrExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯִ +struct CThostFtdcQryErrExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ִ +struct CThostFtdcErrExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯִ +struct CThostFtdcQryErrExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ͶȨԼȨ +struct CThostFtdcOptionInstrTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDirectionType Direction; + ///Ȩ + TThostFtdcTradingRightType TradingRight; +}; + +///ѯȨԼȨ +struct CThostFtdcQryOptionInstrTradingRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; +}; + +///ѯ +struct CThostFtdcInputForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ +struct CThostFtdcForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ѯ۱ + TThostFtdcSequenceNoType BrokerForQutoSeq; +}; + +///ѯ۲ѯ +struct CThostFtdcQryForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ѯϢ +struct CThostFtdcExchangeForQuoteField +{ + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; +}; + +///ѯ۲ѯ +struct CThostFtdcQryExchangeForQuoteField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ı +struct CThostFtdcInputQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; +}; + +///뱨۲ +struct CThostFtdcInputQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +/// +struct CThostFtdcQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾۱ + TThostFtdcSequenceNoType BrokerQuoteSeq; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; +}; + +///۲ +struct CThostFtdcQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///۲ѯ +struct CThostFtdcQryQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///Ϣ +struct CThostFtdcExchangeQuoteField +{ + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; +}; + +///۲ѯ +struct CThostFtdcQryExchangeQuoteField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///۲ѯ +struct CThostFtdcQryQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///۲ +struct CThostFtdcExchangeQuoteActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; +}; + +///۲ѯ +struct CThostFtdcQryExchangeQuoteActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ȨԼdeltaֵ +struct CThostFtdcOptionInstrDeltaField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Deltaֵ + TThostFtdcRatioType Delta; +}; + +///̵ѯ +struct CThostFtdcForQuoteRspField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///ѯʱ + TThostFtdcTimeType ForQuoteTime; + ///ҵ + TThostFtdcDateType ActionDay; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ǰȨԼִƫֵϸ +struct CThostFtdcStrikeOffsetField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִƫֵ + TThostFtdcMoneyType Offset; +}; + +///Ȩִƫֵѯ +struct CThostFtdcQryStrikeOffsetField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///г +struct CThostFtdcMarketDataField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +/// +struct CThostFtdcMarketDataBaseField +{ + /// + TThostFtdcDateType TradingDay; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + ///ʵ + TThostFtdcRatioType PreDelta; +}; + +///龲̬ +struct CThostFtdcMarketDataStaticField +{ + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcPriceType ClosePrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ʵ + TThostFtdcRatioType CurrDelta; +}; + +///³ɽ +struct CThostFtdcMarketDataLastMatchField +{ + ///¼ + TThostFtdcPriceType LastPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; +}; + +///ż +struct CThostFtdcMarketDataBestPriceField +{ + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; +}; + +/// +struct CThostFtdcMarketDataBid23Field +{ + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; +}; + +/// +struct CThostFtdcMarketDataAsk23Field +{ + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; +}; + +///ġ +struct CThostFtdcMarketDataBid45Field +{ + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; +}; + +///ġ +struct CThostFtdcMarketDataAsk45Field +{ + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; +}; + +///ʱ +struct CThostFtdcMarketDataUpdateTimeField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +///齻 +struct CThostFtdcMarketDataExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ָĺԼ +struct CThostFtdcSpecificInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///Լ״̬ +struct CThostFtdcInstrumentStatusField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcSettlementGroupIDType SettlementGroupID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Լ״̬ + TThostFtdcInstrumentStatusType InstrumentStatus; + ///׽׶α + TThostFtdcTradingSegmentSNType TradingSegmentSN; + ///뱾״̬ʱ + TThostFtdcTimeType EnterTime; + ///뱾״̬ԭ + TThostFtdcInstStatusEnterReasonType EnterReason; +}; + +///ѯԼ״̬ +struct CThostFtdcQryInstrumentStatusField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; +}; + +///Ͷ˻ +struct CThostFtdcInvestorAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ӯ㷨 +struct CThostFtdcPositionProfitAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///ע + TThostFtdcMemoType Memo; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///Աʽۿ +struct CThostFtdcDiscountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʽۿ۱ + TThostFtdcRatioType Discount; +}; + +///ѯת +struct CThostFtdcQryTransferBankField +{ + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; +}; + +///ת +struct CThostFtdcTransferBankField +{ + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///ѯͶֲ߳ϸ +struct CThostFtdcQryInvestorPositionDetailField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///Ͷֲ߳ϸ +struct CThostFtdcInvestorPositionDetailField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcDateType OpenDate; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcVolumeType Volume; + ///ּ + TThostFtdcPriceType OpenPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///նгֲӯ + TThostFtdcMoneyType PositionProfitByDate; + ///ʶԳֲӯ + TThostFtdcMoneyType PositionProfitByTrade; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + /// + TThostFtdcPriceType LastSettlementPrice; + /// + TThostFtdcPriceType SettlementPrice; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///鱨̻ +struct CThostFtdcMDTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ϯλɽ + TThostFtdcTradeIDType MaxTradeID; + ///ϯλ󱨵 + TThostFtdcReturnCodeType MaxOrderMessageReference; +}; + +///ѯ鱨̻ +struct CThostFtdcQryMDTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯͻ֪ͨ +struct CThostFtdcQryNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ͻ֪ͨ +struct CThostFtdcNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ϣ + TThostFtdcContentType Content; + ///͹˾֪ͨк + TThostFtdcSequenceLabelType SequenceLabel; +}; + +///ûȨ +struct CThostFtdcUserRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ͻȨ + TThostFtdcUserRightTypeType UserRightType; + ///Ƿֹ + TThostFtdcBoolType IsForbidden; +}; + +///ѯϢȷ +struct CThostFtdcQrySettlementInfoConfirmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///װؽϢ +struct CThostFtdcLoadSettlementInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///͹˾ʽ㷨 +struct CThostFtdcBrokerWithdrawAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ㷨 + TThostFtdcAlgorithmType WithdrawAlgorithm; + ///ʽʹ + TThostFtdcRatioType UsingRatio; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType IncludeCloseProfit; + ///޲޳ɽͻǷܿ + TThostFtdcAllWithoutTradeType AllWithoutTrade; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///Ƿû¼ + TThostFtdcBoolType IsBrokerUserEvent; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; + ///Ȩ㷨 + TThostFtdcBalanceAlgorithmType BalanceAlgorithm; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordUpdateV1Field +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordUpdateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯϺԼ +struct CThostFtdcQryCombinationLegField +{ + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; +}; + +///ѯϺԼ +struct CThostFtdcQrySyncStatusField +{ + /// + TThostFtdcDateType TradingDay; +}; + +///Ͻ׺Լĵ +struct CThostFtdcCombinationLegField +{ + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + /// + TThostFtdcImplyLevelType ImplyLevel; +}; + +///ͬ״̬ +struct CThostFtdcSyncStatusField +{ + /// + TThostFtdcDateType TradingDay; + ///ͬ״̬ + TThostFtdcDataSyncStatusType DataSyncStatus; +}; + +///ѯϵ +struct CThostFtdcQryLinkManField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ϵ +struct CThostFtdcLinkManField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵ + TThostFtdcPersonTypeType PersonType; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + /// + TThostFtdcPartyNameType PersonName; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcZipCodeType ZipCode; + ///ȼ + TThostFtdcPriorityType Priority; + /// + TThostFtdcUOAZipCodeType UOAZipCode; + ///ȫ + TThostFtdcInvestorFullNameType PersonFullName; +}; + +///ѯ͹˾û¼ +struct CThostFtdcQryBrokerUserEventField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; +}; + +///ѯ͹˾û¼ +struct CThostFtdcBrokerUserEventField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; + ///û¼ + TThostFtdcSequenceNoType EventSequenceNo; + ///¼ + TThostFtdcDateType EventDate; + ///¼ʱ + TThostFtdcTimeType EventTime; + ///û¼Ϣ + TThostFtdcUserEventInfoType UserEventInfo; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯǩԼ +struct CThostFtdcQryContractBankField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; +}; + +///ѯǩԼӦ +struct CThostFtdcContractBankField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; +}; + +///Ͷϳֲϸ +struct CThostFtdcInvestorPositionCombineDetailField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///ϱ + TThostFtdcTradeIDType TradeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + ///ֲ + TThostFtdcVolumeType TotalAmt; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ɽ + TThostFtdcTradeGroupIDType TradeGroupID; +}; + +///Ԥ +struct CThostFtdcParkedOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ԥ񱨵 + TThostFtdcParkedOrderIDType ParkedOrderID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ״̬ + TThostFtdcParkedOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; +}; + +///Ԥ񵥲 +struct CThostFtdcParkedOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ԥ񳷵 + TThostFtdcParkedOrderActionIDType ParkedOrderActionID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ񳷵״̬ + TThostFtdcParkedOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯԤ +struct CThostFtdcQryParkedOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯԤ񳷵 +struct CThostFtdcQryParkedOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ɾԤ +struct CThostFtdcRemoveParkedOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񱨵 + TThostFtdcParkedOrderIDType ParkedOrderID; +}; + +///ɾԤ񳷵 +struct CThostFtdcRemoveParkedOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񳷵 + TThostFtdcParkedOrderActionIDType ParkedOrderActionID; +}; + +///͹˾ʽ㷨 +struct CThostFtdcInvestorWithdrawAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʽ + TThostFtdcRatioType UsingRatio; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; +}; + +///ѯϳֲϸ +struct CThostFtdcQryInvestorPositionCombineDetailField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; +}; + +///ɽ +struct CThostFtdcMarketDataAveragePriceField +{ + ///վ + TThostFtdcPriceType AveragePrice; +}; + +///УͶ +struct CThostFtdcVerifyInvestorPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcPasswordType Password; +}; + +///ûIP +struct CThostFtdcUserIPField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///IPַ + TThostFtdcIPAddressType IPMask; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///û¼֪ͨϢ +struct CThostFtdcTradingNoticeInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʱ + TThostFtdcTimeType SendTime; + ///Ϣ + TThostFtdcContentType FieldContent; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///к + TThostFtdcSequenceNoType SequenceNo; +}; + +///û¼֪ͨ +struct CThostFtdcTradingNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///û + TThostFtdcUserIDType UserID; + ///ʱ + TThostFtdcTimeType SendTime; + ///к + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType FieldContent; +}; + +///ѯ¼֪ͨ +struct CThostFtdcQryTradingNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ѯ󱨵 +struct CThostFtdcQryErrOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///󱨵 +struct CThostFtdcErrOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; +}; + +///ѯ󱨵 +struct CThostFtdcErrorConditionalOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ + TThostFtdcVolumeType ZCETotalTradedVolume; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; +}; + +///ѯ󱨵 +struct CThostFtdcQryErrOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///󱨵 +struct CThostFtdcErrOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ״̬ +struct CThostFtdcQryExchangeSequenceField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///״̬ +struct CThostFtdcExchangeSequenceField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Լ״̬ + TThostFtdcInstrumentStatusType MarketStatus; +}; + +///ݼ۸ѯ󱨵 +struct CThostFtdcQueryMaxOrderVolumeWithPriceField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; + ///۸ + TThostFtdcPriceType Price; +}; + +///ѯ͹˾ײ +struct CThostFtdcQryBrokerTradingParamsField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///͹˾ײ +struct CThostFtdcBrokerTradingParamsField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤۸ + TThostFtdcMarginPriceTypeType MarginPriceType; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ȨȨ۸ + TThostFtdcOptionRoyaltyPriceTypeType OptionRoyaltyPriceType; +}; + +///ѯ͹˾㷨 +struct CThostFtdcQryBrokerTradingAlgosField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///͹˾㷨 +struct CThostFtdcBrokerTradingAlgosField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ֲִ㷨 + TThostFtdcHandlePositionAlgoIDType HandlePositionAlgoID; + ///Ѱұ֤㷨 + TThostFtdcFindMarginRateAlgoIDType FindMarginRateAlgoID; + ///ʽ㷨 + TThostFtdcHandleTradingAccountAlgoIDType HandleTradingAccountAlgoID; +}; + +///ѯ͹˾ʽ +struct CThostFtdcQueryBrokerDepositField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///͹˾ʽ +struct CThostFtdcBrokerDepositField +{ + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ʽ + TThostFtdcMoneyType Available; + ///׼ + TThostFtdcMoneyType Reserve; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; +}; + +///ѯ֤ϵͳ͹˾Կ +struct CThostFtdcQryCFMMCBrokerKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///֤ϵͳ͹˾Կ +struct CThostFtdcCFMMCBrokerKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Կ + TThostFtdcDateType CreateDate; + ///Կʱ + TThostFtdcTimeType CreateTime; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬Կ + TThostFtdcCFMMCKeyType CurrentKey; + ///̬Կ + TThostFtdcCFMMCKeyKindType KeyKind; +}; + +///֤ϵͳ͹˾ʽ˻Կ +struct CThostFtdcCFMMCTradingAccountKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬Կ + TThostFtdcCFMMCKeyType CurrentKey; +}; + +///ѯ֤ϵͳ͹˾ʽ˻Կ +struct CThostFtdcQryCFMMCTradingAccountKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///û̬Ʋ +struct CThostFtdcBrokerUserOTPParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ṩ + TThostFtdcOTPVendorsIDType OTPVendorsID; + ///̬к + TThostFtdcSerialNumberType SerialNumber; + ///Կ + TThostFtdcAuthKeyType AuthKey; + ///Ưֵ + TThostFtdcLastDriftType LastDrift; + ///ɹֵ + TThostFtdcLastSuccessType LastSuccess; + ///̬ + TThostFtdcOTPTypeType OTPType; +}; + +///ֹͬû̬ +struct CThostFtdcManualSyncBrokerUserOTPField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ + TThostFtdcOTPTypeType OTPType; + ///һ̬ + TThostFtdcPasswordType FirstOTP; + ///ڶ̬ + TThostFtdcPasswordType SecondOTP; +}; + +///Ͷģ +struct CThostFtdcCommRateModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///ģ + TThostFtdcCommModelNameType CommModelName; +}; + +///ѯͶģ +struct CThostFtdcQryCommRateModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; +}; + +///Ͷ֤߱ģ +struct CThostFtdcMarginModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + ///ģ + TThostFtdcCommModelNameType MarginModelName; +}; + +///ѯͶ֤߱ģ +struct CThostFtdcQryMarginModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ֵ۵Ϣ +struct CThostFtdcEWarrantOffsetField +{ + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType Volume; +}; + +///ѯֵ۵Ϣ +struct CThostFtdcQryEWarrantOffsetField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯͶƷ/Ʒֱ֤ +struct CThostFtdcQryInvestorProductGroupMarginField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ͶƷ/Ʒֱ֤ +struct CThostFtdcInvestorProductGroupMarginField +{ + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType LongFrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType ShortFrozenMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ͷ֤ + TThostFtdcMoneyType LongUseMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortUseMargin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///ͷ֤ + TThostFtdcMoneyType LongExchMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortExchMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + /// + TThostFtdcMoneyType FrozenCommission; + /// + TThostFtdcMoneyType Commission; + ///ʽ + TThostFtdcMoneyType FrozenCash; + ///ʽ + TThostFtdcMoneyType CashIn; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///۵ܽ + TThostFtdcMoneyType OffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortOffsetAmount; + ///۵ܽ + TThostFtdcMoneyType ExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortExchOffsetAmount; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯû +struct CThostFtdcQueryCFMMCTradingAccountTokenField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///û +struct CThostFtdcCFMMCTradingAccountTokenField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬ + TThostFtdcCFMMCTokenType Token; +}; + +///תʿ +struct CThostFtdcReqOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; +}; + +///ת +struct CThostFtdcReqCancelAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; +}; + +///˻ +struct CThostFtdcReqChangeAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ת +struct CThostFtdcReqTransferField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; +}; + +///зʽתڻӦ +struct CThostFtdcRspTransferField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +/// +struct CThostFtdcReqRepealField +{ + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; +}; + +///Ӧ +struct CThostFtdcRspRepealField +{ + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ˻Ϣ +struct CThostFtdcReqQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ѯ˻ϢӦ +struct CThostFtdcRspQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; +}; + +///ǩǩ +struct CThostFtdcFutureSignIOField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ǩӦ +struct CThostFtdcRspFutureSignInField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; +}; + +///ǩ +struct CThostFtdcReqFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ǩӦ +struct CThostFtdcRspFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯָˮŵĽ׽ +struct CThostFtdcReqQueryTradeResultBySerialField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ˮ + TThostFtdcSerialType Reference; + ///ˮŷߵĻ + TThostFtdcInstitutionTypeType RefrenceIssureType; + ///ˮŷ߻ + TThostFtdcOrganCodeType RefrenceIssure; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ѯָˮŵĽ׽Ӧ +struct CThostFtdcRspQueryTradeResultBySerialField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///ˮ + TThostFtdcSerialType Reference; + ///ˮŷߵĻ + TThostFtdcInstitutionTypeType RefrenceIssureType; + ///ˮŷ߻ + TThostFtdcOrganCodeType RefrenceIssure; + ///ԭʼش + TThostFtdcReturnCodeType OriginReturnCode; + ///ԭʼ + TThostFtdcDescrInfoForReturnCodeType OriginDescrInfoForReturnCode; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ļ +struct CThostFtdcReqDayEndFileReadyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ļҵ + TThostFtdcFileBusinessCodeType FileBusinessCode; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ؽ +struct CThostFtdcReturnResultField +{ + ///ش + TThostFtdcReturnCodeType ReturnCode; + /// + TThostFtdcDescrInfoForReturnCodeType DescrInfoForReturnCode; +}; + +///֤ڻʽ +struct CThostFtdcVerifyFuturePasswordField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///װ + TThostFtdcInstallIDType InstallID; + ///ID + TThostFtdcTIDType TID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///֤ͻϢ +struct CThostFtdcVerifyCustInfoField +{ + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; +}; + +///֤ڻʽͿͻϢ +struct CThostFtdcVerifyFuturePasswordAndCustInfoField +{ + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///֤ڻʽͿͻϢ +struct CThostFtdcDepositResultInformField +{ + ///ˮţˮΪڱ̷صˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcRequestIDType RequestID; + ///ش + TThostFtdcReturnCodeType ReturnCode; + /// + TThostFtdcDescrInfoForReturnCodeType DescrInfoForReturnCode; +}; + +///׺ڱ̷Կͬ +struct CThostFtdcReqSyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///׺ڱ̷ԿͬӦ +struct CThostFtdcRspSyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ˻Ϣ֪ͨ +struct CThostFtdcNotifyQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ת˽ˮ +struct CThostFtdcTransferSerialField +{ + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateSerial; + ///׷ + TThostFtdcTradeDateType TradeDate; + /// + TThostFtdcDateType TradingDay; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///Ự + TThostFtdcSessionIDType SessionID; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///ڻ˾ʺ + TThostFtdcFutureAccTypeType FutureAccType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///׽ + TThostFtdcTradeAmountType TradeAmount; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///Ч־ + TThostFtdcAvailabilityFlagType AvailabilityFlag; + ///Ա + TThostFtdcOperatorCodeType OperatorCode; + ///ʺ + TThostFtdcBankAccountType BankNewAccount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯתˮ +struct CThostFtdcQryTransferSerialField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ǩ֪ͨ +struct CThostFtdcNotifyFutureSignInField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; +}; + +///ǩ֪ͨ +struct CThostFtdcNotifyFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///׺ڱ̷Կ֪ͬͨ +struct CThostFtdcNotifySyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯǩԼϵ +struct CThostFtdcQryAccountregisterField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ͻϢ +struct CThostFtdcAccountregisterField +{ + /// + TThostFtdcTradeDateType TradeDay; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///ڻ˾֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcOpenOrDestroyType OpenOrDestroy; + ///ǩԼ + TThostFtdcTradeDateType RegDate; + ///Լ + TThostFtdcTradeDateType OutDate; + ///ID + TThostFtdcTIDType TID; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; +}; + +///ڿϢ +struct CThostFtdcOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///Ϣ +struct CThostFtdcCancelAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ڱ˺Ϣ +struct CThostFtdcChangeAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ԱȨ +struct CThostFtdcSecAgentACIDMapField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcCurrencyIDType CurrencyID; + ///нʽʺ + TThostFtdcAccountIDType BrokerSecAgentID; +}; + +///ԱȨ޲ѯ +struct CThostFtdcQrySecAgentACIDMapField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ֱĽȨ +struct CThostFtdcUserRightsAssignField +{ + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; +}; + +///ù˾ǷڱʾĽȨ +struct CThostFtdcBrokerUserRightAssignField +{ + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; + ///ܷ + TThostFtdcBoolType Tradeable; +}; + +///ֱת +struct CThostFtdcDRTransferField +{ + ///ԭĴ + TThostFtdcDRIdentityIDType OrigDRIdentityID; + ///Ŀ꽻Ĵ + TThostFtdcDRIdentityIDType DestDRIdentityID; + ///ԭӦõԪ + TThostFtdcBrokerIDType OrigBrokerID; + ///ĿõԪ + TThostFtdcBrokerIDType DestBrokerID; +}; + +///FensûϢ +struct CThostFtdcFensUserInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ģʽ + TThostFtdcLoginModeType LoginMode; +}; + +///ǰ +struct CThostFtdcCurrTransferIdentityField +{ + ///Ĵ + TThostFtdcDRIdentityIDType IdentityID; +}; + +///ֹ¼û +struct CThostFtdcLoginForbiddenUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯֹ¼û +struct CThostFtdcQryLoginForbiddenUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///UDP鲥Ϣ +struct CThostFtdcMulticastGroupInfoField +{ + ///鲥IPַ + TThostFtdcIPAddressType GroupIP; + ///鲥IP˿ + TThostFtdcIPPortType GroupPort; + ///Դַ + TThostFtdcIPAddressType SourceIP; +}; + +///ʽ˻׼ +struct CThostFtdcTradingAccountReserveField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///׼ + TThostFtdcMoneyType Reserve; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + + + +#endif diff --git a/include/ATP/error.dtd b/include/ATP/error.dtd new file mode 100644 index 0000000..15e50b7 --- /dev/null +++ b/include/ATP/error.dtd @@ -0,0 +1,9 @@ + + + + + diff --git a/include/ATP/error.xml b/include/ATP/error.xml new file mode 100644 index 0000000..96b2cea --- /dev/null +++ b/include/ATP/error.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/ATP/md5.txt b/include/ATP/md5.txt new file mode 100644 index 0000000..c79f84b --- /dev/null +++ b/include/ATP/md5.txt @@ -0,0 +1,3 @@ + +thostmduserapi.dll 8085ea01db7df188e2444ef1fdb787b7 +thosttraderapi.dll d2c1c2981445fa2bcc741a0de2d15d9a diff --git a/include/ATP/win32/thostmduserapi.dll b/include/ATP/win32/thostmduserapi.dll new file mode 100644 index 0000000..51698dc Binary files /dev/null and b/include/ATP/win32/thostmduserapi.dll differ diff --git a/include/ATP/win32/thostmduserapi.lib b/include/ATP/win32/thostmduserapi.lib new file mode 100644 index 0000000..8633da8 Binary files /dev/null and b/include/ATP/win32/thostmduserapi.lib differ diff --git a/include/ATP/win32/thosttraderapi.dll b/include/ATP/win32/thosttraderapi.dll new file mode 100644 index 0000000..1aac3c3 Binary files /dev/null and b/include/ATP/win32/thosttraderapi.dll differ diff --git a/include/ATP/win32/thosttraderapi.lib b/include/ATP/win32/thosttraderapi.lib new file mode 100644 index 0000000..be5f170 Binary files /dev/null and b/include/ATP/win32/thosttraderapi.lib differ diff --git a/include/ApiEnum.h b/include/ApiEnum.h index c686c91..38c369c 100644 --- a/include/ApiEnum.h +++ b/include/ApiEnum.h @@ -23,7 +23,7 @@ enum ConnectionStatus :char // API功能类型,功能可叠加 enum ApiType :char { - ApiType_Nono = 0, /// 无 + ApiType_None = 0, /// 无 ApiType_Trade = 1, /// 交易,只下单撤单 ApiType_MarketData = 2, /// 行情 ApiType_Level2 = 4, /// Level2行情,这是否有保留的必要? @@ -76,16 +76,21 @@ enum OrderStatus :char OrderStatus_Replaced, }; -/// 方向,没有区分ETF与开放式基金的申购赎回 +/// 方向 /// 新股申购、回购,质押都暂时不写入,等业务掌握熟了后再加 enum OrderSide :char { OrderSide_Buy, OrderSide_Sell, - OrderSide_Creation, ///申购 - OrderSide_Redemption, ///赎回 - OrderSide_Merge, ///合并 - OrderSide_Split, ///拆分 + OrderSide_LOFCreation, ///申购,LOF申购 + OrderSide_LOFRedemption, ///赎回,LOF赎回 + OrderSide_ETFCreation, ///ETF申购 + OrderSide_ETFRedemption, ///ETF赎回 + OrderSide_Merge, ///合并 + OrderSide_Split, ///拆分 + OrderSide_CBConvert, ///可转债转股,参考于https://en.wikipedia.org/wiki/Convertible_bond + OrderSide_CBRedemption, ///可转债回售,参考于https://en.wikipedia.org/wiki/Convertible_bond + OrderSide_Unknown, ///出现这个输出时,需要技术人员去查找原因修正代码 }; /// 报单类型,与OpenQuant2014中的值一样 @@ -141,11 +146,17 @@ enum ExecType : char ExecType_PendingReplace, ExecType_Replace, ExecType_ReplaceReject, + ExecType_TradeCorrect, + ExecType_TradeCancel, + ExecType_OrderStatus, + ExecType_PendingNew, + ExecType_ClearingHold, }; ///开平标志,没有提供专门的平昨,而是用Close enum OpenCloseType :char { + OpenCloseType_Undefined = 0, // 未指定,用来自行处理 OpenCloseType_Open, OpenCloseType_Close, OpenCloseType_CloseToday, @@ -179,6 +190,7 @@ enum InstrumentType :char InstrumentType_ETF, InstrumentType_MultiLeg, InstrumentType_Synthetic, + InstrumentType_LOF, ///多加LOF }; ////////////////////////////////////////////////////////////////////////// @@ -245,6 +257,16 @@ enum TradingPhaseType :char TradingPhaseType_Fuse, ///熔断时段,参考于LTS }; +/// 业务类型,主要是有些API实际上已经对接了各种市场 +// 不同的市场需要不同的函数,统一到一起实在太难,所以这个地方交给用户自己来指定 +enum BusinessType :char +{ + BusinessType_Undefined = 0, /// 未指定 + BusinessType_Future, + BusinessType_Stock, + BusinessType_Option, +}; + @@ -260,7 +282,7 @@ enum TradingPhaseType :char enum BarType :char { - Time = 1, + BarType_Time = 1, Tick, Volume, Range, diff --git a/include/ApiHeader.h b/include/ApiHeader.h index 5ed0b04..ab7c25b 100644 --- a/include/ApiHeader.h +++ b/include/ApiHeader.h @@ -1,17 +1,23 @@ -#ifndef _API_HEADER_H_ +#ifndef _API_HEADER_H_ #define _API_HEADER_H_ -#include "../include/CrossPlatform.h" +#include "CrossPlatform.h" #ifdef __cplusplus extern "C" { #endif - //ڷָĺбǰûַбԲܳ֡:һ - #define _QUANTBOX_SEPS_ ",;" + //用于分隔输入的合列表,与前置机地址列表,所以不能出现“:”一类的 +#define _QUANTBOX_SEPS_ ";" 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); #ifdef __cplusplus } #endif +// 长度不够时,后面会填0,但长度超出会写出界 +#define SAFE_STRNCPY(x,y) if(y) strncpy_s(x, y, sizeof(x));x[sizeof(x)-1]=0; +#define SAFE_STRNCAT(x,y) if(y) strncat_s(x, y, sizeof(x));x[sizeof(x)-1]=0; +// 有循环问题,不能乱用,比如abc%s,结果将变成abcabc +#define SAFE_SNPRINTF(x, ...) _snprintf_s(x,sizeof(x),##__VA_ARGS__);x[sizeof(x)-1]=0; + #endif//end of _API_HEADER_H_ diff --git a/include/ApiStruct.h b/include/ApiStruct.h index ab0deaf..3e35cdf 100644 --- a/include/ApiStruct.h +++ b/include/ApiStruct.h @@ -3,7 +3,6 @@ #include "ApiDataType.h" #include "ApiEnum.h" -//#include "QueueEnum.h" #pragma pack(push,1) @@ -12,6 +11,15 @@ /// 1.由API直接提供有效值 /// 2.计算出来的值,字段正好预留了此字段,可以直接填充,这样使用者就不需要定义自己的字段了 +///////////////////////////////////////////////////////////////////////// +/// +/// 账号体系分成三层 +/// 客户端XAPI层,主要是多账号功能,如TDX可以登录多个账号 +/// 分账户层,如O32中下单要指定资产单元或投资组合 +/// 交易所层,比如股东代码,有可能无法区分需要 + + + ///查询持仓,查委托,查成交,查合约,查资金等 ///定义一个通用的结构,省事 struct ReqQueryField @@ -46,8 +54,19 @@ struct ReqQueryField Int32Type Int32ID; ///一般是由API底层查询预留 - OrderIDType Char64RefID; - Int32Type Int32RefID; + OrderIDType Char64PositionIndex; + Int32Type Int32PositionIndex; + + + + /// 基金 + IDChar32Type PortfolioID1; + /// 资产单元 + IDChar32Type PortfolioID2; + /// 投资组合 + IDChar32Type PortfolioID3; + + BusinessType Business; }; ///持仓 @@ -95,6 +114,18 @@ struct PositionField QtyType TodayPRPosition; ///今日申赎持仓冻结 QtyType TodayPRFrozen; + + ///同一账号下的唯一ID,本地拼接成的,方便其它程序存到dict中 + PositionIDType ID; + + /// 基金 + IDChar32Type PortfolioID1; + /// 资产单元 + IDChar32Type PortfolioID2; + /// 投资组合 + IDChar32Type PortfolioID3; + + BusinessType Business; }; ///做市商双向报价 @@ -219,6 +250,19 @@ struct OrderField Int32Type ReserveInt32; ///预留字符串 Char64Type ReserveChar64; + + /// 基金 + IDChar32Type PortfolioID1; + /// 资产单元 + IDChar32Type PortfolioID2; + /// 投资组合 + IDChar32Type PortfolioID3; + + BusinessType Business; + + // 本处代码只内部使用,用于方便在封装API时快速的进行查找,减少代码 + void* pUserData1; + void* pUserData2; }; @@ -269,6 +313,15 @@ struct TradeField Int32Type ReserveInt32; ///预留字符串 Char64Type ReserveChar64; + + /// 基金 + IDChar32Type PortfolioID1; + /// 资产单元 + IDChar32Type PortfolioID2; + /// 投资组合 + IDChar32Type PortfolioID3; + + BusinessType Business; }; ///服务器信息 @@ -363,6 +416,10 @@ struct RspUserLoginField Int32Type RawErrorID; ///信息 Char256Type Text; + + Char32Type Version; + + Char32Type Lang; }; @@ -384,6 +441,8 @@ struct DepthMarketDataNField SymbolType Symbol; ///合约代码 InstrumentIDType InstrumentID; + + ExchangeIDType ExchangeID; ///交易所代码,枚举类型,主要是用于过滤使用,效率比字符串比较要高 ExchangeType Exchange; @@ -573,7 +632,20 @@ struct InvestorField }; - +/// 合约状态信息,CTP中其实是交易所信息 +struct InstrumentStatusField +{ + ///唯一符号 + SymbolType Symbol; + ///合约代码 + InstrumentIDType InstrumentID; + ///交易所代码 + ExchangeIDType ExchangeID; + ///合约交易状态 + TradingPhaseType InstrumentStatus; + ///进入本状态时间 + TimeIntType EnterTime; +}; diff --git a/include/CSubscribeManager.cpp b/include/CSubscribeManager.cpp new file mode 100644 index 0000000..7ab68a3 --- /dev/null +++ b/include/CSubscribeManager.cpp @@ -0,0 +1,266 @@ +#include "stdafx.h" +#include "CSubscribeManager.h" + +#include "CSubscribeManager1.h" +#include "CSubscribeManager2.h" + +#include "synthetic/CSyntheticConfig.h" +#include "synthetic/CSyntheticManager.h" + +#include + +CSubscribeManager::CSubscribeManager(CSyntheticConfig* pConfig, CSyntheticManager* pManager, CSyntheticCalculateFactory* pCalculateFactory) +{ + m_pConfig = pConfig; + m_pManager = pManager; + m_pCalculateFactory = pCalculateFactory; +} + + +CSubscribeManager::~CSubscribeManager() +{ + for (auto it = m_map_pSubscribeManager1.begin(); it != m_map_pSubscribeManager1.end(); it++) + { + delete it->second; + } + for (auto it = m_map_pSubscribeManager2.begin(); it != m_map_pSubscribeManager2.end(); it++) + { + delete it->second; + } +} + +CSubscribeManager1* CSubscribeManager::GetManager1(string exchange) +{ + auto it = m_map_pSubscribeManager1.find(exchange); + if (it == m_map_pSubscribeManager1.end()) + { + auto pSM = new CSubscribeManager1(); + m_map_pSubscribeManager1.insert(pair(exchange, pSM)); + return pSM; + } + else + { + return it->second; + } +} + +CSubscribeManager2* CSubscribeManager::GetManager2(string exchange) +{ + auto it = m_map_pSubscribeManager2.find(exchange); + if (it == m_map_pSubscribeManager2.end()) + { + auto pSM = new CSubscribeManager2(); + m_map_pSubscribeManager2.insert(pair(exchange, pSM)); + return pSM; + } + else + { + return it->second; + } +} + +set CSubscribeManager::GetExchanges() +{ + set ss; + for (auto it = m_map_pSubscribeManager1.begin(); it != m_map_pSubscribeManager1.end(); it++) + { + ss.insert(it->first); + } + return ss; +} + + +// ģҪAPIĵĺԼ +set CSubscribeManager::Subscribe(set instruments, string exchange) +{ + if (instruments.size() == 0) + return instruments; + + CSubscribeManager1* pSubscribeManager1 = GetManager1(exchange); + CSubscribeManager2* pSubscribeManager2 = GetManager2(exchange); + + // ǰĺԼ + set s_syn_old = pSubscribeManager2->GetChildenInstruments(); + set s_com_old = pSubscribeManager1->GetInstruments(); + + // ֳ + set s_syn; + set s_com; + m_pConfig->Classify(instruments, s_syn, s_com); + pSubscribeManager1->Subscribe(s_com); + + auto cfgs = m_pConfig->GetMap(); + for (auto it = cfgs.begin(); it != cfgs.end(); it++) + { + auto x = s_syn.find(it->second.symbol); + if (x != s_syn.end()) + { + auto pSMD = m_pManager->Register( + it->second.symbol.c_str(), + it->second.emits, + it->second.legs, + m_pCalculateFactory->Create(it->second.method)); + + pSubscribeManager2->Subscribe(it->second.symbol.c_str(), pSMD->GetInstruments()); + } + } + + // ĺĺԼ + set s_syn_new = pSubscribeManager2->GetChildenInstruments(); + set s_com_new = pSubscribeManager1->GetInstruments(); + + set s_old; + set s_new; + set s_dif; + set_union(s_syn_old.begin(), s_syn_old.end(), s_com_old.begin(), s_com_old.end(), inserter(s_old, s_old.begin())); + set_union(s_syn_new.begin(), s_syn_new.end(), s_com_new.begin(), s_com_new.end(), inserter(s_new, s_new.begin())); + set_difference(s_new.begin(), s_new.end(), s_old.begin(), s_old.end(), inserter(s_dif, s_dif.begin())); + + return s_dif; +} + +// ȡģҪAPIȡĺԼ +set CSubscribeManager::Unsubscribe(set instruments, string exchange) +{ + if (instruments.size() == 0) + return instruments; + + CSubscribeManager1* pSubscribeManager1 = GetManager1(exchange); + CSubscribeManager2* pSubscribeManager2 = GetManager2(exchange); + + // ǰĺԼ + set s_syn_old = pSubscribeManager2->GetChildenInstruments(); + set s_com_old = pSubscribeManager1->GetInstruments(); + + // ֳ + set s_syn; + set s_com; + m_pConfig->Classify(instruments, s_syn, s_com); + pSubscribeManager1->Unsubscribe(s_com); + + auto cfgs = m_pConfig->GetMap(); + for (auto it = cfgs.begin(); it != cfgs.end(); it++) + { + auto x = s_syn.find(it->second.symbol); + if (x != s_syn.end()) + { + auto pSMD = m_pManager->UnRegister( + it->second.symbol.c_str()); + + pSubscribeManager2->Unsubscribe(it->second.symbol.c_str()); + } + } + + // ĺĺԼ + set s_syn_new = pSubscribeManager2->GetChildenInstruments(); + set s_com_new = pSubscribeManager1->GetInstruments(); + + set s_old; + set s_new; + set s_dif; + set_union(s_syn_old.begin(), s_syn_old.end(), s_com_old.begin(), s_com_old.end(), inserter(s_old, s_old.begin())); + set_union(s_syn_new.begin(), s_syn_new.end(), s_com_new.begin(), s_com_new.end(), inserter(s_new, s_new.begin())); + set_difference(s_old.begin(), s_old.end(), s_new.begin(), s_new.end(), inserter(s_dif, s_dif.begin())); + + return s_dif; +} + +string CSubscribeManager::Set2String(set instruments, const char* seps) +{ + string str; + for (auto it = instruments.begin(); it != instruments.end(); ++it) + { + str.append(*it); + str.append(seps); + } + return str; +} + +char* CSubscribeManager::String2Buf(const char* str, vector& vct, const char* seps) +{ + vct.clear(); + + if (strlen(str) == 0) + return nullptr; + + //ﲻ֪Ҫӵַж೤ܱ + size_t len = (size_t)(strlen(str)*1.5 + 1); + char* buf = new char[len]; + strncpy(buf, str, len); + + char* token = strtok(buf, seps); + while (token) + { + if (strlen(token)>0) + { + vct.push_back(token); + } + token = strtok(nullptr, seps); + } + + return buf; +} + +set CSubscribeManager::String2Set(const char* szString, const char* seps, int before, const char* prefix) +{ + size_t len = (size_t)(strlen(szString)*1.5 + 1); + char* buf = new char[len]; + strncpy(buf, szString, len); + + set ss; + + char* token = strtok(buf, seps); + while (token) + { + if (strlen(token) > 0) + { + char temp[64] = { 0 }; + if (prefix) + { + if (before > 0) + { + sprintf(temp, "%s%s", prefix, token); + } + else + { + sprintf(temp, "%s%s", token, prefix); + } + } + else + { + sprintf(temp, "%s", token); + } + + ss.insert(temp); + } + token = strtok(nullptr, seps); + } + + delete[] buf; + return ss; +} + +set CSubscribeManager::GetParentInstruments(string exchange) +{ + CSubscribeManager1* pSubscribeManager1 = GetManager1(exchange); + CSubscribeManager2* pSubscribeManager2 = GetManager2(exchange); + + set s_syn_old = pSubscribeManager2->GetParentInstruments(); + set s_com_old = pSubscribeManager1->GetInstruments(); + + set s_old; + set_union(s_syn_old.begin(), s_syn_old.end(), s_com_old.begin(), s_com_old.end(), inserter(s_old, s_old.begin())); + return s_old; +} + +void CSubscribeManager::Clear() +{ + for (auto it = m_map_pSubscribeManager1.begin(); it != m_map_pSubscribeManager1.end(); it++) + { + it->second->Clear(); + } + for (auto it = m_map_pSubscribeManager2.begin(); it != m_map_pSubscribeManager2.end(); it++) + { + it->second->Clear(); + } +} \ No newline at end of file diff --git a/include/CSubscribeManager.h b/include/CSubscribeManager.h new file mode 100644 index 0000000..dd2c42d --- /dev/null +++ b/include/CSubscribeManager.h @@ -0,0 +1,53 @@ +#pragma once + +#include +#include +#include +#include + +class CSubscribeManager1; +class CSubscribeManager2; +class CSyntheticConfig; +class CSyntheticManager; +class CSyntheticCalculateFactory; + +using namespace std; + +class CSubscribeManager +{ +public: + CSubscribeManager(CSyntheticConfig* pConfig, CSyntheticManager* pManager, CSyntheticCalculateFactory* pCalculateFactory); + ~CSubscribeManager(); + + // ģҪAPIĵĺԼ + set Subscribe(set instruments, string exchange); + // ȡģҪAPIȡĺԼ + set Unsubscribe(set instruments, string exchange); + + // setתַڷ + string Set2String(set instruments, const char* seps = ";"); + + // ַתapiõĸʽ + char* String2Buf(const char* str, vector& vct, const char* seps = ";"); + // ַתsetںĶļ + set String2Set(const char* str, const char* seps = ";", int before = 1, const char* prefix = ""); + + set GetParentInstruments(string exchange); + + void Clear(); + + CSubscribeManager1* GetManager1(string exchange); + CSubscribeManager2* GetManager2(string exchange); + + set GetExchanges(); + +private: + map m_map_pSubscribeManager1; + map m_map_pSubscribeManager2; + + CSyntheticConfig* m_pConfig; + CSyntheticManager* m_pManager; + + CSyntheticCalculateFactory* m_pCalculateFactory; +}; + diff --git a/include/CSubscribeManager1.cpp b/include/CSubscribeManager1.cpp new file mode 100644 index 0000000..54e3bad --- /dev/null +++ b/include/CSubscribeManager1.cpp @@ -0,0 +1,85 @@ +#include "stdafx.h" +#include "CSubscribeManager1.h" + + +CSubscribeManager1::CSubscribeManager1() +{ +} + + +CSubscribeManager1::~CSubscribeManager1() +{ +} + +set CSubscribeManager1::Subscribe(set ss) +{ + lock_guard cl(m_cs); + + set sss; + for (auto it = ss.begin(); it != ss.end(); ++it) + { + auto s = m_map.find(it->data()); + if (s == m_map.end()) + { + m_map.insert(pair(it->data(), 1)); + sss.insert(it->data()); + } + else + { + int t = s->second + 1; + m_map[it->data()] = t; + } + } + return sss; +} + +set CSubscribeManager1::Unsubscribe(set ss) +{ + lock_guard cl(m_cs); + + set sss; + for (auto it = ss.begin(); it != ss.end(); ++it) + { + auto s = m_map.find(it->data()); + if (s == m_map.end()) + { + // m_map.insert(pair(it->data(), 1)); + } + else + { + int t = s->second - 1; + if (t <= 0) + { + m_map.erase(it->data()); + sss.insert(it->data()); + } + else + { + m_map[it->data()] = t; + } + } + } + return sss; +} + + +set CSubscribeManager1::GetInstruments() +{ + lock_guard cl(m_cs); + + set ss; + for (auto it = m_map.begin(); it != m_map.end(); ++it) + { + if (it->second>0) + { + ss.insert(it->first); + } + } + return ss; +} + +void CSubscribeManager1::Clear() +{ + lock_guard cl(m_cs); + m_map.clear(); +} diff --git a/include/CSubscribeManager1.h b/include/CSubscribeManager1.h new file mode 100644 index 0000000..dab2d4a --- /dev/null +++ b/include/CSubscribeManager1.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include +#include + +using namespace std; + +class CSubscribeManager1 +{ +public: + CSubscribeManager1(); + ~CSubscribeManager1(); + + // ģҪAPIĵĺԼ + set Subscribe(set ss); + // ȡģҪAPIȡĺԼ + set Unsubscribe(set ss); + + // õеĺԼ + set GetInstruments(); + // + void Clear(); + + +private: + // Ҫ¼Ĵ + map m_map; + mutex m_cs; +}; + diff --git a/include/CSubscribeManager2.cpp b/include/CSubscribeManager2.cpp new file mode 100644 index 0000000..64f7868 --- /dev/null +++ b/include/CSubscribeManager2.cpp @@ -0,0 +1,67 @@ +#include "stdafx.h" +#include "CSubscribeManager2.h" + + +CSubscribeManager2::CSubscribeManager2() +{ +} + + +CSubscribeManager2::~CSubscribeManager2() +{ +} + +// ģҪAPIĵĺԼ +set CSubscribeManager2::Subscribe(string sym, set ss) +{ + auto it = m_maps.find(sym); + if (it == m_maps.end()) + { + m_maps.insert(pair>(sym, ss)); + } + else + { + m_maps[sym] = ss; + } + return ss; +} + +// ȡģҪAPIȡĺԼ +set CSubscribeManager2::Unsubscribe(string sym) +{ + m_maps.erase(sym); + return GetChildenInstruments(); +} + +set CSubscribeManager2::GetChildenInstruments() +{ + lock_guard cl(m_cs); + + set ss; + for (auto i = m_maps.begin(); i != m_maps.end(); ++i) + { + for (auto j = i->second.begin(); j != i->second.end(); ++j) + { + ss.insert(j->data()); + } + } + return ss; +} + +set CSubscribeManager2::GetParentInstruments() +{ + lock_guard cl(m_cs); + + set ss; + for (auto i = m_maps.begin(); i != m_maps.end(); ++i) + { + ss.insert(i->first); + } + return ss; +} + +void CSubscribeManager2::Clear() +{ + lock_guard cl(m_cs); + m_maps.clear(); +} diff --git a/include/CSubscribeManager2.h b/include/CSubscribeManager2.h new file mode 100644 index 0000000..61f32d2 --- /dev/null +++ b/include/CSubscribeManager2.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include + +using namespace std; + +class CSubscribeManager2 +{ +public: + CSubscribeManager2(); + ~CSubscribeManager2(); + + // ģҪAPIĵĺԼ + set Subscribe(string sym, set ss); + // ȡģҪAPIȡĺԼ + set Unsubscribe(string sym); + // õеĺԼ + set GetChildenInstruments(); + // õϳɵĺԼ + set GetParentInstruments(); + // + void Clear(); + +private: + // Ҫ¼Ĵ + //unordered_map m_map; + mutex m_cs; + map> m_maps; +}; + diff --git a/include/CSyntheticCalculate_DepthMarketDataNField.cpp b/include/CSyntheticCalculate_DepthMarketDataNField.cpp new file mode 100644 index 0000000..ca98405 --- /dev/null +++ b/include/CSyntheticCalculate_DepthMarketDataNField.cpp @@ -0,0 +1,278 @@ +#include "stdafx.h" +#include "CSyntheticCalculate_DepthMarketDataNField.h" + +#include +#include + +#include "ApiStruct.h" +#include "ApiProcess.h" +#include "CrossPlatform.h" + +void CSyntheticCalculate_DepthMarketDataNField_OpenInterest::Begin(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) +{ + auto pI = (DepthMarketDataNField*)(pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + memset(pO, 0, sizeof(DepthMarketDataNField)); + memset(pOut, 0, sizeof(LegData)); + + pOut->pBuf = (char*)pO; +} + +void CSyntheticCalculate_DepthMarketDataNField_OpenInterest::Sum(CSyntheticMarketData* pCall, LegData * pIn, LegData * pOut) +{ + auto pI = (DepthMarketDataNField*)(pIn->pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + pO->OpenInterest += pI->OpenInterest; + pO->Volume += pI->Volume; + // 可能溢出,所以另加一个sum + pOut->sum += pI->OpenInterest; +} + +void CSyntheticCalculate_DepthMarketDataNField_OpenInterest::ForEach(CSyntheticMarketData* pCall, LegData * pIn, LegData * pOut) +{ + auto pI = (DepthMarketDataNField*)(pIn->pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + // 生成权重,对于指定权重的数据不需要修改,如指数的成份股 + pIn->weight = pI->OpenInterest / pOut->sum; + // 生成新价格 + pO->LastPrice += pI->LastPrice*pIn->weight; +} + +void CSyntheticCalculate_DepthMarketDataNField_OpenInterest::End(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) +{ + auto pI = (DepthMarketDataNField*)(pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + pO->Size = sizeof(DepthMarketDataNField); + pO->BidCount = 0; + pO->ActionDay = pI->ActionDay; + pO->TradingDay = pI->TradingDay; + pO->UpdateTime = pI->UpdateTime; + pO->UpdateMillisec = pI->UpdateMillisec; + strcpy(pO->ExchangeID, pI->ExchangeID); + + strcpy(pO->InstrumentID, pCall->GetProduct().c_str()); + strcpy(pO->Symbol, pO->InstrumentID); +} + +void CSyntheticCalculate_DepthMarketDataNField_Weight::Begin(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) +{ + auto pI = (DepthMarketDataNField*)(pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + memset(pO, 0, sizeof(DepthMarketDataNField)); + memset(pOut, 0, sizeof(LegData)); + + pOut->pBuf = (char*)pO; +} + +void CSyntheticCalculate_DepthMarketDataNField_Weight::Sum(CSyntheticMarketData* pCall, LegData * pIn, LegData * pOut) +{ + auto pI = (DepthMarketDataNField*)(pIn->pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + // 理论上应当权重和为1或100 + // 目前没有用到 + // pOut->weight += pIn->weight; +} + +void CSyntheticCalculate_DepthMarketDataNField_Weight::ForEach(CSyntheticMarketData* pCall, LegData * pIn, LegData * pOut) +{ + auto pI = (DepthMarketDataNField*)(pIn->pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + // 生成新价格,这里的权重在加载时就修正过 + pO->LastPrice += pI->LastPrice*pIn->weight; +} + +void CSyntheticCalculate_DepthMarketDataNField_Weight::End(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) +{ + auto pI = (DepthMarketDataNField*)(pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + pO->Size = sizeof(DepthMarketDataNField); + pO->BidCount = 0; + pO->ActionDay = pI->ActionDay; + pO->TradingDay = pI->TradingDay; + pO->UpdateTime = pI->UpdateTime; + pO->UpdateMillisec = pI->UpdateMillisec; + strcpy(pO->ExchangeID, pI->ExchangeID); + + strcpy(pO->InstrumentID, pCall->GetProduct().c_str()); + strcpy(pO->Symbol, pO->InstrumentID); +} + +void CSyntheticCalculate_DepthMarketDataNField_Copy::Begin(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) +{ + auto pI = (DepthMarketDataNField*)(pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + //memset(pO, 0, sizeof(DepthMarketDataNField)); + // 复制数据 + memcpy(pO, pI, pI->Size); + memset(pOut, 0, sizeof(LegData)); + + pOut->pBuf = (char*)pO; +} + +void CSyntheticCalculate_DepthMarketDataNField_Copy::Sum(CSyntheticMarketData* pCall, LegData * pIn, LegData * pOut) +{ + auto pI = (DepthMarketDataNField*)(pIn->pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); +} + +void CSyntheticCalculate_DepthMarketDataNField_Copy::ForEach(CSyntheticMarketData* pCall, LegData * pIn, LegData * pOut) +{ + auto pI = (DepthMarketDataNField*)(pIn->pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); +} + +void CSyntheticCalculate_DepthMarketDataNField_Copy::End(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) +{ + auto pI = (DepthMarketDataNField*)(pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + strcpy(pO->InstrumentID, pCall->GetProduct().c_str()); + strcpy(pO->Symbol, pO->InstrumentID); +} + +void CSyntheticCalculate_DepthMarketDataNField_Spread::Begin(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) +{ + auto pI = (DepthMarketDataNField*)(pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + memset(pO, 0, sizeof(DepthMarketDataNField)); + memset(pOut, 0, sizeof(LegData)); + + pOut->pBuf = (char*)pO; + + pOut->askSize = DBL_MAX; + pOut->bidSize = DBL_MAX; +} + +void CSyntheticCalculate_DepthMarketDataNField_Spread::Sum(CSyntheticMarketData* pCall, LegData * pIn, LegData * pOut) +{ + auto pI = (DepthMarketDataNField*)(pIn->pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); +} + +void CSyntheticCalculate_DepthMarketDataNField_Spread::ForEach(CSyntheticMarketData* pCall, LegData * pIn, LegData * pOut) +{ + auto pI = (DepthMarketDataNField*)(pIn->pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + pO->LastPrice += pI->LastPrice*pIn->weight; + + auto bid = GetBid(pI, 1); + auto ask = GetAsk(pI, 1); + + if (pIn->weight > 0) + { + if (ask == nullptr) + { + pOut->askSize = 0; + pOut->ask = 0; + } + else + { + // pOut->askSize = min(pOut->askSize, ask->Size); + pOut->askSize = pOut->askSize < ask->Size ? pOut->askSize : ask->Size; + pOut->ask += ask->Price*pIn->weight; + } + + if (bid == nullptr) + { + pOut->bidSize = 0; + pOut->bid = 0; + } + else + { + // pOut->bidSize = min(pOut->bidSize, bid->Size); + pOut->bidSize = pOut->bidSize < bid->Size ? pOut->bidSize : bid->Size; + pOut->bid += bid->Price*pIn->weight; + } + } + else + { + if (ask == nullptr) + { + pOut->bidSize = 0; + pOut->bid = 0; + } + else + { + // pOut->bidSize = min(pOut->bidSize, ask->Size); + pOut->bidSize = pOut->bidSize < ask->Size ? pOut->bidSize : ask->Size; + pOut->bid += ask->Price*pIn->weight; + } + + if (bid == nullptr) + { + pOut->askSize = 0; + pOut->ask = 0; + } + else + { + // pOut->askSize = min(pOut->askSize, bid->Size); + pOut->askSize = pOut->askSize < bid->Size ? pOut->askSize : bid->Size; + pOut->ask += bid->Price*pIn->weight; + } + } +} + +void CSyntheticCalculate_DepthMarketDataNField_Spread::End(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) +{ + auto pI = (DepthMarketDataNField*)(pBuf); + auto pO = (DepthMarketDataNField*)(pOut->pBuf); + + pO->Size = sizeof(DepthMarketDataNField); + pO->BidCount = 0; + pO->ActionDay = pI->ActionDay; + pO->TradingDay = pI->TradingDay; + pO->UpdateTime = pI->UpdateTime; + pO->UpdateMillisec = pI->UpdateMillisec; + strcpy(pO->ExchangeID, pI->ExchangeID); + + strcpy(pO->InstrumentID, pCall->GetProduct().c_str()); + strcpy(pO->Symbol, pO->InstrumentID); + + + InitBidAsk(pO); + + do + { + if (pOut->bidSize == 0) + break; + AddBid(pO, pOut->bid, pOut->bidSize, 0); + } while (false); + + do + { + if (pOut->askSize == 0) + break; + AddAsk(pO, pOut->ask, pOut->askSize, 0); + + } while (false); +} + +CSyntheticCalculate* CSyntheticCalculateFactory_XAPI::Create(string method) +{ + if (method == "OpenInterest") + { + return new CSyntheticCalculate_DepthMarketDataNField_OpenInterest(); + } + else if (method == "Weight") + { + return new CSyntheticCalculate_DepthMarketDataNField_Weight(); + } + else if (method == "Copy") + { + return new CSyntheticCalculate_DepthMarketDataNField_Copy(); + } + else if (method == "Spread") + { + return new CSyntheticCalculate_DepthMarketDataNField_Spread(); + } + return nullptr; +} diff --git a/include/CSyntheticCalculate_DepthMarketDataNField.h b/include/CSyntheticCalculate_DepthMarketDataNField.h new file mode 100644 index 0000000..cb74696 --- /dev/null +++ b/include/CSyntheticCalculate_DepthMarketDataNField.h @@ -0,0 +1,47 @@ +#pragma once + +#include "synthetic/CSyntheticMarketData.h" + +class CSyntheticCalculateFactory_XAPI:public CSyntheticCalculateFactory +{ +public: + virtual CSyntheticCalculate* Create(string method); +}; + + +class CSyntheticCalculate_DepthMarketDataNField_OpenInterest :public CSyntheticCalculate +{ +public: + virtual void Begin(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut); + virtual void Sum(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut); + virtual void ForEach(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut); + virtual void End(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut); +}; + +class CSyntheticCalculate_DepthMarketDataNField_Weight :public CSyntheticCalculate +{ +public: + virtual void Begin(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut); + virtual void Sum(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut); + virtual void ForEach(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut); + virtual void End(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut); +}; + +class CSyntheticCalculate_DepthMarketDataNField_Copy :public CSyntheticCalculate +{ +public: + virtual void Begin(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut); + virtual void Sum(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut); + virtual void ForEach(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut); + virtual void End(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut); +}; + +class CSyntheticCalculate_DepthMarketDataNField_Spread :public CSyntheticCalculate +{ +public: + virtual void Begin(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut); + virtual void Sum(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut); + virtual void ForEach(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut); + virtual void End(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut); +}; + diff --git a/include/CTP/ThostFtdcTraderApi.h b/include/CTP/ThostFtdcTraderApi.h index 4cccbf7..5a4a6a7 100644 --- a/include/CTP/ThostFtdcTraderApi.h +++ b/include/CTP/ThostFtdcTraderApi.h @@ -100,8 +100,14 @@ class CThostFtdcTraderSpi ///۲Ӧ virtual void OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; - ///Ӧ - virtual void OnRspLockInsert(CThostFtdcInputLockField *pInputLock, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + ///Ӧ + virtual void OnRspBatchOrderAction(CThostFtdcInputBatchOrderActionField *pInputBatchOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȨԶԳ¼Ӧ + virtual void OnRspOptionSelfCloseInsert(CThostFtdcInputOptionSelfCloseField *pInputOptionSelfClose, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȨԶԳӦ + virtual void OnRspOptionSelfCloseAction(CThostFtdcInputOptionSelfCloseActionField *pInputOptionSelfCloseAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; ///¼Ӧ virtual void OnRspCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; @@ -184,6 +190,24 @@ class CThostFtdcTraderSpi ///ѯƷۻ virtual void OnRspQryProductExchRate(CThostFtdcProductExchRateField *pProductExchRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + ///ѯƷ + virtual void OnRspQryProductGroup(CThostFtdcProductGroupField *pProductGroup, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ̺ԼӦ + virtual void OnRspQryMMInstrumentCommissionRate(CThostFtdcMMInstrumentCommissionRateField *pMMInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨԼӦ + virtual void OnRspQryMMOptionInstrCommRate(CThostFtdcMMOptionInstrCommRateField *pMMOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryInstrumentOrderCommRate(CThostFtdcInstrumentOrderCommRateField *pInstrumentOrderCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʽ˻Ӧ + virtual void OnRspQrySecAgentTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʽУģʽӦ + virtual void OnRspQrySecAgentCheckMode(CThostFtdcSecAgentCheckModeField *pSecAgentCheckMode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + ///ѯȨ׳ɱӦ virtual void OnRspQryOptionInstrTradeCost(CThostFtdcOptionInstrTradeCostField *pOptionInstrTradeCost, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; @@ -199,11 +223,11 @@ class CThostFtdcTraderSpi ///ѯӦ virtual void OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; - ///ѯӦ - virtual void OnRspQryLock(CThostFtdcLockField *pLock, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + ///ѯȨԶԳӦ + virtual void OnRspQryOptionSelfClose(CThostFtdcOptionSelfCloseField *pOptionSelfClose, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; - ///ѯ֤ȯλӦ - virtual void OnRspQryLockPosition(CThostFtdcLockPositionField *pLockPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + ///ѯͶʵԪӦ + virtual void OnRspQryInvestUnit(CThostFtdcInvestUnitField *pInvestUnit, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; ///ѯϺԼȫϵӦ virtual void OnRspQryCombInstrumentGuard(CThostFtdcCombInstrumentGuardField *pCombInstrumentGuard, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; @@ -235,6 +259,9 @@ class CThostFtdcTraderSpi ///Լ״̬֪ͨ virtual void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) {}; + ///֪ͨ + virtual void OnRtnBulletin(CThostFtdcBulletinField *pBulletin) {}; + ///֪ͨ virtual void OnRtnTradingNotice(CThostFtdcTradingNoticeInfoField *pTradingNoticeInfo) {}; @@ -268,11 +295,17 @@ class CThostFtdcTraderSpi ///֤û virtual void OnRtnCFMMCTradingAccountToken(CThostFtdcCFMMCTradingAccountTokenField *pCFMMCTradingAccountToken) {}; - ///֪ͨ - virtual void OnRtnLock(CThostFtdcLockField *pLock) {}; + ///ر + virtual void OnErrRtnBatchOrderAction(CThostFtdcBatchOrderActionField *pBatchOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ȨԶԳ֪ͨ + virtual void OnRtnOptionSelfClose(CThostFtdcOptionSelfCloseField *pOptionSelfClose) {}; + + ///ȨԶԳ¼ر + virtual void OnErrRtnOptionSelfCloseInsert(CThostFtdcInputOptionSelfCloseField *pInputOptionSelfClose, CThostFtdcRspInfoField *pRspInfo) {}; - ///֪ͨ - virtual void OnErrRtnLockInsert(CThostFtdcInputLockField *pInputLock, CThostFtdcRspInfoField *pRspInfo) {}; + ///ȨԶԳر + virtual void OnErrRtnOptionSelfCloseAction(CThostFtdcOptionSelfCloseActionField *pOptionSelfCloseAction, CThostFtdcRspInfoField *pRspInfo) {}; ///֪ͨ virtual void OnRtnCombAction(CThostFtdcCombActionField *pCombAction) {}; @@ -450,6 +483,12 @@ class TRADER_API_EXPORT CThostFtdcTraderApi ///ʽ˻ virtual int ReqTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, int nRequestID) = 0; + ///¼2 + virtual int ReqUserLogin2(CThostFtdcReqUserLoginField *pReqUserLogin, int nRequestID) = 0; + + ///û2 + virtual int ReqUserPasswordUpdate2(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, int nRequestID) = 0; + ///¼ virtual int ReqOrderInsert(CThostFtdcInputOrderField *pInputOrder, int nRequestID) = 0; @@ -489,8 +528,14 @@ class TRADER_API_EXPORT CThostFtdcTraderApi ///۲ virtual int ReqQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, int nRequestID) = 0; - /// - virtual int ReqLockInsert(CThostFtdcInputLockField *pInputLock, int nRequestID) = 0; + /// + virtual int ReqBatchOrderAction(CThostFtdcInputBatchOrderActionField *pInputBatchOrderAction, int nRequestID) = 0; + + ///ȨԶԳ¼ + virtual int ReqOptionSelfCloseInsert(CThostFtdcInputOptionSelfCloseField *pInputOptionSelfClose, int nRequestID) = 0; + + ///ȨԶԳ + virtual int ReqOptionSelfCloseAction(CThostFtdcInputOptionSelfCloseActionField *pInputOptionSelfCloseAction, int nRequestID) = 0; ///¼ virtual int ReqCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, int nRequestID) = 0; @@ -573,6 +618,24 @@ class TRADER_API_EXPORT CThostFtdcTraderApi ///ѯƷۻ virtual int ReqQryProductExchRate(CThostFtdcQryProductExchRateField *pQryProductExchRate, int nRequestID) = 0; + ///ѯƷ + virtual int ReqQryProductGroup(CThostFtdcQryProductGroupField *pQryProductGroup, int nRequestID) = 0; + + ///ѯ̺Լ + virtual int ReqQryMMInstrumentCommissionRate(CThostFtdcQryMMInstrumentCommissionRateField *pQryMMInstrumentCommissionRate, int nRequestID) = 0; + + ///ѯȨԼ + virtual int ReqQryMMOptionInstrCommRate(CThostFtdcQryMMOptionInstrCommRateField *pQryMMOptionInstrCommRate, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryInstrumentOrderCommRate(CThostFtdcQryInstrumentOrderCommRateField *pQryInstrumentOrderCommRate, int nRequestID) = 0; + + ///ѯʽ˻ + virtual int ReqQrySecAgentTradingAccount(CThostFtdcQryTradingAccountField *pQryTradingAccount, int nRequestID) = 0; + + ///ѯʽУģʽ + virtual int ReqQrySecAgentCheckMode(CThostFtdcQrySecAgentCheckModeField *pQrySecAgentCheckMode, int nRequestID) = 0; + ///ѯȨ׳ɱ virtual int ReqQryOptionInstrTradeCost(CThostFtdcQryOptionInstrTradeCostField *pQryOptionInstrTradeCost, int nRequestID) = 0; @@ -588,11 +651,11 @@ class TRADER_API_EXPORT CThostFtdcTraderApi ///ѯ virtual int ReqQryQuote(CThostFtdcQryQuoteField *pQryQuote, int nRequestID) = 0; - ///ѯ - virtual int ReqQryLock(CThostFtdcQryLockField *pQryLock, int nRequestID) = 0; + ///ѯȨԶԳ + virtual int ReqQryOptionSelfClose(CThostFtdcQryOptionSelfCloseField *pQryOptionSelfClose, int nRequestID) = 0; - ///ѯ֤ȯλ - virtual int ReqQryLockPosition(CThostFtdcQryLockPositionField *pQryLockPosition, int nRequestID) = 0; + ///ѯͶʵԪ + virtual int ReqQryInvestUnit(CThostFtdcQryInvestUnitField *pQryInvestUnit, int nRequestID) = 0; ///ѯϺԼȫϵ virtual int ReqQryCombInstrumentGuard(CThostFtdcQryCombInstrumentGuardField *pQryCombInstrumentGuard, int nRequestID) = 0; diff --git a/include/CTP/ThostFtdcUserApiDataType.h b/include/CTP/ThostFtdcUserApiDataType.h index 1414426..974817e 100644 --- a/include/CTP/ThostFtdcUserApiDataType.h +++ b/include/CTP/ThostFtdcUserApiDataType.h @@ -398,8 +398,6 @@ typedef char TThostFtdcTraderConnectStatusType; #define THOST_FTDC_FC_SyncOTP 'E' ///ɾδ֪ #define THOST_FTDC_FC_DeleteOrder 'F' -///Ȩ -#define THOST_FTDC_FC_LockInsert 'G' typedef char TThostFtdcFunctionCodeType; @@ -494,8 +492,28 @@ typedef char TThostFtdcFunctionCodeType; #define THOST_FTDC_BFC_ParkedOrderInsert 'K' ///Ԥ񱨵 #define THOST_FTDC_BFC_ParkedOrderAction 'L' -///Ȩ -#define THOST_FTDC_BFC_LockInsert 'M' +///ʽ𲻹Ȩ +#define THOST_FTDC_BFC_ExecOrderNoCheck 'M' +///ָ +#define THOST_FTDC_BFC_Designate 'N' +///֤ȯ +#define THOST_FTDC_BFC_StockDisposal 'O' +///ϯλʽԤ +#define THOST_FTDC_BFC_BrokerDepositWarn 'Q' +///ҲԤ +#define THOST_FTDC_BFC_CoverWarn 'S' +///Ȩ +#define THOST_FTDC_BFC_PreExecOrder 'T' +///Ȩշ +#define THOST_FTDC_BFC_ExecOrderRisk 'P' +///ֲ޶Ԥ +#define THOST_FTDC_BFC_PosiLimitWarn 'U' +///ֲ޶ѯ +#define THOST_FTDC_BFC_QryPosiLimit 'V' +///ǩǩ +#define THOST_FTDC_BFC_FBSign 'W' +///ǩԼԼ +#define THOST_FTDC_BFC_FBAccount 'X' typedef char TThostFtdcBrokerFunctionCodeType; @@ -602,10 +620,6 @@ typedef char TThostFtdcTradingRoleType; #define THOST_FTDC_PC_EFP '5' ///ֻȨ #define THOST_FTDC_PC_SpotOption '6' -///Ȩ -#define THOST_FTDC_PC_ETFOption '7' -///֤ȯ -#define THOST_FTDC_PC_Stock '8' typedef char TThostFtdcProductClassType; @@ -690,8 +704,8 @@ typedef char TThostFtdcRatioAttrType; #define THOST_FTDC_HF_Arbitrage '2' ///ױ #define THOST_FTDC_HF_Hedge '3' -/// -#define THOST_FTDC_HF_Covered '4' +/// +#define THOST_FTDC_HF_MarketMaker '5' typedef char TThostFtdcHedgeFlagType; @@ -716,6 +730,8 @@ typedef char TThostFtdcBillHedgeFlagType; #define THOST_FTDC_CIDT_Arbitrage '2' ///ױ #define THOST_FTDC_CIDT_Hedge '3' +/// +#define THOST_FTDC_CIDT_MarketMaker '5' typedef char TThostFtdcClientIDTypeType; @@ -1415,6 +1431,28 @@ typedef char TThostFtdcSystemParamIDType; #define THOST_FTDC_TPID_IsPosiFreeze 'F' ///Ƿ޲ #define THOST_FTDC_TPID_IsPosiLimit 'M' +///֣ѯʱ +#define THOST_FTDC_TPID_ForQuoteTimeInterval 'Q' +///Ƿڻ޲ +#define THOST_FTDC_TPID_IsFuturePosiLimit 'B' +///ǷڻµƵ +#define THOST_FTDC_TPID_IsFutureOrderFreq 'C' +///ȨǷӯ +#define THOST_FTDC_TPID_IsExecOrderProfit 'H' +///ڿǷ֤пǷԤ˻ +#define THOST_FTDC_TPID_IsCheckBankAcc 'I' +///޸ +#define THOST_FTDC_TPID_PasswordDeadLine 'J' +///ǿУ +#define THOST_FTDC_TPID_IsStrongPassword 'K' +///ʽѺ +#define THOST_FTDC_TPID_BalanceMorgage 'a' +///С볤 +#define THOST_FTDC_TPID_MinPwdLen 'O' +///IP½ʧܴ +#define THOST_FTDC_TPID_LoginFailMaxNumForIP 'U' +///Ч +#define THOST_FTDC_TPID_PasswordPeriod 'V' typedef char TThostFtdcTradeParamIDType; @@ -2799,31 +2837,6 @@ typedef char TThostFtdcCFMMCKeyKindType; ///////////////////////////////////////////////////////////////////////// typedef char TThostFtdcAMLReportNameType[81]; -///////////////////////////////////////////////////////////////////////// -///TFtdcDBFComdTypeTypeһDBF -///////////////////////////////////////////////////////////////////////// -typedef char TThostFtdcDBFComdTypeType[65]; - -///////////////////////////////////////////////////////////////////////// -///TFtdcDBFComTimeTypeһDBFʱ -///////////////////////////////////////////////////////////////////////// -typedef char TThostFtdcDBFComTimeType[65]; - -///////////////////////////////////////////////////////////////////////// -///TFtdcDBFComNoTypeһDBFˮ -///////////////////////////////////////////////////////////////////////// -typedef char TThostFtdcDBFComNoType[17]; - -///////////////////////////////////////////////////////////////////////// -///TFtdcDBFFdNameTypeһDBFֶ -///////////////////////////////////////////////////////////////////////// -typedef char TThostFtdcDBFFdNameType[256]; - -///////////////////////////////////////////////////////////////////////// -///TFtdcDBFFdContentTypeһDBFֶ -///////////////////////////////////////////////////////////////////////// -typedef char TThostFtdcDBFFdContentType[256]; - ///////////////////////////////////////////////////////////////////////// ///TFtdcIndividualNameTypeһ ///////////////////////////////////////////////////////////////////////// @@ -3697,6 +3710,12 @@ typedef char TThostFtdcReqRspTypeType; #define THOST_FTDC_FBTUET_SignOut 'A' ///Կͬ #define THOST_FTDC_FBTUET_SyncKey 'B' +///ԤԼ +#define THOST_FTDC_FBTUET_ReserveOpenAccount 'C' +///ԤԼ +#define THOST_FTDC_FBTUET_CancelReserveOpenAccount 'D' +///ԤԼȷ +#define THOST_FTDC_FBTUET_ReserveOpenAccountConfirm 'E' /// #define THOST_FTDC_FBTUET_Other 'Z' @@ -6165,6 +6184,8 @@ typedef char TThostFtdcCombinationTypeType; #define THOST_FTDC_ORPT_PreSettlementPrice '1' ///ּ #define THOST_FTDC_ORPT_OpenPrice '4' +///¼۽ϴֵ +#define THOST_FTDC_ORPT_MaxPreSettlementPrice '5' typedef char TThostFtdcOptionRoyaltyPriceTypeType; @@ -6323,98 +6344,123 @@ typedef char TThostFtdcCFFEXUploadFileNameType; typedef char TThostFtdcCombDirectionType; ///////////////////////////////////////////////////////////////////////// -///TFtdcLockTypeTypeһ +///TFtdcStrikeOffsetTypeTypeһȨƫ ///////////////////////////////////////////////////////////////////////// -/// -#define THOST_FTDC_LCKT_Lock '1' -/// -#define THOST_FTDC_LCKT_Unlock '2' +///ʵֵ +#define THOST_FTDC_STOV_RealValue '1' +///ӯ +#define THOST_FTDC_STOV_ProfitValue '2' +///ʵֵ +#define THOST_FTDC_STOV_RealRatio '3' +///ӯ +#define THOST_FTDC_STOV_ProfitRatio '4' -typedef char TThostFtdcLockTypeType; +typedef char TThostFtdcStrikeOffsetTypeType; ///////////////////////////////////////////////////////////////////////// -///TFtdcBizTypeTypeһҵ +///TFtdcReserveOpenAccStasTypeһԤԼ״̬ ///////////////////////////////////////////////////////////////////////// -///ڻ -#define THOST_FTDC_BZTP_Future '1' -///֤ȯ -#define THOST_FTDC_BZTP_Stock '2' +///ȴ +#define THOST_FTDC_ROAST_Processing '0' +///ѳ +#define THOST_FTDC_ROAST_Cancelled '1' +///ѿ +#define THOST_FTDC_ROAST_Opened '2' +///Ч +#define THOST_FTDC_ROAST_Invalid '3' -typedef char TThostFtdcBizTypeType; +typedef char TThostFtdcReserveOpenAccStasType; ///////////////////////////////////////////////////////////////////////// -///TFtdcDesignateTypeTypeһָ +///TFtdcLoginRemarkTypeһ¼ע ///////////////////////////////////////////////////////////////////////// -///ָǼ -#define THOST_FTDC_DSTP_Register '1' -///ָ -#define THOST_FTDC_DSTP_Cancel '2' +typedef char TThostFtdcLoginRemarkType[36]; -typedef char TThostFtdcDesignateTypeType; +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestUnitIDTypeһͶʵԪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestUnitIDType[17]; ///////////////////////////////////////////////////////////////////////// -///TFtdcFreezeReasonTypeTypeһԭ +///TFtdcBulletinIDTypeһ ///////////////////////////////////////////////////////////////////////// -///ʼ -#define THOST_FTDC_FRTP_Init '1' -/// -#define THOST_FTDC_FRTP_Lock '2' -///ִ -#define THOST_FTDC_FRTP_Exec '3' +typedef int TThostFtdcBulletinIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNewsTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNewsTypeType[3]; -typedef char TThostFtdcFreezeReasonTypeType; +///////////////////////////////////////////////////////////////////////// +///TFtdcNewsUrgencyTypeһ̶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNewsUrgencyType; ///////////////////////////////////////////////////////////////////////// -///TFtdcFreezeTypeTypeһ +///TFtdcAbstractTypeһϢժҪ ///////////////////////////////////////////////////////////////////////// -/// -#define THOST_FTDC_FZTP_Freeze '1' -///ⶳ -#define THOST_FTDC_FZTP_Unfreeze '2' -///ǿִ -#define THOST_FTDC_FZTP_Force '3' +typedef char TThostFtdcAbstractType[81]; -typedef char TThostFtdcFreezeTypeType; +///////////////////////////////////////////////////////////////////////// +///TFtdcComeFromTypeһϢԴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcComeFromType[21]; ///////////////////////////////////////////////////////////////////////// -///TFtdcTradeSystemTypeTypeһϵͳ +///TFtdcURLLinkTypeһWEBַ ///////////////////////////////////////////////////////////////////////// -///δ֪ϵͳ -#define THOST_FTDC_TSTP_Unknow '0' -///ڻϵͳ -#define THOST_FTDC_TSTP_Future '1' -///ϵͳ -#define THOST_FTDC_TSTP_IShare '2' +typedef char TThostFtdcURLLinkType[201]; -typedef char TThostFtdcTradeSystemTypeType; +///////////////////////////////////////////////////////////////////////// +///TFtdcLongIndividualNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLongIndividualNameType[161]; ///////////////////////////////////////////////////////////////////////// -///TFtdcStockDisposalTypeTypeһ֤ȯ÷ +///TFtdcLongFBEBankAccountNameTypeһ˻ ///////////////////////////////////////////////////////////////////////// -///뾭͹˾˻ -#define THOST_FTDC_STPT_ToBroker '1' -///Ͷ˻ -#define THOST_FTDC_STPT_ToInvestor '2' +typedef char TThostFtdcLongFBEBankAccountNameType[161]; -typedef char TThostFtdcStockDisposalTypeType; +///////////////////////////////////////////////////////////////////////// +///TFtdcDateTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDateTimeType[17]; ///////////////////////////////////////////////////////////////////////// -///TFtdcStockDisposalSysIDTypeһ֤ȯñ +///TFtdcWeakPasswordSourceTypeһԴ ///////////////////////////////////////////////////////////////////////// -typedef char TThostFtdcStockDisposalSysIDType[21]; +/// +#define THOST_FTDC_WPSR_Lib '1' +///ֹ¼ +#define THOST_FTDC_WPSR_Manual '2' + +typedef char TThostFtdcWeakPasswordSourceType; ///////////////////////////////////////////////////////////////////////// -///TFtdcStockDisposalStatusTypeһ״̬ +///TFtdcRandomStringTypeһ ///////////////////////////////////////////////////////////////////////// -///Ѿύ -#define THOST_FTDC_SDPS_Submitted 'a' -///Ѿ -#define THOST_FTDC_SDPS_Accepted 'b' -///Ѿܾ -#define THOST_FTDC_SDPS_Rejected 'c' -///Ѿ -#define THOST_FTDC_SDPS_Cancelled 'd' +typedef char TThostFtdcRandomStringType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptSelfCloseFlagTypeһȨȨͷǷԶԳ +///////////////////////////////////////////////////////////////////////// +///ԶԳȨλ +#define THOST_FTDC_OSCF_CloseSelfOptionPosition '1' +///Ȩλ +#define THOST_FTDC_OSCF_ReserveOptionPosition '2' +///ԶԳԼڻλ +#define THOST_FTDC_OSCF_SellCloseSelfFuturePosition '3' + +typedef char TThostFtdcOptSelfCloseFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBizTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_BZTP_Future '1' +///֤ȯ +#define THOST_FTDC_BZTP_Stock '2' -typedef char TThostFtdcStockDisposalStatusType; +typedef char TThostFtdcBizTypeType; #endif diff --git a/include/CTP/ThostFtdcUserApiStruct.h b/include/CTP/ThostFtdcUserApiStruct.h index 4ae204c..faa83c7 100644 --- a/include/CTP/ThostFtdcUserApiStruct.h +++ b/include/CTP/ThostFtdcUserApiStruct.h @@ -48,6 +48,8 @@ struct CThostFtdcReqUserLoginField TThostFtdcPasswordType OneTimePassword; ///նIPַ TThostFtdcIPAddressType ClientIPAddress; + ///¼ע + TThostFtdcLoginRemarkType LoginRemark; }; ///û¼Ӧ @@ -138,6 +140,39 @@ struct CThostFtdcAuthenticationInfoField TThostFtdcBoolType IsResult; }; +///û¼Ӧ2 +struct CThostFtdcRspUserLogin2Field +{ + /// + TThostFtdcDateType TradingDay; + ///¼ɹʱ + TThostFtdcTimeType LoginTime; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Դʱ + TThostFtdcTimeType INETime; + /// + TThostFtdcRandomStringType RandomString; +}; + ///תʱͷ struct CThostFtdcTransferHeaderField { @@ -433,12 +468,6 @@ struct CThostFtdcInstrumentField TThostFtdcUnderlyingMultipleType UnderlyingMultiple; /// TThostFtdcCombinationTypeType CombinationType; - ///Сµλ - TThostFtdcVolumeType MinBuyVolume; - ///Сµλ - TThostFtdcVolumeType MinSellVolume; - ///Լʶ - TThostFtdcInstrumentCodeType InstrumentCode; }; ///͹˾ @@ -521,6 +550,8 @@ struct CThostFtdcTradingCodeField TThostFtdcBranchIDType BranchID; ///ҵ TThostFtdcBizTypeType BizType; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Ա;͹˾ձ @@ -666,6 +697,10 @@ struct CThostFtdcTradingAccountField TThostFtdcMoneyType SpecProductExchangeMargin; ///ҵ TThostFtdcBizTypeType BizType; + ///ʱ㶳 + TThostFtdcMoneyType FrozenSwap; + ///ʣ໻ + TThostFtdcMoneyType RemainSwap; }; ///Ͷֲ߳ @@ -759,6 +794,10 @@ struct CThostFtdcInvestorPositionField TThostFtdcVolumeType AbandonFrozen; /// TThostFtdcExchangeIDType ExchangeID; + ///ִж + TThostFtdcVolumeType YdStrikeFrozen; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Լ֤ @@ -784,6 +823,10 @@ struct CThostFtdcInstrumentMarginRateField TThostFtdcMoneyType ShortMarginRatioByVolume; ///ǷԽȡ TThostFtdcBoolType IsRelative; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Լ @@ -813,6 +856,8 @@ struct CThostFtdcInstrumentCommissionRateField TThostFtdcExchangeIDType ExchangeID; ///ҵ TThostFtdcBizTypeType BizType; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; /// @@ -921,10 +966,6 @@ struct CThostFtdcInstrumentTradingRightField TThostFtdcInvestorIDType InvestorID; ///Ȩ TThostFtdcTradingRightType TradingRight; - /// - TThostFtdcExchangeIDType ExchangeID; - ///ҵ - TThostFtdcBizTypeType BizType; }; ///͹˾û @@ -942,6 +983,8 @@ struct CThostFtdcBrokerUserField TThostFtdcBoolType IsActive; ///Ƿʹ TThostFtdcBoolType IsUsingOTP; + ///Ƿǿն֤ + TThostFtdcBoolType IsAuthForce; }; ///͹˾û @@ -953,6 +996,14 @@ struct CThostFtdcBrokerUserPasswordField TThostFtdcUserIDType UserID; /// TThostFtdcPasswordType Password; + ///ϴ޸ʱ + TThostFtdcDateTimeType LastUpdateTime; + ///ϴε½ʱ + TThostFtdcDateTimeType LastLoginTime; + ///ʱ + TThostFtdcDateType ExpireDate; + ///ʱ + TThostFtdcDateType WeakExpireDate; }; ///͹˾ûȨ @@ -1007,8 +1058,6 @@ struct CThostFtdcTraderOfferField TThostFtdcTradeIDType MaxTradeID; ///ϯλ󱨵 TThostFtdcReturnCodeType MaxOrderMessageReference; - ///ҵ - TThostFtdcBizTypeType BizType; }; ///Ͷ߽ @@ -1026,6 +1075,10 @@ struct CThostFtdcSettlementInfoField TThostFtdcSequenceNoType SequenceNo; ///Ϣ TThostFtdcContentType Content; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; }; ///Լ֤ʵ @@ -1070,6 +1123,8 @@ struct CThostFtdcExchangeMarginRateField TThostFtdcRatioType ShortMarginRatioByMoney; ///ͷ֤ TThostFtdcMoneyType ShortMarginRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; }; ///֤ʵ @@ -1180,8 +1235,8 @@ struct CThostFtdcLoginInfoField TThostFtdcProtocolInfoType ProtocolInfo; ///ϵͳ TThostFtdcSystemNameType SystemName; - /// - TThostFtdcPasswordType Password; + ///, + TThostFtdcPasswordType PasswordDeprecated; ///󱨵 TThostFtdcOrderRefType MaxOrderRef; ///ʱ @@ -1198,6 +1253,12 @@ struct CThostFtdcLoginInfoField TThostFtdcPasswordType OneTimePassword; ///Դʱ TThostFtdcTimeType INETime; + ///ѯʱǷҪ + TThostFtdcBoolType IsQryControl; + ///¼ע + TThostFtdcLoginRemarkType LoginRemark; + /// + TThostFtdcPasswordType Password; }; ///¼Ϣ @@ -1288,6 +1349,18 @@ struct CThostFtdcInputOrderField TThostFtdcBoolType IsSwapOrder; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; /// @@ -1409,6 +1482,16 @@ struct CThostFtdcOrderField TThostFtdcBoolType IsSwapOrder; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; /// @@ -1500,6 +1583,10 @@ struct CThostFtdcExchangeOrderField TThostFtdcSequenceNoType SequenceNo; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ʧ @@ -1552,6 +1639,12 @@ struct CThostFtdcInputOrderActionField TThostFtdcUserIDType UserID; ///Լ TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; /// @@ -1609,6 +1702,12 @@ struct CThostFtdcOrderActionField TThostFtdcInstrumentIDType InstrumentID; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; /// @@ -1648,6 +1747,10 @@ struct CThostFtdcExchangeOrderActionField TThostFtdcUserIDType UserID; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ʧ @@ -1669,8 +1772,6 @@ struct CThostFtdcExchangeOrderActionErrorField TThostFtdcErrorIDType ErrorID; ///Ϣ TThostFtdcErrorMsgType ErrorMsg; - ///͹˾ - TThostFtdcBrokerIDType BrokerID; }; ///ɽ @@ -1785,6 +1886,8 @@ struct CThostFtdcTradeField TThostFtdcSequenceNoType BrokerOrderSeq; ///ɽԴ TThostFtdcTradeSourceType TradeSource; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ûỰ @@ -1812,6 +1915,8 @@ struct CThostFtdcUserSessionField TThostFtdcProtocolInfoType ProtocolInfo; ///Macַ TThostFtdcMacAddressType MacAddress; + ///¼ע + TThostFtdcLoginRemarkType LoginRemark; }; ///ѯ󱨵 @@ -1833,6 +1938,8 @@ struct CThostFtdcQueryMaxOrderVolumeField TThostFtdcVolumeType MaxVolume; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Ͷ߽ȷϢ @@ -1846,6 +1953,12 @@ struct CThostFtdcSettlementInfoConfirmField TThostFtdcDateType ConfirmDate; ///ȷʱ TThostFtdcTimeType ConfirmTime; + /// + TThostFtdcSettlementIDType SettlementID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; }; ///ͬ @@ -1935,8 +2048,6 @@ struct CThostFtdcSyncingTradingCodeField TThostFtdcBoolType IsActive; ///ױ TThostFtdcClientIDTypeType ClientIDType; - ///Ӫҵ - TThostFtdcBranchIDType BranchID; }; ///ͬеͶ߷ @@ -2045,6 +2156,10 @@ struct CThostFtdcSyncingTradingAccountField TThostFtdcMoneyType SpecProductPositionProfitByAlg; ///Ʒ֤ TThostFtdcMoneyType SpecProductExchangeMargin; + ///ʱ㶳 + TThostFtdcMoneyType FrozenSwap; + ///ʣ໻ + TThostFtdcMoneyType RemainSwap; }; ///ͬеͶֲ߳ @@ -2138,6 +2253,10 @@ struct CThostFtdcSyncingInvestorPositionField TThostFtdcVolumeType AbandonFrozen; /// TThostFtdcExchangeIDType ExchangeID; + ///ִж + TThostFtdcVolumeType YdStrikeFrozen; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ͬеĺԼ֤ @@ -2188,8 +2307,6 @@ struct CThostFtdcSyncingInstrumentCommissionRateField TThostFtdcRatioType CloseTodayRatioByMoney; ///ƽ TThostFtdcRatioType CloseTodayRatioByVolume; - /// - TThostFtdcExchangeIDType ExchangeID; }; ///ͬеĺԼȨ @@ -2205,8 +2322,6 @@ struct CThostFtdcSyncingInstrumentTradingRightField TThostFtdcInvestorIDType InvestorID; ///Ȩ TThostFtdcTradingRightType TradingRight; - /// - TThostFtdcExchangeIDType ExchangeID; }; ///ѯ @@ -2226,6 +2341,8 @@ struct CThostFtdcQryOrderField TThostFtdcTimeType InsertTimeStart; ///ʱ TThostFtdcTimeType InsertTimeEnd; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯɽ @@ -2245,6 +2362,8 @@ struct CThostFtdcQryTradeField TThostFtdcTimeType TradeTimeStart; ///ʱ TThostFtdcTimeType TradeTimeEnd; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯͶֲ߳ @@ -2258,6 +2377,8 @@ struct CThostFtdcQryInvestorPositionField TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯʽ˻ @@ -2271,6 +2392,8 @@ struct CThostFtdcQryTradingAccountField TThostFtdcCurrencyIDType CurrencyID; ///ҵ TThostFtdcBizTypeType BizType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; }; ///ѯͶ @@ -2295,6 +2418,8 @@ struct CThostFtdcQryTradingCodeField TThostFtdcClientIDType ClientID; ///ױ TThostFtdcClientIDTypeType ClientIDType; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯͶ @@ -2315,6 +2440,10 @@ struct CThostFtdcQryInstrumentMarginRateField TThostFtdcInstrumentIDType InstrumentID; ///Ͷױ־ TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯ @@ -2328,6 +2457,8 @@ struct CThostFtdcQryInstrumentCommissionRateField TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯԼȨ @@ -2339,8 +2470,6 @@ struct CThostFtdcQryInstrumentTradingRightField TThostFtdcInvestorIDType InvestorID; ///Լ TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; }; ///ѯ͹˾ @@ -2532,6 +2661,10 @@ struct CThostFtdcQrySettlementInfoField TThostFtdcInvestorIDType InvestorID; /// TThostFtdcDateType TradingDay; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; }; ///ѯ֤ @@ -2543,6 +2676,8 @@ struct CThostFtdcQryExchangeMarginRateField TThostFtdcInstrumentIDType InstrumentID; ///Ͷױ־ TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; }; ///ѯ֤ @@ -2616,8 +2751,6 @@ struct CThostFtdcOptionInstrMiniMarginField TThostFtdcValueMethodType ValueMethod; ///Ƿ潻ȡ TThostFtdcBoolType IsRelative; - /// - TThostFtdcExchangeIDType ExchangeID; }; ///ǰȨԼ֤ϵ @@ -2645,8 +2778,10 @@ struct CThostFtdcOptionInstrMarginAdjustField TThostFtdcMoneyType AShortMarginRatioByVolume; ///Ƿ潻ȡ TThostFtdcBoolType IsRelative; - /// - TThostFtdcExchangeIDType ExchangeID; + ///̿ͷ֤ϵ + TThostFtdcRatioType MShortMarginRatioByMoney; + ///̿ͷ֤ϵ + TThostFtdcMoneyType MShortMarginRatioByVolume; }; ///ǰȨԼѵϸ @@ -2678,6 +2813,8 @@ struct CThostFtdcOptionInstrCommRateField TThostFtdcRatioType StrikeRatioByVolume; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Ȩ׳ɱ @@ -2703,6 +2840,8 @@ struct CThostFtdcOptionInstrTradeCostField TThostFtdcMoneyType ExchMiniMargin; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Ȩ׳ɱѯ @@ -2722,6 +2861,8 @@ struct CThostFtdcQryOptionInstrTradeCostField TThostFtdcPriceType UnderlyingPrice; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Ȩʲѯ @@ -2735,6 +2876,8 @@ struct CThostFtdcQryOptionInstrCommRateField TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ָָֻ @@ -2746,8 +2889,6 @@ struct CThostFtdcIndexPriceField TThostFtdcInstrumentIDType InstrumentID; ///ָֻ̼ TThostFtdcPriceType ClosePrice; - /// - TThostFtdcExchangeIDType ExchangeID; }; ///ִ @@ -2777,12 +2918,24 @@ struct CThostFtdcInputExecOrderField TThostFtdcActionTypeType ActionType; ///ͷijֲַ TThostFtdcPosiDirectionType PosiDirection; - ///ȨȨǷڻͷı + ///ȨȨǷڻͷı,ֶѷ TThostFtdcExecOrderPositionFlagType ReservePositionFlag; ///ȨȨɵͷǷԶƽ TThostFtdcExecOrderCloseFlagType CloseFlag; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ִ @@ -2812,6 +2965,12 @@ struct CThostFtdcInputExecOrderActionField TThostFtdcUserIDType UserID; ///Լ TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ִ @@ -2841,7 +3000,7 @@ struct CThostFtdcExecOrderField TThostFtdcActionTypeType ActionType; ///ͷijֲַ TThostFtdcPosiDirectionType PosiDirection; - ///ȨȨǷڻͷı + ///ȨȨǷڻͷı,ֶѷ TThostFtdcExecOrderPositionFlagType ReservePositionFlag; ///ȨȨɵͷǷԶƽ TThostFtdcExecOrderCloseFlagType CloseFlag; @@ -2895,6 +3054,16 @@ struct CThostFtdcExecOrderField TThostFtdcSequenceNoType BrokerExecOrderSeq; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ִ @@ -2950,6 +3119,12 @@ struct CThostFtdcExecOrderActionField TThostFtdcInstrumentIDType InstrumentID; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ִѯ @@ -2988,7 +3163,7 @@ struct CThostFtdcExchangeExecOrderField TThostFtdcActionTypeType ActionType; ///ͷijֲַ TThostFtdcPosiDirectionType PosiDirection; - ///ȨȨǷڻͷı + ///ȨȨǷڻͷı,ֶѷ TThostFtdcExecOrderPositionFlagType ReservePositionFlag; ///ȨȨɵͷǷԶƽ TThostFtdcExecOrderCloseFlagType CloseFlag; @@ -3030,6 +3205,10 @@ struct CThostFtdcExchangeExecOrderField TThostFtdcSequenceNoType SequenceNo; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ִѯ @@ -3093,6 +3272,10 @@ struct CThostFtdcExchangeExecOrderActionField TThostFtdcActionTypeType ActionType; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ִѯ @@ -3135,12 +3318,24 @@ struct CThostFtdcErrExecOrderField TThostFtdcActionTypeType ActionType; ///ͷijֲַ TThostFtdcPosiDirectionType PosiDirection; - ///ȨȨǷڻͷı + ///ȨȨǷڻͷı,ֶѷ TThostFtdcExecOrderPositionFlagType ReservePositionFlag; ///ȨȨɵͷǷԶƽ TThostFtdcExecOrderCloseFlagType CloseFlag; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; /// TThostFtdcErrorIDType ErrorID; ///Ϣ @@ -3183,6 +3378,12 @@ struct CThostFtdcErrExecOrderActionField TThostFtdcUserIDType UserID; ///Լ TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; /// TThostFtdcErrorIDType ErrorID; ///Ϣ @@ -3213,10 +3414,6 @@ struct CThostFtdcOptionInstrTradingRightField TThostFtdcDirectionType Direction; ///Ȩ TThostFtdcTradingRightType TradingRight; - /// - TThostFtdcExchangeIDType ExchangeID; - ///Ͷױ־ - TThostFtdcHedgeFlagType HedgeFlag; }; ///ѯȨԼȨ @@ -3230,8 +3427,6 @@ struct CThostFtdcQryOptionInstrTradingRightField TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcDirectionType Direction; - /// - TThostFtdcExchangeIDType ExchangeID; }; ///ѯ @@ -3249,6 +3444,12 @@ struct CThostFtdcInputForQuoteField TThostFtdcUserIDType UserID; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ѯ @@ -3294,6 +3495,12 @@ struct CThostFtdcForQuoteField TThostFtdcUserIDType ActiveUserID; ///͹˾ѯ۱ TThostFtdcSequenceNoType BrokerForQutoSeq; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ѯ۲ѯ @@ -3311,6 +3518,8 @@ struct CThostFtdcQryForQuoteField TThostFtdcTimeType InsertTimeStart; ///ʱ TThostFtdcTimeType InsertTimeEnd; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯϢ @@ -3336,6 +3545,10 @@ struct CThostFtdcExchangeForQuoteField TThostFtdcTimeType InsertTime; ///ѯ״̬ TThostFtdcForQuoteStatusType ForQuoteStatus; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ѯ۲ѯ @@ -3394,6 +3607,14 @@ struct CThostFtdcInputQuoteField TThostFtdcOrderSysIDType ForQuoteSysID; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///뱨۲ @@ -3423,6 +3644,14 @@ struct CThostFtdcInputQuoteActionField TThostFtdcUserIDType UserID; ///Լ TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; /// @@ -3518,6 +3747,16 @@ struct CThostFtdcQuoteField TThostFtdcOrderSysIDType ForQuoteSysID; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///۲ @@ -3571,6 +3810,12 @@ struct CThostFtdcQuoteActionField TThostFtdcInstrumentIDType InstrumentID; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///۲ѯ @@ -3590,6 +3835,8 @@ struct CThostFtdcQryQuoteField TThostFtdcTimeType InsertTimeStart; ///ʱ TThostFtdcTimeType InsertTimeEnd; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Ϣ @@ -3659,6 +3906,10 @@ struct CThostFtdcExchangeQuoteField TThostFtdcOrderSysIDType ForQuoteSysID; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///۲ѯ @@ -3718,6 +3969,10 @@ struct CThostFtdcExchangeQuoteActionField TThostFtdcOrderActionStatusType OrderActionStatus; ///û TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///۲ѯ @@ -3746,8 +4001,6 @@ struct CThostFtdcOptionInstrDeltaField TThostFtdcInvestorIDType InvestorID; ///Deltaֵ TThostFtdcRatioType Delta; - /// - TThostFtdcExchangeIDType ExchangeID; }; ///̵ѯ @@ -3780,8 +4033,8 @@ struct CThostFtdcStrikeOffsetField TThostFtdcInvestorIDType InvestorID; ///ִƫֵ TThostFtdcMoneyType Offset; - /// - TThostFtdcExchangeIDType ExchangeID; + ///ִƫ + TThostFtdcStrikeOffsetTypeType OffsetType; }; ///Ȩִƫֵѯ @@ -3795,642 +4048,58 @@ struct CThostFtdcQryStrikeOffsetField TThostFtdcInstrumentIDType InstrumentID; }; -///¼ -struct CThostFtdcInputLockField +/// +struct CThostFtdcInputBatchOrderActionField { ///͹˾ TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcOrderRefType LockRef; - ///û - TThostFtdcUserIDType UserID; - /// - TThostFtdcVolumeType Volume; + /// + TThostFtdcOrderActionRefType OrderActionRef; /// TThostFtdcRequestIDType RequestID; - ///ҵԪ - TThostFtdcBusinessUnitType BusinessUnit; - /// - TThostFtdcLockTypeType LockType; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; /// TThostFtdcExchangeIDType ExchangeID; + ///û + TThostFtdcUserIDType UserID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; -/// -struct CThostFtdcLockField +/// +struct CThostFtdcBatchOrderActionField { ///͹˾ TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcOrderRefType LockRef; - ///û - TThostFtdcUserIDType UserID; - /// - TThostFtdcVolumeType Volume; + /// + TThostFtdcOrderActionRefType OrderActionRef; /// TThostFtdcRequestIDType RequestID; - ///ҵԪ - TThostFtdcBusinessUnitType BusinessUnit; - /// - TThostFtdcLockTypeType LockType; - /// - TThostFtdcOrderLocalIDType LockLocalID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; /// TThostFtdcExchangeIDType ExchangeID; - ///Ա - TThostFtdcParticipantIDType ParticipantID; - ///ͻ - TThostFtdcClientIDType ClientID; - ///ԼڽĴ - TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; ///Ա TThostFtdcTraderIDType TraderID; ///װ TThostFtdcInstallIDType InstallID; - ///ִύ״̬ - TThostFtdcOrderSubmitStatusType OrderSubmitStatus; - ///ʾ - TThostFtdcSequenceNoType NotifySequence; - /// - TThostFtdcDateType TradingDay; - /// - TThostFtdcSettlementIDType SettlementID; - /// - TThostFtdcOrderSysIDType LockSysID; - /// - TThostFtdcDateType InsertDate; - ///ʱ - TThostFtdcTimeType InsertTime; - ///ʱ - TThostFtdcTimeType CancelTime; - ///״̬ - TThostFtdcOrderActionStatusType LockStatus; - ///Ա - TThostFtdcParticipantIDType ClearingPartID; - /// - TThostFtdcSequenceNoType SequenceNo; - ///ǰñ - TThostFtdcFrontIDType FrontID; - ///Ự - TThostFtdcSessionIDType SessionID; - ///û˲ƷϢ - TThostFtdcProductInfoType UserProductInfo; - ///״̬Ϣ - TThostFtdcErrorMsgType StatusMsg; - ///û - TThostFtdcUserIDType ActiveUserID; - ///͹˾ - TThostFtdcSequenceNoType BrokerLockSeq; - ///Ӫҵ - TThostFtdcBranchIDType BranchID; -}; - -///ѯ -struct CThostFtdcQryLockField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcOrderSysIDType LockSysID; - ///ʼʱ - TThostFtdcTimeType InsertTimeStart; - ///ʱ - TThostFtdcTimeType InsertTimeEnd; -}; - -///֤ȯλ -struct CThostFtdcLockPositionField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcVolumeType Volume; - /// - TThostFtdcVolumeType FrozenVolume; -}; - -///ѯ֤ȯλ -struct CThostFtdcQryLockPositionField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; -}; - -///ǰETFȨԼѵϸ -struct CThostFtdcETFOptionInstrCommRateField -{ - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - ///Ͷ߷Χ - TThostFtdcInvestorRangeType InvestorRange; - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - /// - TThostFtdcRatioType OpenRatioByMoney; - /// - TThostFtdcRatioType OpenRatioByVolume; - ///ƽ - TThostFtdcRatioType CloseRatioByMoney; - ///ƽ - TThostFtdcRatioType CloseRatioByVolume; - ///ƽ - TThostFtdcRatioType CloseTodayRatioByMoney; - ///ƽ - TThostFtdcRatioType CloseTodayRatioByVolume; - ///ִ - TThostFtdcRatioType StrikeRatioByMoney; - ///ִ - TThostFtdcRatioType StrikeRatioByVolume; - /// - TThostFtdcExchangeIDType ExchangeID; - ///Ͷױ־ - TThostFtdcHedgeFlagType HedgeFlag; - ///ֲַ - TThostFtdcPosiDirectionType PosiDirection; -}; - -///ETFȨʲѯ -struct CThostFtdcQryETFOptionInstrCommRateField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; -}; - -///ijֲֶ -struct CThostFtdcPosiFreezeField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; - ///ر - TThostFtdcOrderLocalIDType OrderLocalID; - ///Ա - TThostFtdcTraderIDType TraderID; - ///Ա - TThostFtdcParticipantIDType ParticipantID; - ///װ - TThostFtdcInstallIDType InstallID; - /// - TThostFtdcVolumeType Volume; - ///ԭ - TThostFtdcFreezeReasonTypeType FreezeReasonType; - /// - TThostFtdcFreezeTypeType FreezeType; -}; - -///ѯ -struct CThostFtdcQryExchangeLockField -{ - ///Ա - TThostFtdcParticipantIDType ParticipantID; - ///ͻ - TThostFtdcClientIDType ClientID; - ///ԼڽĴ - TThostFtdcExchangeInstIDType ExchangeInstID; - /// - TThostFtdcExchangeIDType ExchangeID; - ///Ա - TThostFtdcTraderIDType TraderID; -}; - -/// -struct CThostFtdcExchangeLockField -{ - /// - TThostFtdcVolumeType Volume; - /// - TThostFtdcRequestIDType RequestID; - ///ҵԪ - TThostFtdcBusinessUnitType BusinessUnit; - /// - TThostFtdcLockTypeType LockType; - /// - TThostFtdcOrderLocalIDType LockLocalID; - /// - TThostFtdcExchangeIDType ExchangeID; - ///Ա - TThostFtdcParticipantIDType ParticipantID; - ///ͻ - TThostFtdcClientIDType ClientID; - ///ԼڽĴ - TThostFtdcExchangeInstIDType ExchangeInstID; - ///Ա - TThostFtdcTraderIDType TraderID; - ///װ - TThostFtdcInstallIDType InstallID; - ///ִύ״̬ - TThostFtdcOrderSubmitStatusType OrderSubmitStatus; - ///ʾ - TThostFtdcSequenceNoType NotifySequence; - /// - TThostFtdcDateType TradingDay; - /// - TThostFtdcSettlementIDType SettlementID; - /// - TThostFtdcOrderSysIDType LockSysID; - /// - TThostFtdcDateType InsertDate; - ///ʱ - TThostFtdcTimeType InsertTime; - ///ʱ - TThostFtdcTimeType CancelTime; - ///״̬ - TThostFtdcOrderActionStatusType LockStatus; - ///Ա - TThostFtdcParticipantIDType ClearingPartID; - /// - TThostFtdcSequenceNoType SequenceNo; - ///Ӫҵ - TThostFtdcBranchIDType BranchID; -}; - -/// -struct CThostFtdcExchangeExecOrderActionErrorField -{ - /// - TThostFtdcExchangeIDType ExchangeID; - ///ִ - TThostFtdcExecOrderSysIDType ExecOrderSysID; - ///Ա - TThostFtdcTraderIDType TraderID; - ///װ - TThostFtdcInstallIDType InstallID; - ///ִ - TThostFtdcOrderLocalIDType ExecOrderLocalID; - ///ر - TThostFtdcOrderLocalIDType ActionLocalID; - /// - TThostFtdcErrorIDType ErrorID; - ///Ϣ - TThostFtdcErrorMsgType ErrorMsg; - ///͹˾ - TThostFtdcBrokerIDType BrokerID; -}; - -/// -struct CThostFtdcInputBatchOrderActionField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - /// - TThostFtdcOrderActionRefType OrderActionRef; - /// - TThostFtdcRequestIDType RequestID; - ///ǰñ - TThostFtdcFrontIDType FrontID; - ///Ự - TThostFtdcSessionIDType SessionID; - /// - TThostFtdcExchangeIDType ExchangeID; - ///û - TThostFtdcUserIDType UserID; -}; - -/// -struct CThostFtdcBatchOrderActionField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - /// - TThostFtdcOrderActionRefType OrderActionRef; - /// - TThostFtdcRequestIDType RequestID; - ///ǰñ - TThostFtdcFrontIDType FrontID; - ///Ự - TThostFtdcSessionIDType SessionID; - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcDateType ActionDate; - ///ʱ - TThostFtdcTimeType ActionTime; - ///Ա - TThostFtdcTraderIDType TraderID; - ///װ - TThostFtdcInstallIDType InstallID; - ///ر - TThostFtdcOrderLocalIDType ActionLocalID; - ///Ա - TThostFtdcParticipantIDType ParticipantID; - ///ͻ - TThostFtdcClientIDType ClientID; - ///ҵԪ - TThostFtdcBusinessUnitType BusinessUnit; - ///״̬ - TThostFtdcOrderActionStatusType OrderActionStatus; - ///û - TThostFtdcUserIDType UserID; - ///״̬Ϣ - TThostFtdcErrorMsgType StatusMsg; -}; - -/// -struct CThostFtdcExchangeBatchOrderActionField -{ - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcDateType ActionDate; - ///ʱ - TThostFtdcTimeType ActionTime; - ///Ա - TThostFtdcTraderIDType TraderID; - ///װ - TThostFtdcInstallIDType InstallID; - ///ر - TThostFtdcOrderLocalIDType ActionLocalID; - ///Ա - TThostFtdcParticipantIDType ParticipantID; - ///ͻ - TThostFtdcClientIDType ClientID; - ///ҵԪ - TThostFtdcBusinessUnitType BusinessUnit; - ///״̬ - TThostFtdcOrderActionStatusType OrderActionStatus; - ///û - TThostFtdcUserIDType UserID; -}; - -///ѯ -struct CThostFtdcQryBatchOrderActionField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - /// - TThostFtdcExchangeIDType ExchangeID; -}; - -///Ͷֲ߳ -struct CThostFtdcLimitPosiField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcVolumeType TotalVolume; - ///ͷ - TThostFtdcVolumeType LongVolume; - ///նͷ - TThostFtdcVolumeType OpenVolume; - ///ͷֲֽ - TThostFtdcMoneyType LongAmount; - /// - TThostFtdcVolumeType TotalVolumeFrozen; - ///ͷ - TThostFtdcVolumeType LongVolumeFrozen; - ///նͷ - TThostFtdcVolumeType OpenVolumeFrozen; - ///ͷֲֽ - TThostFtdcMoneyType LongAmountFrozen; -}; - -///ѯͶֲ߳ -struct CThostFtdcQryLimitPosiField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; -}; - -///͹˾ֲ -struct CThostFtdcBrokerLimitPosiField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcLargeVolumeType TotalVolume; - ///ͷ - TThostFtdcLargeVolumeType LongVolume; - /// - TThostFtdcLargeVolumeType TotalVolumeFrozen; - ///ͷ - TThostFtdcLargeVolumeType LongVolumeFrozen; -}; - -///ѯ͹˾ֲ -struct CThostFtdcQryBrokerLimitPosiField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; -}; - -///Ͷ֤ȯֲ -struct CThostFtdcLimitPosiSField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcVolumeType TotalVolume; - ///տ - TThostFtdcVolumeType OpenVolume; - /// - TThostFtdcVolumeType TotalVolumeFrozen; - ///տ - TThostFtdcVolumeType OpenVolumeFrozen; -}; - -///ѯͶ֤ȯֲ -struct CThostFtdcQryLimitPosiSField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; -}; - -///Ͷֲ߳Ʋ -struct CThostFtdcLimitPosiParamField -{ - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - ///Ͷ߷Χ - TThostFtdcInvestorRangeType InvestorRange; - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcVolumeType TotalVolume; - ///ͷ - TThostFtdcVolumeType LongVolume; - ///նͷ - TThostFtdcVolumeType OpenVolume; - ///ͷֲֽ - TThostFtdcMoneyType LongAmount; -}; - -///͹˾ֲƲ -struct CThostFtdcBrokerLimitPosiParamField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcLargeVolumeType TotalVolume; - ///ͷ - TThostFtdcLargeVolumeType LongVolume; -}; - -///Ͷ֤ȯֲƲ -struct CThostFtdcLimitPosiParamSField -{ - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - ///Ͷ߷Χ - TThostFtdcInvestorRangeType InvestorRange; - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - /// - TThostFtdcExchangeIDType ExchangeID; - /// - TThostFtdcVolumeType TotalVolume; - ///տ - TThostFtdcVolumeType OpenVolume; -}; - -///֤ȯò -struct CThostFtdcInputStockDisposalActionField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///֤ȯò - TThostFtdcOrderActionRefType StockDisposalActionRef; - ///֤ȯ - TThostFtdcOrderRefType StockDisposalRef; - /// - TThostFtdcRequestIDType RequestID; - ///ǰñ - TThostFtdcFrontIDType FrontID; - ///Ự - TThostFtdcSessionIDType SessionID; - /// - TThostFtdcExchangeIDType ExchangeID; - ///֤ȯò - TThostFtdcStockDisposalSysIDType StockDisposalSysID; - ///־ - TThostFtdcActionFlagType ActionFlag; - ///û - TThostFtdcUserIDType UserID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; -}; - -///֤ȯò -struct CThostFtdcStockDisposalActionField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///֤ȯò - TThostFtdcOrderActionRefType StockDisposalActionRef; - ///֤ȯ - TThostFtdcOrderRefType StockDisposalRef; - /// - TThostFtdcRequestIDType RequestID; - ///ǰñ - TThostFtdcFrontIDType FrontID; - ///Ự - TThostFtdcSessionIDType SessionID; - /// - TThostFtdcExchangeIDType ExchangeID; - ///֤ȯò - TThostFtdcStockDisposalSysIDType StockDisposalSysID; - ///־ - TThostFtdcActionFlagType ActionFlag; - /// - TThostFtdcDateType ActionDate; - ///ʱ - TThostFtdcTimeType ActionTime; - ///Ա - TThostFtdcTraderIDType TraderID; - ///װ - TThostFtdcInstallIDType InstallID; - ///֤ȯñ - TThostFtdcOrderLocalIDType StockDisposalLocalID; ///ر TThostFtdcOrderLocalIDType ActionLocalID; ///Ա @@ -4443,36 +4112,21 @@ struct CThostFtdcStockDisposalActionField TThostFtdcOrderActionStatusType OrderActionStatus; ///û TThostFtdcUserIDType UserID; - ///ִ - TThostFtdcActionTypeType ActionType; ///״̬Ϣ TThostFtdcErrorMsgType StatusMsg; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - ///Ӫҵ - TThostFtdcBranchIDType BranchID; -}; - -///֤ȯòѯ -struct CThostFtdcQryStockDisposalActionField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - /// - TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; -///֤ȯò -struct CThostFtdcExchangeStockDisposalActionField +/// +struct CThostFtdcExchangeBatchOrderActionField { /// TThostFtdcExchangeIDType ExchangeID; - ///֤ȯò - TThostFtdcStockDisposalSysIDType StockDisposalSysID; - ///־ - TThostFtdcActionFlagType ActionFlag; /// TThostFtdcDateType ActionDate; ///ʱ @@ -4481,8 +4135,6 @@ struct CThostFtdcExchangeStockDisposalActionField TThostFtdcTraderIDType TraderID; ///װ TThostFtdcInstallIDType InstallID; - ///֤ȯñ - TThostFtdcOrderLocalIDType StockDisposalLocalID; ///ر TThostFtdcOrderLocalIDType ActionLocalID; ///Ա @@ -4491,92 +4143,25 @@ struct CThostFtdcExchangeStockDisposalActionField TThostFtdcClientIDType ClientID; ///ҵԪ TThostFtdcBusinessUnitType BusinessUnit; - ///״̬ - TThostFtdcOrderActionStatusType OrderActionStatus; - ///û - TThostFtdcUserIDType UserID; - ///ִ - TThostFtdcActionTypeType ActionType; - ///Ӫҵ - TThostFtdcBranchIDType BranchID; -}; - -///֤ȯò -struct CThostFtdcQryExchangeStockDisposalActionField -{ - ///Ա - TThostFtdcParticipantIDType ParticipantID; - ///ͻ - TThostFtdcClientIDType ClientID; - /// - TThostFtdcExchangeIDType ExchangeID; - ///Ա - TThostFtdcTraderIDType TraderID; -}; - -///ѯ֤ȯò -struct CThostFtdcQryErrStockDisposalActionField -{ - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; -}; - -///֤ȯò -struct CThostFtdcExchangeStockDisposalActionErrorField -{ - /// - TThostFtdcExchangeIDType ExchangeID; - ///֤ȯñ - TThostFtdcStockDisposalSysIDType StockDisposalSysID; - ///Ա - TThostFtdcTraderIDType TraderID; - ///װ - TThostFtdcInstallIDType InstallID; - ///֤ȯñ - TThostFtdcOrderLocalIDType StockDisposalLocalID; - ///ر - TThostFtdcOrderLocalIDType ActionLocalID; - /// - TThostFtdcErrorIDType ErrorID; - ///Ϣ - TThostFtdcErrorMsgType ErrorMsg; - ///͹˾ - TThostFtdcBrokerIDType BrokerID; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; -///֤ȯò -struct CThostFtdcErrStockDisposalActionField +///ѯ +struct CThostFtdcQryBatchOrderActionField { ///͹˾ TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; - ///֤ȯò - TThostFtdcOrderActionRefType StockDisposalActionRef; - ///֤ȯ - TThostFtdcOrderRefType StockDisposalRef; - /// - TThostFtdcRequestIDType RequestID; - ///ǰñ - TThostFtdcFrontIDType FrontID; - ///Ự - TThostFtdcSessionIDType SessionID; /// TThostFtdcExchangeIDType ExchangeID; - ///֤ȯò - TThostFtdcStockDisposalSysIDType StockDisposalSysID; - ///־ - TThostFtdcActionFlagType ActionFlag; - ///û - TThostFtdcUserIDType UserID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcErrorIDType ErrorID; - ///Ϣ - TThostFtdcErrorMsgType ErrorMsg; }; ///ϺԼȫϵ @@ -4588,6 +4173,8 @@ struct CThostFtdcCombInstrumentGuardField TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcRatioType GuarantRatio; + /// + TThostFtdcExchangeIDType ExchangeID; }; ///ϺԼȫϵѯ @@ -4597,6 +4184,8 @@ struct CThostFtdcQryCombInstrumentGuardField TThostFtdcBrokerIDType BrokerID; ///Լ TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; }; /// @@ -4622,6 +4211,12 @@ struct CThostFtdcInputCombActionField TThostFtdcHedgeFlagType HedgeFlag; /// TThostFtdcExchangeIDType ExchangeID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; /// @@ -4677,6 +4272,16 @@ struct CThostFtdcCombActionField TThostFtdcProductInfoType UserProductInfo; ///״̬Ϣ TThostFtdcErrorMsgType StatusMsg; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ϲѯ @@ -4690,6 +4295,8 @@ struct CThostFtdcQryCombActionField TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Ϣ @@ -4727,6 +4334,14 @@ struct CThostFtdcExchangeCombActionField TThostFtdcSettlementIDType SettlementID; /// TThostFtdcSequenceNoType SequenceNo; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; }; ///ϲѯ @@ -4753,6 +4368,8 @@ struct CThostFtdcProductExchRateField TThostFtdcCurrencyIDType QuoteCurrencyID; /// TThostFtdcExchangeRateType ExchangeRate; + /// + TThostFtdcExchangeIDType ExchangeID; }; ///Ʒۻʲѯ @@ -4760,62 +4377,350 @@ struct CThostFtdcQryProductExchRateField { ///Ʒ TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯѯۼ۲ +struct CThostFtdcQryForQuoteParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯۼ۲ +struct CThostFtdcForQuoteParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///¼ + TThostFtdcPriceType LastPrice; + ///۲ + TThostFtdcPriceType PriceInterval; +}; + +///ǰȨԼѵϸ +struct CThostFtdcMMOptionInstrCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///ִ + TThostFtdcRatioType StrikeRatioByMoney; + ///ִ + TThostFtdcRatioType StrikeRatioByVolume; +}; + +///Ȩʲѯ +struct CThostFtdcQryMMOptionInstrCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///̺Լ +struct CThostFtdcMMInstrumentCommissionRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; +}; + +///ѯ̺Լ +struct CThostFtdcQryMMInstrumentCommissionRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ǰѵϸ +struct CThostFtdcInstrumentOrderCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcRatioType OrderCommByVolume; + /// + TThostFtdcRatioType OrderActionCommByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ʲѯ +struct CThostFtdcQryInstrumentOrderCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ײ +struct CThostFtdcTradeParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcTradeParamIDType TradeParamID; + ///ֵ + TThostFtdcSettlementParamValueType TradeParamValue; + ///ע + TThostFtdcMemoType Memo; +}; + +///Լ֤ʵ +struct CThostFtdcInstrumentMarginRateULField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; +}; + +///ڻֲƲ +struct CThostFtdcFutureLimitPosiParamField +{ + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ͷ + TThostFtdcVolumeType SpecOpenVolume; + /// + TThostFtdcVolumeType ArbiOpenVolume; + ///Ͷ+ + TThostFtdcVolumeType OpenVolume; +}; + +///ֹ¼IP +struct CThostFtdcLoginForbiddenIPField +{ + ///IPַ + TThostFtdcIPAddressType IPAddress; +}; + +///IPб +struct CThostFtdcIPListField +{ + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Ƿ + TThostFtdcBoolType IsWhite; }; -///ָ -struct CThostFtdcInputDesignateField +///ȨԶԳ +struct CThostFtdcInputOptionSelfCloseField { ///͹˾ TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; - ///ָǼ - TThostFtdcOrderRefType DesignateRef; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ȨԶԳ + TThostFtdcOrderRefType OptionSelfCloseRef; ///û TThostFtdcUserIDType UserID; - ///ָ - TThostFtdcDesignateTypeType DesignateType; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨȨͷǷԶԳ + TThostFtdcOptSelfCloseFlagType OptSelfCloseFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ȨԶԳ +struct CThostFtdcInputOptionSelfCloseActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ȨԶԳ + TThostFtdcOrderActionRefType OptionSelfCloseActionRef; + ///ȨԶԳ + TThostFtdcOrderRefType OptionSelfCloseRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; /// TThostFtdcExchangeIDType ExchangeID; + ///ȨԶԳ + TThostFtdcOrderSysIDType OptionSelfCloseSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; -///ָ -struct CThostFtdcDesignateField +///ȨԶԳ +struct CThostFtdcOptionSelfCloseField { ///͹˾ TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; - ///ָǼ - TThostFtdcOrderRefType DesignateRef; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ȨԶԳ + TThostFtdcOrderRefType OptionSelfCloseRef; ///û TThostFtdcUserIDType UserID; - ///ָ - TThostFtdcDesignateTypeType DesignateType; - ///ָ - TThostFtdcOrderLocalIDType DesignateLocalID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨȨͷǷԶԳ + TThostFtdcOptSelfCloseFlagType OptSelfCloseFlag; + ///ȨԶԳ + TThostFtdcOrderLocalIDType OptionSelfCloseLocalID; /// TThostFtdcExchangeIDType ExchangeID; ///Ա TThostFtdcParticipantIDType ParticipantID; ///ͻ TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; ///Ա TThostFtdcTraderIDType TraderID; ///װ TThostFtdcInstallIDType InstallID; - ///ָ״̬ - TThostFtdcOrderActionStatusType DesignateStatus; + ///ȨԶԳύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; ///ʾ TThostFtdcSequenceNoType NotifySequence; /// TThostFtdcDateType TradingDay; /// TThostFtdcSettlementIDType SettlementID; + ///ȨԶԳ + TThostFtdcOrderSysIDType OptionSelfCloseSysID; /// TThostFtdcDateType InsertDate; ///ʱ TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ԶԳ + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; ///ǰñ TThostFtdcFrontIDType FrontID; ///Ự @@ -4824,136 +4729,161 @@ struct CThostFtdcDesignateField TThostFtdcProductInfoType UserProductInfo; ///״̬Ϣ TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOptionSelfCloseSeq; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; -///ָ -struct CThostFtdcQryDesignateField +///ȨԶԳ +struct CThostFtdcOptionSelfCloseActionField { ///͹˾ TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; + ///ȨԶԳ + TThostFtdcOrderActionRefType OptionSelfCloseActionRef; + ///ȨԶԳ + TThostFtdcOrderRefType OptionSelfCloseRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; /// TThostFtdcExchangeIDType ExchangeID; -}; - -///ָϢ -struct CThostFtdcExchangeDesignateField -{ - ///ָ - TThostFtdcDesignateTypeType DesignateType; - ///ָ - TThostFtdcOrderLocalIDType DesignateLocalID; - /// - TThostFtdcExchangeIDType ExchangeID; - ///Ա - TThostFtdcParticipantIDType ParticipantID; - ///ͻ - TThostFtdcClientIDType ClientID; + ///ȨԶԳ + TThostFtdcOrderSysIDType OptionSelfCloseSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; ///Ա TThostFtdcTraderIDType TraderID; ///װ TThostFtdcInstallIDType InstallID; - ///ָ״̬ - TThostFtdcOrderActionStatusType DesignateStatus; - ///ʾ - TThostFtdcSequenceNoType NotifySequence; - /// - TThostFtdcDateType TradingDay; - /// - TThostFtdcSettlementIDType SettlementID; - /// - TThostFtdcDateType InsertDate; - ///ʱ - TThostFtdcTimeType InsertTime; + ///ȨԶԳ + TThostFtdcOrderLocalIDType OptionSelfCloseLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; -///֤ȯ -struct CThostFtdcInputStockDisposalField +///ȨԶԳѯ +struct CThostFtdcQryOptionSelfCloseField { ///͹˾ TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; - ///֤ȯõǼ - TThostFtdcOrderRefType StockDisposalRef; - ///û - TThostFtdcUserIDType UserID; ///Լ TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcVolumeType Volume; - ///֤ȯ÷ - TThostFtdcStockDisposalTypeType StockDisposalType; /// TThostFtdcExchangeIDType ExchangeID; + ///ȨԶԳ + TThostFtdcOrderSysIDType OptionSelfCloseSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; }; -///֤ȯ -struct CThostFtdcStockDisposalField +///ȨԶԳϢ +struct CThostFtdcExchangeOptionSelfCloseField { - ///͹˾ - TThostFtdcBrokerIDType BrokerID; - ///Ͷߴ - TThostFtdcInvestorIDType InvestorID; - ///֤ȯõǼ - TThostFtdcOrderRefType StockDisposalRef; - ///û - TThostFtdcUserIDType UserID; - ///Լ - TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcVolumeType Volume; - ///֤ȯ÷ - TThostFtdcStockDisposalTypeType StockDisposalType; - ///֤ȯñ - TThostFtdcOrderLocalIDType StockDisposalLocalID; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨȨͷǷԶԳ + TThostFtdcOptSelfCloseFlagType OptSelfCloseFlag; + ///ȨԶԳ + TThostFtdcOrderLocalIDType OptionSelfCloseLocalID; /// TThostFtdcExchangeIDType ExchangeID; - ///ԼڽĴ - TThostFtdcExchangeInstIDType ExchangeInstID; ///Ա TThostFtdcParticipantIDType ParticipantID; ///ͻ TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; ///Ա TThostFtdcTraderIDType TraderID; ///װ TThostFtdcInstallIDType InstallID; - ///֤ȯ״̬ - TThostFtdcStockDisposalStatusType StockDisposalStatus; + ///ȨԶԳύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; ///ʾ TThostFtdcSequenceNoType NotifySequence; /// TThostFtdcDateType TradingDay; /// TThostFtdcSettlementIDType SettlementID; + ///ȨԶԳ + TThostFtdcOrderSysIDType OptionSelfCloseSysID; /// TThostFtdcDateType InsertDate; ///ʱ TThostFtdcTimeType InsertTime; - ///ǰñ - TThostFtdcFrontIDType FrontID; - ///Ự - TThostFtdcSessionIDType SessionID; - ///û˲ƷϢ - TThostFtdcProductInfoType UserProductInfo; - ///״̬Ϣ - TThostFtdcErrorMsgType StatusMsg; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ԶԳ + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; ///Ӫҵ TThostFtdcBranchIDType BranchID; - ///֤ȯò - TThostFtdcStockDisposalSysIDType StockDisposalSysID; - ///ҵԪ - TThostFtdcBusinessUnitType BusinessUnit; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; -///֤ȯ -struct CThostFtdcQryStockDisposalField +///ȨԶԳѯ +struct CThostFtdcQryOptionSelfCloseActionField { ///͹˾ TThostFtdcBrokerIDType BrokerID; @@ -4963,45 +4893,124 @@ struct CThostFtdcQryStockDisposalField TThostFtdcExchangeIDType ExchangeID; }; -///֤ȯϢ -struct CThostFtdcExchangeStockDisposalField +///ȨԶԳ +struct CThostFtdcExchangeOptionSelfCloseActionField { - /// - TThostFtdcVolumeType Volume; - ///֤ȯ÷ - TThostFtdcStockDisposalTypeType StockDisposalType; - ///֤ȯñ - TThostFtdcOrderLocalIDType StockDisposalLocalID; /// TThostFtdcExchangeIDType ExchangeID; - ///ԼڽĴ - TThostFtdcExchangeInstIDType ExchangeInstID; - ///Ա - TThostFtdcParticipantIDType ParticipantID; - ///ͻ - TThostFtdcClientIDType ClientID; + ///ȨԶԳ + TThostFtdcOrderSysIDType OptionSelfCloseSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; ///Ա TThostFtdcTraderIDType TraderID; ///װ TThostFtdcInstallIDType InstallID; - ///֤ȯ״̬ - TThostFtdcStockDisposalStatusType StockDisposalStatus; - ///ʾ - TThostFtdcSequenceNoType NotifySequence; - /// - TThostFtdcDateType TradingDay; - /// - TThostFtdcSettlementIDType SettlementID; - /// - TThostFtdcDateType InsertDate; - ///ʱ - TThostFtdcTimeType InsertTime; - ///Ӫҵ - TThostFtdcBranchIDType BranchID; - ///֤ȯò - TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///ȨԶԳ + TThostFtdcOrderLocalIDType OptionSelfCloseLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; ///ҵԪ TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ʱͬ +struct CThostFtdcSyncDelaySwapField +{ + ///ˮ + TThostFtdcDepositSeqNoType DelaySwapSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Դ + TThostFtdcMoneyType FromAmount; + ///Դ㶳(ö) + TThostFtdcMoneyType FromFrozenSwap; + ///Դʣ໻(ᶳ) + TThostFtdcMoneyType FromRemainSwap; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; + ///Ŀ + TThostFtdcMoneyType ToAmount; +}; + +///ѯʱͬ +struct CThostFtdcQrySyncDelaySwapField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʱˮ + TThostFtdcDepositSeqNoType DelaySwapSeqNo; +}; + +///ͶʵԪ +struct CThostFtdcInvestUnitField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ͶߵԪ + TThostFtdcPartyNameType InvestorUnitName; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯͶʵԪ +struct CThostFtdcQryInvestUnitField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ʽУģʽ +struct CThostFtdcSecAgentCheckModeField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcCurrencyIDType CurrencyID; + ///нʽʺ + TThostFtdcAccountIDType BrokerSecAgentID; + ///ǷҪУԼʽ˻ + TThostFtdcBoolType CheckSelfAccount; }; ///г @@ -5180,8 +5189,6 @@ struct CThostFtdcMarketDataUpdateTimeField TThostFtdcMillisecType UpdateMillisec; ///ҵ TThostFtdcDateType ActionDay; - /// - TThostFtdcExchangeIDType ExchangeID; }; ///齻 @@ -5302,6 +5309,8 @@ struct CThostFtdcQryInvestorPositionDetailField TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Ͷֲ߳ϸ @@ -5359,6 +5368,8 @@ struct CThostFtdcInvestorPositionDetailField TThostFtdcVolumeType CloseVolume; ///ƽֽ TThostFtdcMoneyType CloseAmount; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ʽ˻ @@ -5415,8 +5426,6 @@ struct CThostFtdcMDTraderOfferField TThostFtdcTradeIDType MaxTradeID; ///ϯλ󱨵 TThostFtdcReturnCodeType MaxOrderMessageReference; - ///ҵ - TThostFtdcBizTypeType BizType; }; ///ѯ鱨̻ @@ -5468,6 +5477,10 @@ struct CThostFtdcQrySettlementInfoConfirmField TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; }; ///װؽϢ @@ -5644,8 +5657,6 @@ struct CThostFtdcBrokerUserEventField TThostFtdcInvestorIDType InvestorID; ///Լ TThostFtdcInstrumentIDType InstrumentID; - /// - TThostFtdcExchangeIDType ExchangeID; }; ///ѯǩԼ @@ -5715,6 +5726,8 @@ struct CThostFtdcInvestorPositionCombineDetailField TThostFtdcInstrumentIDType CombInstrumentID; ///ɽ TThostFtdcTradeGroupIDType TradeGroupID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///Ԥ @@ -5778,6 +5791,18 @@ struct CThostFtdcParkedOrderField TThostFtdcErrorMsgType ErrorMsg; ///־ TThostFtdcBoolType IsSwapOrder; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///Ԥ񵥲 @@ -5821,6 +5846,12 @@ struct CThostFtdcParkedOrderActionField TThostFtdcErrorIDType ErrorID; ///Ϣ TThostFtdcErrorMsgType ErrorMsg; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ѯԤ @@ -5834,6 +5865,8 @@ struct CThostFtdcQryParkedOrderField TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯԤ񳷵 @@ -5847,6 +5880,8 @@ struct CThostFtdcQryParkedOrderActionField TThostFtdcInstrumentIDType InstrumentID; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ɾԤ @@ -5858,6 +5893,8 @@ struct CThostFtdcRemoveParkedOrderField TThostFtdcInvestorIDType InvestorID; ///Ԥ񱨵 TThostFtdcParkedOrderIDType ParkedOrderID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ɾԤ񳷵 @@ -5869,6 +5906,8 @@ struct CThostFtdcRemoveParkedOrderActionField TThostFtdcInvestorIDType InvestorID; ///Ԥ񳷵 TThostFtdcParkedOrderActionIDType ParkedOrderActionID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///͹˾ʽ㷨 @@ -5897,6 +5936,10 @@ struct CThostFtdcQryInvestorPositionCombineDetailField TThostFtdcInvestorIDType InvestorID; ///ϳֲֺԼ TThostFtdcInstrumentIDType CombInstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ɽ @@ -5947,6 +5990,8 @@ struct CThostFtdcTradingNoticeInfoField TThostFtdcSequenceSeriesType SequenceSeries; ///к TThostFtdcSequenceNoType SequenceNo; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///û¼֪ͨ @@ -5968,6 +6013,8 @@ struct CThostFtdcTradingNoticeField TThostFtdcSequenceNoType SequenceNo; ///Ϣ TThostFtdcContentType FieldContent; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯ¼֪ͨ @@ -5977,6 +6024,8 @@ struct CThostFtdcQryTradingNoticeField TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯ󱨵 @@ -6043,6 +6092,18 @@ struct CThostFtdcErrOrderField TThostFtdcBoolType IsSwapOrder; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ѯ󱨵 @@ -6168,6 +6229,16 @@ struct CThostFtdcErrorConditionalOrderField TThostFtdcBoolType IsSwapOrder; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; }; ///ѯ󱨵 @@ -6234,6 +6305,12 @@ struct CThostFtdcErrOrderActionField TThostFtdcInstrumentIDType InstrumentID; ///Ӫҵ TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; /// TThostFtdcErrorIDType ErrorID; ///Ϣ @@ -6279,6 +6356,8 @@ struct CThostFtdcQueryMaxOrderVolumeWithPriceField TThostFtdcPriceType Price; /// TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯ͹˾ײ @@ -6290,6 +6369,8 @@ struct CThostFtdcQryBrokerTradingParamsField TThostFtdcInvestorIDType InvestorID; ///ִ TThostFtdcCurrencyIDType CurrencyID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; }; ///͹˾ײ @@ -6309,6 +6390,8 @@ struct CThostFtdcBrokerTradingParamsField TThostFtdcCurrencyIDType CurrencyID; ///ȨȨ۸ TThostFtdcOptionRoyaltyPriceTypeType OptionRoyaltyPriceType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; }; ///ѯ͹˾㷨 @@ -6524,6 +6607,8 @@ struct CThostFtdcEWarrantOffsetField TThostFtdcHedgeFlagType HedgeFlag; /// TThostFtdcVolumeType Volume; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯֵ۵Ϣ @@ -6537,6 +6622,8 @@ struct CThostFtdcQryEWarrantOffsetField TThostFtdcExchangeIDType ExchangeID; ///Լ TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯͶƷ/Ʒֱ֤ @@ -6550,6 +6637,10 @@ struct CThostFtdcQryInvestorProductGroupMarginField TThostFtdcInstrumentIDType ProductGroupID; ///Ͷױ־ TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ͶƷ/Ʒֱ֤ @@ -6609,6 +6700,10 @@ struct CThostFtdcInvestorProductGroupMarginField TThostFtdcMoneyType ShortExchOffsetAmount; ///Ͷױ־ TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///ѯû @@ -6618,6 +6713,8 @@ struct CThostFtdcQueryCFMMCTradingAccountTokenField TThostFtdcBrokerIDType BrokerID; ///Ͷߴ TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; }; ///û @@ -6635,6 +6732,70 @@ struct CThostFtdcCFMMCTradingAccountTokenField TThostFtdcCFMMCTokenType Token; }; +///ѯƷ +struct CThostFtdcQryProductGroupField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ͶƷ/Ʒֱ֤Ʒ +struct CThostFtdcProductGroupField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductGroupID; +}; + +/// +struct CThostFtdcBulletinField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcBulletinIDType BulletinID; + ///к + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcNewsTypeType NewsType; + ///̶ + TThostFtdcNewsUrgencyType NewsUrgency; + ///ʱ + TThostFtdcTimeType SendTime; + ///ϢժҪ + TThostFtdcAbstractType Abstract; + ///ϢԴ + TThostFtdcComeFromType ComeFrom; + ///Ϣ + TThostFtdcContentType Content; + ///WEBַ + TThostFtdcURLLinkType URLLink; + ///г + TThostFtdcMarketIDType MarketID; +}; + +///ѯ +struct CThostFtdcQryBulletinField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcBulletinIDType BulletinID; + ///к + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcNewsTypeType NewsType; + ///̶ + TThostFtdcNewsUrgencyType NewsUrgency; +}; + ///תʿ struct CThostFtdcReqOpenAccountField { @@ -6726,6 +6887,8 @@ struct CThostFtdcReqOpenAccountField TThostFtdcTIDType TID; ///ûʶ TThostFtdcUserIDType UserID; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ת @@ -6819,6 +6982,8 @@ struct CThostFtdcReqCancelAccountField TThostFtdcTIDType TID; ///ûʶ TThostFtdcUserIDType UserID; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///˻ @@ -6904,6 +7069,8 @@ struct CThostFtdcReqChangeAccountField TThostFtdcTIDType TID; ///ժҪ TThostFtdcDigestType Digest; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ת @@ -6995,6 +7162,8 @@ struct CThostFtdcReqTransferField TThostFtdcTIDType TID; ///ת˽״̬ TThostFtdcTransferStatusType TransferStatus; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///зʽתڻӦ @@ -7090,6 +7259,8 @@ struct CThostFtdcRspTransferField TThostFtdcErrorIDType ErrorID; ///Ϣ TThostFtdcErrorMsgType ErrorMsg; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; /// @@ -7195,6 +7366,8 @@ struct CThostFtdcReqRepealField TThostFtdcTIDType TID; ///ת˽״̬ TThostFtdcTransferStatusType TransferStatus; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///Ӧ @@ -7304,6 +7477,8 @@ struct CThostFtdcRspRepealField TThostFtdcErrorIDType ErrorID; ///Ϣ TThostFtdcErrorMsgType ErrorMsg; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ѯ˻Ϣ @@ -7381,6 +7556,8 @@ struct CThostFtdcReqQueryAccountField TThostFtdcRequestIDType RequestID; ///ID TThostFtdcTIDType TID; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ѯ˻ϢӦ @@ -7462,6 +7639,8 @@ struct CThostFtdcRspQueryAccountField TThostFtdcTradeAmountType BankUseAmount; ///пȡ TThostFtdcTradeAmountType BankFetchAmount; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ǩǩ @@ -7719,6 +7898,8 @@ struct CThostFtdcReqQueryTradeResultBySerialField TThostFtdcTradeAmountType TradeAmount; ///ժҪ TThostFtdcDigestType Digest; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ѯָˮŵĽ׽Ӧ @@ -7874,6 +8055,8 @@ struct CThostFtdcVerifyCustInfoField TThostFtdcIdentifiedCardNoType IdentifiedCardNo; ///ͻ TThostFtdcCustTypeType CustType; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///֤ڻʽͿͻϢ @@ -7893,6 +8076,8 @@ struct CThostFtdcVerifyFuturePasswordAndCustInfoField TThostFtdcPasswordType Password; ///ִ TThostFtdcCurrencyIDType CurrencyID; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///֤ڻʽͿͻϢ @@ -8091,6 +8276,8 @@ struct CThostFtdcNotifyQueryAccountField TThostFtdcErrorIDType ErrorID; ///Ϣ TThostFtdcErrorMsgType ErrorMsg; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ת˽ˮ @@ -8374,6 +8561,8 @@ struct CThostFtdcAccountregisterField TThostFtdcCustTypeType CustType; ///ʺ TThostFtdcBankAccTypeType BankAccType; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ڿϢ @@ -8471,6 +8660,8 @@ struct CThostFtdcOpenAccountField TThostFtdcErrorIDType ErrorID; ///Ϣ TThostFtdcErrorMsgType ErrorMsg; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///Ϣ @@ -8568,6 +8759,8 @@ struct CThostFtdcCancelAccountField TThostFtdcErrorIDType ErrorID; ///Ϣ TThostFtdcErrorMsgType ErrorMsg; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ڱ˺Ϣ @@ -8657,6 +8850,8 @@ struct CThostFtdcChangeAccountField TThostFtdcErrorIDType ErrorID; ///Ϣ TThostFtdcErrorMsgType ErrorMsg; + ///ͻ + TThostFtdcLongIndividualNameType LongCustomerName; }; ///ԱȨ @@ -8747,6 +8942,8 @@ struct CThostFtdcLoginForbiddenUserField TThostFtdcBrokerIDType BrokerID; ///û TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; }; ///ѯֹ¼û @@ -8782,33 +8979,249 @@ struct CThostFtdcTradingAccountReserveField TThostFtdcCurrencyIDType CurrencyID; }; -///DBF¼ -struct CThostFtdcDBFRecordField -{ - ///DBF - TThostFtdcDBFComdTypeType DBFComdType; - ///DBFʱ - TThostFtdcDBFComTimeType DBFComTime; - ///DBFԭʼˮ - TThostFtdcDBFComNoType DBFOComNo; - ///DBFˮ - TThostFtdcDBFComNoType DBFComNo; - ///DBFֶ - TThostFtdcDBFFdNameType DBFFdName1; - ///DBFֶ - TThostFtdcDBFFdContentType DBFFdContent1; - ///DBFֶ - TThostFtdcDBFFdNameType DBFFdName2; - ///DBFֶ - TThostFtdcDBFFdContentType DBFFdContent2; - ///DBFֶ - TThostFtdcDBFFdNameType DBFFdName3; - ///DBFֶ - TThostFtdcDBFFdContentType DBFFdContent3; - ///DBFֶ - TThostFtdcDBFFdNameType DBFFdName4; - ///DBFֶ - TThostFtdcDBFFdContentType DBFFdContent4; +///ѯֹ¼IP +struct CThostFtdcQryLoginForbiddenIPField +{ + ///IPַ + TThostFtdcIPAddressType IPAddress; +}; + +///ѯIPб +struct CThostFtdcQryIPListField +{ + ///IPַ + TThostFtdcIPAddressType IPAddress; +}; + +///ѯûµȨ޷ +struct CThostFtdcQryUserRightsAssignField +{ + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ԤԼȷ +struct CThostFtdcReserveOpenAccountConfirmField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcLongIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ID + TThostFtdcTIDType TID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ԤԼˮ + TThostFtdcBankSerialType BankReserveOpenSeq; + ///ԤԼ + TThostFtdcTradeDateType BookDate; + ///ԤԼ֤ + TThostFtdcPasswordType BookPsw; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ԤԼ +struct CThostFtdcReserveOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcLongIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ID + TThostFtdcTIDType TID; + ///ԤԼ״̬ + TThostFtdcReserveOpenAccStasType ReserveOpenAccStas; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///˻ +struct CThostFtdcAccountPropertyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ͳһʶ + TThostFtdcBankIDType BankID; + ///˻ + TThostFtdcBankAccountType BankAccount; + ///˻Ŀ + TThostFtdcInvestorFullNameType OpenName; + ///˻Ŀ + TThostFtdcOpenBankType OpenBank; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///˻Դ + TThostFtdcAccountSourceTypeType AccountSourceType; + /// + TThostFtdcDateType OpenDate; + ///ע + TThostFtdcDateType CancelDate; + ///¼Ա + TThostFtdcOperatorIDType OperatorID; + ///¼ + TThostFtdcDateType OperateDate; + ///¼ʱ + TThostFtdcTimeType OperateTime; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯǰ +struct CThostFtdcQryCurrDRIdentityField +{ + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; +}; + +///ǰ +struct CThostFtdcCurrDRIdentityField +{ + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; +}; + +///ѯʽУģʽ +struct CThostFtdcQrySecAgentCheckModeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; }; diff --git a/include/CTP/error.xml b/include/CTP/error.xml index 4a798a1..8907e17 100644 --- a/include/CTP/error.xml +++ b/include/CTP/error.xml @@ -63,7 +63,7 @@ - + @@ -96,24 +96,22 @@ - - - - - - - - - - + - - - - + + + + + + + + + + + @@ -155,7 +153,9 @@ - + + + @@ -170,7 +170,10 @@ + + + diff --git a/include/CTP/linux32/libthostmduserapi.so b/include/CTP/linux32/libthostmduserapi.so deleted file mode 100644 index 1b6e4cf..0000000 Binary files a/include/CTP/linux32/libthostmduserapi.so and /dev/null differ diff --git a/include/CTP/linux32/libthosttraderapi.so b/include/CTP/linux32/libthosttraderapi.so deleted file mode 100644 index 87c231e..0000000 Binary files a/include/CTP/linux32/libthosttraderapi.so and /dev/null differ diff --git a/include/CTP/linux64/libthostmduserapi.so b/include/CTP/linux64/libthostmduserapi.so index bae6a82..2a350b3 100644 Binary files a/include/CTP/linux64/libthostmduserapi.so and b/include/CTP/linux64/libthostmduserapi.so differ diff --git a/include/CTP/linux64/libthosttraderapi.so b/include/CTP/linux64/libthosttraderapi.so index 4fc941a..66c583d 100644 Binary files a/include/CTP/linux64/libthosttraderapi.so and b/include/CTP/linux64/libthosttraderapi.so differ diff --git a/include/CTP/version.txt b/include/CTP/version.txt index f7e01f2..ad2b2f5 100644 --- a/include/CTP/version.txt +++ b/include/CTP/version.txt @@ -1,3 +1,4 @@ 20141217 64位windows 20141230 其它版本 -20150324 个股期权版 \ No newline at end of file +20150324 个股期权版 +20160606 修正CTP断线重连崩溃的Bug \ No newline at end of file diff --git a/include/CTP/win32/thostmduserapi.dll b/include/CTP/win32/thostmduserapi.dll index c5186ef..80ff984 100644 Binary files a/include/CTP/win32/thostmduserapi.dll and b/include/CTP/win32/thostmduserapi.dll differ diff --git a/include/CTP/win32/thostmduserapi.lib b/include/CTP/win32/thostmduserapi.lib index b14c3e9..9792317 100644 Binary files a/include/CTP/win32/thostmduserapi.lib and b/include/CTP/win32/thostmduserapi.lib differ diff --git a/include/CTP/win32/thosttraderapi.dll b/include/CTP/win32/thosttraderapi.dll index 79999aa..ec275a7 100644 Binary files a/include/CTP/win32/thosttraderapi.dll and b/include/CTP/win32/thosttraderapi.dll differ diff --git a/include/CTP/win32/thosttraderapi.lib b/include/CTP/win32/thosttraderapi.lib index fbb60a7..a81442b 100644 Binary files a/include/CTP/win32/thosttraderapi.lib and b/include/CTP/win32/thosttraderapi.lib differ diff --git a/include/CTP/win64/thostmduserapi.dll b/include/CTP/win64/thostmduserapi.dll new file mode 100644 index 0000000..a88261e Binary files /dev/null and b/include/CTP/win64/thostmduserapi.dll differ diff --git a/include/CTP/win64/thostmduserapi.lib b/include/CTP/win64/thostmduserapi.lib new file mode 100644 index 0000000..766213d Binary files /dev/null and b/include/CTP/win64/thostmduserapi.lib differ diff --git a/include/CTP/win64/thosttraderapi.dll b/include/CTP/win64/thosttraderapi.dll new file mode 100644 index 0000000..9996dd0 Binary files /dev/null and b/include/CTP/win64/thosttraderapi.dll differ diff --git a/include/CTP/win64/thosttraderapi.lib b/include/CTP/win64/thosttraderapi.lib new file mode 100644 index 0000000..ebf5de6 Binary files /dev/null and b/include/CTP/win64/thosttraderapi.lib differ diff --git a/include/CTP_INTER/ThostFtdcMdApi.h b/include/CTP_INTER/ThostFtdcMdApi.h new file mode 100644 index 0000000..d3abce2 --- /dev/null +++ b/include/CTP_INTER/ThostFtdcMdApi.h @@ -0,0 +1,141 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcMdApi.h +///@brief ˿ͻ˽ӿ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCMDAPI_H) +#define THOST_FTDCMDAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ThostFtdcUserApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_MD_API_EXPORT +#define MD_API_EXPORT __declspec(dllexport) +#else +#define MD_API_EXPORT __declspec(dllimport) +#endif +#else +#define MD_API_EXPORT +#endif + +class CThostFtdcMdSpi +{ +public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡӦ + virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) {}; +}; + +class MD_API_EXPORT CThostFtdcMdApi +{ +public: + ///MdApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + ///modify for udp marketdata + static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp=false, const bool bIsMulticast=false); + + ///ȡAPIİ汾Ϣ + ///@retrun ȡİ汾 + static const char *GetApiVersion(); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcMdSpi *pSpi) = 0; + + ///顣 + ///@param pInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeMarketData(CThostFtdcSpecificInstrumentField *pInstrumentID, int nCount) = 0; + ///˶顣 + ///@param pInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeMarketData(CThostFtdcSpecificInstrumentField * pInstrumentID, int nCount) = 0; + + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; +protected: + ~CThostFtdcMdApi(){}; +}; + +#endif diff --git a/include/CTP_INTER/ThostFtdcTraderApi.h b/include/CTP_INTER/ThostFtdcTraderApi.h new file mode 100644 index 0000000..98e2b4e --- /dev/null +++ b/include/CTP_INTER/ThostFtdcTraderApi.h @@ -0,0 +1,336 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcTraderApi.h +///@brief ˿ͻ˽ӿ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCTRADERAPI_H) +#define THOST_FTDCTRADERAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ThostFtdcUserApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_TRADER_API_EXPORT +#define TRADER_API_EXPORT __declspec(dllexport) +#else +#define TRADER_API_EXPORT __declspec(dllimport) +#endif +#else +#define TRADER_API_EXPORT +#endif + +class CThostFtdcTraderSpi +{ +public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + ///ͻ֤Ӧ + virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ûӦ + virtual void OnRspUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ʽ˻Ӧ + virtual void OnRspTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ󱨵Ӧ + virtual void OnRspQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ͷ߽ȷӦ + virtual void OnRspInvestorSettlementInfoConfirm(CThostFtdcInvestorSettlementInfoConfirmField *pInvestorSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯɽӦ + virtual void OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳Ӧ + virtual void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʽ˻Ӧ + virtual void OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶӦ + virtual void OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯױӦ + virtual void OnRspQryTradingCode(CThostFtdcTradingCodeField *pTradingCode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼ֤Ӧ + virtual void OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchange(CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷӦ + virtual void OnRspQryProduct(CThostFtdcProductField *pProduct, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶ߽Ӧ + virtual void OnRspQryInvestorSettlementInfo(CThostFtdcInvestorSettlementInfoField *pInvestorSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionDetail(CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͻ֪ͨӦ + virtual void OnRspQryNotice(CThostFtdcNoticeField *pNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯϢȷӦ + virtual void OnRspQryInvestorSettlementInfoConfirm(CThostFtdcInvestorSettlementInfoConfirmField *pInvestorSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionCombineDetail(CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶƷ/Ʒֱ֤Ӧ + virtual void OnRspQryInvestorProductGroupMargin(CThostFtdcInvestorProductGroupMarginField *pInvestorProductGroupMargin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤Ӧ + virtual void OnRspQryExchangeMarginRate(CThostFtdcExchangeMarginRateField *pExchangeMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchangeRate(CThostFtdcExchangeRateField *pExchangeRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯұӦ + virtual void OnRspQryBaseCurrencyAccount(CThostFtdcBaseCurrencyAccountField *pBaseCurrencyAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnOrder(CThostFtdcOrderField *pOrder) {}; + + ///ɽ֪ͨ + virtual void OnRtnTrade(CThostFtdcTradeField *pTrade) {}; + + ///¼ر + virtual void OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ر + virtual void OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///Լ״̬֪ͨ + virtual void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) {}; + + ///֪ͨ + virtual void OnRtnTradingNotice(CThostFtdcTradingNoticeInfoField *pTradingNoticeInfo) {}; + + ///ʾУ + virtual void OnRtnErrorConditionalOrder(CThostFtdcErrorConditionalOrderField *pErrorConditionalOrder) {}; + + ///ѯ֪ͨӦ + virtual void OnRspQryTradingNotice(CThostFtdcTradingNoticeField *pTradingNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ͹˾ײӦ + virtual void OnRspQryBrokerTradingParams(CThostFtdcBrokerTradingParamsField *pBrokerTradingParams, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; +}; + +class TRADER_API_EXPORT CThostFtdcTraderApi +{ +public: + ///TraderApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + static CThostFtdcTraderApi *CreateFtdcTraderApi(const char *pszFlowPath = ""); + + ///ȡAPIİ汾Ϣ + ///@retrun ȡİ汾 + static const char *GetApiVersion(); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcTraderSpi *pSpi) = 0; + + ///˽ + ///@param nResumeType ˽شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼˽ + ///@remark ÷ҪInitǰá򲻻յ˽ݡ + virtual void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///Ĺ + ///@param nResumeType شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼󹫹 + ///@remark ÷ҪInitǰá򲻻յݡ + virtual void SubscribePublicTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///ͻ֤ + virtual int ReqAuthenticate(CThostFtdcReqAuthenticateField *pReqAuthenticateField, int nRequestID) = 0; + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; + + ///û + virtual int ReqUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, int nRequestID) = 0; + + ///ʽ˻ + virtual int ReqTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, int nRequestID) = 0; + + ///¼ + virtual int ReqOrderInsert(CThostFtdcInputOrderField *pInputOrder, int nRequestID) = 0; + + /// + virtual int ReqOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, int nRequestID) = 0; + + ///ѯ󱨵 + virtual int ReqQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, int nRequestID) = 0; + + ///Ͷ߽ȷ + virtual int ReqInvestorSettlementInfoConfirm(CThostFtdcInvestorSettlementInfoConfirmField *pInvestorSettlementInfoConfirm, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryOrder(CThostFtdcQryOrderField *pQryOrder, int nRequestID) = 0; + + ///ѯɽ + virtual int ReqQryTrade(CThostFtdcQryTradeField *pQryTrade, int nRequestID) = 0; + + ///ѯͶֲ߳ + virtual int ReqQryInvestorPosition(CThostFtdcQryInvestorPositionField *pQryInvestorPosition, int nRequestID) = 0; + + ///ѯʽ˻ + virtual int ReqQryTradingAccount(CThostFtdcQryTradingAccountField *pQryTradingAccount, int nRequestID) = 0; + + ///ѯͶ + virtual int ReqQryInvestor(CThostFtdcQryInvestorField *pQryInvestor, int nRequestID) = 0; + + ///ѯױ + virtual int ReqQryTradingCode(CThostFtdcQryTradingCodeField *pQryTradingCode, int nRequestID) = 0; + + ///ѯԼ֤ + virtual int ReqQryInstrumentMarginRate(CThostFtdcQryInstrumentMarginRateField *pQryInstrumentMarginRate, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrumentCommissionRate(CThostFtdcQryInstrumentCommissionRateField *pQryInstrumentCommissionRate, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchange(CThostFtdcQryExchangeField *pQryExchange, int nRequestID) = 0; + + ///ѯƷ + virtual int ReqQryProduct(CThostFtdcQryProductField *pQryProduct, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrument(CThostFtdcQryInstrumentField *pQryInstrument, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryDepthMarketData(CThostFtdcQryDepthMarketDataField *pQryDepthMarketData, int nRequestID) = 0; + + ///ѯͶ߽ + virtual int ReqQryInvestorSettlementInfo(CThostFtdcQryInvestorSettlementInfoField *pQryInvestorSettlementInfo, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionDetail(CThostFtdcQryInvestorPositionDetailField *pQryInvestorPositionDetail, int nRequestID) = 0; + + ///ѯͻ֪ͨ + virtual int ReqQryNotice(CThostFtdcQryNoticeField *pQryNotice, int nRequestID) = 0; + + ///ѯϢȷ + virtual int ReqQryInvestorSettlementInfoConfirm(CThostFtdcQryInvestorSettlementInfoConfirmField *pQryInvestorSettlementInfoConfirm, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionCombineDetail(CThostFtdcQryInvestorPositionCombineDetailField *pQryInvestorPositionCombineDetail, int nRequestID) = 0; + + ///ѯͶƷ/Ʒֱ֤ + virtual int ReqQryInvestorProductGroupMargin(CThostFtdcQryInvestorProductGroupMarginField *pQryInvestorProductGroupMargin, int nRequestID) = 0; + + ///ѯ֤ + virtual int ReqQryExchangeMarginRate(CThostFtdcQryExchangeMarginRateField *pQryExchangeMarginRate, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchangeRate(CThostFtdcQryExchangeRateField *pQryExchangeRate, int nRequestID) = 0; + + ///ѯұ + virtual int ReqQryBaseCurrencyAccount(CThostFtdcQryBaseCurrencyAccountField *pQryBaseCurrencyAccount, int nRequestID) = 0; + + ///ѯ֪ͨ + virtual int ReqQryTradingNotice(CThostFtdcQryTradingNoticeField *pQryTradingNotice, int nRequestID) = 0; + + ///ѯ͹˾ײ + virtual int ReqQryBrokerTradingParams(CThostFtdcQryBrokerTradingParamsField *pQryBrokerTradingParams, int nRequestID) = 0; +protected: + ~CThostFtdcTraderApi(){}; +}; + +#endif diff --git a/include/CTP_INTER/ThostFtdcUserApiDataType.h b/include/CTP_INTER/ThostFtdcUserApiDataType.h new file mode 100644 index 0000000..8874cae --- /dev/null +++ b/include/CTP_INTER/ThostFtdcUserApiDataType.h @@ -0,0 +1,6807 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcUserApiDataType.h +///@brief ˿ͻ˽ӿʹõҵ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#ifndef THOST_FTDCDATATYPE_H +#define THOST_FTDCDATATYPE_H + +enum THOST_TE_RESUME_TYPE +{ + THOST_TERT_RESTART = 0, + THOST_TERT_RESUME, + THOST_TERT_QUICK +}; + +typedef __int64 LONGLONG; +typedef unsigned __int64 ULONGLONG; +///////////////////////////////////////////////////////////////////////// +///TFtdcRtnFlowID_BaseTypeһ֪ͨID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRtnFlowID_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceNo_BaseTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSequenceNo_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessID_BaseTypeһҵID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBusinessID_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataLength_BaseTypeһҵݳ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDataLength_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRtnObjPoint_BaseTypeһָ֪ͨ +///////////////////////////////////////////////////////////////////////// +typedef char *TThostFtdcRtnObjPoint_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInt32Typeһ32λ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcInt32Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInt64Typeһ64λ +///////////////////////////////////////////////////////////////////////// +typedef LONGLONG TThostFtdcInt64Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDbConnStrTypeһݿַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDbConnStrType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDbConnTypeTypeһݿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDbConnTypeType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransactionIDTypeһױʾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTransactionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAppNameTypeһӦ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAppNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRunIDTypeһб +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcRunIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAppTypeTypeһӦó +///////////////////////////////////////////////////////////////////////// +///Offer +#define THOST_FTDC_APP_Offer '1' +///Tmdb +#define THOST_FTDC_APP_Tmdb '2' +///Dbmt +#define THOST_FTDC_APP_Dbmt '3' +///MdServer +#define THOST_FTDC_APP_MdServer '4' +///TInit +#define THOST_FTDC_APP_TInit '5' +///֤Ʋѯ +#define THOST_FTDC_APP_CFMMCToken '6' + +typedef char TThostFtdcAppTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSnapShotPointTypeһյ +///////////////////////////////////////////////////////////////////////// +typedef LONGLONG TThostFtdcSnapShotPointType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVarDataTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcVarDataType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTableNameTypeһFBT +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTableNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcObjStreamTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcObjStreamType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLogSNTypeһ־к +///////////////////////////////////////////////////////////////////////// +typedef LONGLONG TThostFtdcLogSNType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRowSequenceTypeһ¼к +///////////////////////////////////////////////////////////////////////// +typedef LONGLONG TThostFtdcRowSequenceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBigSequenceNoTypeһLongк +///////////////////////////////////////////////////////////////////////// +typedef LONGLONG TThostFtdcBigSequenceNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBOperationTypeһ¼ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_DBOP_Unknown '0' +/// +#define THOST_FTDC_DBOP_Insert '1' +/// +#define THOST_FTDC_DBOP_Update '2' +///ɾ +#define THOST_FTDC_DBOP_Delete '3' +///ύ +#define THOST_FTDC_DBOP_Commit '4' + +typedef char TThostFtdcDBOperationType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorID_BaseTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcErrorID_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorMsg_BaseTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcErrorMsg_BaseType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceSeries_BaseTypeһϵк +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcSequenceSeries_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerID_BaseTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerID_BaseType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserID_BaseTypeһû +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserID_BaseType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParticipantID_BaseTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParticipantID_BaseType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPassword_BaseTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPassword_BaseType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataCenterID_BaseTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDataCenterID_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSmdbSqlText_BaseTypeһsqlı +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSmdbSqlText_BaseType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStatementID_BaseTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcStatementID_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRecordSetID_BaseTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRecordSetID_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataType_BaseTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDataType_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcColumnName_BaseTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcColumnName_BaseType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamData_BaseTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParamData_BaseType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoreRows_BaseTypeһǷк +///////////////////////////////////////////////////////////////////////// +///к +#define THOST_FTDC_MoreRows_Yes '1' +///ûк +#define THOST_FTDC_MoreRows_No '2' + +typedef char TThostFtdcMoreRows_BaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerAbbrTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerNameTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeInstIDTypeһԼڽĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderRefTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderRefType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTraderIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDTypeһͶߴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestUnitIDTypeһͶʵԪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestUnitIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerIDTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerAbbrTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerNameTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeInstIDTypeһԼڽĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderRefTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderRefType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParticipantIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParticipantIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserIDTypeһû +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserIDType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPasswordType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDTypeһױ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductIDTypeһƷִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarketIDTypeһг +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMarketIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductNameTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubExchangeIDTypeһг +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSubExchangeIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcExchangeCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeAbbrTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMacAddressTypeһMacַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMacAddressType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSystemIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangePropertyTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EXP_Normal '0' +///ݳɽɱ +#define THOST_FTDC_EXP_GenOrderByTrade '1' + +typedef char TThostFtdcExchangePropertyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLongTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLongTimeType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentNameTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementGroupIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettlementGroupIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSysIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeIDTypeһɽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandTypeTypeһDB +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommandTypeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPAddressTypeһIPַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIPAddressType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPPortTypeһIP˿ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcIPPortType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductInfoTypeһƷϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProtocolInfoTypeһЭϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProtocolInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessUnitTypeһҵԪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessUnitType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepositSeqNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef LONGLONG TThostFtdcDepositSeqNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdentifiedCardNoTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIdentifiedCardNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdCardTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֯ +#define THOST_FTDC_ICT_EID '0' +///й֤ +#define THOST_FTDC_ICT_IDCard '1' +///֤ +#define THOST_FTDC_ICT_OfficerIDCard '2' +///֤ +#define THOST_FTDC_ICT_PoliceIDCard '3' +///ʿ֤ +#define THOST_FTDC_ICT_SoldierIDCard '4' +///ڲ +#define THOST_FTDC_ICT_HouseholdRegister '5' +/// +#define THOST_FTDC_ICT_Passport '6' +///̨֤ +#define THOST_FTDC_ICT_TaiwanCompatriotIDCard '7' +///֤ +#define THOST_FTDC_ICT_HomeComingCard '8' +///Ӫҵִպ +#define THOST_FTDC_ICT_LicenseNo '9' +///˰ǼǺ/˰ID +#define THOST_FTDC_ICT_TaxNo 'A' +///۰ľڵ֤ͨ +#define THOST_FTDC_ICT_HMMainlandTravelPermit 'B' +///̨½֤ͨ +#define THOST_FTDC_ICT_TwMainlandTravelPermit 'C' +/// +#define THOST_FTDC_ICT_DrivingLicense 'D' +///籣ID +#define THOST_FTDC_ICT_SocialID 'F' +///֤ +#define THOST_FTDC_ICT_LocalID 'G' +///ҵǼ֤ +#define THOST_FTDC_ICT_BusinessRegistration 'H' +///۰Ծ֤ +#define THOST_FTDC_ICT_HKMCIDCard 'I' +///֤ +#define THOST_FTDC_ICT_OtherCard 'x' + +typedef char TThostFtdcIdCardTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderLocalIDTypeһر +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderLocalIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserNameTypeһû +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPartyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPartyNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcErrorIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorMsgTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcErrorMsgType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldNameTypeһֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFieldNameType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldContentTypeһֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFieldContentType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemNameTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSystemNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContentTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcContentType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IR_All '1' +///Ͷ +#define THOST_FTDC_IR_Group '2' +///һͶ +#define THOST_FTDC_IR_Single '3' + +typedef char TThostFtdcInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepartmentRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_DR_All '1' +///ܹ֯ +#define THOST_FTDC_DR_Group '2' +///һͶ +#define THOST_FTDC_DR_Single '3' + +typedef char TThostFtdcDepartmentRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataSyncStatusTypeһͬ״̬ +///////////////////////////////////////////////////////////////////////// +///δͬ +#define THOST_FTDC_DS_Asynchronous '1' +///ͬ +#define THOST_FTDC_DS_Synchronizing '2' +///ͬ +#define THOST_FTDC_DS_Synchronized '3' + +typedef char TThostFtdcDataSyncStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerDataSyncStatusTypeһ͹˾ͬ״̬ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_BDS_Synchronized '1' +///ͬ +#define THOST_FTDC_BDS_Synchronizing '2' + +typedef char TThostFtdcBrokerDataSyncStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeConnectStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_ECS_NoConnection '1' +///ѾԼѯ +#define THOST_FTDC_ECS_QryInstrumentSent '2' +///ѾȡϢ +#define THOST_FTDC_ECS_GotInformation '9' + +typedef char TThostFtdcExchangeConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderConnectStatusTypeһԱ״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_TCS_NotConnected '1' +///Ѿ +#define THOST_FTDC_TCS_Connected '2' +///ѾԼѯ +#define THOST_FTDC_TCS_QryInstrumentSent '3' +///˽ +#define THOST_FTDC_TCS_SubPrivateFlow '4' + +typedef char TThostFtdcTraderConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionCodeTypeһܴ +///////////////////////////////////////////////////////////////////////// +///첽 +#define THOST_FTDC_FC_DataAsync '1' +///ǿûdz +#define THOST_FTDC_FC_ForceUserLogout '2' +///û +#define THOST_FTDC_FC_UserPasswordUpdate '3' +///͹˾ +#define THOST_FTDC_FC_BrokerPasswordUpdate '4' +///Ͷ߿ +#define THOST_FTDC_FC_InvestorPasswordUpdate '5' +/// +#define THOST_FTDC_FC_OrderInsert '6' +/// +#define THOST_FTDC_FC_OrderAction '7' +///ͬϵͳ +#define THOST_FTDC_FC_SyncSystemData '8' +///ͬ͹˾ +#define THOST_FTDC_FC_SyncBrokerData '9' +///ͬ͹˾ +#define THOST_FTDC_FC_BachSyncBrokerData 'A' +///ѯ +#define THOST_FTDC_FC_SuperQuery 'B' +///Ԥ񱨵 +#define THOST_FTDC_FC_PrePayOrderInsert 'C' +///Ԥ񱨵 +#define THOST_FTDC_FC_PrePayOrderAction 'D' +///̬ͬ +#define THOST_FTDC_FC_SyncOTP 'E' +///ɾδ֪ +#define THOST_FTDC_FC_DeleteOrder 'F' + +typedef char TThostFtdcFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerFunctionCodeTypeһ͹˾ܴ +///////////////////////////////////////////////////////////////////////// +///ǿûdz +#define THOST_FTDC_BFC_ForceUserLogout '1' +///û +#define THOST_FTDC_BFC_UserPasswordUpdate '2' +///ͬ͹˾ +#define THOST_FTDC_BFC_SyncBrokerData '3' +///ͬ͹˾ +#define THOST_FTDC_BFC_BachSyncBrokerData '4' +/// +#define THOST_FTDC_BFC_OrderInsert '5' +/// +#define THOST_FTDC_BFC_OrderAction '6' +///ȫѯ +#define THOST_FTDC_BFC_AllQuery '7' +///ϵͳܣ/dz/޸ +#define THOST_FTDC_BFC_log 'a' +///ѯѯݣԼȳ +#define THOST_FTDC_BFC_BaseQry 'b' +///ײѯɽί +#define THOST_FTDC_BFC_TradeQry 'c' +///׹ܣ +#define THOST_FTDC_BFC_Trade 'd' +///ת +#define THOST_FTDC_BFC_Virement 'e' +///ռ +#define THOST_FTDC_BFC_Risk 'f' +///ѯ/ѯỰ˵ +#define THOST_FTDC_BFC_Session 'g' +///֪ͨ +#define THOST_FTDC_BFC_RiskNoticeCtl 'h' +///֪ͨ +#define THOST_FTDC_BFC_RiskNotice 'i' +///쿴͹˾ʽȨ +#define THOST_FTDC_BFC_BrokerDeposit 'j' +///ʽѯ +#define THOST_FTDC_BFC_QueryFund 'k' +///ѯ +#define THOST_FTDC_BFC_QueryOrder 'l' +///ɽѯ +#define THOST_FTDC_BFC_QueryTrade 'm' +///ֲֲѯ +#define THOST_FTDC_BFC_QueryPosition 'n' +///ѯ +#define THOST_FTDC_BFC_QueryMarketData 'o' +///û¼ѯ +#define THOST_FTDC_BFC_QueryUserEvent 'p' +///֪ͨѯ +#define THOST_FTDC_BFC_QueryRiskNotify 'q' +///ѯ +#define THOST_FTDC_BFC_QueryFundChange 'r' +///ͶϢѯ +#define THOST_FTDC_BFC_QueryInvestor 's' +///ױѯ +#define THOST_FTDC_BFC_QueryTradingCode 't' +///ǿƽ +#define THOST_FTDC_BFC_ForceClose 'u' +///ѹ +#define THOST_FTDC_BFC_PressTest 'v' +///Ȩ淴 +#define THOST_FTDC_BFC_RemainCalc 'w' +///ֱֲָ֤ +#define THOST_FTDC_BFC_NetPositionInd 'x' +///Ԥ +#define THOST_FTDC_BFC_RiskPredict 'y' +///ݵ +#define THOST_FTDC_BFC_DataExport 'z' +///ָ +#define THOST_FTDC_BFC_RiskTargetSetup 'A' +///Ԥ +#define THOST_FTDC_BFC_MarketDataWarn 'B' +///ҵ֪ͨѯ +#define THOST_FTDC_BFC_QryBizNotice 'C' +///ҵ֪ͨģ +#define THOST_FTDC_BFC_CfgBizNotice 'D' +///̬ͬ +#define THOST_FTDC_BFC_SyncOTP 'E' +///ҵ֪ͨ +#define THOST_FTDC_BFC_SendBizNotice 'F' +///ռ׼ +#define THOST_FTDC_BFC_CfgRiskLevelStd 'G' +///նӦ +#define THOST_FTDC_BFC_TbCommand 'H' +///ɾδ֪ +#define THOST_FTDC_BFC_DeleteOrder 'J' +///Ԥ񱨵 +#define THOST_FTDC_BFC_PrePayOrderInsert 'K' +///Ԥ񱨵 +#define THOST_FTDC_BFC_PrePayOrderAction 'L' + +typedef char TThostFtdcBrokerFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_OAS_Submitted 'a' +///Ѿ +#define THOST_FTDC_OAS_Accepted 'b' +///Ѿܾ +#define THOST_FTDC_OAS_Rejected 'c' + +typedef char TThostFtdcOrderActionStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ȫɽ +#define THOST_FTDC_OST_AllTraded '0' +///ֳɽڶ +#define THOST_FTDC_OST_PartTradedQueueing '1' +///ֳɽڶ +#define THOST_FTDC_OST_PartTradedNotQueueing '2' +///δɽڶ +#define THOST_FTDC_OST_NoTradeQueueing '3' +///δɽڶ +#define THOST_FTDC_OST_NoTradeNotQueueing '4' +/// +#define THOST_FTDC_OST_Canceled '5' +///δ֪ +#define THOST_FTDC_OST_Unknown 'a' +///δ +#define THOST_FTDC_OST_NotTouched 'b' +///Ѵ +#define THOST_FTDC_OST_Touched 'c' + +typedef char TThostFtdcOrderStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSubmitStatusTypeһύ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_OSS_InsertSubmitted '0' +///Ѿύ +#define THOST_FTDC_OSS_CancelSubmitted '1' +///޸Ѿύ +#define THOST_FTDC_OSS_ModifySubmitted '2' +///Ѿ +#define THOST_FTDC_OSS_Accepted '3' +///Ѿܾ +#define THOST_FTDC_OSS_InsertRejected '4' +///Ѿܾ +#define THOST_FTDC_OSS_CancelRejected '5' +///ĵѾܾ +#define THOST_FTDC_OSS_ModifyRejected '6' + +typedef char TThostFtdcOrderSubmitStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ճֲ +#define THOST_FTDC_PSD_Today '1' +///ʷֲ +#define THOST_FTDC_PSD_History '2' + +typedef char TThostFtdcPositionDateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateModeTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ʹʷֲ +#define THOST_FTDC_PDM_UseHistory '1' +///ʹʷֲ +#define THOST_FTDC_PDM_NoUseHistory '2' + +typedef char TThostFtdcPositionDateModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRoleTypeһ׽ɫ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ER_Broker '1' +///Ӫ +#define THOST_FTDC_ER_Host '2' +/// +#define THOST_FTDC_ER_Maker '3' + +typedef char TThostFtdcTradingRoleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductClassTypeһƷ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_PC_Futures '1' +///ڻȨ +#define THOST_FTDC_PC_Options '2' +/// +#define THOST_FTDC_PC_Combination '3' +/// +#define THOST_FTDC_PC_Spot '4' +///ת +#define THOST_FTDC_PC_EFP '5' +///ֻȨ +#define THOST_FTDC_PC_SpotOption '6' + +typedef char TThostFtdcProductClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReportProductClassTypeһƷ +///////////////////////////////////////////////////////////////////////// +///Ʒڻ +#define THOST_FTDC_RPC_Futures '1' +///ڻȨ +#define THOST_FTDC_RPC_Options '2' +///ֻȨ +#define THOST_FTDC_RPC_SpotOption '6' +///ڻ +#define THOST_FTDC_RPC_FinancialFutures '7' + +typedef char TThostFtdcReportProductClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstLifePhaseTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_IP_NotStart '0' +/// +#define THOST_FTDC_IP_Started '1' +///ͣ +#define THOST_FTDC_IP_Pause '2' +/// +#define THOST_FTDC_IP_Expired '3' + +typedef char TThostFtdcInstLifePhaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_D_Buy '0' +/// +#define THOST_FTDC_D_Sell '1' + +typedef char TThostFtdcDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombDirectionTypeһָ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CMDR_Comb '0' +/// +#define THOST_FTDC_CMDR_UnComb '1' + +typedef char TThostFtdcCombDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionModeTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ֲ +#define THOST_FTDC_PM_Net '1' +///ۺϳֲ +#define THOST_FTDC_PM_Gross '2' + +typedef char TThostFtdcPositionModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPosiDirectionTypeһֲֶշ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PD_Net '1' +///ͷ +#define THOST_FTDC_PD_Long '2' +///ͷ +#define THOST_FTDC_PD_Short '3' + +typedef char TThostFtdcPosiDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysSettlementStatusTypeһϵͳ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_SS_NonActive '1' +/// +#define THOST_FTDC_SS_Startup '2' +/// +#define THOST_FTDC_SS_Operating '3' +/// +#define THOST_FTDC_SS_Settlement '4' +/// +#define THOST_FTDC_SS_SettlementFinished '5' + +typedef char TThostFtdcSysSettlementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRatioAttrTypeһ +///////////////////////////////////////////////////////////////////////// +///׷ +#define THOST_FTDC_RA_Trade '0' +/// +#define THOST_FTDC_RA_Settlement '1' + +typedef char TThostFtdcRatioAttrType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_HF_Speculation '1' +/// +#define THOST_FTDC_HF_Arbitrage '2' +///ױ +#define THOST_FTDC_HF_Hedge '3' +/// +#define THOST_FTDC_HF_Maker '5' + +typedef char TThostFtdcHedgeFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDModeTypeһױ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_CIDM_Speculation '1' +/// +#define THOST_FTDC_CIDM_Arbitrage '2' +///ױ +#define THOST_FTDC_CIDM_Hedge '3' +/// +#define THOST_FTDC_CIDM_Maker '4' + +typedef char TThostFtdcClientIDModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderPriceTypeTypeһ۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OPT_AnyPrice '1' +///޼ +#define THOST_FTDC_OPT_LimitPrice '2' +///ż +#define THOST_FTDC_OPT_BestPrice '3' +///¼ +#define THOST_FTDC_OPT_LastPrice '4' +///¼۸ϸ1ticks +#define THOST_FTDC_OPT_LastPricePlusOneTicks '5' +///¼۸ϸ2ticks +#define THOST_FTDC_OPT_LastPricePlusTwoTicks '6' +///¼۸ϸ3ticks +#define THOST_FTDC_OPT_LastPricePlusThreeTicks '7' +///һ +#define THOST_FTDC_OPT_AskPrice1 '8' +///һ۸ϸ1ticks +#define THOST_FTDC_OPT_AskPrice1PlusOneTicks '9' +///һ۸ϸ2ticks +#define THOST_FTDC_OPT_AskPrice1PlusTwoTicks 'A' +///һ۸ϸ3ticks +#define THOST_FTDC_OPT_AskPrice1PlusThreeTicks 'B' +///һ +#define THOST_FTDC_OPT_BidPrice1 'C' +///һ۸ϸ1ticks +#define THOST_FTDC_OPT_BidPrice1PlusOneTicks 'D' +///һ۸ϸ2ticks +#define THOST_FTDC_OPT_BidPrice1PlusTwoTicks 'E' +///һ۸ϸ3ticks +#define THOST_FTDC_OPT_BidPrice1PlusThreeTicks 'F' +///嵵 +#define THOST_FTDC_OPT_FiveLevelPrice 'G' + +typedef char TThostFtdcOrderPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetFlagTypeһƽ־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OF_Open '0' +///ƽ +#define THOST_FTDC_OF_Close '1' +///ǿƽ +#define THOST_FTDC_OF_ForceClose '2' +///ƽ +#define THOST_FTDC_OF_CloseToday '3' +///ƽ +#define THOST_FTDC_OF_CloseYesterday '4' +///ǿ +#define THOST_FTDC_OF_ForceOff '5' +///ǿƽ +#define THOST_FTDC_OF_LocalForceClose '6' +///Ч +#define THOST_FTDC_OF_Invalid '7' + +typedef char TThostFtdcOffsetFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseReasonTypeһǿƽԭ +///////////////////////////////////////////////////////////////////////// +///ǿƽ +#define THOST_FTDC_FCC_NotForceClose '0' +///ʽ +#define THOST_FTDC_FCC_LackDeposit '1' +///ͻ +#define THOST_FTDC_FCC_ClientOverPositionLimit '2' +///Ա +#define THOST_FTDC_FCC_MemberOverPositionLimit '3' +///ֲַ +#define THOST_FTDC_FCC_NotMultiple '4' +///Υ +#define THOST_FTDC_FCC_Violation '5' +/// +#define THOST_FTDC_FCC_Other '6' +///Ȼٽ +#define THOST_FTDC_FCC_PersonDeliv '7' + +typedef char TThostFtdcForceCloseReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ORDT_Normal '0' +/// +#define THOST_FTDC_ORDT_DeriveFromQuote '1' +/// +#define THOST_FTDC_ORDT_DeriveFromCombination '2' +///ϱ +#define THOST_FTDC_ORDT_Combination '3' +/// +#define THOST_FTDC_ORDT_ConditionalOrder '4' +/// +#define THOST_FTDC_ORDT_Swap '5' + +typedef char TThostFtdcOrderTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeConditionTypeһЧ +///////////////////////////////////////////////////////////////////////// +///ɣ +#define THOST_FTDC_TC_IOC '1' +///Ч +#define THOST_FTDC_TC_GFS '2' +///Ч +#define THOST_FTDC_TC_GFD '3' +///ָǰЧ +#define THOST_FTDC_TC_GTD '4' +///ǰЧ +#define THOST_FTDC_TC_GTC '5' +///ϾЧ +#define THOST_FTDC_TC_GFA '6' + +typedef char TThostFtdcTimeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeConditionTypeһɽ +///////////////////////////////////////////////////////////////////////// +///κ +#define THOST_FTDC_VC_AV '1' +///С +#define THOST_FTDC_VC_MV '2' +///ȫ +#define THOST_FTDC_VC_CV '3' + +typedef char TThostFtdcVolumeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContingentConditionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CC_Immediately '1' +///ֹ +#define THOST_FTDC_CC_Touch '2' +///ֹӮ +#define THOST_FTDC_CC_TouchProfit '3' +///Ԥ +#define THOST_FTDC_CC_PrePayOrder '4' +///¼۴ +#define THOST_FTDC_CC_LastPriceGreaterThanStopPrice '5' +///¼۴ڵ +#define THOST_FTDC_CC_LastPriceGreaterEqualStopPrice '6' +///¼С +#define THOST_FTDC_CC_LastPriceLesserThanStopPrice '7' +///¼Сڵ +#define THOST_FTDC_CC_LastPriceLesserEqualStopPrice '8' +///һ۴ +#define THOST_FTDC_CC_AskPriceGreaterThanStopPrice '9' +///һ۴ڵ +#define THOST_FTDC_CC_AskPriceGreaterEqualStopPrice 'A' +///һС +#define THOST_FTDC_CC_AskPriceLesserThanStopPrice 'B' +///һСڵ +#define THOST_FTDC_CC_AskPriceLesserEqualStopPrice 'C' +///һ۴ +#define THOST_FTDC_CC_BidPriceGreaterThanStopPrice 'D' +///һ۴ڵ +#define THOST_FTDC_CC_BidPriceGreaterEqualStopPrice 'E' +///һС +#define THOST_FTDC_CC_BidPriceLesserThanStopPrice 'F' +///һСڵ +#define THOST_FTDC_CC_BidPriceLesserEqualStopPrice 'H' + +typedef char TThostFtdcContingentConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActionFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +///ɾ +#define THOST_FTDC_AF_Delete '0' +///޸ +#define THOST_FTDC_AF_Modify '3' + +typedef char TThostFtdcActionFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRightTypeһȨ +///////////////////////////////////////////////////////////////////////// +///Խ +#define THOST_FTDC_TR_Allow '0' +///ֻƽ +#define THOST_FTDC_TR_CloseOnly '1' +///ܽ +#define THOST_FTDC_TR_Forbidden '2' + +typedef char TThostFtdcTradingRightType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSourceTypeһԴ +///////////////////////////////////////////////////////////////////////// +///Բ +#define THOST_FTDC_OSRC_Participant '0' +///ԹԱ +#define THOST_FTDC_OSRC_Administrator '1' + +typedef char TThostFtdcOrderSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTypeTypeһɽ +///////////////////////////////////////////////////////////////////////// +///ϳֲֲΪһֲ,ʼӦ͵ijֲ +#define THOST_FTDC_TRDT_SplitCombination '#' +///ͨɽ +#define THOST_FTDC_TRDT_Common '0' +///Ȩִ +#define THOST_FTDC_TRDT_OptionsExecution '1' +///OTCɽ +#define THOST_FTDC_TRDT_OTC '2' +///תɽ +#define THOST_FTDC_TRDT_EFPDerived '3' +///ɽ +#define THOST_FTDC_TRDT_CombinationDerived '4' + +typedef char TThostFtdcTradeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceSourceTypeһɽԴ +///////////////////////////////////////////////////////////////////////// +///ǰɽ +#define THOST_FTDC_PSRC_LastPrice '0' +///ίм +#define THOST_FTDC_PSRC_Buy '1' +///ίм +#define THOST_FTDC_PSRC_Sell '2' + +typedef char TThostFtdcPriceSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentStatusTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +///ǰ +#define THOST_FTDC_IS_BeforeTrading '0' +///ǽ +#define THOST_FTDC_IS_NoTrading '1' +/// +#define THOST_FTDC_IS_Continous '2' +///Ͼ۱ +#define THOST_FTDC_IS_AuctionOrdering '3' +///Ͼۼ۸ƽ +#define THOST_FTDC_IS_AuctionBalance '4' +///Ͼ۴ +#define THOST_FTDC_IS_AuctionMatch '5' +/// +#define THOST_FTDC_IS_Closed '6' + +typedef char TThostFtdcInstrumentStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstStatusEnterReasonTypeһƷֽ뽻״̬ԭ +///////////////////////////////////////////////////////////////////////// +///Զл +#define THOST_FTDC_IER_Automatic '1' +///ֶл +#define THOST_FTDC_IER_Manual '2' +///۶ +#define THOST_FTDC_IER_Fuse '3' + +typedef char TThostFtdcInstStatusEnterReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionRefTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcOrderActionRefType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstallCountTypeһװ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcInstallCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstallIDTypeһװ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcInstallIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSettlementIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFrontIDTypeһǰñ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFrontIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSessionIDTypeһỰ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSessionIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubjectIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcSubjectIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSequenceNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandNoTypeһDB +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCommandNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMillisecTypeһʱ䣨룩 +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMillisecType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeDifferTypeһʱ룩 +///////////////////////////////////////////////////////////////////////// +typedef LONGLONG TThostFtdcTimeDifferType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeMultipleTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcVolumeMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingSegmentSNTypeһ׽׶α +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradingSegmentSNType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRequestIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRequestIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYearTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcYearType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMonthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBoolTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBoolType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcPriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceTickTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcPriceTickType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombOffsetFlagTypeһϿƽ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombOffsetFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombHedgeFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRatioTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcRatioType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLargeVolumeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcLargeVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceSeriesTypeһϵк +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcSequenceSeriesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommPhaseNoTypeһͨѶʱα +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcCommPhaseNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceLabelTypeһб +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSequenceLabelType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUnderlyingMultipleTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcUnderlyingMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriorityTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcPriorityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContractCodeTypeһͬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcContractCodeType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCityTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCityType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsStockTypeһǷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIsStockType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcChannelTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcChannelType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAddressTypeһͨѶַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAddressType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcZipCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcZipCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTelephoneTypeһϵ绰 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTelephoneType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFaxTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFaxType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMobileTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMobileType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEMailTypeһʼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEMailType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMemoTypeһע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMemoType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCompanyCodeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCompanyCodeType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWebsiteTypeһվַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWebsiteType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTaxNoTypeһ˰ǼǺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTaxNoType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBatchStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δϴ +#define THOST_FTDC_BS_NoUpload '1' +///ϴ +#define THOST_FTDC_BS_Uploaded '2' +///ʧ +#define THOST_FTDC_BS_Failed '3' + +typedef char TThostFtdcBatchStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyIDTypeһԴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLicenseNoTypeһӪҵִպ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLicenseNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentIDTypeһ˴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentGroupIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentGroupIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentGroupNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentGroupNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnStyleTypeһƷַʽ +///////////////////////////////////////////////////////////////////////// +///Ʒ +#define THOST_FTDC_RS_All '1' +///Ʒ +#define THOST_FTDC_RS_ByProduct '2' + +typedef char TThostFtdcReturnStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnPatternTypeһģʽ +///////////////////////////////////////////////////////////////////////// +///ɽ +#define THOST_FTDC_RP_ByVolume '1' +/// +#define THOST_FTDC_RP_ByFeeOnHand '2' + +typedef char TThostFtdcReturnPatternType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnLevelTypeһ +///////////////////////////////////////////////////////////////////////// +///1 +#define THOST_FTDC_RL_Level1 '1' +///2 +#define THOST_FTDC_RL_Level2 '2' +///3 +#define THOST_FTDC_RL_Level3 '3' +///4 +#define THOST_FTDC_RL_Level4 '4' +///5 +#define THOST_FTDC_RL_Level5 '5' +///6 +#define THOST_FTDC_RL_Level6 '6' +///7 +#define THOST_FTDC_RL_Level7 '7' +///8 +#define THOST_FTDC_RL_Level8 '8' +///9 +#define THOST_FTDC_RL_Level9 '9' + +typedef char TThostFtdcReturnLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnStandardTypeһ׼ +///////////////////////////////////////////////////////////////////////// +///ֽ׶η +#define THOST_FTDC_RSD_ByPeriod '1' +///ijһ׼ +#define THOST_FTDC_RSD_ByStandard '2' + +typedef char TThostFtdcReturnStandardType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMortgageTypeTypeһѺ +///////////////////////////////////////////////////////////////////////// +///ʳ +#define THOST_FTDC_MT_Out '0' +/// +#define THOST_FTDC_MT_In '1' + +typedef char TThostFtdcMortgageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorSettlementParamIDTypeһͶ߽ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_ISPI_MortgageRatio '4' +///֤㷨 +#define THOST_FTDC_ISPI_MarginWay '5' +///㵥ǷѺ +#define THOST_FTDC_ISPI_BillDeposit '9' + +typedef char TThostFtdcInvestorSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeSettlementParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_ESPI_MortgageRatio '1' +///ʽ +#define THOST_FTDC_ESPI_OtherFundItem '2' +///ʽ뽻 +#define THOST_FTDC_ESPI_OtherFundImport '3' +///нͿý +#define THOST_FTDC_ESPI_CFFEXMinPrepa '6' +///֣㷽ʽ +#define THOST_FTDC_ESPI_CZCESettlementType '7' +///ȡʽ +#define THOST_FTDC_ESPI_ExchDelivFeeMode '9' +///Ͷ߽ȡʽ +#define THOST_FTDC_ESPI_DelivFeeMode '0' +///֣ϳֱֲ֤ȡʽ +#define THOST_FTDC_ESPI_CZCEComMarginType 'A' +///֤ǷŻ +#define THOST_FTDC_ESPI_DceComMarginType 'B' +///ֵȨ֤Żݱ +#define THOST_FTDC_ESPI_OptOutDisCountRate 'a' +///ͱϵ +#define THOST_FTDC_ESPI_OptMiniGuarantee 'b' +///֣Ȩȡʽ +#define THOST_FTDC_ESPI_CZCEOptExerFeeType 'c' + +typedef char TThostFtdcExchangeSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemParamIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +///ͶߴС +#define THOST_FTDC_SPI_InvestorIDMinLength '1' +///ͶʺŴС +#define THOST_FTDC_SPI_AccountIDMinLength '2' +///Ͷ߿Ĭϵ¼Ȩ +#define THOST_FTDC_SPI_UserRightLogon '3' +///Ͷ߽׽㵥ɽܷʽ +#define THOST_FTDC_SPI_SettlementBillTrade '4' +///ͳһ½ױ뷽ʽ +#define THOST_FTDC_SPI_TradingCode '5' +///Ƿжϴδ˵ijͷʽ +#define THOST_FTDC_SPI_CheckFund '6' +///ǷģȨ +#define THOST_FTDC_SPI_CommModelRight '7' +///Ƿñ֤ģȨ +#define THOST_FTDC_SPI_MarginModelRight '9' +///Ƿ淶ûܼ +#define THOST_FTDC_SPI_IsStandardActive '8' +///ϴĽļ· +#define THOST_FTDC_SPI_UploadSettlementFile 'U' +///ϱ֤ļ· +#define THOST_FTDC_SPI_DownloadCSRCFile 'D' +///ɵĽ㵥ļ· +#define THOST_FTDC_SPI_SettlementBillFile 'S' +///֤ļʶ +#define THOST_FTDC_SPI_CSRCOthersFile 'C' +///ͶƬ· +#define THOST_FTDC_SPI_InvestorPhoto 'P' +///ȫᾭ͹˾ϴļ· +#define THOST_FTDC_SPI_CSRCData 'R' +///¼뷽ʽ +#define THOST_FTDC_SPI_InvestorPwdModel 'I' +///Ͷнļ· +#define THOST_FTDC_SPI_CFFEXInvestorSettleFile 'F' +///Ͷߴ뷽ʽ +#define THOST_FTDC_SPI_InvestorIDType 'a' +///߻Ȩ +#define THOST_FTDC_SPI_FreezeMaxReMain 'r' +///زʵʱϳ +#define THOST_FTDC_SPI_IsSync 'A' +///Ȩ +#define THOST_FTDC_SPI_RelieveOpenLimit 'O' +///Ƿ淶û +#define THOST_FTDC_SPI_IsStandardFreeze 'X' +///֣Ƿ񿪷Ʒױ +#define THOST_FTDC_SPI_CZCENormalProductHedge 'B' + +typedef char TThostFtdcSystemParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeParamIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +///ϵͳ㷨 +#define THOST_FTDC_TPID_EncryptionStandard 'E' +///ϵͳ㷨 +#define THOST_FTDC_TPID_RiskMode 'R' +///ϵͳ㷨Ƿȫ 0- 1- +#define THOST_FTDC_TPID_RiskModeGlobal 'G' +///㷨 +#define THOST_FTDC_TPID_modeEncode 'P' +///۸Сλ +#define THOST_FTDC_TPID_tickMode 'T' +///ûỰ +#define THOST_FTDC_TPID_SingleUserSessionMaxNum 'S' +///¼ʧ +#define THOST_FTDC_TPID_LoginFailMaxNum 'L' +///Ƿǿ֤ +#define THOST_FTDC_TPID_IsAuthForce 'A' + +typedef char TThostFtdcTradeParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementParamValueTypeһֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettlementParamValueType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCounterIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCounterIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorGroupNameTypeһͶ߷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorGroupNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrandCodeTypeһƺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrandCodeType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWarehouseTypeһֿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWarehouseType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductDateType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGradeTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcGradeType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClassifyTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClassifyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPositionType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYieldlyTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcYieldlyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWeightTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWeightType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubEntryFundNoTypeһʽˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSubEntryFundNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileIDTypeһļʶ +///////////////////////////////////////////////////////////////////////// +///ʽ +#define THOST_FTDC_FI_SettlementFund 'F' +///ɽ +#define THOST_FTDC_FI_Trade 'T' +///Ͷֲ߳ +#define THOST_FTDC_FI_InvestorPosition 'P' +///Ͷ߷ʽ +#define THOST_FTDC_FI_SubEntryFund 'O' +///ϳֲ +#define THOST_FTDC_FI_CZCECombinationPos 'C' +///ϱ֤ +#define THOST_FTDC_FI_CSRCData 'R' +///֣ƽ˽ +#define THOST_FTDC_FI_CZCEClose 'L' +///֣ƽ˽ +#define THOST_FTDC_FI_CZCENoClose 'N' +///ֲϸ +#define THOST_FTDC_FI_PositionDtl 'D' +///Ȩִļ +#define THOST_FTDC_FI_OptionStrike 'S' +///۱ȶļ +#define THOST_FTDC_FI_SettlementPriceComparison 'M' +///dzֱֲ䶯ϸ +#define THOST_FTDC_FI_NonTradePosChange 'B' + +typedef char TThostFtdcFileIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFileNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileTypeTypeһļϴ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FUT_Settlement '0' +///˶ +#define THOST_FTDC_FUT_Check '1' + +typedef char TThostFtdcFileTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileFormatTypeһļʽ +///////////////////////////////////////////////////////////////////////// +///ıļ(.txt) +#define THOST_FTDC_FFT_Txt '0' +///ѹļ(.zip) +#define THOST_FTDC_FFT_Zip '1' +///DBFļ(.dbf) +#define THOST_FTDC_FFT_DBF '2' + +typedef char TThostFtdcFileFormatType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileUploadStatusTypeһļ״̬ +///////////////////////////////////////////////////////////////////////// +///ϴɹ +#define THOST_FTDC_FUS_SucceedUpload '1' +///ϴʧ +#define THOST_FTDC_FUS_FailedUpload '2' +///ɹ +#define THOST_FTDC_FUS_SucceedLoad '3' +///벿ֳɹ +#define THOST_FTDC_FUS_PartSucceedLoad '4' +///ʧ +#define THOST_FTDC_FUS_FailedLoad '5' + +typedef char TThostFtdcFileUploadStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferDirectionTypeһƲַ +///////////////////////////////////////////////////////////////////////// +///Ƴ +#define THOST_FTDC_TD_Out '0' +/// +#define THOST_FTDC_TD_In '1' + +typedef char TThostFtdcTransferDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUploadModeTypeһϴļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUploadModeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountIDTypeһʽ˺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAccountIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountOwnerModeTypeһʽ˺ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_AOM_Investor '1' +/// +#define THOST_FTDC_AOM_SecAgent '2' +///׻Ա +#define THOST_FTDC_AOM_TradeMember '3' + +typedef char TThostFtdcAccountOwnerModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankFlagTypeһͳһʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankFlagType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenNameTypeһ˻Ŀ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOpenNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenBankTypeһ˻Ŀ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOpenBankType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPublishPathTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPublishPathType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperatorIDType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthCountTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMonthCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAdvanceMonthArrayTypeһ·ǰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAdvanceMonthArrayType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDateExprTypeһڱʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDateExprType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDExprTypeһԼʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDExprType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentNameExprTypeһԼƱʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentNameExprType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSpecialCreateRuleTypeһĴ +///////////////////////////////////////////////////////////////////////// +///ûⴴ +#define THOST_FTDC_SC_NoSpecialRule '0' +/// +#define THOST_FTDC_SC_NoSpringFestival '1' + +typedef char TThostFtdcSpecialCreateRuleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBasisPriceTypeTypeһƻ׼ +///////////////////////////////////////////////////////////////////////// +///һԼ +#define THOST_FTDC_IPT_LastSettlement '1' +///һԼ̼ +#define THOST_FTDC_IPT_LaseClose '2' + +typedef char TThostFtdcBasisPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductLifePhaseTypeһƷ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_PLP_Active '1' +///Ծ +#define THOST_FTDC_PLP_NonActive '2' +///ע +#define THOST_FTDC_PLP_Canceled '3' + +typedef char TThostFtdcProductLifePhaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeliveryModeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///ֽ𽻸 +#define THOST_FTDC_DM_CashDeliv '1' +///ʵサ +#define THOST_FTDC_DM_CommodityDeliv '2' + +typedef char TThostFtdcDeliveryModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLogLevelTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLogLevelType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessNameTypeһ洢 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperationMemoTypeһժҪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperationMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundIOTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FIOT_FundIO '1' +///ת +#define THOST_FTDC_FIOT_Transfer '2' +///ڻ +#define THOST_FTDC_FIOT_SwapCurrency '3' + +typedef char TThostFtdcFundIOTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundTypeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_FT_Deposite '1' +///ʽ +#define THOST_FTDC_FT_ItemFund '2' +///˾ +#define THOST_FTDC_FT_Company '3' +///ʽת +#define THOST_FTDC_FT_InnerTransfer '4' + +typedef char TThostFtdcFundTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FD_In '1' +/// +#define THOST_FTDC_FD_Out '2' + +typedef char TThostFtdcFundDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundStatusTypeһʽ״̬ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_FS_Record '1' +///Ѹ +#define THOST_FTDC_FS_Check '2' +///ѳ +#define THOST_FTDC_FS_Charge '3' + +typedef char TThostFtdcFundStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillNoTypeһƱݺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBillNoType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillNameTypeһƱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBillNameType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPublishStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PS_None '1' +///ڷ +#define THOST_FTDC_PS_Publishing '2' +///ѷ +#define THOST_FTDC_PS_Published '3' + +typedef char TThostFtdcPublishStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueIDTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueIDType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueTypeTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueLabelTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueLabelType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueResultTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueResultType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemStatusTypeһϵͳ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_ES_NonActive '1' +/// +#define THOST_FTDC_ES_Startup '2' +///׿ʼʼ +#define THOST_FTDC_ES_Initialize '3' +///ɳʼ +#define THOST_FTDC_ES_Initialized '4' +///пʼ +#define THOST_FTDC_ES_Close '5' +/// +#define THOST_FTDC_ES_Closed '6' +/// +#define THOST_FTDC_ES_Settlement '7' + +typedef char TThostFtdcSystemStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ʼ +#define THOST_FTDC_STS_Initialize '0' +/// +#define THOST_FTDC_STS_Settlementing '1' +///ѽ +#define THOST_FTDC_STS_Settlemented '2' +/// +#define THOST_FTDC_STS_Finished '3' + +typedef char TThostFtdcSettlementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntTypeTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntFromTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntFromType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntToTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntToType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionIDTypeһܴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionIDType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionValueCodeTypeһܱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionValueCodeType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleIDTypeһɫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRoleIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleNameTypeһɫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRoleNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDescriptionTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDescriptionType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombineIDTypeһϱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombineIDType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombineTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombineTypeType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CT_Person '0' +/// +#define THOST_FTDC_CT_Company '1' +///Ͷʻ +#define THOST_FTDC_CT_Fund '2' +///ⷨ +#define THOST_FTDC_CT_SpecialOrgan '3' +///ʹܻ +#define THOST_FTDC_CT_Asset '4' + +typedef char TThostFtdcInvestorTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPartTypeTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +///׻Ա +#define THOST_FTDC_PART_Trade '0' +///׽Ա +#define THOST_FTDC_PART_TradeSettle '1' + +typedef char TThostFtdcPartTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskLevelTypeһյȼ +///////////////////////////////////////////////////////////////////////// +///ͷտͻ +#define THOST_FTDC_FAS_Low '1' +///ͨͻ +#define THOST_FTDC_FAS_Normal '2' +///עͻ +#define THOST_FTDC_FAS_Focus '3' +///տͻ +#define THOST_FTDC_FAS_Risk '4' + +typedef char TThostFtdcRiskLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PWDT_Trade '1' +///ʽ +#define THOST_FTDC_PWDT_Account '2' + +typedef char TThostFtdcPasswordTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAlgorithmTypeһӯ㷨 +///////////////////////////////////////////////////////////////////////// +///ӯ +#define THOST_FTDC_AG_All '1' +///ӯƣ +#define THOST_FTDC_AG_OnlyLost '2' +///ӯƣ +#define THOST_FTDC_AG_OnlyGain '3' +///ӯ +#define THOST_FTDC_AG_None '4' + +typedef char TThostFtdcAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIncludeCloseProfitTypeһǷƽӯ +///////////////////////////////////////////////////////////////////////// +///ƽӯ +#define THOST_FTDC_ICP_Include '0' +///ƽӯ +#define THOST_FTDC_ICP_NotInclude '2' + +typedef char TThostFtdcIncludeCloseProfitType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAllWithoutTradeTypeһǷܿ +///////////////////////////////////////////////////////////////////////// +///޲޳ɽܿ +#define THOST_FTDC_AWT_Enable '0' +///ܿ +#define THOST_FTDC_AWT_Disable '2' +///޲ֲܿ +#define THOST_FTDC_AWT_NoHoldEnable '3' + +typedef char TThostFtdcAllWithoutTradeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommentTypeһӯ㷨˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommentType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVersionTypeһ汾 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcVersionType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeCodeTypeһ״ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeSerialType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSerialNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradeSerialNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureIDTypeһڻ˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankIDTypeһд +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankBrchIDTypeһзĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankBrchIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankBranchIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankBranchIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperNoTypeһ׹Ա +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperNoType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeviceIDTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDeviceIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRecordNumTypeһ¼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRecordNumType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccountTypeһڻʽ˺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccountType[22]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFuturePwdFlagTypeһʽ˶Ա־ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_FPWD_UnCheck '0' +///˶ +#define THOST_FTDC_FPWD_Check '1' + +typedef char TThostFtdcFuturePwdFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferTypeTypeһת +///////////////////////////////////////////////////////////////////////// +///תڻ +#define THOST_FTDC_TT_BankToFuture '0' +///ڻת +#define THOST_FTDC_TT_FutureToBank '1' + +typedef char TThostFtdcTransferTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccPwdTypeһڻʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccPwdType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRetCodeTypeһӦ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRetCodeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRetInfoTypeһӦϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRetInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeAmtTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUseAmtTypeһп +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUseAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFetchAmtTypeһпȡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFetchAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferValidFlagTypeһתЧ־ +///////////////////////////////////////////////////////////////////////// +///Чʧ +#define THOST_FTDC_TVF_Invalid '0' +///Ч +#define THOST_FTDC_TVF_Valid '1' +/// +#define THOST_FTDC_TVF_Reverse '2' + +typedef char TThostFtdcTransferValidFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCertCodeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCertCodeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReasonTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_RN_CD '0' +///ʽ; +#define THOST_FTDC_RN_ZT '1' +/// +#define THOST_FTDC_RN_QT '2' + +typedef char TThostFtdcReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundProjectIDTypeһʽĿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFundProjectIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSexTypeһԱ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_SEX_None '0' +/// +#define THOST_FTDC_SEX_Man '1' +///Ů +#define THOST_FTDC_SEX_Woman '2' + +typedef char TThostFtdcSexType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProfessionTypeһְҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProfessionType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNationalTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNationalType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProvinceTypeһʡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProvinceType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRegionTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRegionType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCountryTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCountryType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLicenseNOTypeһӪҵִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLicenseNOType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCompanyTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCompanyTypeType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessScopeTypeһӪΧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessScopeType[1001]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCapitalCurrencyTypeһעʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCapitalCurrencyType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserTypeTypeһû +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_UT_Investor '0' +///Ա +#define THOST_FTDC_UT_Operator '1' +///Ա +#define THOST_FTDC_UT_SuperUser '2' + +typedef char TThostFtdcUserTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_RATETYPE_MarginRate '2' + +typedef char TThostFtdcRateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNoteTypeTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +///׽㵥 +#define THOST_FTDC_NOTETYPE_TradeSettleBill '1' +///׽± +#define THOST_FTDC_NOTETYPE_TradeSettleMonth '2' +///׷ӱ֤֪ͨ +#define THOST_FTDC_NOTETYPE_CallMarginNotes '3' +///ǿƽ֪ͨ +#define THOST_FTDC_NOTETYPE_ForceCloseNotes '4' +///ɽ֪ͨ +#define THOST_FTDC_NOTETYPE_TradeNotes '5' +///֪ͨ +#define THOST_FTDC_NOTETYPE_DelivNotes '6' + +typedef char TThostFtdcNoteTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementStyleTypeһ㵥ʽ +///////////////////////////////////////////////////////////////////////// +///ն +#define THOST_FTDC_SBS_Day '1' +///ʶԳ +#define THOST_FTDC_SBS_Volume '2' + +typedef char TThostFtdcSettlementStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerDNSTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerDNSType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSentenceTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSentenceType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementBillTypeTypeһ㵥 +///////////////////////////////////////////////////////////////////////// +///ձ +#define THOST_FTDC_ST_Day '0' +///± +#define THOST_FTDC_ST_Month '1' + +typedef char TThostFtdcSettlementBillTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserRightTypeTypeһͻȨ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_URT_Logon '1' +///ת +#define THOST_FTDC_URT_Transfer '2' +///ʼĽ㵥 +#define THOST_FTDC_URT_EMail '3' +///㵥 +#define THOST_FTDC_URT_Fax '4' +/// +#define THOST_FTDC_URT_ConditionOrder '5' + +typedef char TThostFtdcUserRightTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginPriceTypeTypeһ֤۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_MPT_PreSettlementPrice '1' +///¼ +#define THOST_FTDC_MPT_SettlementPrice '2' +///ɽ +#define THOST_FTDC_MPT_AveragePrice '3' +///ּ +#define THOST_FTDC_MPT_OpenPrice '4' + +typedef char TThostFtdcMarginPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillGenStatusTypeһ㵥״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_BGS_None '0' +/// +#define THOST_FTDC_BGS_NoGenerated '1' +/// +#define THOST_FTDC_BGS_Generated '2' + +typedef char TThostFtdcBillGenStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAlgoTypeTypeһ㷨 +///////////////////////////////////////////////////////////////////////// +///ֲִ㷨 +#define THOST_FTDC_AT_HandlePositionAlgo '1' +///Ѱұ֤㷨 +#define THOST_FTDC_AT_FindMarginRateAlgo '2' + +typedef char TThostFtdcAlgoTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandlePositionAlgoIDTypeһֲִ㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HPA_Base '1' +///Ʒ +#define THOST_FTDC_HPA_DCE '2' +///֣Ʒ +#define THOST_FTDC_HPA_CZCE '3' + +typedef char TThostFtdcHandlePositionAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFindMarginRateAlgoIDTypeһѰұ֤㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FMRA_Base '1' +///Ʒ +#define THOST_FTDC_FMRA_DCE '2' +///֣Ʒ +#define THOST_FTDC_FMRA_CZCE '3' + +typedef char TThostFtdcFindMarginRateAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandleTradingAccountAlgoIDTypeһʽ㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HTAA_Base '1' +///Ʒ +#define THOST_FTDC_HTAA_DCE '2' +///֣Ʒ +#define THOST_FTDC_HTAA_CZCE '3' + +typedef char TThostFtdcHandleTradingAccountAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPersonTypeTypeһϵ +///////////////////////////////////////////////////////////////////////// +///ָµ +#define THOST_FTDC_PST_Order '1' +///Ȩ +#define THOST_FTDC_PST_Open '2' +///ʽ +#define THOST_FTDC_PST_Fund '3' +///㵥ȷ +#define THOST_FTDC_PST_Settlement '4' +/// +#define THOST_FTDC_PST_Company '5' +///˴ +#define THOST_FTDC_PST_Corporation '6' +///Ͷϵ +#define THOST_FTDC_PST_LinkMan '7' +///ֻʲ +#define THOST_FTDC_PST_Ledger '8' +///У +#define THOST_FTDC_PST_Trustee '9' +///Уܻ˴ +#define THOST_FTDC_PST_TrusteeCorporation 'A' +///УܻȨ +#define THOST_FTDC_PST_TrusteeOpen 'B' +///Уܻϵ +#define THOST_FTDC_PST_TrusteeContact 'C' +///Ȼ˲ο֤ +#define THOST_FTDC_PST_ForeignerRefer 'D' +///˴ο֤ +#define THOST_FTDC_PST_CorporationRefer 'E' + +typedef char TThostFtdcPersonTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQueryInvestorRangeTypeһѯΧ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_QIR_All '1' +///ѯ +#define THOST_FTDC_QIR_Group '2' +///һͶ +#define THOST_FTDC_QIR_Single '3' + +typedef char TThostFtdcQueryInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorRiskStatusTypeһͶ߷״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IRS_Normal '1' +/// +#define THOST_FTDC_IRS_Warn '2' +///׷ +#define THOST_FTDC_IRS_Call '3' +///ǿƽ +#define THOST_FTDC_IRS_Force '4' +///쳣 +#define THOST_FTDC_IRS_Exception '5' + +typedef char TThostFtdcInvestorRiskStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLegIDTypeһȱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLegIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLegMultipleTypeһȳ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLegMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcImplyLevelTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcImplyLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearAccountType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganNOTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganNOType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearbarchIDTypeһ˻к +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearbarchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventTypeTypeһû¼ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_UET_Login '1' +///dz +#define THOST_FTDC_UET_Logout '2' +///׳ɹ +#define THOST_FTDC_UET_Trading '3' +///ʧ +#define THOST_FTDC_UET_TradingError '4' +///޸ +#define THOST_FTDC_UET_UpdatePassword '5' +///ͻ֤ +#define THOST_FTDC_UET_Authenticate '6' +/// +#define THOST_FTDC_UET_Other '9' + +typedef char TThostFtdcUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventInfoTypeһû¼Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserEventInfoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCloseStyleTypeһƽַʽ +///////////////////////////////////////////////////////////////////////// +///ȿƽ +#define THOST_FTDC_ICS_Close '0' +///ƽƽ +#define THOST_FTDC_ICS_CloseToday '1' + +typedef char TThostFtdcCloseStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStatModeTypeһͳƷʽ +///////////////////////////////////////////////////////////////////////// +///---- +#define THOST_FTDC_SM_Non '0' +///Լͳ +#define THOST_FTDC_SM_Instrument '1' +///Ʒͳ +#define THOST_FTDC_SM_Product '2' +///Ͷͳ +#define THOST_FTDC_SM_Investor '3' + +typedef char TThostFtdcStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPrePayOrderStatusTypeһԤ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PPOS_NotSend '1' +///ѷ +#define THOST_FTDC_PPOS_Send '2' +///ɾ +#define THOST_FTDC_PPOS_Deleted '3' + +typedef char TThostFtdcPrePayOrderStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPrePayOrderIDTypeһԤ񱨵 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPrePayOrderIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirDealStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ڴ +#define THOST_FTDC_VDS_Dealing '1' +///ɹ +#define THOST_FTDC_VDS_DeaclSucceed '2' + +typedef char TThostFtdcVirDealStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrgSystemIDTypeһԭϵͳ +///////////////////////////////////////////////////////////////////////// +///ۺϽƽ̨ +#define THOST_FTDC_ORGS_Standard '0' +///ʢϵͳ +#define THOST_FTDC_ORGS_ESunny '1' +///˴V6ϵͳ +#define THOST_FTDC_ORGS_KingStarV6 '2' + +typedef char TThostFtdcOrgSystemIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirTradeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VTS_NaturalDeal '0' +///ɹ +#define THOST_FTDC_VTS_SucceedEnd '1' +///ʧܽ +#define THOST_FTDC_VTS_FailedEND '2' +///쳣 +#define THOST_FTDC_VTS_Exception '3' +///˹쳣 +#define THOST_FTDC_VTS_ManualDeal '4' +///ͨѶ쳣 ˹ +#define THOST_FTDC_VTS_MesException '5' +///ϵͳ˹ +#define THOST_FTDC_VTS_SysException '6' + +typedef char TThostFtdcVirTradeStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirBankAccTypeTypeһʻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VBAT_BankBook '1' +/// +#define THOST_FTDC_VBAT_BankCard '2' +///ÿ +#define THOST_FTDC_VBAT_CreditCard '3' + +typedef char TThostFtdcVirBankAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementStatusTypeһʻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VMS_Natural '0' +/// +#define THOST_FTDC_VMS_Canceled '9' + +typedef char TThostFtdcVirementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementAvailAbilityTypeһЧ־ +///////////////////////////////////////////////////////////////////////// +///δȷ +#define THOST_FTDC_VAA_NoAvailAbility '0' +///Ч +#define THOST_FTDC_VAA_AvailAbility '1' +/// +#define THOST_FTDC_VAA_Repeal '2' + +typedef char TThostFtdcVirementAvailAbilityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementTradeCodeTypeһ״ +///////////////////////////////////////////////////////////////////////// +///зʽתڻ +#define THOST_FTDC_VTC_BankBankToFuture '102001' +///зڻʽת +#define THOST_FTDC_VTC_BankFutureToBank '102002' +///ڻʽתڻ +#define THOST_FTDC_VTC_FutureBankToFuture '202001' +///ڻڻʽת +#define THOST_FTDC_VTC_FutureFutureToBank '202002' + +typedef char TThostFtdcVirementTradeCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoTypeNameTypeһӰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoTypeNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoTypeIDTypeһӰʹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoTypeIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoNameTypeһӰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoNameType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTopicIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTopicIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReportTypeIDTypeһױͱʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcReportTypeIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCharacterIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCharacterIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLParamIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInvestorTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInvestorTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLIdCardTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLIdCardTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradeDirectTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradeDirectType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradeModelTypeһʽʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradeModelType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLParamIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLOpParamValueTypeһҵֵ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcAMLOpParamValueType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCustomerCardTypeTypeһͻ֤/֤ļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCustomerCardTypeType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionNameTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLDistrictIDTypeһڻڵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLDistrictIDType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLRelationShipTypeһڻ׵Ĺϵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLRelationShipType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionTypeTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionIDTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLAccountTypeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradingTypeTypeһ׷ʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradingTypeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTransactClassTypeһ֧׷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTransactClassType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCapitalIOTypeһʽոʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCapitalIOType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSiteTypeһ׵ص +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSiteType[10]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCapitalPurposeTypeһʽ; +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCapitalPurposeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLReportTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLReportTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSerialNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSerialNoType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLStatusType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLGenStatusTypeһAmlɷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_GEN_Program '0' +///˹ +#define THOST_FTDC_GEN_HandWork '1' + +typedef char TThostFtdcAMLGenStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSeqCodeTypeһҵʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSeqCodeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLFileNameTypeһAMLļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLFileNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLMoneyTypeһϴǮʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcAMLMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLFileAmountTypeһϴǮʽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcAMLFileAmountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCTokenTypeһ(֤) +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCFMMCTokenType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCKeyKindTypeһ̬Կ(֤) +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CFMMCKK_REQUEST 'R' +///CFMMCԶ +#define THOST_FTDC_CFMMCKK_AUTO 'A' +///CFMMCֶ +#define THOST_FTDC_CFMMCKK_MANUAL 'M' + +typedef char TThostFtdcCFMMCKeyKindType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLReportNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLReportNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIndividualNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIndividualNameType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyIDTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustNumberTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCustNumberType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganCodeType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSuperOrganCodeTypeһϼ,ڻ˾ܲ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSuperOrganCodeType[12]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubBranchIDTypeһ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSubBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubBranchNameTypeһ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSubBranchNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchNetCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBranchNetCodeType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchNetNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBranchNetNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganFlagTypeһʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankCodingForFutureTypeһжڻ˾ı +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankCodingForFutureType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankReturnCodeTypeһжԷĶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankReturnCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPlateReturnCodeTypeһתƽ̨ԷĶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPlateReturnCodeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankSubBranchIDTypeһз֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankSubBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureBranchIDTypeһڻ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnCodeTypeһش +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcReturnCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorCodeTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperatorCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearDepIDTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearDepIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearBrchIDTypeһʻк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearBrchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearNameTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountNameTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvDepIDTypeһͶ˺Ż +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvDepIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvBrchIDTypeһͶк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvBrchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMessageFormatVersionTypeһϢʽ汾 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMessageFormatVersionType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDigestTypeһժҪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDigestType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthenticDataTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthenticDataType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPasswordKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccountNameTypeһڻʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccountNameType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMobilePhoneTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMobilePhoneType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureMainKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureMainKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureWorkKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureWorkKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureTransKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureTransKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankMainKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankMainKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankWorkKeyTypeһйԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankWorkKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankTransKeyTypeһдԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankTransKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankServerDescriptionTypeһзϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankServerDescriptionType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAddInfoTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAddInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDescrInfoForReturnCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDescrInfoForReturnCodeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCountryCodeTypeһҴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCountryCodeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPlateSerialTypeһƽ̨ˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcPlateSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankSerialType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCorrectSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCorrectSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureSerialTypeһڻ˾ˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFutureSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplicationIDTypeһӦñʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcApplicationIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankProxyIDTypeһдʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBankProxyIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTCoreIDTypeһתʺϵͳʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBTCoreIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServerPortTypeһ˿ں +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServerPortType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepealedTimesTypeһѾ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRepealedTimesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepealTimeIntervalTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRepealTimeIntervalType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTotalTimesTypeһÿۼתʴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTotalTimesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTRequestIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBTRequestIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeAmountTypeһ׽Ԫ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcTradeAmountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustFeeTypeһӦտͻãԪ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCustFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureFeeTypeһӦڻ˾ãԪ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcFutureFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSingleMaxAmtTypeһ޶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcSingleMaxAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSingleMinAmtTypeһ޶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcSingleMinAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTotalAmtTypeһÿۼתʶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcTotalAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCertificationTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_CFT_IDCard '0' +/// +#define THOST_FTDC_CFT_Passport '1' +///֤ +#define THOST_FTDC_CFT_OfficerIDCard '2' +///ʿ֤ +#define THOST_FTDC_CFT_SoldierIDCard '3' +///֤ +#define THOST_FTDC_CFT_HomeComingCard '4' +///ڲ +#define THOST_FTDC_CFT_HouseholdRegister '5' +///Ӫҵִպ +#define THOST_FTDC_CFT_LicenseNo '6' +///֤֯ +#define THOST_FTDC_CFT_InstitutionCodeCard '7' +///ʱӪҵִպ +#define THOST_FTDC_CFT_TempLicenseNo '8' +///ҵǼ֤ +#define THOST_FTDC_CFT_NoEnterpriseLicenseNo '9' +///֤ +#define THOST_FTDC_CFT_OtherCard 'x' +///ܲ +#define THOST_FTDC_CFT_SuperDepAgree 'a' + +typedef char TThostFtdcCertificationTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileBusinessCodeTypeһļҵ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBC_Others '0' +///ת˽ϸ +#define THOST_FTDC_FBC_TransferDetails '1' +///ͻ˻״̬ +#define THOST_FTDC_FBC_CustAccStatus '2' +///˻ཻϸ +#define THOST_FTDC_FBC_AccountTradeDetails '3' +///ڻ˻Ϣϸ +#define THOST_FTDC_FBC_FutureAccountChangeInfoDetails '4' +///ͻʽ̨ϸ +#define THOST_FTDC_FBC_CustMoneyDetail '5' +///ͻϢϸ +#define THOST_FTDC_FBC_CustCancelAccountInfo '6' +///ͻʽ˽ +#define THOST_FTDC_FBC_CustMoneyResult '7' +///쳣ļ +#define THOST_FTDC_FBC_OthersExceptionResult '8' +///ͻϢϸ +#define THOST_FTDC_FBC_CustInterestNetMoneyDetails '9' +///ͻʽϸ +#define THOST_FTDC_FBC_CustMoneySendAndReceiveDetails 'a' +///˴ʽջ +#define THOST_FTDC_FBC_CorporationMoneyTotal 'b' +///ʽջ +#define THOST_FTDC_FBC_MainbodyMoneyTotal 'c' +///ܷƽ +#define THOST_FTDC_FBC_MainPartMonitorData 'd' +///б +#define THOST_FTDC_FBC_PreparationMoney 'e' +///Эʽ +#define THOST_FTDC_FBC_BankMoneyMonitorData 'f' + +typedef char TThostFtdcFileBusinessCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCashExchangeCodeTypeһ㳮־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CEC_Exchange '1' +/// +#define THOST_FTDC_CEC_Cash '2' + +typedef char TThostFtdcCashExchangeCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYesNoIndicatorTypeһǻʶ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_YNI_Yes '0' +/// +#define THOST_FTDC_YNI_No '1' + +typedef char TThostFtdcYesNoIndicatorType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBanlanceTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ǰ +#define THOST_FTDC_BLT_CurrentMoney '0' +/// +#define THOST_FTDC_BLT_UsableMoney '1' +///ȡ +#define THOST_FTDC_BLT_FetchableMoney '2' +/// +#define THOST_FTDC_BLT_FreezeMoney '3' + +typedef char TThostFtdcBanlanceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGenderTypeһԱ +///////////////////////////////////////////////////////////////////////// +///δ֪״̬ +#define THOST_FTDC_GD_Unknown '0' +/// +#define THOST_FTDC_GD_Male '1' +///Ů +#define THOST_FTDC_GD_Female '2' + +typedef char TThostFtdcGenderType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFeePayFlagTypeһ֧־ +///////////////////////////////////////////////////////////////////////// +///淽֧ +#define THOST_FTDC_FPF_BEN '0' +///ɷͷ֧ +#define THOST_FTDC_FPF_OUR '1' +///ɷͷ֧ķã淽֧ܵķ +#define THOST_FTDC_FPF_SHA '2' + +typedef char TThostFtdcFeePayFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPassWordKeyTypeTypeһԿ +///////////////////////////////////////////////////////////////////////// +///Կ +#define THOST_FTDC_PWKT_ExchangeKey '0' +///Կ +#define THOST_FTDC_PWKT_PassWordKey '1' +///MACԿ +#define THOST_FTDC_PWKT_MACKey '2' +///Կ +#define THOST_FTDC_PWKT_MessageKey '3' + +typedef char TThostFtdcPassWordKeyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTPassWordTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ѯ +#define THOST_FTDC_PWT_Query '0' +///ȡ +#define THOST_FTDC_PWT_Fetch '1' +///ת +#define THOST_FTDC_PWT_Transfer '2' +/// +#define THOST_FTDC_PWT_Trade '3' + +typedef char TThostFtdcFBTPassWordTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTEncryModeTypeһܷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EM_NoEncry '0' +///DES +#define THOST_FTDC_EM_DES '1' +///3DES +#define THOST_FTDC_EM_3DES '2' + +typedef char TThostFtdcFBTEncryModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankRepealFlagTypeһг־ +///////////////////////////////////////////////////////////////////////// +///Զ +#define THOST_FTDC_BRF_BankNotNeedRepeal '0' +///дԶ +#define THOST_FTDC_BRF_BankWaitingRepeal '1' +///Զ +#define THOST_FTDC_BRF_BankBeenRepealed '2' + +typedef char TThostFtdcBankRepealFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerRepealFlagTypeһ̳־ +///////////////////////////////////////////////////////////////////////// +///Զ +#define THOST_FTDC_BRORF_BrokerNotNeedRepeal '0' +///̴Զ +#define THOST_FTDC_BRORF_BrokerWaitingRepeal '1' +///Զ +#define THOST_FTDC_BRORF_BrokerBeenRepealed '2' + +typedef char TThostFtdcBrokerRepealFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstitutionTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TS_Bank '0' +/// +#define THOST_FTDC_TS_Future '1' +///ȯ +#define THOST_FTDC_TS_Store '2' + +typedef char TThostFtdcInstitutionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastFragmentTypeһƬ־ +///////////////////////////////////////////////////////////////////////// +///Ƭ +#define THOST_FTDC_LF_Yes '0' +///Ƭ +#define THOST_FTDC_LF_No '1' + +typedef char TThostFtdcLastFragmentType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccStatusTypeһ˻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_BAS_Normal '0' +/// +#define THOST_FTDC_BAS_Freeze '1' +///ʧ +#define THOST_FTDC_BAS_ReportLoss '2' + +typedef char TThostFtdcBankAccStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoneyAccountStatusTypeһʽ˻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_MAS_Normal '0' +/// +#define THOST_FTDC_MAS_Cancel '1' + +typedef char TThostFtdcMoneyAccountStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcManageStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ָ +#define THOST_FTDC_MSS_Point '0' +///Ԥָ +#define THOST_FTDC_MSS_PrePoint '1' +///ָ +#define THOST_FTDC_MSS_CancelPoint '2' + +typedef char TThostFtdcManageStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemTypeTypeһӦϵͳ +///////////////////////////////////////////////////////////////////////// +///ת +#define THOST_FTDC_SYT_FutureBankTransfer '0' +///֤ת +#define THOST_FTDC_SYT_StockBankTransfer '1' +/// +#define THOST_FTDC_SYT_TheThirdPartStore '2' + +typedef char TThostFtdcSystemTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTxnEndFlagTypeһתʻת־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TEF_NormalProcessing '0' +///ɹ +#define THOST_FTDC_TEF_Success '1' +///ʧܽ +#define THOST_FTDC_TEF_Failed '2' +///쳣 +#define THOST_FTDC_TEF_Abnormal '3' +///˹쳣 +#define THOST_FTDC_TEF_ManualProcessedForException '4' +///ͨѶ쳣 ˹ +#define THOST_FTDC_TEF_CommuFailedNeedManualProcess '5' +///ϵͳ˹ +#define THOST_FTDC_TEF_SysErrorNeedManualProcess '6' + +typedef char TThostFtdcTxnEndFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessStatusTypeһתʷ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PSS_NotProcess '0' +///ʼ +#define THOST_FTDC_PSS_StartProcess '1' +/// +#define THOST_FTDC_PSS_Finished '2' + +typedef char TThostFtdcProcessStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustTypeTypeһͻ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CUSTT_Person '0' +/// +#define THOST_FTDC_CUSTT_Institution '1' + +typedef char TThostFtdcCustTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTTransferDirectionTypeһתʷ +///////////////////////////////////////////////////////////////////////// +///תڻ +#define THOST_FTDC_FBTTD_FromBankToFuture '1' +///ڻת +#define THOST_FTDC_FBTTD_FromFutureToBank '2' + +typedef char TThostFtdcFBTTransferDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenOrDestroyTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OOD_Open '1' +/// +#define THOST_FTDC_OOD_Destroy '0' + +typedef char TThostFtdcOpenOrDestroyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAvailabilityFlagTypeһЧ־ +///////////////////////////////////////////////////////////////////////// +///δȷ +#define THOST_FTDC_AVAF_Invalid '0' +///Ч +#define THOST_FTDC_AVAF_Valid '1' +/// +#define THOST_FTDC_AVAF_Repeal '2' + +typedef char TThostFtdcAvailabilityFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_OT_Bank '1' +///ǰ +#define THOST_FTDC_OT_Future '2' +///תƽ̨ +#define THOST_FTDC_OT_PlateForm '9' + +typedef char TThostFtdcOrganTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganLevelTypeһ +///////////////////////////////////////////////////////////////////////// +///лܲ +#define THOST_FTDC_OL_HeadQuarters '1' +///зĻڻ˾Ӫҵ +#define THOST_FTDC_OL_Branch '2' + +typedef char TThostFtdcOrganLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProtocalIDTypeһЭ +///////////////////////////////////////////////////////////////////////// +///Э +#define THOST_FTDC_PID_FutureProtocal '0' +///Э +#define THOST_FTDC_PID_ICBCProtocal '1' +///ũЭ +#define THOST_FTDC_PID_ABCProtocal '2' +///йЭ +#define THOST_FTDC_PID_CBCProtocal '3' +///Э +#define THOST_FTDC_PID_CCBProtocal '4' +///Э +#define THOST_FTDC_PID_BOCOMProtocal '5' +///תƽ̨Э +#define THOST_FTDC_PID_FBTPlateFormProtocal 'X' + +typedef char TThostFtdcProtocalIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcConnectModeTypeһ׽ӷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CM_ShortConnect '0' +/// +#define THOST_FTDC_CM_LongConnect '1' + +typedef char TThostFtdcConnectModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncModeTypeһ׽ͨŷʽ +///////////////////////////////////////////////////////////////////////// +///첽 +#define THOST_FTDC_SRM_ASync '0' +///ͬ +#define THOST_FTDC_SRM_Sync '1' + +typedef char TThostFtdcSyncModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccTypeTypeһʺ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_BAT_BankBook '1' +/// +#define THOST_FTDC_BAT_SavingCard '2' +///ÿ +#define THOST_FTDC_BAT_CreditCard '3' + +typedef char TThostFtdcBankAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccTypeTypeһڻ˾ʺ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_FAT_BankBook '1' +/// +#define THOST_FTDC_FAT_SavingCard '2' +///ÿ +#define THOST_FTDC_FAT_CreditCard '3' + +typedef char TThostFtdcFutureAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OS_Ready '0' +///ǩ +#define THOST_FTDC_OS_CheckIn '1' +///ǩ +#define THOST_FTDC_OS_CheckOut '2' +///ļ +#define THOST_FTDC_OS_CheckFileArrived '3' +/// +#define THOST_FTDC_OS_CheckDetail '4' +/// +#define THOST_FTDC_OS_DayEndClean '5' +///ע +#define THOST_FTDC_OS_Invalid '9' + +typedef char TThostFtdcOrganStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCCBFeeModeTypeһշģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CCBFM_ByAmount '1' +///¿ +#define THOST_FTDC_CCBFM_ByMonth '2' + +typedef char TThostFtdcCCBFeeModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommApiTypeTypeһͨѶAPI +///////////////////////////////////////////////////////////////////////// +///ͻ +#define THOST_FTDC_CAPIT_Client '1' +/// +#define THOST_FTDC_CAPIT_Server '2' +///ϵͳUserApi +#define THOST_FTDC_CAPIT_UserApi '3' + +typedef char TThostFtdcCommApiTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServiceIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceLineNoTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServiceLineNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcServiceNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLinkStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿ +#define THOST_FTDC_LS_Connected '1' +///û +#define THOST_FTDC_LS_Disconnected '2' + +typedef char TThostFtdcLinkStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommApiPointerTypeһͨѶAPIָ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCommApiPointerType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPwdFlagTypeһ˶Ա־ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_BPWDF_NoCheck '0' +///ĺ˶ +#define THOST_FTDC_BPWDF_BlankCheck '1' +///ĺ˶ +#define THOST_FTDC_BPWDF_EncryptCheck '2' + +typedef char TThostFtdcPwdFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSecuAccTypeTypeһڻʺ +///////////////////////////////////////////////////////////////////////// +///ʽʺ +#define THOST_FTDC_SAT_AccountID '1' +///ʽ𿨺 +#define THOST_FTDC_SAT_CardID '2' +///Ϻɶʺ +#define THOST_FTDC_SAT_SHStockholderID '3' +///ڹɶʺ +#define THOST_FTDC_SAT_SZStockholderID '4' + +typedef char TThostFtdcSecuAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferStatusTypeһת˽״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TRFS_Normal '0' +/// +#define THOST_FTDC_TRFS_Repealed '1' + +typedef char TThostFtdcTransferStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSponsorTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SPTYPE_Broker '0' +/// +#define THOST_FTDC_SPTYPE_Bank '1' + +typedef char TThostFtdcSponsorTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReqRspTypeTypeһӦ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_REQRSP_Request '0' +///Ӧ +#define THOST_FTDC_REQRSP_Response '1' + +typedef char TThostFtdcReqRspTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTUserEventTypeTypeһתû¼ +///////////////////////////////////////////////////////////////////////// +///ǩ +#define THOST_FTDC_FBTUET_SignIn '0' +///תڻ +#define THOST_FTDC_FBTUET_FromBankToFuture '1' +///ڻת +#define THOST_FTDC_FBTUET_FromFutureToBank '2' +/// +#define THOST_FTDC_FBTUET_OpenAccount '3' +/// +#define THOST_FTDC_FBTUET_CancelAccount '4' +///˻ +#define THOST_FTDC_FBTUET_ChangeAccount '5' +///תڻ +#define THOST_FTDC_FBTUET_RepealFromBankToFuture '6' +///ڻת +#define THOST_FTDC_FBTUET_RepealFromFutureToBank '7' +///ѯ˻ +#define THOST_FTDC_FBTUET_QueryBankAccount '8' +///ѯڻ˻ +#define THOST_FTDC_FBTUET_QueryFutureAccount '9' +///ǩ +#define THOST_FTDC_FBTUET_SignOut 'A' +///Կͬ +#define THOST_FTDC_FBTUET_SyncKey 'B' +/// +#define THOST_FTDC_FBTUET_Other 'Z' + +typedef char TThostFtdcFBTUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankIDByBankTypeһԼı +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankIDByBankType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankOperNoTypeһвԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankOperNoType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankCustNoTypeһпͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankCustNoType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBOPSeqNoTypeһк +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDBOPSeqNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTableNameTypeһFBT +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTableNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPKNameTypeһFBT +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPKNameType[201]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPKValueTypeһFBTֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPKValueType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncFlagTypeһͬ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_SYNF_Yes '0' +///δͬ +#define THOST_FTDC_SYNF_No '1' + +typedef char TThostFtdcSyncFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTargetIDTypeһͬĿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTargetIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncTypeTypeһͬ +///////////////////////////////////////////////////////////////////////// +///һͬ +#define THOST_FTDC_SYNT_OneOffSync '0' +///ʱͬ +#define THOST_FTDC_SYNT_TimerSync '1' +///ʱȫͬ +#define THOST_FTDC_SYNT_TimerFullSync '2' + +typedef char TThostFtdcSyncTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBETimeTypeһֻʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBETimeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankNoTypeһк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBECertNoTypeһƾ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBECertNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExDirectionTypeһ㷽 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBEDIR_Settlement '0' +///ۻ +#define THOST_FTDC_FBEDIR_Sale '1' + +typedef char TThostFtdcExDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankAccountType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankAccountNameTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankAccountNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEAmtTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcFBEAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBusinessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEPostScriptTypeһ㸽 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEPostScriptType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBERemarkTypeһ㱸ע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBERemarkType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExRateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcExRateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEResultFlagTypeһɹ־ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_FBERES_Success '0' +///˻ +#define THOST_FTDC_FBERES_InsufficientBalance '1' +///׽δ֪ +#define THOST_FTDC_FBERES_UnknownTrading '8' +///ʧ +#define THOST_FTDC_FBERES_Fail 'x' + +typedef char TThostFtdcFBEResultFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBERtnMsgTypeһ㷵Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBERtnMsgType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEExtendMsgTypeһչϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEExtendMsgType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBusinessSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBusinessSerialType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBESystemSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBESystemSerialType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBETotalExCntTypeһ㽻ܱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBETotalExCntType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEExchStatusTypeһ㽻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBEES_Normal '0' +///ط +#define THOST_FTDC_FBEES_ReExchange '1' + +typedef char TThostFtdcFBEExchStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEFileFlagTypeһļ־ +///////////////////////////////////////////////////////////////////////// +///ݰ +#define THOST_FTDC_FBEFG_DataPackage '0' +///ļ +#define THOST_FTDC_FBEFG_File '1' + +typedef char TThostFtdcFBEFileFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEAlreadyTradeTypeһѽױ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FBEAT_NotTrade '0' +///ѽ +#define THOST_FTDC_FBEAT_Trade '1' + +typedef char TThostFtdcFBEAlreadyTradeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEOpenBankTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEOpenBankType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEUserEventTypeTypeһڻû¼ +///////////////////////////////////////////////////////////////////////// +///ǩ +#define THOST_FTDC_FBEUET_SignIn '0' +/// +#define THOST_FTDC_FBEUET_Exchange '1' +///ط +#define THOST_FTDC_FBEUET_ReExchange '2' +///˻ѯ +#define THOST_FTDC_FBEUET_QueryBankAccount '3' +///ϸѯ +#define THOST_FTDC_FBEUET_QueryExchDetial '4' +///ܲѯ +#define THOST_FTDC_FBEUET_QueryExchSummary '5' +///ʲѯ +#define THOST_FTDC_FBEUET_QueryExchRate '6' +///ļ֪ͨ +#define THOST_FTDC_FBEUET_CheckBankAccount '7' +///ǩ +#define THOST_FTDC_FBEUET_SignOut '8' +/// +#define THOST_FTDC_FBEUET_Other 'Z' + +typedef char TThostFtdcFBEUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEFileNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBatchSerialTypeһκ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBatchSerialType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEReqFlagTypeһ㷢ͱ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FBERF_UnProcessed '0' +///ȴ +#define THOST_FTDC_FBERF_WaitSend '1' +///ͳɹ +#define THOST_FTDC_FBERF_SendSuccess '2' +///ʧ +#define THOST_FTDC_FBERF_SendFailed '3' +///ȴط +#define THOST_FTDC_FBERF_WaitReSend '4' + +typedef char TThostFtdcFBEReqFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNotifyClassTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_NC_NOERROR '0' +///ʾ +#define THOST_FTDC_NC_Warn '1' +///׷ +#define THOST_FTDC_NC_Call '2' +///ǿƽ +#define THOST_FTDC_NC_Force '3' +/// +#define THOST_FTDC_NC_CHUANCANG '4' +///쳣 +#define THOST_FTDC_NC_Exception '5' + +typedef char TThostFtdcNotifyClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNofityInfoTypeһͻ֪ͨϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRiskNofityInfoType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseSceneIdTypeһǿƽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcForceCloseSceneIdType[24]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseTypeTypeһǿƽ +///////////////////////////////////////////////////////////////////////// +///ֹǿƽ +#define THOST_FTDC_FCT_Manual '0' +///һͶ߸ǿƽ +#define THOST_FTDC_FCT_Single '1' +///Ͷ߸ǿƽ +#define THOST_FTDC_FCT_Group '2' + +typedef char TThostFtdcForceCloseTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDsTypeһƷ,+ָ,cu+zn +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDsType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNotifyMethodTypeһ֪ͨ; +///////////////////////////////////////////////////////////////////////// +///ϵͳ֪ͨ +#define THOST_FTDC_RNM_System '0' +///֪ͨ +#define THOST_FTDC_RNM_SMS '1' +///ʼ֪ͨ +#define THOST_FTDC_RNM_EMail '2' +///˹֪ͨ +#define THOST_FTDC_RNM_Manual '3' + +typedef char TThostFtdcRiskNotifyMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNotifyStatusTypeһ֪ͨ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_RNS_NotGen '0' +///δ +#define THOST_FTDC_RNS_Generated '1' +///ʧ +#define THOST_FTDC_RNS_SendError '2' +///ѷδ +#define THOST_FTDC_RNS_SendOk '3' +///ѽδȷ +#define THOST_FTDC_RNS_Received '4' +///ȷ +#define THOST_FTDC_RNS_Confirmed '5' + +typedef char TThostFtdcRiskNotifyStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskUserEventTypeһû¼ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_RUE_ExportData '0' + +typedef char TThostFtdcRiskUserEventType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParamNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamValueTypeһֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParamValueType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcConditionalOrderSortTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ʹ¼ +#define THOST_FTDC_COST_LastPriceAsc '0' +///ʹ¼۽ +#define THOST_FTDC_COST_LastPriceDesc '1' +///ʹ +#define THOST_FTDC_COST_AskPriceAsc '2' +///ʹ۽ +#define THOST_FTDC_COST_AskPriceDesc '3' +///ʹ +#define THOST_FTDC_COST_BidPriceAsc '4' +///ʹ۽ +#define THOST_FTDC_COST_BidPriceDesc '5' + +typedef char TThostFtdcConditionalOrderSortTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSendTypeTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UOAST_NoSend '0' +///ѷ +#define THOST_FTDC_UOAST_Sended '1' +/// +#define THOST_FTDC_UOAST_Generated '2' +///ʧ +#define THOST_FTDC_UOAST_SendFail '3' +///ճɹ +#define THOST_FTDC_UOAST_Success '4' +///ʧ +#define THOST_FTDC_UOAST_Fail '5' +///ȡ +#define THOST_FTDC_UOAST_Cancel '6' + +typedef char TThostFtdcSendTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDStatusTypeһױ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UOACS_NoApply '1' +///ύ +#define THOST_FTDC_UOACS_Submited '2' +///ѷ +#define THOST_FTDC_UOACS_Sended '3' +/// +#define THOST_FTDC_UOACS_Success '4' +///ܾ +#define THOST_FTDC_UOACS_Refuse '5' +///ѳ +#define THOST_FTDC_UOACS_Cancel '6' + +typedef char TThostFtdcClientIDStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIndustryIDTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIndustryIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionIDTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcQuestionIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionContentTypeһϢ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcQuestionContentType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionIDTypeһѡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOptionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionContentTypeһѡ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOptionContentType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionTypeTypeһϢ +///////////////////////////////////////////////////////////////////////// +///ѡ +#define THOST_FTDC_QT_Radio '1' +///ѡ +#define THOST_FTDC_QT_Option '2' +/// +#define THOST_FTDC_QT_Blank '3' + +typedef char TThostFtdcQuestionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessIDTypeһҵˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSeqNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSeqNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAProcessStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAProcessStatusType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessTypeTypeһ̹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_BT_Request '1' +///Ӧ +#define THOST_FTDC_BT_Response '2' +///֪ͨ +#define THOST_FTDC_BT_Notice '3' + +typedef char TThostFtdcBusinessTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCfmmcReturnCodeTypeһķ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_CRC_Success '0' +///ÿͻѾڴ +#define THOST_FTDC_CRC_Working '1' +///пͻϼʧ +#define THOST_FTDC_CRC_InfoFail '2' +///ʵƼʧ +#define THOST_FTDC_CRC_IDCardFail '3' +/// +#define THOST_FTDC_CRC_OtherFail '4' + +typedef char TThostFtdcCfmmcReturnCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExReturnCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcExReturnCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientTypeTypeһͻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CfMMCCT_All '0' +/// +#define THOST_FTDC_CfMMCCT_Person '1' +///λ +#define THOST_FTDC_CfMMCCT_Company '2' +/// +#define THOST_FTDC_CfMMCCT_Other '3' +///ⷨ +#define THOST_FTDC_CfMMCCT_SpecialOrgan '4' +///ʹܻ +#define THOST_FTDC_CfMMCCT_Asset '5' + +typedef char TThostFtdcClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeIDTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///Ϻڻ +#define THOST_FTDC_EIDT_SHFE 'S' +///֣Ʒ +#define THOST_FTDC_EIDT_CZCE 'Z' +///Ʒ +#define THOST_FTDC_EIDT_DCE 'D' +///йڻ +#define THOST_FTDC_EIDT_CFFEX 'J' +///ϺԴĹɷ޹˾ +#define THOST_FTDC_EIDT_INE 'N' + +typedef char TThostFtdcExchangeIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientClassifyTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientClassifyType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAOrganTypeTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAOrganTypeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOACountryCodeTypeһҴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOACountryCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAreaCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAreaCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFuturesIDTypeһΪͻĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFuturesIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffmcDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffmcDateType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffmcTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffmcTimeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNocIDTypeһ֯ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNocIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUpdateFlagTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UF_NoUpdate '0' +///ȫϢɹ +#define THOST_FTDC_UF_Success '1' +///ȫϢʧ +#define THOST_FTDC_UF_Fail '2' +///½ױɹ +#define THOST_FTDC_UF_TCSuccess '3' +///½ױʧ +#define THOST_FTDC_UF_TCFail '4' +///Ѷ +#define THOST_FTDC_UF_Cancel '5' + +typedef char TThostFtdcUpdateFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyOperateIDTypeһ붯 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AOID_OpenInvestor '1' +///޸Ϣ +#define THOST_FTDC_AOID_ModifyIDCard '2' +///޸һϢ +#define THOST_FTDC_AOID_ModifyNoIDCard '3' +///뽻ױ +#define THOST_FTDC_AOID_ApplyTradingCode '4' +///ױ +#define THOST_FTDC_AOID_CancelTradingCode '5' +/// +#define THOST_FTDC_AOID_CancelInvestor '6' +///˻ +#define THOST_FTDC_AOID_FreezeAccount '8' +///˻ +#define THOST_FTDC_AOID_ActiveFreezeAccount '9' + +typedef char TThostFtdcApplyOperateIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyStatusIDTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δȫ +#define THOST_FTDC_ASID_NoComplete '1' +///ύ +#define THOST_FTDC_ASID_Submited '2' +/// +#define THOST_FTDC_ASID_Checked '3' +///Ѿܾ +#define THOST_FTDC_ASID_Refused '4' +///ɾ +#define THOST_FTDC_ASID_Deleted '5' + +typedef char TThostFtdcApplyStatusIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSendMethodTypeһͷʽ +///////////////////////////////////////////////////////////////////////// +///ļ +#define THOST_FTDC_UOASM_ByAPI '1' +///ӷ +#define THOST_FTDC_UOASM_ByFile '2' + +typedef char TThostFtdcSendMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEventTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEventTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEventModeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EvM_ADD '1' +///޸ +#define THOST_FTDC_EvM_UPDATE '2' +///ɾ +#define THOST_FTDC_EvM_DELETE '3' +/// +#define THOST_FTDC_EvM_CHECK '4' +/// +#define THOST_FTDC_EvM_COPY '5' +///ע +#define THOST_FTDC_EvM_CANCEL '6' +/// +#define THOST_FTDC_EvM_Reverse '7' + +typedef char TThostFtdcEventModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAAutoSendTypeһͳһԶ +///////////////////////////////////////////////////////////////////////// +///ԶͲ +#define THOST_FTDC_UOAA_ASR '1' +///ԶͣԶ +#define THOST_FTDC_UOAA_ASNR '2' +///ԶͣԶ +#define THOST_FTDC_UOAA_NSAR '3' +///ԶͣҲԶ +#define THOST_FTDC_UOAA_NSR '4' + +typedef char TThostFtdcUOAAutoSendType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQueryDepthTypeһѯ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcQueryDepthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataCenterIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDataCenterIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckLevelTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///㼶 +#define THOST_FTDC_CL_Zero '0' +///һ +#define THOST_FTDC_CL_One '1' +/// +#define THOST_FTDC_CL_Two '2' + +typedef char TThostFtdcCheckLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCheckNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckStatusTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_CHS_Init '0' +/// +#define THOST_FTDC_CHS_Checking '1' +///Ѹ +#define THOST_FTDC_CHS_Checked '2' +///ܾ +#define THOST_FTDC_CHS_Refuse '3' +/// +#define THOST_FTDC_CHS_Cancel '4' + +typedef char TThostFtdcCheckStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUsedStatusTypeһЧ״̬ +///////////////////////////////////////////////////////////////////////// +///δЧ +#define THOST_FTDC_CHU_Unused '0' +///Ч +#define THOST_FTDC_CHU_Used '1' +///Чʧ +#define THOST_FTDC_CHU_Fail '2' + +typedef char TThostFtdcUsedStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTemplateNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRateTemplateNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyStringTypeһڲѯͶֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyStringType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAcountOriginTypeһ˻Դ +///////////////////////////////////////////////////////////////////////// +///ֹ¼ +#define THOST_FTDC_BAO_ByAccProperty '0' +///ת +#define THOST_FTDC_BAO_ByFBTransfer '1' + +typedef char TThostFtdcBankAcountOriginType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthBillTradeSumTypeһ㵥±ɽܷʽ +///////////////////////////////////////////////////////////////////////// +///ͬͬԼ +#define THOST_FTDC_MBTS_ByInstrument '0' +///ͬͬԼͬ۸ +#define THOST_FTDC_MBTS_ByDayInsPrc '1' +///ͬԼ +#define THOST_FTDC_MBTS_ByDayIns '2' + +typedef char TThostFtdcMonthBillTradeSumType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTTradeCodeEnumTypeһڽ״ö +///////////////////////////////////////////////////////////////////////// +///зתڻ +#define THOST_FTDC_FTC_BankLaunchBankToBroker '102001' +///ڻתڻ +#define THOST_FTDC_FTC_BrokerLaunchBankToBroker '202001' +///зڻת +#define THOST_FTDC_FTC_BankLaunchBrokerToBank '102002' +///ڻڻת +#define THOST_FTDC_FTC_BrokerLaunchBrokerToBank '202002' + +typedef char TThostFtdcFBTTradeCodeEnumType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTemplateIDTypeһģʹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRateTemplateIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskRateTypeһն +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRiskRateType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimestampTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTimestampType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDRuleNameTypeһŶι +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDRuleNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDRuleExprTypeһŶιʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDRuleExprType[513]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastDriftTypeһϴOTPƯֵ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLastDriftType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastSuccessTypeһϴOTPɹֵ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLastSuccessType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthKeyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialNumberTypeһк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSerialNumberType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPTypeTypeһ̬ +///////////////////////////////////////////////////////////////////////// +///޶̬ +#define THOST_FTDC_OTP_NONE '0' +///ʱ +#define THOST_FTDC_OTP_TOTP '1' + +typedef char TThostFtdcOTPTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPVendorsIDTypeһ̬ṩ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOTPVendorsIDType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPVendorsNameTypeһ̬ṩ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOTPVendorsNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPStatusTypeһ̬״̬ +///////////////////////////////////////////////////////////////////////// +///δʹ +#define THOST_FTDC_OTPS_Unused '0' +///ʹ +#define THOST_FTDC_OTPS_Used '1' +///ע +#define THOST_FTDC_OTPS_Disuse '2' + +typedef char TThostFtdcOTPStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureTypeTypeһڻ +///////////////////////////////////////////////////////////////////////// +///Ʒڻ +#define THOST_FTDC_FUTT_Commodity '1' +///ڻ +#define THOST_FTDC_FUTT_Financial '2' + +typedef char TThostFtdcFutureTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundEventTypeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///ת޶ +#define THOST_FTDC_FET_Restriction '0' +///ת޶ +#define THOST_FTDC_FET_TodayRestriction '1' +///ˮ +#define THOST_FTDC_FET_Transfer '2' +///ʽ𶳽 +#define THOST_FTDC_FET_Credit '3' +///Ͷ߿ʽ +#define THOST_FTDC_FET_InvestorWithdrawAlm '4' +///ʻת޶ +#define THOST_FTDC_FET_BankRestriction '5' +///ǩԼ˻ +#define THOST_FTDC_FET_Accountregister '6' +/// +#define THOST_FTDC_FET_ExchangeFundIO '7' +///Ͷ߳ +#define THOST_FTDC_FET_InvestorFundIO '8' + +typedef char TThostFtdcFundEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountSourceTypeTypeһʽ˻Դ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_AST_FBTransfer '0' +///ֹ¼ +#define THOST_FTDC_AST_ManualEntry '1' + +typedef char TThostFtdcAccountSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCodeSourceTypeTypeһױԴ +///////////////////////////////////////////////////////////////////////// +///ͳһ(ѹ淶) +#define THOST_FTDC_CST_UnifyAccount '0' +///ֹ¼(δ淶) +#define THOST_FTDC_CST_ManualEntry '1' + +typedef char TThostFtdcCodeSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserRangeTypeһԱΧ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_UR_All '0' +///һԱ +#define THOST_FTDC_UR_Single '1' + +typedef char TThostFtdcUserRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeSpanTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTimeSpanType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcImportSequenceIDTypeһ̬Ƶα +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcImportSequenceIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcByGroupTypeһͳƱͻͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Ͷͳ +#define THOST_FTDC_BG_Investor '2' +///ͳ +#define THOST_FTDC_BG_Group '1' + +typedef char TThostFtdcByGroupType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSumStatModeTypeһͳƱΧͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Լͳ +#define THOST_FTDC_TSSM_Instrument '1' +///Ʒͳ +#define THOST_FTDC_TSSM_Product '2' +///ͳ +#define THOST_FTDC_TSSM_Exchange '3' + +typedef char TThostFtdcTradeSumStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcComTypeTypeһϳɽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcComTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductIDTypeһƷʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductNameTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductMemoTypeһƷ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductMemoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCCancelFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCCancelFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCDateType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCInvestorNameTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCInvestorNameType[201]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOpenInvestorNameTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOpenInvestorNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCInvestorIDTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCInvestorIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCIdentifiedCardNoTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCIdentifiedCardNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCClientIDTypeһױ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCClientIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCBankFlagTypeһбʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCBankFlagType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCBankAccountType[23]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOpenNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOpenNameType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMemoTypeһ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMemoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTimeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTradeIDTypeһɽˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTradeIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCExchangeInstIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMortgageNameTypeһѺƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMortgageNameType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCReasonTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCReasonType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsSettlementTypeһǷΪǽԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIsSettlementType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCPriceTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCPriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOptionsTypeTypeһȨ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOptionsTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCStrikePriceTypeһִм +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCStrikePriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTargetProductIDTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTargetProductIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTargetInstrIDTypeһĺԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTargetInstrIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommModelNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommModelNameType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommModelMemoTypeһģ屸ע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommModelMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExprSetModeTypeһڱʽ +///////////////////////////////////////////////////////////////////////// +///й +#define THOST_FTDC_ESM_Relative '1' +/// +#define THOST_FTDC_ESM_Typical '2' + +typedef char TThostFtdcExprSetModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +///˾׼ +#define THOST_FTDC_RIR_All '1' +///ģ +#define THOST_FTDC_RIR_Model '2' +///һͶ +#define THOST_FTDC_RIR_Single '3' + +typedef char TThostFtdcRateInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentBrokerIDTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentBrokerIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDRIdentityIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDRIdentityIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDRIdentityNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDRIdentityNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBLinkIDTypeһDBLinkʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDBLinkIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncDataStatusTypeһϵͳͬ״̬ +///////////////////////////////////////////////////////////////////////// +///δͬ +#define THOST_FTDC_SDS_Initialize '0' +///ͬ +#define THOST_FTDC_SDS_Settlementing '1' +///ͬ +#define THOST_FTDC_SDS_Settlemented '2' + +typedef char TThostFtdcSyncDataStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSourceTypeһɽԴ +///////////////////////////////////////////////////////////////////////// +///Խͨر +#define THOST_FTDC_TSRC_NORMAL '0' +///Բѯ +#define THOST_FTDC_TSRC_QUERY '1' + +typedef char TThostFtdcTradeSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFlexStatModeTypeһƷԼͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Ʒͳ +#define THOST_FTDC_FSM_Product '1' +///ͳ +#define THOST_FTDC_FSM_Exchange '2' +///ͳ +#define THOST_FTDC_FSM_All '3' + +typedef char TThostFtdcFlexStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcByInvestorRangeTypeһͶ߷ΧͳƷʽ +///////////////////////////////////////////////////////////////////////// +///ͳ +#define THOST_FTDC_BIR_Property '1' +///ͳ +#define THOST_FTDC_BIR_All '2' + +typedef char TThostFtdcByInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSRiskRateTypeһն +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSRiskRateType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PIR_All '1' +///Ͷ +#define THOST_FTDC_PIR_Property '2' +///һͶ +#define THOST_FTDC_PIR_Single '3' + +typedef char TThostFtdcPropertyInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileStatusTypeһļ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FIS_NoCreate '0' +/// +#define THOST_FTDC_FIS_Created '1' +///ʧ +#define THOST_FTDC_FIS_Failed '2' + +typedef char TThostFtdcFileStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileGenStyleTypeһļɷʽ +///////////////////////////////////////////////////////////////////////// +///· +#define THOST_FTDC_FGS_FileTransmit '0' +/// +#define THOST_FTDC_FGS_FileGen '1' + +typedef char TThostFtdcFileGenStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysOperModeTypeһϵͳ־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SoM_Add '1' +///޸ +#define THOST_FTDC_SoM_Update '2' +///ɾ +#define THOST_FTDC_SoM_Delete '3' +/// +#define THOST_FTDC_SoM_Copy '4' +/// +#define THOST_FTDC_SoM_AcTive '5' +///ע +#define THOST_FTDC_SoM_CanCel '6' +/// +#define THOST_FTDC_SoM_ReSet '7' + +typedef char TThostFtdcSysOperModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysOperTypeTypeһϵͳ־ +///////////////////////////////////////////////////////////////////////// +///޸IJԱ +#define THOST_FTDC_SoT_UpdatePassword '0' +///Աܹ֯ϵ +#define THOST_FTDC_SoT_UserDepartment '1' +///ɫ +#define THOST_FTDC_SoT_RoleManager '2' +///ɫ +#define THOST_FTDC_SoT_RoleFunction '3' +/// +#define THOST_FTDC_SoT_BaseParam '4' +///òԱ +#define THOST_FTDC_SoT_SetUserID '5' +///ûɫ +#define THOST_FTDC_SoT_SetUserRole '6' +///ûIP +#define THOST_FTDC_SoT_UserIpRestriction '7' +///ܹ֯ +#define THOST_FTDC_SoT_DepartmentManager '8' +///ܹ֯ѯิ +#define THOST_FTDC_SoT_DepartmentCopy '9' +///ױ +#define THOST_FTDC_SoT_Tradingcode 'A' +///Ͷ״̬ά +#define THOST_FTDC_SoT_InvestorStatus 'B' +///ͶȨ޹ +#define THOST_FTDC_SoT_InvestorAuthority 'C' +/// +#define THOST_FTDC_SoT_PropertySet 'D' +///Ͷ +#define THOST_FTDC_SoT_ReSetInvestorPasswd 'E' +///Ͷ߸Ϣά +#define THOST_FTDC_SoT_InvestorPersonalityInfo 'F' + +typedef char TThostFtdcSysOperTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCDataQueyTypeTypeһϱݲѯ +///////////////////////////////////////////////////////////////////////// +///ѯǰձ͵ +#define THOST_FTDC_CSRCQ_Current '0' +///ѯʷ͵Ĵ͹˾ +#define THOST_FTDC_CSRCQ_History '1' + +typedef char TThostFtdcCSRCDataQueyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFreezeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_FRS_Normal '1' +/// +#define THOST_FTDC_FRS_Freeze '0' + +typedef char TThostFtdcFreezeStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStandardStatusTypeһ淶״̬ +///////////////////////////////////////////////////////////////////////// +///ѹ淶 +#define THOST_FTDC_STST_Standard '0' +///δ淶 +#define THOST_FTDC_STST_NonStandard '1' + +typedef char TThostFtdcStandardStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCFreezeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCFreezeStatusType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightParamTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///߻ +#define THOST_FTDC_RPT_Freeze '1' +///߻ +#define THOST_FTDC_RPT_FreezeActive '2' +///Ȩ +#define THOST_FTDC_RPT_OpenLimit '3' +///Ȩ +#define THOST_FTDC_RPT_RelieveOpenLimit '4' + +typedef char TThostFtdcRightParamTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightTemplateIDTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRightTemplateIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightTemplateNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRightTemplateNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataStatusTypeһϴǮ˱״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMLDS_Normal '0' +///ɾ +#define THOST_FTDC_AMLDS_Deleted '1' + +typedef char TThostFtdcDataStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCheckStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_AMLCHS_Init '0' +/// +#define THOST_FTDC_AMLCHS_Checking '1' +///Ѹ +#define THOST_FTDC_AMLCHS_Checked '2' +///ܾϱ +#define THOST_FTDC_AMLCHS_RefuseReport '3' + +typedef char TThostFtdcAMLCheckStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlDateTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMLDT_DrawDay '0' +/// +#define THOST_FTDC_AMLDT_TouchDay '1' + +typedef char TThostFtdcAmlDateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlCheckLevelTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///㼶 +#define THOST_FTDC_AMLCL_CheckLevel0 '0' +///һ +#define THOST_FTDC_AMLCL_CheckLevel1 '1' +/// +#define THOST_FTDC_AMLCL_CheckLevel2 '2' +/// +#define THOST_FTDC_AMLCL_CheckLevel3 '3' + +typedef char TThostFtdcAmlCheckLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlCheckFlowTypeһϴǮݳȡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAmlCheckFlowType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDataTypeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExportFileTypeTypeһļ +///////////////////////////////////////////////////////////////////////// +///CSV +#define THOST_FTDC_EFT_CSV '0' +///Excel +#define THOST_FTDC_EFT_EXCEL '1' +///DBF +#define THOST_FTDC_EFT_DBF '2' + +typedef char TThostFtdcExportFileTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ǰ׼ +#define THOST_FTDC_SMT_Before '1' +/// +#define THOST_FTDC_SMT_Settlement '2' +///˶ +#define THOST_FTDC_SMT_After '3' +/// +#define THOST_FTDC_SMT_Settlemented '4' + +typedef char TThostFtdcSettleManagerTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerIDTypeһô +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettleManagerIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettleManagerNameType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerLevelTypeһõȼ +///////////////////////////////////////////////////////////////////////// +///Ҫ +#define THOST_FTDC_SML_Must '1' +/// +#define THOST_FTDC_SML_Alarm '2' +///ʾ +#define THOST_FTDC_SML_Prompt '3' +/// +#define THOST_FTDC_SML_Ignore '4' + +typedef char TThostFtdcSettleManagerLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerGroupTypeһģ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_SMG_Exhcange '1' +///ڲ˶ +#define THOST_FTDC_SMG_ASP '2' +///ϱݺ˶ +#define THOST_FTDC_SMG_CSRC '3' + +typedef char TThostFtdcSettleManagerGroupType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckResultMemoTypeһ˶Խ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCheckResultMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionUrlTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionUrlType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthInfoTypeһͻ֤Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthCodeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLimitUseTypeTypeһֵʹ +///////////////////////////////////////////////////////////////////////// +///ظʹ +#define THOST_FTDC_LUT_Repeatable '1' +///ظʹ +#define THOST_FTDC_LUT_Unrepeatable '2' + +typedef char TThostFtdcLimitUseTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataResourceTypeһԴ +///////////////////////////////////////////////////////////////////////// +///ϵͳ +#define THOST_FTDC_DAR_Settle '1' +/// +#define THOST_FTDC_DAR_Exchange '2' +/// +#define THOST_FTDC_DAR_CSRC '3' + +typedef char TThostFtdcDataResourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_MGT_ExchMarginRate '0' +///Ͷ֤߱ +#define THOST_FTDC_MGT_InstrMarginRate '1' +///Ͷ߽ױ֤ +#define THOST_FTDC_MGT_InstrMarginRateTrade '2' + +typedef char TThostFtdcMarginTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActiveTypeTypeһЧ +///////////////////////////////////////////////////////////////////////// +///Ч +#define THOST_FTDC_ACT_Intraday '1' +///Ч +#define THOST_FTDC_ACT_Long '2' + +typedef char TThostFtdcActiveTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginRateTypeTypeһͻ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_MRT_Exchange '1' +///Ͷ֤߱ +#define THOST_FTDC_MRT_Investor '2' +///Ͷ߽ױ֤ +#define THOST_FTDC_MRT_InvestorTrade '3' + +typedef char TThostFtdcMarginRateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBackUpStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δɱ +#define THOST_FTDC_BUS_UnBak '0' +/// +#define THOST_FTDC_BUS_BakUp '1' +///ɱ +#define THOST_FTDC_BUS_BakUped '2' +///ʧ +#define THOST_FTDC_BUS_BakFail '3' + +typedef char TThostFtdcBackUpStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInitSettlementTypeһʼ״̬ +///////////////////////////////////////////////////////////////////////// +///ʼδʼ +#define THOST_FTDC_SIS_UnInitialize '0' +///ʼ +#define THOST_FTDC_SIS_Initialize '1' +///ʼ +#define THOST_FTDC_SIS_Initialized '2' + +typedef char TThostFtdcInitSettlementType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReportStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δɱ +#define THOST_FTDC_SRS_NoCreate '0' +/// +#define THOST_FTDC_SRS_Create '1' +///ɱ +#define THOST_FTDC_SRS_Created '2' +///ɱʧ +#define THOST_FTDC_SRS_CreateFail '3' + +typedef char TThostFtdcReportStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSaveStatusTypeһݹ鵵״̬ +///////////////////////////////////////////////////////////////////////// +///鵵δ +#define THOST_FTDC_SSS_UnSaveData '0' +///鵵 +#define THOST_FTDC_SSS_SaveDatad '1' + +typedef char TThostFtdcSaveStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettArchiveStatusTypeһȷݹ鵵״̬ +///////////////////////////////////////////////////////////////////////// +///δ鵵 +#define THOST_FTDC_SAS_UnArchived '0' +///ݹ鵵 +#define THOST_FTDC_SAS_Archiving '1' +///ѹ鵵 +#define THOST_FTDC_SAS_Archived '2' +///鵵ʧ +#define THOST_FTDC_SAS_ArchiveFail '3' + +typedef char TThostFtdcSettArchiveStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCTPTypeTypeһCTPϵͳ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_CTPT_Unkown '0' +/// +#define THOST_FTDC_CTPT_MainCenter '1' +/// +#define THOST_FTDC_CTPT_BackUp '2' + +typedef char TThostFtdcCTPTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcToolIDTypeһߴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcToolIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcToolNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcToolNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCloseDealTypeTypeһƽִ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CDT_Normal '0' +///Ͷƽ +#define THOST_FTDC_CDT_SpecFirst '1' + +typedef char TThostFtdcCloseDealTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMortgageFundUseRangeTypeһѺʽ÷Χ +///////////////////////////////////////////////////////////////////////// +///ʹ +#define THOST_FTDC_MFUR_None '0' +///ڱ֤ +#define THOST_FTDC_MFUR_Margin '1' +///ѡӯ֤ +#define THOST_FTDC_MFUR_All '2' + +typedef char TThostFtdcMortgageFundUseRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyUnitTypeһֵλ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCurrencyUnitType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeRateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcExchangeRateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSpecProductTypeTypeһƷ +///////////////////////////////////////////////////////////////////////// +///֣ױƷ +#define THOST_FTDC_SPT_CzceHedge '1' +///ѺƷ +#define THOST_FTDC_SPT_IneForeignCurrency '2' +///߿ƽֲƷ +#define THOST_FTDC_SPT_DceOpenClose '3' + +typedef char TThostFtdcSpecProductTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortgageTypeTypeһѺ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_FMT_Mortgage '1' +/// +#define THOST_FTDC_FMT_Redemption '2' + +typedef char TThostFtdcFundMortgageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountSettlementParamIDTypeһͶ˻ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_ASPI_BaseMargin '1' +///Ȩ׼ +#define THOST_FTDC_ASPI_LowestInterest '2' + +typedef char TThostFtdcAccountSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyNameType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySignTypeһַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencySignType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountsTypeһѿʽ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAccountsType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortDirectionTypeһѺ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FMD_In '1' +///ʳ +#define THOST_FTDC_FMD_Out '2' + +typedef char TThostFtdcFundMortDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessClassTypeһ +///////////////////////////////////////////////////////////////////////// +///ӯ +#define THOST_FTDC_BT_Profit '0' +/// +#define THOST_FTDC_BT_Loss '1' +/// +#define THOST_FTDC_BT_Other 'Z' + +typedef char TThostFtdcBusinessClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSwapSourceTypeTypeһԴ +///////////////////////////////////////////////////////////////////////// +///ֹ +#define THOST_FTDC_SST_Manual '0' +///Զ +#define THOST_FTDC_SST_Automatic '1' + +typedef char TThostFtdcSwapSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrExDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CED_Settlement '0' +///ۻ +#define THOST_FTDC_CED_Sale '1' + +typedef char TThostFtdcCurrExDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySwapStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_CSS_Entry '1' +/// +#define THOST_FTDC_CSS_Approve '2' +///Ѿܾ +#define THOST_FTDC_CSS_Refuse '3' +///ѳ +#define THOST_FTDC_CSS_Revoke '4' +///ѷ +#define THOST_FTDC_CSS_Send '5' +///ɹ +#define THOST_FTDC_CSS_Success '6' +///ʧ +#define THOST_FTDC_CSS_Failure '7' + +typedef char TThostFtdcCurrencySwapStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrExchCertNoTypeһƾ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrExchCertNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBatchSerialNoTypeһκ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBatchSerialNoType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReqFlagTypeһ㷢ͱ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_REQF_NoSend '0' +///ͳɹ +#define THOST_FTDC_REQF_SendSuccess '1' +///ʧ +#define THOST_FTDC_REQF_SendFailed '2' +///ȴط +#define THOST_FTDC_REQF_WaitReSend '3' + +typedef char TThostFtdcReqFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcResFlagTypeһ㷵سɹ־ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_RESF_Success '0' +///˻ +#define THOST_FTDC_RESF_InsuffiCient '1' +///׽δ֪ +#define THOST_FTDC_RESF_UnKnown '8' + +typedef char TThostFtdcResFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPageControlTypeһҳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPageControlType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRecordCountTypeһ¼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRecordCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySwapMemoTypeһȷϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencySwapMemoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExStatusTypeһ޸״̬ +///////////////////////////////////////////////////////////////////////// +///޸ǰ +#define THOST_FTDC_EXS_Before '0' +///޸ĺ +#define THOST_FTDC_EXS_After '1' + +typedef char TThostFtdcExStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientRegionTypeһͻ +///////////////////////////////////////////////////////////////////////// +///ڿͻ +#define THOST_FTDC_CR_Domestic '1' +///۰̨ͻ +#define THOST_FTDC_CR_GMT '2' +///ͻ +#define THOST_FTDC_CR_Foreign '3' + +typedef char TThostFtdcClientRegionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWorkPlaceTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWorkPlaceType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessPeriodTypeһӪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessPeriodType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWebSiteTypeһַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWebSiteType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAIdCardTypeTypeһͳһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAIdCardTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientModeTypeһģʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientModeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorFullNameTypeһͶȫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorFullNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOABrokerIDTypeһнID +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOABrokerIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAZipCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAZipCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAEMailTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAEMailType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOldCityTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOldCityType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCorporateIdentifiedCardNoTypeһ˴֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCorporateIdentifiedCardNoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHasBoardTypeһǷж» +///////////////////////////////////////////////////////////////////////// +///û +#define THOST_FTDC_HB_No '0' +/// +#define THOST_FTDC_HB_Yes '1' + +typedef char TThostFtdcHasBoardType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTemplateTypeTypeһģ +///////////////////////////////////////////////////////////////////////// +///ȫ +#define THOST_FTDC_TPT_Full '1' +/// +#define THOST_FTDC_TPT_Increment '2' +/// +#define THOST_FTDC_TPT_BackUp '3' + +typedef char TThostFtdcTemplateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLoginModeTypeһ¼ģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_LM_Trade '0' +///ת +#define THOST_FTDC_LM_Transfer '1' + +typedef char TThostFtdcLoginModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPromptTypeTypeһʾ +///////////////////////////////////////////////////////////////////////// +///Լ +#define THOST_FTDC_CPT_Instrument '1' +///ֶ֤Ч +#define THOST_FTDC_CPT_Margin '2' + +typedef char TThostFtdcPromptTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLedgerManageIDTypeһֻʲ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLedgerManageIDType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestVarietyTypeһͶƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestVarietyType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLedgerManageBankTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLedgerManageBankType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffexDepartmentNameTypeһӪҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffexDepartmentNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffexDepartmentCodeTypeһӪҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffexDepartmentCodeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHasTrusteeTypeһǷй +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HT_Yes '1' +///û +#define THOST_FTDC_HT_No '0' + +typedef char TThostFtdcHasTrusteeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrCFullNameTypeһʲҵڻ˾ȫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrCFullNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrApprovalNOTypeһʲҵĺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrApprovalNOType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrMgrNameTypeһʲҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrMgrNameType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMT_Bank '1' +///֤ȯ˾ +#define THOST_FTDC_AMT_Securities '2' +///˾ +#define THOST_FTDC_AMT_Fund '3' +///չ˾ +#define THOST_FTDC_AMT_Insurance '4' +///й˾ +#define THOST_FTDC_AMT_Trust '5' +/// +#define THOST_FTDC_AMT_Other '9' + +typedef char TThostFtdcAmTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCAmTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCAmTypeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCFundIOTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CFIOT_FundIO '0' +///ڻ +#define THOST_FTDC_CFIOT_SwapCurrency '1' + +typedef char TThostFtdcCSRCFundIOTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCusAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +///ڻ˻ +#define THOST_FTDC_CAT_Futures '1' +///ڻʹҵµʹܽ˻ +#define THOST_FTDC_CAT_AssetmgrFuture '2' +///ۺʹҵµڻʹй˻ +#define THOST_FTDC_CAT_AssetmgrTrustee '3' +///ۺʹҵµʽת˻ +#define THOST_FTDC_CAT_AssetmgrTransfer '4' + +typedef char TThostFtdcCusAccountTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCNationalTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCNationalType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCSecAgentIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCSecAgentIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLanguageTypeTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_LT_Chinese '0' +///Ӣ +#define THOST_FTDC_LT_English '1' + +typedef char TThostFtdcLanguageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmAccountTypeһͶ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAmAccountType[23]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrClientTypeTypeһʲͻ +///////////////////////////////////////////////////////////////////////// +///ʹܿͻ +#define THOST_FTDC_AMCT_Person '1' +///λʹܿͻ +#define THOST_FTDC_AMCT_Organ '2' +///ⵥλʹܿͻ +#define THOST_FTDC_AMCT_SpecialOrgan '4' + +typedef char TThostFtdcAssetmgrClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_ASST_Futures '3' +///ۺ +#define THOST_FTDC_ASST_SpecialOrgan '4' + +typedef char TThostFtdcAssetmgrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOMTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOMType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEInstLifePhaseTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSHFEInstLifePhaseType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEProductClassTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSHFEProductClassType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceDecimalTypeһ۸Сλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPriceDecimalType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInTheMoneyFlagTypeһƽֵȨ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInTheMoneyFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckInstrTypeTypeһԼȽ +///////////////////////////////////////////////////////////////////////// +///Լ +#define THOST_FTDC_CIT_HasExch '0' +///Լϵͳ +#define THOST_FTDC_CIT_HasATP '1' +///ԼȽϲһ +#define THOST_FTDC_CIT_HasDiff '2' + +typedef char TThostFtdcCheckInstrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckInstrPriceTypeTypeһ۱Ƚ +///////////////////////////////////////////////////////////////////////// +///۽ +#define THOST_FTDC_CIPT_HasExch '0' +///۱ϵͳ +#define THOST_FTDC_CIPT_HasATP '1' +///۱Ƚϲһ +#define THOST_FTDC_CIPT_HasDiff '2' + +typedef char TThostFtdcCheckInstrPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeliveryTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ֹ +#define THOST_FTDC_DT_HandDeliv '1' +///ڽ +#define THOST_FTDC_DT_PersonDeliv '2' + +typedef char TThostFtdcDeliveryTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBigMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcBigMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMaxMarginSideAlgorithmTypeһ֤߱㷨 +///////////////////////////////////////////////////////////////////////// +///ʹô֤߱㷨 +#define THOST_FTDC_MMSA_NO '0' +///ʹô֤߱㷨 +#define THOST_FTDC_MMSA_YES '1' + +typedef char TThostFtdcMaxMarginSideAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDAClientTypeTypeһʲͻ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CACT_Person '0' +/// +#define THOST_FTDC_CACT_Company '1' +/// +#define THOST_FTDC_CACT_Other '2' + +typedef char TThostFtdcDAClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinInstrIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombinInstrIDType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinSettlePriceTypeһȽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombinSettlePriceType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDCEPriorityTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDCEPriorityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeGroupIDTypeһɽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradeGroupIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsCheckPrepaTypeһǷУ鿪ʽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcIsCheckPrepaType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAAssetmgrTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_UOAAT_Futures '1' +///ۺ +#define THOST_FTDC_UOAAT_SpecialOrgan '2' + +typedef char TThostFtdcUOAAssetmgrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDirectionEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Buy +#define THOST_FTDC_DEN_Buy '0' +///Sell +#define THOST_FTDC_DEN_Sell '1' + +typedef char TThostFtdcDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetFlagEnTypeһƽ־ +///////////////////////////////////////////////////////////////////////// +///Position Opening +#define THOST_FTDC_OFEN_Open '0' +///Position Close +#define THOST_FTDC_OFEN_Close '1' +///Forced Liquidation +#define THOST_FTDC_OFEN_ForceClose '2' +///Close Today +#define THOST_FTDC_OFEN_CloseToday '3' +///Close Prev. +#define THOST_FTDC_OFEN_CloseYesterday '4' +///Forced Reduction +#define THOST_FTDC_OFEN_ForceOff '5' +///Local Forced Liquidation +#define THOST_FTDC_OFEN_LocalForceClose '6' + +typedef char TThostFtdcOffsetFlagEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHedgeFlagEnTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Speculation +#define THOST_FTDC_HFEN_Speculation '1' +///Arbitrage +#define THOST_FTDC_HFEN_Arbitrage '2' +///Hedge +#define THOST_FTDC_HFEN_Hedge '3' + +typedef char TThostFtdcHedgeFlagEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundIOTypeEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Deposit/Withdrawal +#define THOST_FTDC_FIOTEN_FundIO '1' +///Bank-Futures Transfer +#define THOST_FTDC_FIOTEN_Transfer '2' +///Bank-Futures FX Exchange +#define THOST_FTDC_FIOTEN_SwapCurrency '3' + +typedef char TThostFtdcFundIOTypeEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundTypeEnTypeһʽ +///////////////////////////////////////////////////////////////////////// +///Bank Deposit +#define THOST_FTDC_FTEN_Deposite '1' +///Payment/Fee +#define THOST_FTDC_FTEN_ItemFund '2' +///Brokerage Adj +#define THOST_FTDC_FTEN_Company '3' +///Internal Transfer +#define THOST_FTDC_FTEN_InnerTransfer '4' + +typedef char TThostFtdcFundTypeEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundDirectionEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Deposit +#define THOST_FTDC_FDEN_In '1' +///Withdrawal +#define THOST_FTDC_FDEN_Out '2' + +typedef char TThostFtdcFundDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortDirectionEnTypeһѺ +///////////////////////////////////////////////////////////////////////// +///Pledge +#define THOST_FTDC_FMDEN_In '1' +///Redemption +#define THOST_FTDC_FMDEN_Out '2' + +typedef char TThostFtdcFundMortDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSwapBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSwapBusinessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionsTypeTypeһȨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CP_CallOptions '1' +/// +#define THOST_FTDC_CP_PutOptions '2' + +typedef char TThostFtdcOptionsTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeModeTypeһִзʽ +///////////////////////////////////////////////////////////////////////// +///ŷʽ +#define THOST_FTDC_STM_Continental '0' +///ʽ +#define THOST_FTDC_STM_American '1' +///Ľ +#define THOST_FTDC_STM_Bermuda '2' + +typedef char TThostFtdcStrikeModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeTypeTypeһȨ +///////////////////////////////////////////////////////////////////////// +///Ȩִ +#define THOST_FTDC_STT_Strike '0' +///Ȩ +#define THOST_FTDC_STT_GiveUp '1' + +typedef char TThostFtdcStrikeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyTypeTypeһнȨִ +///////////////////////////////////////////////////////////////////////// +///ִ +#define THOST_FTDC_APPT_NotStrikeNum '4' + +typedef char TThostFtdcApplyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGiveUpDataSourceTypeһִԴ +///////////////////////////////////////////////////////////////////////// +///ϵͳ +#define THOST_FTDC_GUDS_Gen '0' +///ֹ +#define THOST_FTDC_GUDS_Hand '1' + +typedef char TThostFtdcGiveUpDataSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderSysIDTypeһִϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExecOrderSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecResultTypeһִн +///////////////////////////////////////////////////////////////////////// +///ûִ +#define THOST_FTDC_OER_NoExec 'n' +///Ѿȡ +#define THOST_FTDC_OER_Canceled 'c' +///ִгɹ +#define THOST_FTDC_OER_OK '0' +///Ȩֲֲ +#define THOST_FTDC_OER_NoPosition '1' +///ʽ𲻹 +#define THOST_FTDC_OER_NoDeposit '2' +///Ա +#define THOST_FTDC_OER_NoParticipant '3' +///ͻ +#define THOST_FTDC_OER_NoClient '4' +///Լ +#define THOST_FTDC_OER_NoInstrument '6' +///ûִȨ +#define THOST_FTDC_OER_NoRight '7' +/// +#define THOST_FTDC_OER_InvalidVolume '8' +///û㹻ʷɽ +#define THOST_FTDC_OER_NoEnoughHistoryTrade '9' +///δ֪ +#define THOST_FTDC_OER_Unknown 'a' + +typedef char TThostFtdcExecResultType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeSequenceTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcStrikeSequenceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeTimeTypeһִʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcStrikeTimeType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPosChangeTypeTypeһֱֲ䶯 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPosChangeTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPosDirectionTypeһֲַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPosDirectionType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPosChangeNumTypeһֱֲ䶯 +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcPosChangeNumType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDelivTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDelivTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDelivModeTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDelivModeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionChangeTypeTypeһֱֲ䶯 +///////////////////////////////////////////////////////////////////////// +///Ȩִ +#define THOST_FTDC_PCT_OptionStrike '1' +///ֲֶԳ +#define THOST_FTDC_PCT_PositionHedge '2' +///ת뽻 +#define THOST_FTDC_PCT_SwitchToDeliv '3' +///Ʋ +#define THOST_FTDC_PCT_TransferPos '4' + +typedef char TThostFtdcPositionChangeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPctDelivTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ת +#define THOST_FTDC_PCTDT_FutureToSpot '0' +///ڽ +#define THOST_FTDC_PCTDT_ExpireToDeliv '1' + +typedef char TThostFtdcPctDelivTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPctDelivModeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///ֽ𽻸 +#define THOST_FTDC_PCTDM_Cash '0' +///ʵサ +#define THOST_FTDC_PCTDM_Physical '1' + +typedef char TThostFtdcPctDelivModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinationTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_COMBT_Future '0' +///ֱ۲BUL +#define THOST_FTDC_COMBT_BUL '1' +///ֱ۲BER +#define THOST_FTDC_COMBT_BER '2' +///ʽ +#define THOST_FTDC_COMBT_STD '3' +///ʽ +#define THOST_FTDC_COMBT_STG '4' +/// +#define THOST_FTDC_COMBT_PRT '5' +///ʱ۲ +#define THOST_FTDC_COMBT_CLD '6' + +typedef char TThostFtdcCombinationTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionRoyaltyPriceTypeTypeһȨȨ۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ORPT_PreSettlementPrice '1' +///ּ +#define THOST_FTDC_ORPT_OpenPrice '4' + +typedef char TThostFtdcOptionRoyaltyPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBalanceAlgorithmTypeһȨ㷨 +///////////////////////////////////////////////////////////////////////// +///Ȩֵӯ +#define THOST_FTDC_BLAG_Default '1' +///Ȩֵ +#define THOST_FTDC_BLAG_IncludeOptValLost '2' + +typedef char TThostFtdcBalanceAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActionTypeTypeһִ +///////////////////////////////////////////////////////////////////////// +///ִ +#define THOST_FTDC_ACTP_Exec '1' +/// +#define THOST_FTDC_ACTP_Abandon '2' + +typedef char TThostFtdcActionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForQuoteStatusTypeһѯ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_FQST_Submitted 'a' +///Ѿ +#define THOST_FTDC_FQST_Accepted 'b' +///Ѿܾ +#define THOST_FTDC_FQST_Rejected 'c' + +typedef char TThostFtdcForQuoteStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuotStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_QTST_Unknown 'a' +///Ѿ +#define THOST_FTDC_QTST_Accepted 'b' +///Ѿ +#define THOST_FTDC_QTST_Canceled 'c' + +typedef char TThostFtdcQuotStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcValueMethodTypeһȡֵʽ +///////////////////////////////////////////////////////////////////////// +///ֵ +#define THOST_FTDC_VM_Absolute '0' +/// +#define THOST_FTDC_VM_Ratio '1' + +typedef char TThostFtdcValueMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderPositionFlagTypeһȨȨǷڻͷı +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EOPF_Reserve '0' +/// +#define THOST_FTDC_EOPF_UnReserve '1' + +typedef char TThostFtdcExecOrderPositionFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderCloseFlagTypeһȨȨɵͷǷԶƽ +///////////////////////////////////////////////////////////////////////// +///Զƽ +#define THOST_FTDC_EOCF_AutoClose '0' +///Զƽ +#define THOST_FTDC_EOCF_NotToClose '1' + +typedef char TThostFtdcExecOrderCloseFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductTypeTypeһƷ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_PTE_Futures '1' +///Ȩ +#define THOST_FTDC_PTE_Options '2' + +typedef char TThostFtdcProductTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCZCEUploadFileNameTypeһ֣ļ +///////////////////////////////////////////////////////////////////////// +///^\d{8}_zz_\d{4} +#define THOST_FTDC_CUFN_CUFN_O 'O' +///^\d{8}ɽ +#define THOST_FTDC_CUFN_CUFN_T 'T' +///^\d{8}ȳֱֲnew +#define THOST_FTDC_CUFN_CUFN_P 'P' +///^\d{8}ƽ˽ +#define THOST_FTDC_CUFN_CUFN_N 'N' +///^\d{8}ƽֱ +#define THOST_FTDC_CUFN_CUFN_L 'L' +///^\d{8}ʽ +#define THOST_FTDC_CUFN_CUFN_F 'F' +///^\d{8}ϳֱֲ +#define THOST_FTDC_CUFN_CUFN_C 'C' +///^\d{8}֤ +#define THOST_FTDC_CUFN_CUFN_M 'M' + +typedef char TThostFtdcCZCEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDCEUploadFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +///^\d{8}_dl_\d{3} +#define THOST_FTDC_DUFN_DUFN_O 'O' +///^\d{8}_ɽ +#define THOST_FTDC_DUFN_DUFN_T 'T' +///^\d{8}_ֱֲ +#define THOST_FTDC_DUFN_DUFN_P 'P' +///^\d{8}_ʽ +#define THOST_FTDC_DUFN_DUFN_F 'F' +///^\d{8}_Żϳֲϸ +#define THOST_FTDC_DUFN_DUFN_C 'C' +///^\d{8}_ֲϸ +#define THOST_FTDC_DUFN_DUFN_D 'D' +///^\d{8}_֤ +#define THOST_FTDC_DUFN_DUFN_M 'M' +///^\d{8}_Ȩִб +#define THOST_FTDC_DUFN_DUFN_S 'S' + +typedef char TThostFtdcDCEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEUploadFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +///^\d{4}_\d{8}_\d{8}_\d{8}_DailyFundChg_CNY +#define THOST_FTDC_SUFN_SUFN_O 'O' +///^\d{4}_\d{8}_\d{8}_\d{8}_Trade_CNY +#define THOST_FTDC_SUFN_SUFN_T 'T' +///^\d{4}_\d{8}_\d{8}_\d{8}_SettlementDetail_CNY +#define THOST_FTDC_SUFN_SUFN_P 'P' +///^\d{4}_\d{8}_\d{8}_\d{8}_Capital_CNY +#define THOST_FTDC_SUFN_SUFN_F 'F' + +typedef char TThostFtdcSHFEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFFEXUploadFileNameTypeһнļ +///////////////////////////////////////////////////////////////////////// +///^\d{4}_SG\d{1}_\d{8}_\d{1}_Trade +#define THOST_FTDC_CFUFN_SUFN_T 'T' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_SettlementDetail +#define THOST_FTDC_CFUFN_SUFN_P 'P' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_Capital +#define THOST_FTDC_CFUFN_SUFN_F 'F' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_OptionExec +#define THOST_FTDC_CFUFN_SUFN_S 'S' + +typedef char TThostFtdcCFFEXUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderRefTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExecOrderRefType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderLocalidTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExecOrderLocalidType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerExecOrderseqTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBrokerExecOrderseqType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerFlagTypeһ͹˾״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_BF_InActive '0' +///Ծ +#define THOST_FTDC_BF_Active '1' + +typedef char TThostFtdcBrokerFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommodityIDTypeһƷִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommodityIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommodityNameTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommodityNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentFlagTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_INF_Normal '1' + +typedef char TThostFtdcInstrumentFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorFlagTypeһͶ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IVF_Normal '1' + +typedef char TThostFtdcInvestorFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCorporateClassifyTypeһ˿ͻ +///////////////////////////////////////////////////////////////////////// +///ҵ +#define THOST_FTDC_CC_Company '1' + +typedef char TThostFtdcCorporateClassifyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleEntityIDTypeһʵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettleEntityIDType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleEntityTypeTypeһʵ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_SET_Investor 'a' + +typedef char TThostFtdcSettleEntityTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsAllowedTypeһǷ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IA_NotAllowed '0' +/// +#define THOST_FTDC_IA_Allowed '1' + +typedef char TThostFtdcIsAllowedType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLevelTypeһ +///////////////////////////////////////////////////////////////////////// +///һ +#define THOST_FTDC_L_One '1' +/// +#define THOST_FTDC_L_Two '2' + +typedef char TThostFtdcLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSecurityVarietiyIDTypeһм֤ȯƷִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSecurityVarietiyIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSecurityVarietiyNameTypeһм֤ȯƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSecurityVarietiyNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetNameTypeһֵλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOffsetNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessTypeNameTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessTypeNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransactionNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTransactionNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperateTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +///ղ +#define THOST_FTDC_OPTY_None '0' +/// +#define THOST_FTDC_OPTY_Add '1' +///޸ +#define THOST_FTDC_OPTY_Update '2' +///ɾ +#define THOST_FTDC_OPTY_Delete '3' + +typedef char TThostFtdcOperateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperateNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcOperateNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcShortMemoTypeһע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcShortMemoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperationStatusTypeһ״ֶ̬ +///////////////////////////////////////////////////////////////////////// +///δı +#define THOST_FTDC_OPS_UnChange '0' +/// +#define THOST_FTDC_OPS_Add '1' +///޸ +#define THOST_FTDC_OPS_Modify '2' +///ɾ +#define THOST_FTDC_OPS_Delete '3' + +typedef char TThostFtdcOperationStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDelivFeeClassTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_DFO_Exchange '1' +///Ͷ߽ +#define THOST_FTDC_DFO_Investor '2' + +typedef char TThostFtdcDelivFeeClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderRefTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExecOrderRefType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderLocalidTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExecOrderLocalidType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerExecOrderseqTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBrokerExecOrderseqType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMaxMarginProductGroupIdTypeһ߲Ʒ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMaxMarginProductGroupIdType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountRangeTypeһʽ˺ŷΧ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AR_All '1' +///һʽ˺ +#define THOST_FTDC_AR_Single '3' + +typedef char TThostFtdcAccountRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAppConnectStatusTypeһ̻״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_ACS_NotConnected '1' +///Ѿ½׺ +#define THOST_FTDC_ACS_Logged '2' +///Ѿӽ +#define THOST_FTDC_ACS_ExgConnected '3' +///Ѿ½ +#define THOST_FTDC_ACS_ExgLogged '4' + +typedef char TThostFtdcAppConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRemarkTypeһע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRemarkType[37]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeApiStatusTypeһApi״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_EAS_NotConnected '1' +///Ѿӽ +#define THOST_FTDC_EAS_ExgConnected '2' +///Ѿ½ +#define THOST_FTDC_EAS_ExgLogged '3' +///ѾѯԼ +#define THOST_FTDC_EAS_QryInstrumentSent '4' +///ѾȡϢ +#define THOST_FTDC_EAS_GotInformation '5' +/// +#define THOST_FTDC_EAS_SubTopic '6' + +typedef char TThostFtdcExchangeApiStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDisplayFactorTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcDisplayFactorType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFractionTypeTypeһ۹ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFractionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderReturnTypeTypeһر +///////////////////////////////////////////////////////////////////////// +///ر +#define THOST_FTDC_ODRTNT_RtnOrder '0' +///ر +#define THOST_FTDC_ODRTNT_RtnCancel '1' +///ĵر +#define THOST_FTDC_ODRTNT_RtnModify '2' + +typedef char TThostFtdcOrderReturnTypeType; + +#endif diff --git a/include/CTP_INTER/ThostFtdcUserApiStruct.h b/include/CTP_INTER/ThostFtdcUserApiStruct.h new file mode 100644 index 0000000..ac07f60 --- /dev/null +++ b/include/CTP_INTER/ThostFtdcUserApiStruct.h @@ -0,0 +1,8076 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcUserApiStruct.h +///@brief ˿ͻ˽ӿʹõҵݽṹ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCSTRUCT_H) +#define THOST_FTDCSTRUCT_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ThostFtdcUserApiDataType.h" + +///Ϣַ +struct CThostFtdcDisseminationField +{ + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///к + TThostFtdcSequenceNoType SequenceNo; +}; + +///û¼ +struct CThostFtdcReqUserLoginField +{ + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///նIPַ + TThostFtdcIPAddressType ClientIPAddress; + /// + TThostFtdcLanguageTypeType Lang; + ///¼ע + TThostFtdcRemarkType Remark; +}; + +///û¼Ӧ +struct CThostFtdcRspUserLoginField +{ + /// + TThostFtdcDateType TradingDay; + ///¼ɹʱ + TThostFtdcTimeType LoginTime; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Դʱ + TThostFtdcTimeType INETime; + /// + TThostFtdcLanguageTypeType Lang; + ///֥Ӹҵ + TThostFtdcTimeType CMETime; +}; + +///ûdz +struct CThostFtdcUserLogoutField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ǿƽԱ˳ +struct CThostFtdcForceUserLogoutField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ͻ֤ +struct CThostFtdcReqAuthenticateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤ + TThostFtdcAuthCodeType AuthCode; +}; + +///ͻ֤Ӧ +struct CThostFtdcRspAuthenticateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; +}; + +///ͻ֤Ϣ +struct CThostFtdcAuthenticationInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤Ϣ + TThostFtdcAuthInfoType AuthInfo; + ///ǷΪ֤ + TThostFtdcBoolType IsResult; + /// + TThostFtdcLanguageTypeType Lang; +}; + +///תʱͷ +struct CThostFtdcTransferHeaderField +{ + ///汾ţ1.0 + TThostFtdcVersionType Version; + ///״룬 + TThostFtdcTradeCodeType TradeCode; + ///ڣʽyyyymmdd + TThostFtdcTradeDateType TradeDate; + ///ʱ䣬ʽhhmmss + TThostFtdcTradeTimeType TradeTime; + ///ˮţN/A + TThostFtdcTradeSerialType TradeSerial; + ///ڻ˾룬 + TThostFtdcFutureIDType FutureID; + ///д룬ݲѯеõ + TThostFtdcBankIDType BankID; + ///зĴ룬ݲѯеõ + TThostFtdcBankBrchIDType BankBrchID; + ///ԱN/A + TThostFtdcOperNoType OperNo; + ///豸ͣN/A + TThostFtdcDeviceIDType DeviceID; + ///¼N/A + TThostFtdcRecordNumType RecordNum; + ///ỰţN/A + TThostFtdcSessionIDType SessionID; + ///ţN/A + TThostFtdcRequestIDType RequestID; +}; + +///ʽתڻTradeCode=202001 +struct CThostFtdcTransferBankToFutureReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ʽתڻӦ +struct CThostFtdcTransferBankToFutureRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ڻʽתTradeCode=202002 +struct CThostFtdcTransferFutureToBankReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ڻʽתӦ +struct CThostFtdcTransferFutureToBankRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯʽTradeCode=204002 +struct CThostFtdcTransferQryBankReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯʽӦ +struct CThostFtdcTransferQryBankRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + /// + TThostFtdcMoneyType TradeAmt; + ///п + TThostFtdcMoneyType UseAmt; + ///пȡ + TThostFtdcMoneyType FetchAmt; + /// + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯнϸTradeCode=204999 +struct CThostFtdcTransferQryDetailReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; +}; + +///ѯнϸӦ +struct CThostFtdcTransferQryDetailRspField +{ + /// + TThostFtdcDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///ڻˮ + TThostFtdcTradeSerialNoType FutureSerial; + ///ڻ˾ + TThostFtdcFutureIDType FutureID; + ///ʽʺ + TThostFtdcFutureAccountType FutureAccount; + ///ˮ + TThostFtdcTradeSerialNoType BankSerial; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + ///˺ + TThostFtdcBankAccountType BankAccount; + ///֤ + TThostFtdcCertCodeType CertCode; + ///Ҵ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcMoneyType TxAmount; + ///Ч־ + TThostFtdcTransferValidFlagType Flag; +}; + +///ӦϢ +struct CThostFtdcRspInfoField +{ + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +/// +struct CThostFtdcExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcExchangeNameType ExchangeName; + /// + TThostFtdcExchangePropertyType ExchangeProperty; +}; + +///Ʒ +struct CThostFtdcProductField +{ + ///Ʒִ + TThostFtdcProductIDType ProductID; + ///Ʒ + TThostFtdcProductNameType ProductName; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceTickType PriceTick; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///ֲ + TThostFtdcPositionModeType PositionMode; + ///ֲ + TThostFtdcPositionDateModeType PositionDateMode; + ///ƽִ + TThostFtdcCloseDealTypeType CloseDealType; + ///ױ + TThostFtdcCurrencyIDType TradeCurrencyID; + ///Ѻʽ÷Χ + TThostFtdcMortgageFundUseRangeType MortgageFundUseRange; + ///Ʒ + TThostFtdcProductIDType ExchangeProductID; + ///Ʒ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; + ///г + TThostFtdcSubExchangeIDType SubExchangeID; + ///ֵλ + TThostFtdcCurrencyUnitType ExchangeCurrencyUnit; +}; + +///Լ +struct CThostFtdcInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentNameType InstrumentName; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒִ + TThostFtdcProductIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + /// + TThostFtdcYearType DeliveryYear; + /// + TThostFtdcMonthType DeliveryMonth; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceTickType PriceTick; + /// + TThostFtdcDateType CreateDate; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcDateType ExpireDate; + ///ʼ + TThostFtdcDateType StartDelivDate; + /// + TThostFtdcDateType EndDelivDate; + ///Լ״̬ + TThostFtdcInstLifePhaseType InstLifePhase; + ///ǰǷ + TThostFtdcBoolType IsTrading; + ///ֲ + TThostFtdcPositionModeType PositionMode; + ///ֲ + TThostFtdcPositionDateModeType PositionDateMode; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatio; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatio; + ///֤߱㷨 + TThostFtdcMaxMarginSideAlgorithmType MaxMarginSideAlgorithm; + ///Ʒ + TThostFtdcInstrumentIDType UnderlyingInstrID; + ///ִм + TThostFtdcPriceType StrikePrice; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType; + ///Ʒ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; + /// + TThostFtdcCombinationTypeType CombinationType; + ///г + TThostFtdcSubExchangeIDType SubExchangeID; + ///۸ + TThostFtdcDisplayFactorType DisplayFactor; + ///۹1 + TThostFtdcFractionTypeType MainFraction; + ///۹2 + TThostFtdcFractionTypeType SubFraction; +}; + +///͹˾ +struct CThostFtdcBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ + TThostFtdcBrokerAbbrType BrokerAbbr; + ///͹˾ + TThostFtdcBrokerNameType BrokerName; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///Ա +struct CThostFtdcTraderField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///ʹõ + TThostFtdcSubjectIDType SubjectID; + ///IPƷΧ + TThostFtdcIPAddressType IpRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///Ͷ +struct CThostFtdcInvestorField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcDateType OpenDate; + ///ֻ + TThostFtdcMobileType Mobile; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ױ +struct CThostFtdcTradingCodeField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ױ + TThostFtdcClientIDModeType ClientIDMode; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///Ա;͹˾ձ +struct CThostFtdcPartBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///͹˾ + TThostFtdcPartTypeType ParticipantType; +}; + +///û +struct CThostFtdcSuperUserField +{ + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + /// + TThostFtdcPasswordType Password; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///ûȨ +struct CThostFtdcSuperUserFunctionField +{ + ///û + TThostFtdcUserIDType UserID; + ///ܴ + TThostFtdcFunctionCodeType FunctionCode; +}; + +///Ͷ +struct CThostFtdcInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ߷ + TThostFtdcInvestorGroupNameType InvestorGroupName; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ϴѺ + TThostFtdcMoneyType PreMortgage; + ///ϴö + TThostFtdcMoneyType PreCredit; + ///ϴδ + TThostFtdcMoneyType PreDeposit; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///Ϣ + TThostFtdcMoneyType InterestBase; + ///Ϣ + TThostFtdcMoneyType Interest; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + ///ʽ + TThostFtdcMoneyType Available; + ///ȡʽ + TThostFtdcMoneyType WithdrawQuota; + ///׼ + TThostFtdcMoneyType Reserve; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ö + TThostFtdcMoneyType Credit; + ///Ѻ + TThostFtdcMoneyType Mortgage; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///Ͷ߽֤ + TThostFtdcMoneyType DeliveryMargin; + ///֤ + TThostFtdcMoneyType ExchangeDeliveryMargin; + ///ڻ׼ + TThostFtdcMoneyType ReserveBalance; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ϴλ + TThostFtdcMoneyType PreFundMortgageIn; + ///ϴλʳ + TThostFtdcMoneyType PreFundMortgageOut; + /// + TThostFtdcMoneyType FundMortgageIn; + ///ʳ + TThostFtdcMoneyType FundMortgageOut; + ///Ѻ + TThostFtdcMoneyType FundMortgageAvailable; + ///Ѻҽ + TThostFtdcMoneyType MortgageableFund; + ///Ʒռñ֤ + TThostFtdcMoneyType SpecProductMargin; + ///Ʒᱣ֤ + TThostFtdcMoneyType SpecProductFrozenMargin; + ///Ʒ + TThostFtdcMoneyType SpecProductCommission; + ///Ʒ + TThostFtdcMoneyType SpecProductFrozenCommission; + ///Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfit; + ///Ʒƽӯ + TThostFtdcMoneyType SpecProductCloseProfit; + ///ݳֲӯ㷨Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfitByAlg; + ///Ʒ֤ + TThostFtdcMoneyType SpecProductExchangeMargin; + /// + TThostFtdcCurrencyNameType CurrencyName; + ///άֱ֤ + TThostFtdcMoneyType MaintenMargin; + ///άֱ֤ + TThostFtdcMoneyType ExchangeMaintenMargin; +}; + +///Ͷֲ߳ +struct CThostFtdcInvestorPositionField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcPositionDateType PositionDate; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ǰֲ + TThostFtdcVolumeType Position; + ///ͷ + TThostFtdcVolumeType LongFrozen; + ///ͷ + TThostFtdcVolumeType ShortFrozen; + ///ͷ + TThostFtdcMoneyType LongFrozenAmount; + ///ͷ + TThostFtdcMoneyType ShortFrozenAmount; + /// + TThostFtdcVolumeType OpenVolume; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ֽ + TThostFtdcMoneyType OpenAmount; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ֲֳɱ + TThostFtdcMoneyType PositionCost; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ֳɱ + TThostFtdcMoneyType OpenCost; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///ϳɽγɵijֲ + TThostFtdcVolumeType CombPosition; + ///϶ͷ + TThostFtdcVolumeType CombLongFrozen; + ///Ͽͷ + TThostFtdcVolumeType CombShortFrozen; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///ճֲ + TThostFtdcVolumeType TodayPosition; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ִж + TThostFtdcVolumeType StrikeFrozen; + ///ִж + TThostFtdcMoneyType StrikeFrozenAmount; + ///ִж + TThostFtdcVolumeType AbandonFrozen; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ױ + TThostFtdcClientIDType ClientID; + ///άֱ֤ + TThostFtdcMoneyType MaintenMargin; + ///άֱ֤ + TThostFtdcMoneyType ExchMaintenMargin; +}; + +///Լ֤ +struct CThostFtdcInstrumentMarginRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ͷάֱ֤ + TThostFtdcRatioType LMaintenMarginRatioByMoney; + ///ͷάֱ֤ + TThostFtdcMoneyType LMaintenMarginRatioByVolume; + ///ͷάֱ֤ + TThostFtdcRatioType SMaintenMarginRatioByMoney; + ///ͷάֱ֤ + TThostFtdcMoneyType SMaintenMarginRatioByVolume; +}; + +///Լ +struct CThostFtdcInstrumentCommissionRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +/// +struct CThostFtdcDepthMarketDataField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; + ///վ + TThostFtdcPriceType AveragePrice; + ///ҵ + TThostFtdcDateType ActionDay; + /// + TThostFtdcPriceType BidPrice6; + /// + TThostFtdcVolumeType BidVolume6; + /// + TThostFtdcPriceType AskPrice6; + /// + TThostFtdcVolumeType AskVolume6; + /// + TThostFtdcPriceType BidPrice7; + /// + TThostFtdcVolumeType BidVolume7; + /// + TThostFtdcPriceType AskPrice7; + /// + TThostFtdcVolumeType AskVolume7; + ///۰ + TThostFtdcPriceType BidPrice8; + /// + TThostFtdcVolumeType BidVolume8; + ///۰ + TThostFtdcPriceType AskPrice8; + /// + TThostFtdcVolumeType AskVolume8; + ///۾ + TThostFtdcPriceType BidPrice9; + /// + TThostFtdcVolumeType BidVolume9; + ///۾ + TThostFtdcPriceType AskPrice9; + /// + TThostFtdcVolumeType AskVolume9; + ///ʮ + TThostFtdcPriceType BidPrice10; + ///ʮ + TThostFtdcVolumeType BidVolume10; + ///ʮ + TThostFtdcPriceType AskPrice10; + ///ʮ + TThostFtdcVolumeType AskVolume10; +}; + +///ͶߺԼȨ +struct CThostFtdcInstrumentTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ȩ + TThostFtdcTradingRightType TradingRight; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///͹˾û +struct CThostFtdcBrokerUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + ///û + TThostFtdcUserTypeType UserType; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///Ƿʹ + TThostFtdcBoolType IsUsingOTP; +}; + +///͹˾û +struct CThostFtdcBrokerUserPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; +}; + +///͹˾ûȨ +struct CThostFtdcBrokerUserFunctionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///͹˾ܴ + TThostFtdcBrokerFunctionCodeType BrokerFunctionCode; +}; + +///ͶʵԪ +struct CThostFtdcInvestUnitField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ͶʵԪ + TThostFtdcPartyNameType InvestUnitName; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + ///ͶʵԪĬʽʺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///Ա̻ +struct CThostFtdcTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///Ӧ + TThostFtdcAppNameType AppName; + ///б + TThostFtdcRunIDType RunID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///IPƷΧ + TThostFtdcIPAddressType IpRange; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ + TThostFtdcPartTypeType ParticipantType; +}; + +///Ͷ߽ +struct CThostFtdcInvestorSettlementInfoField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType Content; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///֤ +struct CThostFtdcExchangeMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͷάֱ֤ + TThostFtdcRatioType LMaintenMarginRatioByMoney; + ///ͷάֱ֤ + TThostFtdcMoneyType LMaintenMarginRatioByVolume; + ///ͷάֱ֤ + TThostFtdcRatioType SMaintenMarginRatioByMoney; + ///ͷάֱ֤ + TThostFtdcMoneyType SMaintenMarginRatioByVolume; +}; + +/// +struct CThostFtdcExchangeRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Դֵλ + TThostFtdcCurrencyUnitType FromCurrencyUnit; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; + /// + TThostFtdcExchangeRateType ExchangeRate; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +/// +struct CThostFtdcSettlementRefField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; +}; + +///ǰʱ +struct CThostFtdcCurrentTimeField +{ + ///ǰ + TThostFtdcDateType CurrDate; + ///ǰʱ + TThostFtdcTimeType CurrTime; + ///ǰʱ䣨룩 + TThostFtdcMillisecType CurrMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +///ͨѶ׶ +struct CThostFtdcCommPhaseField +{ + /// + TThostFtdcDateType TradingDay; + ///ͨѶʱα + TThostFtdcCommPhaseNoType CommPhaseNo; + ///ϵͳ + TThostFtdcSystemIDType SystemID; +}; + +///¼Ϣ +struct CThostFtdcLoginInfoField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + /// + TThostFtdcPasswordType Password; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///Դʱ + TThostFtdcTimeType INETime; + /// + TThostFtdcLanguageTypeType Lang; + ///¼ע + TThostFtdcRemarkType Remark; +}; + +///¼Ϣ +struct CThostFtdcLogoutAllField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; +}; + +///û +struct CThostFtdcUserPasswordUpdateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; +}; + +///뱨 +struct CThostFtdcInputOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///־ + TThostFtdcBoolType IsSwapOrder; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; +}; + +/// +struct CThostFtdcOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ + TThostFtdcVolumeType ZCETotalTradedVolume; + ///־ + TThostFtdcBoolType IsSwapOrder; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +/// +struct CThostFtdcExchangeOrderField +{ + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ر + TThostFtdcOrderReturnTypeType OrderReturnType; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; +}; + +///ʧ +struct CThostFtdcExchangeOrderInsertErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///뱨 +struct CThostFtdcInputOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +/// +struct CThostFtdcOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +/// +struct CThostFtdcExchangeOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcDirectionType Direction; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcContingentConditionType ContingentCondition; +}; + +///ʧ +struct CThostFtdcExchangeOrderActionErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///ĵ۸ + TThostFtdcPriceType LimitPrice; + ///ĵ + TThostFtdcVolumeType VolumeChange; + ///ĵֹ۸ + TThostFtdcPriceType StopPrice; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcContingentConditionType ContingentCondition; +}; + +///ɽ +struct CThostFtdcExchangeTradeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; +}; + +///ɽ +struct CThostFtdcTradeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ɽԴ + TThostFtdcTradeSourceType TradeSource; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ûỰ +struct CThostFtdcUserSessionField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; + /// + TThostFtdcLanguageTypeType Lang; + ///û + TThostFtdcUserTypeType UserType; + ///Ƿѵ¼ + TThostFtdcBoolType IsLogin; + ///¼ע + TThostFtdcRemarkType Remark; +}; + +///ѯ󱨵 +struct CThostFtdcQueryMaxOrderVolumeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///Ͷ߽ȷϢ +struct CThostFtdcInvestorSettlementInfoConfirmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ȷ + TThostFtdcDateType ConfirmDate; + ///ȷʱ + TThostFtdcTimeType ConfirmTime; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ͬ +struct CThostFtdcSyncDepositField +{ + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcMoneyType Deposit; + ///Ƿǿƽ + TThostFtdcBoolType IsForce; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///Ѻͬ +struct CThostFtdcSyncFundMortgageField +{ + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դʺ + TThostFtdcAccountIDType SourceAccountID; + ///Ŀʺ + TThostFtdcAccountIDType TargetAccountID; + ///Դ + TThostFtdcCurrencyIDType SourceCurrencyID; + ///Ŀ + TThostFtdcCurrencyIDType TargetCurrencyID; + ///Ѻ + TThostFtdcMoneyType MortgageAmount; +}; + +///ѯ +struct CThostFtdcQryOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯɽ +struct CThostFtdcQryTradeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + ///ʼʱ + TThostFtdcTimeType TradeTimeStart; + ///ʱ + TThostFtdcTimeType TradeTimeEnd; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯͶֲ߳ +struct CThostFtdcQryInvestorPositionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯʽ˻ +struct CThostFtdcQryTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯͶ +struct CThostFtdcQryInvestorField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ѯױ +struct CThostFtdcQryTradingCodeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ױ + TThostFtdcClientIDModeType ClientIDMode; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯͶ +struct CThostFtdcQryInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯԼ֤ +struct CThostFtdcQryInstrumentMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ +struct CThostFtdcQryInstrumentCommissionRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯԼȨ +struct CThostFtdcQryInstrumentTradingRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ͹˾ +struct CThostFtdcQryBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯԱ +struct CThostFtdcQryTraderField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯûȨ +struct CThostFtdcQrySuperUserFunctionField +{ + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯûỰ +struct CThostFtdcQryUserSessionField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ͹˾Ա +struct CThostFtdcQryPartBrokerField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; +}; + +///ѯ +struct CThostFtdcQryExchangeOrderField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯ +struct CThostFtdcQryOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯ +struct CThostFtdcQryExchangeOrderActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯû +struct CThostFtdcQrySuperUserField +{ + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ +struct CThostFtdcQryExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯƷ +struct CThostFtdcQryProductField +{ + ///Ʒִ + TThostFtdcProductIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + /// + TThostFtdcExchangeIDType ExchangeID; + ///г + TThostFtdcSubExchangeIDType SubExchangeID; +}; + +///ѯԼ +struct CThostFtdcQryInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒִ + TThostFtdcProductIDType ProductID; + ///г + TThostFtdcSubExchangeIDType SubExchangeID; +}; + +///ѯ +struct CThostFtdcQryDepthMarketDataField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ͹˾û +struct CThostFtdcQryBrokerUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ͹˾ûȨ +struct CThostFtdcQryBrokerUserFunctionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯͶʵԪ +struct CThostFtdcQryInvestUnitField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯԱ̻ +struct CThostFtdcQryTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯˮ +struct CThostFtdcQrySyncDepositField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; +}; + +///ѯͶ߽ +struct CThostFtdcQryInvestorSettlementInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; +}; + +///ѯ֤ +struct CThostFtdcQryExchangeMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ +struct CThostFtdcQryExchangeRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; +}; + +///ѯѺˮ +struct CThostFtdcQrySyncFundMortgageField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; +}; + +///ǰȨԼС֤ +struct CThostFtdcOptionInstrMiniMarginField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///λ֣ȨԼС֤ + TThostFtdcMoneyType MinMargin; + ///ȡֵʽ + TThostFtdcValueMethodType ValueMethod; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ǰȨԼ֤ϵ +struct CThostFtdcOptionInstrMarginAdjustField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷͷ֤ϵ + TThostFtdcRatioType SShortMarginRatioByMoney; + ///Ͷͷ֤ϵ + TThostFtdcMoneyType SShortMarginRatioByVolume; + ///ֵͷ֤ϵ + TThostFtdcRatioType HShortMarginRatioByMoney; + ///ֵͷ֤ϵ + TThostFtdcMoneyType HShortMarginRatioByVolume; + ///ͷ֤ϵ + TThostFtdcRatioType AShortMarginRatioByMoney; + ///ͷ֤ϵ + TThostFtdcMoneyType AShortMarginRatioByVolume; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; + ///̿ͷ֤ϵ + TThostFtdcRatioType MShortMarginRatioByMoney; + ///̿ͷ֤ϵ + TThostFtdcMoneyType MShortMarginRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ǰȨԼѵϸ +struct CThostFtdcOptionInstrCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///ִ + TThostFtdcRatioType StrikeRatioByMoney; + ///ִ + TThostFtdcRatioType StrikeRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///Ȩ׳ɱ +struct CThostFtdcOptionInstrTradeCostField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType FixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType MiniMargin; + ///ȨԼȨ + TThostFtdcMoneyType Royalty; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType ExchFixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType ExchMiniMargin; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///Ȩ׳ɱѯ +struct CThostFtdcQryOptionInstrTradeCostField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ + TThostFtdcPriceType InputPrice; + ///ļ۸,0 + TThostFtdcPriceType UnderlyingPrice; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///Ȩʲѯ +struct CThostFtdcQryOptionInstrCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ָָֻ +struct CThostFtdcIndexPriceField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ָֻ̼ + TThostFtdcPriceType ClosePrice; +}; + +///ִ +struct CThostFtdcInputExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; +}; + +///ִ +struct CThostFtdcInputExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ִ +struct CThostFtdcExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerExecOrderSeq; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ִ +struct CThostFtdcExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ִѯ +struct CThostFtdcQryExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ִϢ +struct CThostFtdcExchangeExecOrderField +{ + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; +}; + +///ִѯ +struct CThostFtdcQryExchangeExecOrderField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ִѯ +struct CThostFtdcQryExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ִ +struct CThostFtdcExchangeExecOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; +}; + +///ִѯ +struct CThostFtdcQryExchangeExecOrderActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ִ +struct CThostFtdcErrExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯִ +struct CThostFtdcQryErrExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ִ +struct CThostFtdcErrExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯִ +struct CThostFtdcQryErrExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ͶȨԼȨ +struct CThostFtdcOptionInstrTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDirectionType Direction; + ///Ȩ + TThostFtdcTradingRightType TradingRight; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯȨԼȨ +struct CThostFtdcQryOptionInstrTradingRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ +struct CThostFtdcInputForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ +struct CThostFtdcForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ѯ۱ + TThostFtdcSequenceNoType BrokerForQutoSeq; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ۲ѯ +struct CThostFtdcQryForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯϢ +struct CThostFtdcExchangeForQuoteField +{ + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ۲ѯ +struct CThostFtdcQryExchangeForQuoteField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ı +struct CThostFtdcInputQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ױ + TThostFtdcClientIDType ClientID; +}; + +///뱨۲ +struct CThostFtdcInputQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ױ + TThostFtdcClientIDType ClientID; +}; + +/// +struct CThostFtdcQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾۱ + TThostFtdcSequenceNoType BrokerQuoteSeq; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///۲ +struct CThostFtdcQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///۲ѯ +struct CThostFtdcQryQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///Ϣ +struct CThostFtdcExchangeQuoteField +{ + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; +}; + +///۲ѯ +struct CThostFtdcQryExchangeQuoteField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///۲ѯ +struct CThostFtdcQryQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///۲ +struct CThostFtdcExchangeQuoteActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; +}; + +///۲ѯ +struct CThostFtdcQryExchangeQuoteActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ȨԼdeltaֵ +struct CThostFtdcOptionInstrDeltaField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Deltaֵ + TThostFtdcRatioType Delta; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///̵ѯ +struct CThostFtdcForQuoteRspField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///ѯʱ + TThostFtdcTimeType ForQuoteTime; + ///ҵ + TThostFtdcDateType ActionDay; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ǰȨԼִƫֵϸ +struct CThostFtdcStrikeOffsetField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִƫֵ + TThostFtdcMoneyType Offset; +}; + +///Ȩִƫֵѯ +struct CThostFtdcQryStrikeOffsetField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +/// +struct CThostFtdcInputBatchOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///û + TThostFtdcUserIDType UserID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +/// +struct CThostFtdcBatchOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +/// +struct CThostFtdcExchangeBatchOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ +struct CThostFtdcQryBatchOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ϺԼȫϵ +struct CThostFtdcCombInstrumentGuardField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcRatioType GuarantRatio; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ϺԼȫϵѯ +struct CThostFtdcQryCombInstrumentGuardField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +/// +struct CThostFtdcInputCombActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +/// +struct CThostFtdcCombActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϱ + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///״̬ + TThostFtdcOrderActionStatusType ActionStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ϲѯ +struct CThostFtdcQryCombActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///Ϣ +struct CThostFtdcExchangeCombActionField +{ + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϱ + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///״̬ + TThostFtdcOrderActionStatusType ActionStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcSequenceNoType SequenceNo; +}; + +///ϲѯ +struct CThostFtdcQryExchangeCombActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///Ʒۻ +struct CThostFtdcProductExchRateField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///۱ + TThostFtdcCurrencyIDType QuoteCurrencyID; + /// + TThostFtdcExchangeRateType ExchangeRate; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ʒۻʲѯ +struct CThostFtdcQryProductExchRateField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯѯۼ۲ +struct CThostFtdcQryForQuoteParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯۼ۲ +struct CThostFtdcForQuoteParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///¼ + TThostFtdcPriceType LastPrice; + ///۲ + TThostFtdcPriceType PriceInterval; +}; + +///ǰѵϸ +struct CThostFtdcOrderCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcRatioType OrderCommByVolume; + /// + TThostFtdcRatioType OrderActionCommByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ʲѯ +struct CThostFtdcQryOrderCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///г +struct CThostFtdcMarketDataField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +/// +struct CThostFtdcMarketDataBaseField +{ + /// + TThostFtdcDateType TradingDay; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + ///ʵ + TThostFtdcRatioType PreDelta; +}; + +///龲̬ +struct CThostFtdcMarketDataStaticField +{ + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcPriceType ClosePrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ʵ + TThostFtdcRatioType CurrDelta; +}; + +///³ɽ +struct CThostFtdcMarketDataLastMatchField +{ + ///¼ + TThostFtdcPriceType LastPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; +}; + +///ż +struct CThostFtdcMarketDataBestPriceField +{ + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; +}; + +/// +struct CThostFtdcMarketDataBid23Field +{ + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; +}; + +/// +struct CThostFtdcMarketDataAsk23Field +{ + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; +}; + +///ġ +struct CThostFtdcMarketDataBid45Field +{ + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; +}; + +///ġ +struct CThostFtdcMarketDataAsk45Field +{ + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; +}; + +///ʱ +struct CThostFtdcMarketDataUpdateTimeField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +/// +struct CThostFtdcMarketDataBid67Field +{ + /// + TThostFtdcPriceType BidPrice6; + /// + TThostFtdcVolumeType BidVolume6; + /// + TThostFtdcPriceType BidPrice7; + /// + TThostFtdcVolumeType BidVolume7; +}; + +/// +struct CThostFtdcMarketDataAsk67Field +{ + /// + TThostFtdcPriceType AskPrice6; + /// + TThostFtdcVolumeType AskVolume6; + /// + TThostFtdcPriceType AskPrice7; + /// + TThostFtdcVolumeType AskVolume7; +}; + +///ˡ +struct CThostFtdcMarketDataBid89Field +{ + ///۰ + TThostFtdcPriceType BidPrice8; + /// + TThostFtdcVolumeType BidVolume8; + ///۾ + TThostFtdcPriceType BidPrice9; + /// + TThostFtdcVolumeType BidVolume9; +}; + +///ˡ +struct CThostFtdcMarketDataAsk89Field +{ + ///۰ + TThostFtdcPriceType AskPrice8; + /// + TThostFtdcVolumeType AskVolume8; + ///۾ + TThostFtdcPriceType AskPrice9; + /// + TThostFtdcVolumeType AskVolume9; +}; + +///ʮ +struct CThostFtdcMarketData10Field +{ + ///ʮ + TThostFtdcPriceType AskPrice10; + ///ʮ + TThostFtdcVolumeType AskVolume10; + ///ʮ + TThostFtdcPriceType BidPrice10; + ///ʮ + TThostFtdcVolumeType BidVolume10; +}; + +///齻 +struct CThostFtdcMarketDataExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ָĺԼ +struct CThostFtdcSpecificInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Լ״̬ +struct CThostFtdcInstrumentStatusField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcSettlementGroupIDType SettlementGroupID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Լ״̬ + TThostFtdcInstrumentStatusType InstrumentStatus; + ///׽׶α + TThostFtdcTradingSegmentSNType TradingSegmentSN; + ///뱾״̬ʱ + TThostFtdcTimeType EnterTime; + ///뱾״̬ԭ + TThostFtdcInstStatusEnterReasonType EnterReason; + ///뱾״̬ + TThostFtdcDateType EnterDate; +}; + +///ѯԼ״̬ +struct CThostFtdcQryInstrumentStatusField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; +}; + +///ӯ㷨 +struct CThostFtdcPositionProfitAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///ע + TThostFtdcMemoType Memo; +}; + +///ѯת +struct CThostFtdcQryTransferBankField +{ + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; +}; + +///ת +struct CThostFtdcTransferBankField +{ + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///ѯͶֲ߳ϸ +struct CThostFtdcQryInvestorPositionDetailField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///Ͷֲ߳ϸ +struct CThostFtdcInvestorPositionDetailField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcDateType OpenDate; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcVolumeType Volume; + ///ּ + TThostFtdcPriceType OpenPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///նгֲӯ + TThostFtdcMoneyType PositionProfitByDate; + ///ʶԳֲӯ + TThostFtdcMoneyType PositionProfitByTrade; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + /// + TThostFtdcPriceType LastSettlementPrice; + /// + TThostFtdcPriceType SettlementPrice; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ױ + TThostFtdcClientIDType ClientID; + ///Ͷάֱ֤ + TThostFtdcMoneyType MaintenMargin; + ///άֱ֤ + TThostFtdcMoneyType ExchMaintenMargin; + ///άֱ֤ + TThostFtdcRatioType MaintenMarginRateByMoney; + ///άֱ֤() + TThostFtdcRatioType MaintenMarginRateByVolume; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcPasswordType Password; +}; + +///鱨̻ +struct CThostFtdcMDTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///Ӧ + TThostFtdcAppNameType AppName; + ///б + TThostFtdcRunIDType RunID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///IPƷΧ + TThostFtdcIPAddressType IpRange; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ + TThostFtdcPartTypeType ParticipantType; +}; + +///ѯ鱨̻ +struct CThostFtdcQryMDTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯͻ֪ͨ +struct CThostFtdcQryNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ͻ֪ͨ +struct CThostFtdcNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ϣ + TThostFtdcContentType Content; + ///к + TThostFtdcSequenceLabelType SequenceLabel; +}; + +///ûȨ +struct CThostFtdcUserRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ͻȨ + TThostFtdcUserRightTypeType UserRightType; + ///Ƿֹ + TThostFtdcBoolType IsForbidden; +}; + +///ѯϢȷ +struct CThostFtdcQryInvestorSettlementInfoConfirmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///͹˾ʽ㷨 +struct CThostFtdcBrokerWithdrawAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ʽ㷨 + TThostFtdcAlgorithmType WithdrawAlgorithm; + ///ʽʹ + TThostFtdcRatioType UsingRatio; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType IncludeCloseProfit; + ///޲޳ɽͻǷܿ + TThostFtdcAllWithoutTradeType AllWithoutTrade; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; + ///Ȩ㷨 + TThostFtdcBalanceAlgorithmType BalanceAlgorithm; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordUpdateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯϺԼ +struct CThostFtdcQryCombinationLegField +{ + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯͬ״̬ +struct CThostFtdcQrySyncStatusField +{ + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ͻ׺Լĵ +struct CThostFtdcCombinationLegField +{ + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + /// + TThostFtdcImplyLevelType ImplyLevel; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ͬ״̬ +struct CThostFtdcSyncStatusField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///к + TThostFtdcSequenceNoType SettlementNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͬ״̬ + TThostFtdcDataSyncStatusType DataSyncStatus; +}; + +///ѯϵ +struct CThostFtdcQryLinkManField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ϵ +struct CThostFtdcLinkManField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵ + TThostFtdcPersonTypeType PersonType; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + /// + TThostFtdcPartyNameType PersonName; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcZipCodeType ZipCode; + ///ȼ + TThostFtdcPriorityType Priority; + /// + TThostFtdcUOAZipCodeType UOAZipCode; + ///ȫ + TThostFtdcInvestorFullNameType PersonFullName; +}; + +///ѯ͹˾û¼ +struct CThostFtdcQryBrokerUserEventField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; +}; + +///ѯ͹˾û¼ +struct CThostFtdcBrokerUserEventField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; + ///û¼ + TThostFtdcSequenceNoType EventSequenceNo; + ///¼ + TThostFtdcDateType EventDate; + ///¼ʱ + TThostFtdcTimeType EventTime; + ///û¼Ϣ + TThostFtdcUserEventInfoType UserEventInfo; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯǩԼ +struct CThostFtdcQryContractBankField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; +}; + +///ѯǩԼӦ +struct CThostFtdcContractBankField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; +}; + +///Ͷϳֲϸ +struct CThostFtdcInvestorPositionCombineDetailField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + ///ֲ + TThostFtdcVolumeType TotalAmt; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ɽ + TThostFtdcTradeGroupIDType TradeGroupID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ױ + TThostFtdcClientIDType ClientID; +}; + +///Ԥ +struct CThostFtdcPrePayOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ԥ񱨵 + TThostFtdcPrePayOrderIDType PrePayOrderID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ״̬ + TThostFtdcPrePayOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///Ԥ񵥲 +struct CThostFtdcPrePayOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ԥ񳷵 + TThostFtdcPrePayOrderIDType PrePayOrderActionID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ񳷵״̬ + TThostFtdcPrePayOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯԤ +struct CThostFtdcQryPrePayOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯԤ񳷵 +struct CThostFtdcQryPrePayOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ɾԤ +struct CThostFtdcRemovePrePayOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񱨵 + TThostFtdcPrePayOrderIDType PrePayOrderID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ɾԤ񳷵 +struct CThostFtdcRemovePrePayOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񳷵 + TThostFtdcPrePayOrderIDType PrePayOrderActionID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///͹˾ʽ㷨CTPһΪͶ߿ʽ +struct CThostFtdcAccountWithdrawAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˻Χ + TThostFtdcAccountRangeType AccountRange; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ʽ + TThostFtdcRatioType UsingRatio; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; +}; + +///ѯϳֲϸ +struct CThostFtdcQryInvestorPositionCombineDetailField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ɽ +struct CThostFtdcMarketDataAveragePriceField +{ + ///վ + TThostFtdcPriceType AveragePrice; +}; + +///УͶ +struct CThostFtdcVerifyInvestorPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcPasswordType Password; +}; + +///ûIP +struct CThostFtdcUserIPField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///IPַ + TThostFtdcIPAddressType IPMask; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///û¼֪ͨϢ +struct CThostFtdcTradingNoticeInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʱ + TThostFtdcTimeType SendTime; + ///Ϣ + TThostFtdcContentType FieldContent; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///û¼֪ͨ +struct CThostFtdcTradingNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///û + TThostFtdcUserIDType UserID; + ///ʱ + TThostFtdcTimeType SendTime; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType FieldContent; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ¼֪ͨ +struct CThostFtdcQryTradingNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ󱨵 +struct CThostFtdcQryErrOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///󱨵 +struct CThostFtdcErrOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///У +struct CThostFtdcErrorConditionalOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ + TThostFtdcVolumeType ZCETotalTradedVolume; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯ󱨵 +struct CThostFtdcQryErrOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///󱨵 +struct CThostFtdcErrOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ״̬ +struct CThostFtdcQryExchangeSequenceField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///״̬ +struct CThostFtdcExchangeSequenceField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Լ״̬ + TThostFtdcInstrumentStatusType MarketStatus; +}; + +///ݼ۸ѯ󱨵 +struct CThostFtdcQueryMaxOrderVolumeWithPriceField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯ͹˾ײ +struct CThostFtdcQryBrokerTradingParamsField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///͹˾ײ +struct CThostFtdcBrokerTradingParamsField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///֤۸ + TThostFtdcMarginPriceTypeType MarginPriceType; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ȨȨ۸ + TThostFtdcOptionRoyaltyPriceTypeType OptionRoyaltyPriceType; +}; + +///ѯ͹˾ʽ +struct CThostFtdcQueryBrokerDepositField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///͹˾ʽ +struct CThostFtdcBrokerDepositField +{ + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ʽ + TThostFtdcMoneyType Available; + ///׼ + TThostFtdcMoneyType Reserve; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; +}; + +///û̬Ʋ +struct CThostFtdcBrokerUserOTPParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ṩ + TThostFtdcOTPVendorsIDType OTPVendorsID; + ///̬к + TThostFtdcSerialNumberType SerialNumber; + ///Կ + TThostFtdcAuthKeyType AuthKey; + ///ϴOTPƯֵ + TThostFtdcLastDriftType LastDrift; + ///ϴOTPɹֵ + TThostFtdcLastSuccessType LastSuccess; + ///̬ + TThostFtdcOTPTypeType OTPType; +}; + +///ֹͬû̬ +struct CThostFtdcManualSyncBrokerUserOTPField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ + TThostFtdcOTPTypeType OTPType; + ///һ̬ + TThostFtdcPasswordType FirstOTP; + ///ڶ̬ + TThostFtdcPasswordType SecondOTP; +}; + +///Ͷģ +struct CThostFtdcCommRateModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///ģ + TThostFtdcCommModelNameType CommModelName; +}; + +///ѯͶģ +struct CThostFtdcQryCommRateModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; +}; + +///Ͷ֤߱ģ +struct CThostFtdcMarginModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + ///ģ + TThostFtdcCommModelNameType MarginModelName; +}; + +///ѯͶ֤߱ģ +struct CThostFtdcQryMarginModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ֵ۵Ϣ +struct CThostFtdcEWarrantOffsetField +{ + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcVolumeType CloseVolume; +}; + +///ѯֵ۵Ϣ +struct CThostFtdcQryEWarrantOffsetField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ѯͶƷ/Ʒֱ֤ +struct CThostFtdcQryInvestorProductGroupMarginField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ͶƷ/Ʒֱ֤ +struct CThostFtdcInvestorProductGroupMarginField +{ + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType LongFrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType ShortFrozenMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ͷ֤ + TThostFtdcMoneyType LongUseMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortUseMargin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///ͷ֤ + TThostFtdcMoneyType LongExchMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortExchMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + /// + TThostFtdcMoneyType FrozenCommission; + /// + TThostFtdcMoneyType Commission; + ///ʽ + TThostFtdcMoneyType FrozenCash; + ///ʽ + TThostFtdcMoneyType CashIn; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///۵ܽ + TThostFtdcMoneyType OffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortOffsetAmount; + ///۵ܽ + TThostFtdcMoneyType ExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortExchOffsetAmount; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///άֱ֤ + TThostFtdcMoneyType MaintenMargin; + ///ͷάֱ֤ + TThostFtdcMoneyType LongMaintenMargin; + ///ͷάֱ֤ + TThostFtdcMoneyType ShortMaintenMargin; + ///άֱ֤ + TThostFtdcMoneyType ExchMaintenMargin; + ///ͷάֱ֤ + TThostFtdcMoneyType LongExchMaintenMargin; + ///ͷάֱ֤ + TThostFtdcMoneyType ShortExchMaintenMargin; +}; + +///ѯû +struct CThostFtdcQueryCFMMCTradingAccountTokenField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///û +struct CThostFtdcCFMMCTradingAccountTokenField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬ + TThostFtdcCFMMCTokenType Token; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; +}; + +///ѯƷ +struct CThostFtdcQryProductGroupField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ͶƷ/Ʒֱ֤Ʒ +struct CThostFtdcProductGroupField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductGroupID; +}; + +///תʿ +struct CThostFtdcReqOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcRequestIDType RequestID; +}; + +///תʿӦ +struct CThostFtdcRspOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcRequestIDType RequestID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ת +struct CThostFtdcReqCancelAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcRequestIDType RequestID; +}; + +///תӦ +struct CThostFtdcRspCancelAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcRequestIDType RequestID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///˻ +struct CThostFtdcReqChangeAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; + /// + TThostFtdcRequestIDType RequestID; +}; + +///˻Ӧ +struct CThostFtdcRspChangeAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; + /// + TThostFtdcRequestIDType RequestID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ת +struct CThostFtdcReqTransferField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; +}; + +///зʽתڻӦ +struct CThostFtdcRspTransferField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +/// +struct CThostFtdcReqRepealField +{ + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; +}; + +///Ӧ +struct CThostFtdcRspRepealField +{ + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ˻Ϣ +struct CThostFtdcReqQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ѯ˻ϢӦ +struct CThostFtdcRspQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; +}; + +///ǩǩ +struct CThostFtdcFutureSignIOField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ǩӦ +struct CThostFtdcRspFutureSignInField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; +}; + +///ǩ +struct CThostFtdcReqFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ǩӦ +struct CThostFtdcRspFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///׺ڱ̷Կͬ +struct CThostFtdcReqSyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///׺ڱ̷ԿͬӦ +struct CThostFtdcRspSyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ˻Ϣ֪ͨ +struct CThostFtdcNotifyQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ת˽ˮ +struct CThostFtdcTransferSerialField +{ + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateSerial; + ///׷ + TThostFtdcTradeDateType TradeDate; + /// + TThostFtdcDateType TradingDay; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///Ự + TThostFtdcSessionIDType SessionID; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///ڻ˾ʺ + TThostFtdcFutureAccTypeType FutureAccType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///׽ + TThostFtdcTradeAmountType TradeAmount; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///Ч־ + TThostFtdcAvailabilityFlagType AvailabilityFlag; + ///Ա + TThostFtdcOperatorCodeType OperatorCode; + ///ʺ + TThostFtdcBankAccountType BankNewAccount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯתˮ +struct CThostFtdcQryTransferSerialField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ǩ֪ͨ +struct CThostFtdcNotifyFutureSignInField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; +}; + +///ǩ֪ͨ +struct CThostFtdcNotifyFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///׺ڱ̷Կ֪ͬͨ +struct CThostFtdcNotifySyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯǩԼϵ +struct CThostFtdcQryAccountregisterField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ͻϢ +struct CThostFtdcAccountregisterField +{ + /// + TThostFtdcTradeDateType TradeDay; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///ڻ˾֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcOpenOrDestroyType OpenOrDestroy; + ///ǩԼ + TThostFtdcTradeDateType RegDate; + ///Լ + TThostFtdcTradeDateType OutDate; + ///ID + TThostFtdcTIDType TID; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; +}; + +///ڿϢ +struct CThostFtdcOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcRequestIDType RequestID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///Ϣ +struct CThostFtdcCancelAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcRequestIDType RequestID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ڱ˺Ϣ +struct CThostFtdcChangeAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; + /// + TThostFtdcRequestIDType RequestID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ʽ˺Źϵ +struct CThostFtdcAccountOwnerShipField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcInvestorIDType AccountOwner; + ///ʽ˺ + TThostFtdcAccountOwnerModeType AccountOwnerMode; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///ͻ֤ +struct CThostFtdcAuthenticationCodeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤ + TThostFtdcAuthCodeType AuthCode; + ///֤ + TThostFtdcAuthCodeType PreAuthCode; +}; + +///ܹ֯ +struct CThostFtdcDepartmentField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ܹ֯ + TThostFtdcInvestorIDType DepartmentID; + ///ܹ֯ + TThostFtdcPartyNameType DepartmentName; +}; + +///Աܹ֯ϵ +struct CThostFtdcDepartmentUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///Ͷ߷Χ + TThostFtdcDepartmentRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ܹ֯Ͷ߶Ӧϵƽ +struct CThostFtdcInvestorDepartmentFlatField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ܹ֯ + TThostFtdcInvestorIDType DepartmentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ϵͳ +struct CThostFtdcTradeParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcTradeParamIDType TradeParamID; + ///ֵ + TThostFtdcSettlementParamValueType TradeParamValue; + ///ע + TThostFtdcMemoType Memo; +}; + +///ӦóϢ +struct CThostFtdcAppInfoField +{ + ///Ӧ + TThostFtdcAppNameType AppName; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ӧó + TThostFtdcAppTypeType AppType; +}; + +///Ӧóû +struct CThostFtdcAppUserField +{ + ///Ӧ + TThostFtdcAppNameType AppName; + ///б + TThostFtdcRunIDType RunID; + /// + TThostFtdcPasswordType Password; + ///IPַ + TThostFtdcIPAddressType IPAddress; +}; + +/// +struct CThostFtdcDRIdentityField +{ + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; + /// + TThostFtdcDRIdentityNameType DRIdentityName; + ///Ƿ + TThostFtdcBoolType IsMain; +}; + +///ǰıʶ +struct CThostFtdcCurrDRIdentityField +{ + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; +}; + +///ֱĽȨ +struct CThostFtdcUserRightAssignField +{ + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; +}; + +///͹˾ǷڱʾĽȨ +struct CThostFtdcBrokerRightAssignField +{ + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; + ///ܷ + TThostFtdcBoolType Tradeable; +}; + +///FensûϢ +struct CThostFtdcFensUserInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ģʽ + TThostFtdcLoginModeType LoginMode; +}; + +///ֹ¼û +struct CThostFtdcLoginForbiddenUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; +}; + +///ѯֹ¼û +struct CThostFtdcQryLoginForbiddenUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///UDP鲥Ϣ +struct CThostFtdcMulticastGroupInfoField +{ + ///鲥IPַ + TThostFtdcIPAddressType GroupIP; + ///鲥IP˿ + TThostFtdcIPPortType GroupPort; + ///Դַ + TThostFtdcIPAddressType SourceIP; +}; + +///ʽ˻׼ +struct CThostFtdcTradingAccountReserveField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///׼ + TThostFtdcMoneyType Reserve; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯ˻ +struct CThostFtdcQryBaseCurrencyAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; +}; + +///˻ +struct CThostFtdcBaseCurrencyAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯֲ޶ +struct CThostFtdcQryInvestorPositionLimitField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; +}; + +///ֲ޶ +struct CThostFtdcInvestorPositionLimitField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///Ʒִ + TThostFtdcProductIDType ProductID; + ///ʱ + TThostFtdcVolumeType SingleOrderMaxVolume; + ///ֲ޶ + TThostFtdcVolumeType PositionLimit; +}; + + + +#endif diff --git a/include/CTP_INTER/win32/thostmduserapi.dll b/include/CTP_INTER/win32/thostmduserapi.dll new file mode 100644 index 0000000..69564bc Binary files /dev/null and b/include/CTP_INTER/win32/thostmduserapi.dll differ diff --git a/include/CTP_INTER/win32/thostmduserapi.lib b/include/CTP_INTER/win32/thostmduserapi.lib new file mode 100644 index 0000000..4b344ad Binary files /dev/null and b/include/CTP_INTER/win32/thostmduserapi.lib differ diff --git a/include/CTP_INTER/win32/thosttraderapi.dll b/include/CTP_INTER/win32/thosttraderapi.dll new file mode 100644 index 0000000..bcd3d91 Binary files /dev/null and b/include/CTP_INTER/win32/thosttraderapi.dll differ diff --git a/include/CTP_INTER/win32/thosttraderapi.lib b/include/CTP_INTER/win32/thosttraderapi.lib new file mode 100644 index 0000000..9c46b1c Binary files /dev/null and b/include/CTP_INTER/win32/thosttraderapi.lib differ diff --git a/include/CTP_SOPT/ThostFtdcMdApi.h b/include/CTP_SOPT/ThostFtdcMdApi.h new file mode 100644 index 0000000..ece33f7 --- /dev/null +++ b/include/CTP_SOPT/ThostFtdcMdApi.h @@ -0,0 +1,162 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcMdApi.h +///@brief ˿ͻ˽ӿ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCMDAPI_H) +#define THOST_FTDCMDAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ThostFtdcUserApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_MD_API_EXPORT +#define MD_API_EXPORT __declspec(dllexport) +#else +#define MD_API_EXPORT __declspec(dllimport) +#endif +#else +#define MD_API_EXPORT +#endif + +class CThostFtdcMdSpi +{ +public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡӦ + virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡѯӦ + virtual void OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) {}; + + ///ѯ֪ͨ + virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {}; +}; + +class MD_API_EXPORT CThostFtdcMdApi +{ +public: + ///MdApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + ///modify for udp marketdata + static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp=false, const bool bIsMulticast=false); + + ///ȡAPIİ汾Ϣ + ///@retrun ȡİ汾 + static const char *GetApiVersion(); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcMdSpi *pSpi) = 0; + + ///顣 + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeMarketData(char *ppInstrumentID[], int nCount) = 0; + + ///˶顣 + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeMarketData(char *ppInstrumentID[], int nCount) = 0; + + ///ѯۡ + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0; + + ///˶ѯۡ + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0; + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; +protected: + ~CThostFtdcMdApi(){}; +}; + +#endif diff --git a/include/CTP_SOPT/ThostFtdcTraderApi.h b/include/CTP_SOPT/ThostFtdcTraderApi.h new file mode 100644 index 0000000..d84d697 --- /dev/null +++ b/include/CTP_SOPT/ThostFtdcTraderApi.h @@ -0,0 +1,696 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcTraderApi.h +///@brief ˿ͻ˽ӿ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCTRADERAPI_H) +#define THOST_FTDCTRADERAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ThostFtdcUserApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_TRADER_API_EXPORT +#define TRADER_API_EXPORT __declspec(dllexport) +#else +#define TRADER_API_EXPORT __declspec(dllimport) +#endif +#else +#define TRADER_API_EXPORT +#endif + +class CThostFtdcTraderSpi +{ +public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + ///ͻ֤Ӧ + virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ûӦ + virtual void OnRspUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ʽ˻Ӧ + virtual void OnRspTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ԥ¼Ӧ + virtual void OnRspParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ԥ񳷵¼Ӧ + virtual void OnRspParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ󱨵Ӧ + virtual void OnRspQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ͷ߽ȷӦ + virtual void OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ɾԤӦ + virtual void OnRspRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ɾԤ񳷵Ӧ + virtual void OnRspRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ִ¼Ӧ + virtual void OnRspExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ִӦ + virtual void OnRspExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ¼Ӧ + virtual void OnRspForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///۲Ӧ + virtual void OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspLockInsert(CThostFtdcInputLockField *pInputLock, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspBatchOrderAction(CThostFtdcInputBatchOrderActionField *pInputBatchOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯɽӦ + virtual void OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳Ӧ + virtual void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʽ˻Ӧ + virtual void OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶӦ + virtual void OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯױӦ + virtual void OnRspQryTradingCode(CThostFtdcTradingCodeField *pTradingCode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼ֤Ӧ + virtual void OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchange(CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷӦ + virtual void OnRspQryProduct(CThostFtdcProductField *pProduct, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶ߽Ӧ + virtual void OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯתӦ + virtual void OnRspQryTransferBank(CThostFtdcTransferBankField *pTransferBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionDetail(CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͻ֪ͨӦ + virtual void OnRspQryNotice(CThostFtdcNoticeField *pNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯϢȷӦ + virtual void OnRspQrySettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionCombineDetail(CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤ϵͳ͹˾ʽ˻ԿӦ + virtual void OnRspQryCFMMCTradingAccountKey(CThostFtdcCFMMCTradingAccountKeyField *pCFMMCTradingAccountKey, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯֵ۵ϢӦ + virtual void OnRspQryEWarrantOffset(CThostFtdcEWarrantOffsetField *pEWarrantOffset, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶƷ/Ʒֱ֤Ӧ + virtual void OnRspQryInvestorProductGroupMargin(CThostFtdcInvestorProductGroupMarginField *pInvestorProductGroupMargin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤Ӧ + virtual void OnRspQryExchangeMarginRate(CThostFtdcExchangeMarginRateField *pExchangeMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤Ӧ + virtual void OnRspQryExchangeMarginRateAdjust(CThostFtdcExchangeMarginRateAdjustField *pExchangeMarginRateAdjust, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchangeRate(CThostFtdcExchangeRateField *pExchangeRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԱȨӦ + virtual void OnRspQrySecAgentACIDMap(CThostFtdcSecAgentACIDMapField *pSecAgentACIDMap, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷۻ + virtual void OnRspQryProductExchRate(CThostFtdcProductExchRateField *pProductExchRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷ + virtual void OnRspQryProductGroup(CThostFtdcProductGroupField *pProductGroup, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ̺ԼӦ + virtual void OnRspQryMMInstrumentCommissionRate(CThostFtdcMMInstrumentCommissionRateField *pMMInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨԼӦ + virtual void OnRspQryMMOptionInstrCommRate(CThostFtdcMMOptionInstrCommRateField *pMMOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryInstrumentOrderCommRate(CThostFtdcInstrumentOrderCommRateField *pInstrumentOrderCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨ׳ɱӦ + virtual void OnRspQryOptionInstrTradeCost(CThostFtdcOptionInstrTradeCostField *pOptionInstrTradeCost, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨԼӦ + virtual void OnRspQryOptionInstrCommRate(CThostFtdcOptionInstrCommRateField *pOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯִӦ + virtual void OnRspQryExecOrder(CThostFtdcExecOrderField *pExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯѯӦ + virtual void OnRspQryForQuote(CThostFtdcForQuoteField *pForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryLock(CThostFtdcLockField *pLock, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤ȯλӦ + virtual void OnRspQryLockPosition(CThostFtdcLockPositionField *pLockPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯETFȨԼӦ + virtual void OnRspQryETFOptionInstrCommRate(CThostFtdcETFOptionInstrCommRateField *pETFOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶ߷ּ + virtual void OnRspQryInvestorLevel(CThostFtdcInvestorLevelField *pInvestorLevel, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯE+1ȨӦ + virtual void OnRspQryExecFreeze(CThostFtdcExecFreezeField *pExecFreeze, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯϺԼȫϵӦ + virtual void OnRspQryCombInstrumentGuard(CThostFtdcCombInstrumentGuardField *pCombInstrumentGuard, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryCombAction(CThostFtdcCombActionField *pCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯתˮӦ + virtual void OnRspQryTransferSerial(CThostFtdcTransferSerialField *pTransferSerial, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯǩԼϵӦ + virtual void OnRspQryAccountregister(CThostFtdcAccountregisterField *pAccountregister, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnOrder(CThostFtdcOrderField *pOrder) {}; + + ///ɽ֪ͨ + virtual void OnRtnTrade(CThostFtdcTradeField *pTrade) {}; + + ///¼ر + virtual void OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ر + virtual void OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///Լ״̬֪ͨ + virtual void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) {}; + + ///֪ͨ + virtual void OnRtnBulletin(CThostFtdcBulletinField *pBulletin) {}; + + ///֪ͨ + virtual void OnRtnTradingNotice(CThostFtdcTradingNoticeInfoField *pTradingNoticeInfo) {}; + + ///ʾУ + virtual void OnRtnErrorConditionalOrder(CThostFtdcErrorConditionalOrderField *pErrorConditionalOrder) {}; + + ///ִ֪ͨ + virtual void OnRtnExecOrder(CThostFtdcExecOrderField *pExecOrder) {}; + + ///ִ¼ر + virtual void OnErrRtnExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ִر + virtual void OnErrRtnExecOrderAction(CThostFtdcExecOrderActionField *pExecOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯ¼ر + virtual void OnErrRtnForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo) {}; + + ///֪ͨ + virtual void OnRtnQuote(CThostFtdcQuoteField *pQuote) {}; + + ///¼ر + virtual void OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo) {}; + + ///۲ر + virtual void OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯ֪ͨ + virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {}; + + ///֤û + virtual void OnRtnCFMMCTradingAccountToken(CThostFtdcCFMMCTradingAccountTokenField *pCFMMCTradingAccountToken) {}; + + ///֪ͨ + virtual void OnRtnLock(CThostFtdcLockField *pLock) {}; + + ///֪ͨ + virtual void OnErrRtnLockInsert(CThostFtdcInputLockField *pInputLock, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ر + virtual void OnErrRtnBatchOrderAction(CThostFtdcBatchOrderActionField *pBatchOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///֪ͨ + virtual void OnRtnCombAction(CThostFtdcCombActionField *pCombAction) {}; + + ///¼ر + virtual void OnErrRtnCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯǩԼӦ + virtual void OnRspQryContractBank(CThostFtdcContractBankField *pContractBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԤӦ + virtual void OnRspQryParkedOrder(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԤ񳷵Ӧ + virtual void OnRspQryParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֪ͨӦ + virtual void OnRspQryTradingNotice(CThostFtdcTradingNoticeField *pTradingNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ͹˾ײӦ + virtual void OnRspQryBrokerTradingParams(CThostFtdcBrokerTradingParamsField *pBrokerTradingParams, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ͹˾㷨Ӧ + virtual void OnRspQryBrokerTradingAlgos(CThostFtdcBrokerTradingAlgosField *pBrokerTradingAlgos, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯû + virtual void OnRspQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///зʽתڻ֪ͨ + virtual void OnRtnFromBankToFutureByBank(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///зڻʽת֪ͨ + virtual void OnRtnFromFutureToBankByBank(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///зתڻ֪ͨ + virtual void OnRtnRepealFromBankToFutureByBank(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///зڻת֪ͨ + virtual void OnRtnRepealFromFutureToBankByBank(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻʽתڻ֪ͨ + virtual void OnRtnFromBankToFutureByFuture(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///ڻڻʽת֪ͨ + virtual void OnRtnFromFutureToBankByFuture(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///ϵͳʱڻֹתڻдϺ̷ص֪ͨ + virtual void OnRtnRepealFromBankToFutureByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ϵͳʱڻֹڻתдϺ̷ص֪ͨ + virtual void OnRtnRepealFromFutureToBankByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻѯ֪ͨ + virtual void OnRtnQueryBankBalanceByFuture(CThostFtdcNotifyQueryAccountField *pNotifyQueryAccount) {}; + + ///ڻʽתڻر + virtual void OnErrRtnBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻڻʽתдر + virtual void OnErrRtnFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ϵͳʱڻֹתڻر + virtual void OnErrRtnRepealBankToFutureByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ϵͳʱڻֹڻתдر + virtual void OnErrRtnRepealFutureToBankByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻѯر + virtual void OnErrRtnQueryBankBalanceByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻתڻдϺ̷ص֪ͨ + virtual void OnRtnRepealFromBankToFutureByFuture(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻڻתдϺ̷ص֪ͨ + virtual void OnRtnRepealFromFutureToBankByFuture(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻʽתڻӦ + virtual void OnRspFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ڻڻʽתӦ + virtual void OnRspFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ڻѯӦ + virtual void OnRspQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///зڿ֪ͨ + virtual void OnRtnOpenAccountByBank(CThostFtdcOpenAccountField *pOpenAccount) {}; + + ///з֪ͨ + virtual void OnRtnCancelAccountByBank(CThostFtdcCancelAccountField *pCancelAccount) {}; + + ///з˺֪ͨ + virtual void OnRtnChangeAccountByBank(CThostFtdcChangeAccountField *pChangeAccount) {}; +}; + +class TRADER_API_EXPORT CThostFtdcTraderApi +{ +public: + ///TraderApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + static CThostFtdcTraderApi *CreateFtdcTraderApi(const char *pszFlowPath = ""); + + ///ȡAPIİ汾Ϣ + ///@retrun ȡİ汾 + static const char *GetApiVersion(); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcTraderSpi *pSpi) = 0; + + ///˽ + ///@param nResumeType ˽شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼˽ + ///@remark ÷ҪInitǰá򲻻յ˽ݡ + virtual void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///Ĺ + ///@param nResumeType شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼󹫹 + ///@remark ÷ҪInitǰá򲻻յݡ + virtual void SubscribePublicTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///ͻ֤ + virtual int ReqAuthenticate(CThostFtdcReqAuthenticateField *pReqAuthenticateField, int nRequestID) = 0; + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; + + ///û + virtual int ReqUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, int nRequestID) = 0; + + ///ʽ˻ + virtual int ReqTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, int nRequestID) = 0; + + ///¼ + virtual int ReqOrderInsert(CThostFtdcInputOrderField *pInputOrder, int nRequestID) = 0; + + ///Ԥ¼ + virtual int ReqParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, int nRequestID) = 0; + + ///Ԥ񳷵¼ + virtual int ReqParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, int nRequestID) = 0; + + /// + virtual int ReqOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, int nRequestID) = 0; + + ///ѯ󱨵 + virtual int ReqQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, int nRequestID) = 0; + + ///Ͷ߽ȷ + virtual int ReqSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, int nRequestID) = 0; + + ///ɾԤ + virtual int ReqRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, int nRequestID) = 0; + + ///ɾԤ񳷵 + virtual int ReqRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, int nRequestID) = 0; + + ///ִ¼ + virtual int ReqExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, int nRequestID) = 0; + + ///ִ + virtual int ReqExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, int nRequestID) = 0; + + ///ѯ¼ + virtual int ReqForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, int nRequestID) = 0; + + ///¼ + virtual int ReqQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, int nRequestID) = 0; + + ///۲ + virtual int ReqQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, int nRequestID) = 0; + + /// + virtual int ReqLockInsert(CThostFtdcInputLockField *pInputLock, int nRequestID) = 0; + + /// + virtual int ReqBatchOrderAction(CThostFtdcInputBatchOrderActionField *pInputBatchOrderAction, int nRequestID) = 0; + + ///¼ + virtual int ReqCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryOrder(CThostFtdcQryOrderField *pQryOrder, int nRequestID) = 0; + + ///ѯɽ + virtual int ReqQryTrade(CThostFtdcQryTradeField *pQryTrade, int nRequestID) = 0; + + ///ѯͶֲ߳ + virtual int ReqQryInvestorPosition(CThostFtdcQryInvestorPositionField *pQryInvestorPosition, int nRequestID) = 0; + + ///ѯʽ˻ + virtual int ReqQryTradingAccount(CThostFtdcQryTradingAccountField *pQryTradingAccount, int nRequestID) = 0; + + ///ѯͶ + virtual int ReqQryInvestor(CThostFtdcQryInvestorField *pQryInvestor, int nRequestID) = 0; + + ///ѯױ + virtual int ReqQryTradingCode(CThostFtdcQryTradingCodeField *pQryTradingCode, int nRequestID) = 0; + + ///ѯԼ֤ + virtual int ReqQryInstrumentMarginRate(CThostFtdcQryInstrumentMarginRateField *pQryInstrumentMarginRate, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrumentCommissionRate(CThostFtdcQryInstrumentCommissionRateField *pQryInstrumentCommissionRate, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchange(CThostFtdcQryExchangeField *pQryExchange, int nRequestID) = 0; + + ///ѯƷ + virtual int ReqQryProduct(CThostFtdcQryProductField *pQryProduct, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrument(CThostFtdcQryInstrumentField *pQryInstrument, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryDepthMarketData(CThostFtdcQryDepthMarketDataField *pQryDepthMarketData, int nRequestID) = 0; + + ///ѯͶ߽ + virtual int ReqQrySettlementInfo(CThostFtdcQrySettlementInfoField *pQrySettlementInfo, int nRequestID) = 0; + + ///ѯת + virtual int ReqQryTransferBank(CThostFtdcQryTransferBankField *pQryTransferBank, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionDetail(CThostFtdcQryInvestorPositionDetailField *pQryInvestorPositionDetail, int nRequestID) = 0; + + ///ѯͻ֪ͨ + virtual int ReqQryNotice(CThostFtdcQryNoticeField *pQryNotice, int nRequestID) = 0; + + ///ѯϢȷ + virtual int ReqQrySettlementInfoConfirm(CThostFtdcQrySettlementInfoConfirmField *pQrySettlementInfoConfirm, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionCombineDetail(CThostFtdcQryInvestorPositionCombineDetailField *pQryInvestorPositionCombineDetail, int nRequestID) = 0; + + ///ѯ֤ϵͳ͹˾ʽ˻Կ + virtual int ReqQryCFMMCTradingAccountKey(CThostFtdcQryCFMMCTradingAccountKeyField *pQryCFMMCTradingAccountKey, int nRequestID) = 0; + + ///ѯֵ۵Ϣ + virtual int ReqQryEWarrantOffset(CThostFtdcQryEWarrantOffsetField *pQryEWarrantOffset, int nRequestID) = 0; + + ///ѯͶƷ/Ʒֱ֤ + virtual int ReqQryInvestorProductGroupMargin(CThostFtdcQryInvestorProductGroupMarginField *pQryInvestorProductGroupMargin, int nRequestID) = 0; + + ///ѯ֤ + virtual int ReqQryExchangeMarginRate(CThostFtdcQryExchangeMarginRateField *pQryExchangeMarginRate, int nRequestID) = 0; + + ///ѯ֤ + virtual int ReqQryExchangeMarginRateAdjust(CThostFtdcQryExchangeMarginRateAdjustField *pQryExchangeMarginRateAdjust, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchangeRate(CThostFtdcQryExchangeRateField *pQryExchangeRate, int nRequestID) = 0; + + ///ѯԱȨ + virtual int ReqQrySecAgentACIDMap(CThostFtdcQrySecAgentACIDMapField *pQrySecAgentACIDMap, int nRequestID) = 0; + + ///ѯƷۻ + virtual int ReqQryProductExchRate(CThostFtdcQryProductExchRateField *pQryProductExchRate, int nRequestID) = 0; + + ///ѯƷ + virtual int ReqQryProductGroup(CThostFtdcQryProductGroupField *pQryProductGroup, int nRequestID) = 0; + + ///ѯ̺Լ + virtual int ReqQryMMInstrumentCommissionRate(CThostFtdcQryMMInstrumentCommissionRateField *pQryMMInstrumentCommissionRate, int nRequestID) = 0; + + ///ѯȨԼ + virtual int ReqQryMMOptionInstrCommRate(CThostFtdcQryMMOptionInstrCommRateField *pQryMMOptionInstrCommRate, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryInstrumentOrderCommRate(CThostFtdcQryInstrumentOrderCommRateField *pQryInstrumentOrderCommRate, int nRequestID) = 0; + + ///ѯȨ׳ɱ + virtual int ReqQryOptionInstrTradeCost(CThostFtdcQryOptionInstrTradeCostField *pQryOptionInstrTradeCost, int nRequestID) = 0; + + ///ѯȨԼ + virtual int ReqQryOptionInstrCommRate(CThostFtdcQryOptionInstrCommRateField *pQryOptionInstrCommRate, int nRequestID) = 0; + + ///ѯִ + virtual int ReqQryExecOrder(CThostFtdcQryExecOrderField *pQryExecOrder, int nRequestID) = 0; + + ///ѯѯ + virtual int ReqQryForQuote(CThostFtdcQryForQuoteField *pQryForQuote, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryQuote(CThostFtdcQryQuoteField *pQryQuote, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryLock(CThostFtdcQryLockField *pQryLock, int nRequestID) = 0; + + ///ѯ֤ȯλ + virtual int ReqQryLockPosition(CThostFtdcQryLockPositionField *pQryLockPosition, int nRequestID) = 0; + + ///ѯETFȨԼ + virtual int ReqQryETFOptionInstrCommRate(CThostFtdcQryETFOptionInstrCommRateField *pQryETFOptionInstrCommRate, int nRequestID) = 0; + + ///ѯͶ߷ּ + virtual int ReqQryInvestorLevel(CThostFtdcQryInvestorLevelField *pQryInvestorLevel, int nRequestID) = 0; + + ///ѯE+1Ȩ + virtual int ReqQryExecFreeze(CThostFtdcQryExecFreezeField *pQryExecFreeze, int nRequestID) = 0; + + ///ѯϺԼȫϵ + virtual int ReqQryCombInstrumentGuard(CThostFtdcQryCombInstrumentGuardField *pQryCombInstrumentGuard, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryCombAction(CThostFtdcQryCombActionField *pQryCombAction, int nRequestID) = 0; + + ///ѯתˮ + virtual int ReqQryTransferSerial(CThostFtdcQryTransferSerialField *pQryTransferSerial, int nRequestID) = 0; + + ///ѯǩԼϵ + virtual int ReqQryAccountregister(CThostFtdcQryAccountregisterField *pQryAccountregister, int nRequestID) = 0; + + ///ѯǩԼ + virtual int ReqQryContractBank(CThostFtdcQryContractBankField *pQryContractBank, int nRequestID) = 0; + + ///ѯԤ + virtual int ReqQryParkedOrder(CThostFtdcQryParkedOrderField *pQryParkedOrder, int nRequestID) = 0; + + ///ѯԤ񳷵 + virtual int ReqQryParkedOrderAction(CThostFtdcQryParkedOrderActionField *pQryParkedOrderAction, int nRequestID) = 0; + + ///ѯ֪ͨ + virtual int ReqQryTradingNotice(CThostFtdcQryTradingNoticeField *pQryTradingNotice, int nRequestID) = 0; + + ///ѯ͹˾ײ + virtual int ReqQryBrokerTradingParams(CThostFtdcQryBrokerTradingParamsField *pQryBrokerTradingParams, int nRequestID) = 0; + + ///ѯ͹˾㷨 + virtual int ReqQryBrokerTradingAlgos(CThostFtdcQryBrokerTradingAlgosField *pQryBrokerTradingAlgos, int nRequestID) = 0; + + ///ѯû + virtual int ReqQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, int nRequestID) = 0; + + ///ڻʽתڻ + virtual int ReqFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID) = 0; + + ///ڻڻʽת + virtual int ReqFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID) = 0; + + ///ڻѯ + virtual int ReqQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, int nRequestID) = 0; +protected: + ~CThostFtdcTraderApi(){}; +}; + +#endif diff --git a/include/CTP_SOPT/ThostFtdcUserApiDataType.h b/include/CTP_SOPT/ThostFtdcUserApiDataType.h new file mode 100644 index 0000000..1ec388a --- /dev/null +++ b/include/CTP_SOPT/ThostFtdcUserApiDataType.h @@ -0,0 +1,6528 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcUserApiDataType.h +///@brief ˿ͻ˽ӿʹõҵ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#ifndef THOST_FTDCDATATYPE_H +#define THOST_FTDCDATATYPE_H + +enum THOST_TE_RESUME_TYPE +{ + THOST_TERT_RESTART = 0, + THOST_TERT_RESUME, + THOST_TERT_QUICK +}; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTraderIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDTypeһͶߴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerIDTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerAbbrTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerNameTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeInstIDTypeһԼڽĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderRefTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderRefType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParticipantIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParticipantIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserIDTypeһû +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserIDType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPasswordType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDTypeһױ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentCodeTypeһԼʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentCodeType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarketIDTypeһг +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMarketIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductNameTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeAbbrTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMacAddressTypeһMacַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMacAddressType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSystemIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangePropertyTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EXP_Normal '0' +///ݳɽɱ +#define THOST_FTDC_EXP_GenOrderByTrade '1' + +typedef char TThostFtdcExchangePropertyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLongTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLongTimeType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentNameTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementGroupIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettlementGroupIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSysIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeIDTypeһɽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandTypeTypeһDB +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommandTypeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPAddressTypeһIPַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIPAddressType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPPortTypeһIP˿ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcIPPortType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductInfoTypeһƷϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProtocolInfoTypeһЭϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProtocolInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessUnitTypeһҵԪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessUnitType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepositSeqNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDepositSeqNoType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdentifiedCardNoTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIdentifiedCardNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdCardTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֯ +#define THOST_FTDC_ICT_EID '0' +///й֤ +#define THOST_FTDC_ICT_IDCard '1' +///֤ +#define THOST_FTDC_ICT_OfficerIDCard '2' +///֤ +#define THOST_FTDC_ICT_PoliceIDCard '3' +///ʿ֤ +#define THOST_FTDC_ICT_SoldierIDCard '4' +///ڲ +#define THOST_FTDC_ICT_HouseholdRegister '5' +/// +#define THOST_FTDC_ICT_Passport '6' +///̨֤ +#define THOST_FTDC_ICT_TaiwanCompatriotIDCard '7' +///֤ +#define THOST_FTDC_ICT_HomeComingCard '8' +///Ӫҵִպ +#define THOST_FTDC_ICT_LicenseNo '9' +///˰ǼǺ/˰ID +#define THOST_FTDC_ICT_TaxNo 'A' +///۰ľڵ֤ͨ +#define THOST_FTDC_ICT_HMMainlandTravelPermit 'B' +///̨½֤ͨ +#define THOST_FTDC_ICT_TwMainlandTravelPermit 'C' +/// +#define THOST_FTDC_ICT_DrivingLicense 'D' +///籣ID +#define THOST_FTDC_ICT_SocialID 'F' +///֤ +#define THOST_FTDC_ICT_LocalID 'G' +///ҵǼ֤ +#define THOST_FTDC_ICT_BusinessRegistration 'H' +///۰Ծ֤ +#define THOST_FTDC_ICT_HKMCIDCard 'I' +///п֤ +#define THOST_FTDC_ICT_AccountsPermits 'J' +///֤ +#define THOST_FTDC_ICT_OtherCard 'x' + +typedef char TThostFtdcIdCardTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderLocalIDTypeһر +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderLocalIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserNameTypeһû +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPartyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPartyNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorMsgTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcErrorMsgType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldNameTypeһֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFieldNameType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldContentTypeһֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFieldContentType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemNameTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSystemNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContentTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcContentType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IR_All '1' +///Ͷ +#define THOST_FTDC_IR_Group '2' +///һͶ +#define THOST_FTDC_IR_Single '3' + +typedef char TThostFtdcInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepartmentRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_DR_All '1' +///ܹ֯ +#define THOST_FTDC_DR_Group '2' +///һͶ +#define THOST_FTDC_DR_Single '3' + +typedef char TThostFtdcDepartmentRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataSyncStatusTypeһͬ״̬ +///////////////////////////////////////////////////////////////////////// +///δͬ +#define THOST_FTDC_DS_Asynchronous '1' +///ͬ +#define THOST_FTDC_DS_Synchronizing '2' +///ͬ +#define THOST_FTDC_DS_Synchronized '3' + +typedef char TThostFtdcDataSyncStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerDataSyncStatusTypeһ͹˾ͬ״̬ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_BDS_Synchronized '1' +///ͬ +#define THOST_FTDC_BDS_Synchronizing '2' + +typedef char TThostFtdcBrokerDataSyncStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeConnectStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_ECS_NoConnection '1' +///ѾԼѯ +#define THOST_FTDC_ECS_QryInstrumentSent '2' +///ѾȡϢ +#define THOST_FTDC_ECS_GotInformation '9' + +typedef char TThostFtdcExchangeConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderConnectStatusTypeһԱ״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_TCS_NotConnected '1' +///Ѿ +#define THOST_FTDC_TCS_Connected '2' +///ѾԼѯ +#define THOST_FTDC_TCS_QryInstrumentSent '3' +///˽ +#define THOST_FTDC_TCS_SubPrivateFlow '4' + +typedef char TThostFtdcTraderConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionCodeTypeһܴ +///////////////////////////////////////////////////////////////////////// +///첽 +#define THOST_FTDC_FC_DataAsync '1' +///ǿûdz +#define THOST_FTDC_FC_ForceUserLogout '2' +///û +#define THOST_FTDC_FC_UserPasswordUpdate '3' +///͹˾ +#define THOST_FTDC_FC_BrokerPasswordUpdate '4' +///Ͷ߿ +#define THOST_FTDC_FC_InvestorPasswordUpdate '5' +/// +#define THOST_FTDC_FC_OrderInsert '6' +/// +#define THOST_FTDC_FC_OrderAction '7' +///ͬϵͳ +#define THOST_FTDC_FC_SyncSystemData '8' +///ͬ͹˾ +#define THOST_FTDC_FC_SyncBrokerData '9' +///ͬ͹˾ +#define THOST_FTDC_FC_BachSyncBrokerData 'A' +///ѯ +#define THOST_FTDC_FC_SuperQuery 'B' +///Ԥ񱨵 +#define THOST_FTDC_FC_ParkedOrderInsert 'C' +///Ԥ񱨵 +#define THOST_FTDC_FC_ParkedOrderAction 'D' +///̬ͬ +#define THOST_FTDC_FC_SyncOTP 'E' +///ɾδ֪ +#define THOST_FTDC_FC_DeleteOrder 'F' + +typedef char TThostFtdcFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerFunctionCodeTypeһ͹˾ܴ +///////////////////////////////////////////////////////////////////////// +///ǿûdz +#define THOST_FTDC_BFC_ForceUserLogout '1' +///û +#define THOST_FTDC_BFC_UserPasswordUpdate '2' +///ͬ͹˾ +#define THOST_FTDC_BFC_SyncBrokerData '3' +///ͬ͹˾ +#define THOST_FTDC_BFC_BachSyncBrokerData '4' +/// +#define THOST_FTDC_BFC_OrderInsert '5' +/// +#define THOST_FTDC_BFC_OrderAction '6' +///ȫѯ +#define THOST_FTDC_BFC_AllQuery '7' +///ϵͳܣ/dz/޸ +#define THOST_FTDC_BFC_log 'a' +///ѯѯݣԼȳ +#define THOST_FTDC_BFC_BaseQry 'b' +///ײѯɽί +#define THOST_FTDC_BFC_TradeQry 'c' +///׹ܣ +#define THOST_FTDC_BFC_Trade 'd' +///ת +#define THOST_FTDC_BFC_Virement 'e' +///ռ +#define THOST_FTDC_BFC_Risk 'f' +///ѯ/ѯỰ˵ +#define THOST_FTDC_BFC_Session 'g' +///֪ͨ +#define THOST_FTDC_BFC_RiskNoticeCtl 'h' +///֪ͨ +#define THOST_FTDC_BFC_RiskNotice 'i' +///쿴͹˾ʽȨ +#define THOST_FTDC_BFC_BrokerDeposit 'j' +///ʽѯ +#define THOST_FTDC_BFC_QueryFund 'k' +///ѯ +#define THOST_FTDC_BFC_QueryOrder 'l' +///ɽѯ +#define THOST_FTDC_BFC_QueryTrade 'm' +///ֲֲѯ +#define THOST_FTDC_BFC_QueryPosition 'n' +///ѯ +#define THOST_FTDC_BFC_QueryMarketData 'o' +///û¼ѯ +#define THOST_FTDC_BFC_QueryUserEvent 'p' +///֪ͨѯ +#define THOST_FTDC_BFC_QueryRiskNotify 'q' +///ѯ +#define THOST_FTDC_BFC_QueryFundChange 'r' +///ͶϢѯ +#define THOST_FTDC_BFC_QueryInvestor 's' +///ױѯ +#define THOST_FTDC_BFC_QueryTradingCode 't' +///ǿƽ +#define THOST_FTDC_BFC_ForceClose 'u' +///ѹ +#define THOST_FTDC_BFC_PressTest 'v' +///Ȩ淴 +#define THOST_FTDC_BFC_RemainCalc 'w' +///ֱֲָ֤ +#define THOST_FTDC_BFC_NetPositionInd 'x' +///Ԥ +#define THOST_FTDC_BFC_RiskPredict 'y' +///ݵ +#define THOST_FTDC_BFC_DataExport 'z' +///ָ +#define THOST_FTDC_BFC_RiskTargetSetup 'A' +///Ԥ +#define THOST_FTDC_BFC_MarketDataWarn 'B' +///ҵ֪ͨѯ +#define THOST_FTDC_BFC_QryBizNotice 'C' +///ҵ֪ͨģ +#define THOST_FTDC_BFC_CfgBizNotice 'D' +///̬ͬ +#define THOST_FTDC_BFC_SyncOTP 'E' +///ҵ֪ͨ +#define THOST_FTDC_BFC_SendBizNotice 'F' +///ռ׼ +#define THOST_FTDC_BFC_CfgRiskLevelStd 'G' +///նӦ +#define THOST_FTDC_BFC_TbCommand 'H' +///ɾδ֪ +#define THOST_FTDC_BFC_DeleteOrder 'J' +///Ԥ񱨵 +#define THOST_FTDC_BFC_ParkedOrderInsert 'K' +///Ԥ񱨵 +#define THOST_FTDC_BFC_ParkedOrderAction 'L' +///ʽ𲻹Ȩ +#define THOST_FTDC_BFC_ExecOrderNoCheck 'M' + +typedef char TThostFtdcBrokerFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_OAS_Submitted 'a' +///Ѿ +#define THOST_FTDC_OAS_Accepted 'b' +///Ѿܾ +#define THOST_FTDC_OAS_Rejected 'c' + +typedef char TThostFtdcOrderActionStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ȫɽ +#define THOST_FTDC_OST_AllTraded '0' +///ֳɽڶ +#define THOST_FTDC_OST_PartTradedQueueing '1' +///ֳɽڶ +#define THOST_FTDC_OST_PartTradedNotQueueing '2' +///δɽڶ +#define THOST_FTDC_OST_NoTradeQueueing '3' +///δɽڶ +#define THOST_FTDC_OST_NoTradeNotQueueing '4' +/// +#define THOST_FTDC_OST_Canceled '5' +///δ֪ +#define THOST_FTDC_OST_Unknown 'a' +///δ +#define THOST_FTDC_OST_NotTouched 'b' +///Ѵ +#define THOST_FTDC_OST_Touched 'c' + +typedef char TThostFtdcOrderStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSubmitStatusTypeһύ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_OSS_InsertSubmitted '0' +///Ѿύ +#define THOST_FTDC_OSS_CancelSubmitted '1' +///޸Ѿύ +#define THOST_FTDC_OSS_ModifySubmitted '2' +///Ѿ +#define THOST_FTDC_OSS_Accepted '3' +///Ѿܾ +#define THOST_FTDC_OSS_InsertRejected '4' +///Ѿܾ +#define THOST_FTDC_OSS_CancelRejected '5' +///ĵѾܾ +#define THOST_FTDC_OSS_ModifyRejected '6' + +typedef char TThostFtdcOrderSubmitStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ճֲ +#define THOST_FTDC_PSD_Today '1' +///ʷֲ +#define THOST_FTDC_PSD_History '2' + +typedef char TThostFtdcPositionDateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateTypeTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ʹʷֲ +#define THOST_FTDC_PDT_UseHistory '1' +///ʹʷֲ +#define THOST_FTDC_PDT_NoUseHistory '2' + +typedef char TThostFtdcPositionDateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRoleTypeһ׽ɫ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ER_Broker '1' +///Ӫ +#define THOST_FTDC_ER_Host '2' +/// +#define THOST_FTDC_ER_Maker '3' + +typedef char TThostFtdcTradingRoleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductClassTypeһƷ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_PC_Futures '1' +///ڻȨ +#define THOST_FTDC_PC_Options '2' +/// +#define THOST_FTDC_PC_Combination '3' +/// +#define THOST_FTDC_PC_Spot '4' +///ת +#define THOST_FTDC_PC_EFP '5' +///ֻȨ +#define THOST_FTDC_PC_SpotOption '6' +///Ȩ +#define THOST_FTDC_PC_ETFOption '7' +///֤ȯ +#define THOST_FTDC_PC_Stock '8' + +typedef char TThostFtdcProductClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstLifePhaseTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_IP_NotStart '0' +/// +#define THOST_FTDC_IP_Started '1' +///ͣ +#define THOST_FTDC_IP_Pause '2' +/// +#define THOST_FTDC_IP_Expired '3' + +typedef char TThostFtdcInstLifePhaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_D_Buy '0' +/// +#define THOST_FTDC_D_Sell '1' + +typedef char TThostFtdcDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionTypeTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ֲ +#define THOST_FTDC_PT_Net '1' +///ۺϳֲ +#define THOST_FTDC_PT_Gross '2' + +typedef char TThostFtdcPositionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPosiDirectionTypeһֲֶշ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PD_Net '1' +///ͷ +#define THOST_FTDC_PD_Long '2' +///ͷ +#define THOST_FTDC_PD_Short '3' + +typedef char TThostFtdcPosiDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysSettlementStatusTypeһϵͳ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_SS_NonActive '1' +/// +#define THOST_FTDC_SS_Startup '2' +/// +#define THOST_FTDC_SS_Operating '3' +/// +#define THOST_FTDC_SS_Settlement '4' +/// +#define THOST_FTDC_SS_SettlementFinished '5' + +typedef char TThostFtdcSysSettlementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRatioAttrTypeһ +///////////////////////////////////////////////////////////////////////// +///׷ +#define THOST_FTDC_RA_Trade '0' +/// +#define THOST_FTDC_RA_Settlement '1' + +typedef char TThostFtdcRatioAttrType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_HF_Speculation '1' +/// +#define THOST_FTDC_HF_Arbitrage '2' +///ױ +#define THOST_FTDC_HF_Hedge '3' +/// +#define THOST_FTDC_HF_Covered '4' +/// +#define THOST_FTDC_HF_MarketMaker '5' + +typedef char TThostFtdcHedgeFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_BHF_Speculation '1' +/// +#define THOST_FTDC_BHF_Arbitrage '2' +///ױ +#define THOST_FTDC_BHF_Hedge '3' + +typedef char TThostFtdcBillHedgeFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDTypeTypeһױ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_CIDT_Speculation '1' +/// +#define THOST_FTDC_CIDT_Arbitrage '2' +///ױ +#define THOST_FTDC_CIDT_Hedge '3' +/// +#define THOST_FTDC_CIDT_MarketMaker '5' + +typedef char TThostFtdcClientIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderPriceTypeTypeһ۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OPT_AnyPrice '1' +///޼ +#define THOST_FTDC_OPT_LimitPrice '2' +///ż +#define THOST_FTDC_OPT_BestPrice '3' +///¼ +#define THOST_FTDC_OPT_LastPrice '4' +///¼۸ϸ1ticks +#define THOST_FTDC_OPT_LastPricePlusOneTicks '5' +///¼۸ϸ2ticks +#define THOST_FTDC_OPT_LastPricePlusTwoTicks '6' +///¼۸ϸ3ticks +#define THOST_FTDC_OPT_LastPricePlusThreeTicks '7' +///һ +#define THOST_FTDC_OPT_AskPrice1 '8' +///һ۸ϸ1ticks +#define THOST_FTDC_OPT_AskPrice1PlusOneTicks '9' +///һ۸ϸ2ticks +#define THOST_FTDC_OPT_AskPrice1PlusTwoTicks 'A' +///һ۸ϸ3ticks +#define THOST_FTDC_OPT_AskPrice1PlusThreeTicks 'B' +///һ +#define THOST_FTDC_OPT_BidPrice1 'C' +///һ۸ϸ1ticks +#define THOST_FTDC_OPT_BidPrice1PlusOneTicks 'D' +///һ۸ϸ2ticks +#define THOST_FTDC_OPT_BidPrice1PlusTwoTicks 'E' +///һ۸ϸ3ticks +#define THOST_FTDC_OPT_BidPrice1PlusThreeTicks 'F' +///嵵 +#define THOST_FTDC_OPT_FiveLevelPrice 'G' +///ż +#define THOST_FTDC_OPT_BestPriceThisSide 'H' + +typedef char TThostFtdcOrderPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetFlagTypeһƽ־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OF_Open '0' +///ƽ +#define THOST_FTDC_OF_Close '1' +///ǿƽ +#define THOST_FTDC_OF_ForceClose '2' +///ƽ +#define THOST_FTDC_OF_CloseToday '3' +///ƽ +#define THOST_FTDC_OF_CloseYesterday '4' +///ǿ +#define THOST_FTDC_OF_ForceOff '5' +///ǿƽ +#define THOST_FTDC_OF_LocalForceClose '6' + +typedef char TThostFtdcOffsetFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseReasonTypeһǿƽԭ +///////////////////////////////////////////////////////////////////////// +///ǿƽ +#define THOST_FTDC_FCC_NotForceClose '0' +///ʽ +#define THOST_FTDC_FCC_LackDeposit '1' +///ͻ +#define THOST_FTDC_FCC_ClientOverPositionLimit '2' +///Ա +#define THOST_FTDC_FCC_MemberOverPositionLimit '3' +///ֲַ +#define THOST_FTDC_FCC_NotMultiple '4' +///Υ +#define THOST_FTDC_FCC_Violation '5' +/// +#define THOST_FTDC_FCC_Other '6' +///Ȼٽ +#define THOST_FTDC_FCC_PersonDeliv '7' + +typedef char TThostFtdcForceCloseReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ORDT_Normal '0' +/// +#define THOST_FTDC_ORDT_DeriveFromQuote '1' +/// +#define THOST_FTDC_ORDT_DeriveFromCombination '2' +///ϱ +#define THOST_FTDC_ORDT_Combination '3' +/// +#define THOST_FTDC_ORDT_ConditionalOrder '4' +/// +#define THOST_FTDC_ORDT_Swap '5' + +typedef char TThostFtdcOrderTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeConditionTypeһЧ +///////////////////////////////////////////////////////////////////////// +///ɣ +#define THOST_FTDC_TC_IOC '1' +///Ч +#define THOST_FTDC_TC_GFS '2' +///Ч +#define THOST_FTDC_TC_GFD '3' +///ָǰЧ +#define THOST_FTDC_TC_GTD '4' +///ǰЧ +#define THOST_FTDC_TC_GTC '5' +///ϾЧ +#define THOST_FTDC_TC_GFA '6' + +typedef char TThostFtdcTimeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeConditionTypeһɽ +///////////////////////////////////////////////////////////////////////// +///κ +#define THOST_FTDC_VC_AV '1' +///С +#define THOST_FTDC_VC_MV '2' +///ȫ +#define THOST_FTDC_VC_CV '3' + +typedef char TThostFtdcVolumeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContingentConditionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CC_Immediately '1' +///ֹ +#define THOST_FTDC_CC_Touch '2' +///ֹӮ +#define THOST_FTDC_CC_TouchProfit '3' +///Ԥ +#define THOST_FTDC_CC_ParkedOrder '4' +///¼۴ +#define THOST_FTDC_CC_LastPriceGreaterThanStopPrice '5' +///¼۴ڵ +#define THOST_FTDC_CC_LastPriceGreaterEqualStopPrice '6' +///¼С +#define THOST_FTDC_CC_LastPriceLesserThanStopPrice '7' +///¼Сڵ +#define THOST_FTDC_CC_LastPriceLesserEqualStopPrice '8' +///һ۴ +#define THOST_FTDC_CC_AskPriceGreaterThanStopPrice '9' +///һ۴ڵ +#define THOST_FTDC_CC_AskPriceGreaterEqualStopPrice 'A' +///һС +#define THOST_FTDC_CC_AskPriceLesserThanStopPrice 'B' +///һСڵ +#define THOST_FTDC_CC_AskPriceLesserEqualStopPrice 'C' +///һ۴ +#define THOST_FTDC_CC_BidPriceGreaterThanStopPrice 'D' +///һ۴ڵ +#define THOST_FTDC_CC_BidPriceGreaterEqualStopPrice 'E' +///һС +#define THOST_FTDC_CC_BidPriceLesserThanStopPrice 'F' +///һСڵ +#define THOST_FTDC_CC_BidPriceLesserEqualStopPrice 'H' + +typedef char TThostFtdcContingentConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActionFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +///ɾ +#define THOST_FTDC_AF_Delete '0' +///޸ +#define THOST_FTDC_AF_Modify '3' + +typedef char TThostFtdcActionFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRightTypeһȨ +///////////////////////////////////////////////////////////////////////// +///Խ +#define THOST_FTDC_TR_Allow '0' +///ֻƽ +#define THOST_FTDC_TR_CloseOnly '1' +///ܽ +#define THOST_FTDC_TR_Forbidden '2' + +typedef char TThostFtdcTradingRightType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSourceTypeһԴ +///////////////////////////////////////////////////////////////////////// +///Բ +#define THOST_FTDC_OSRC_Participant '0' +///ԹԱ +#define THOST_FTDC_OSRC_Administrator '1' + +typedef char TThostFtdcOrderSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTypeTypeһɽ +///////////////////////////////////////////////////////////////////////// +///ϳֲֲΪһֲ,ʼӦ͵ijֲ +#define THOST_FTDC_TRDT_SplitCombination '#' +///ͨɽ +#define THOST_FTDC_TRDT_Common '0' +///Ȩִ +#define THOST_FTDC_TRDT_OptionsExecution '1' +///OTCɽ +#define THOST_FTDC_TRDT_OTC '2' +///תɽ +#define THOST_FTDC_TRDT_EFPDerived '3' +///ɽ +#define THOST_FTDC_TRDT_CombinationDerived '4' + +typedef char TThostFtdcTradeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceSourceTypeһɽԴ +///////////////////////////////////////////////////////////////////////// +///ǰɽ +#define THOST_FTDC_PSRC_LastPrice '0' +///ίм +#define THOST_FTDC_PSRC_Buy '1' +///ίм +#define THOST_FTDC_PSRC_Sell '2' + +typedef char TThostFtdcPriceSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentStatusTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +///ǰ +#define THOST_FTDC_IS_BeforeTrading '0' +///ǽ +#define THOST_FTDC_IS_NoTrading '1' +/// +#define THOST_FTDC_IS_Continous '2' +///Ͼ۱ +#define THOST_FTDC_IS_AuctionOrdering '3' +///Ͼۼ۸ƽ +#define THOST_FTDC_IS_AuctionBalance '4' +///Ͼ۴ +#define THOST_FTDC_IS_AuctionMatch '5' +/// +#define THOST_FTDC_IS_Closed '6' + +typedef char TThostFtdcInstrumentStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstStatusEnterReasonTypeһƷֽ뽻״̬ԭ +///////////////////////////////////////////////////////////////////////// +///Զл +#define THOST_FTDC_IER_Automatic '1' +///ֶл +#define THOST_FTDC_IER_Manual '2' +///۶ +#define THOST_FTDC_IER_Fuse '3' + +typedef char TThostFtdcInstStatusEnterReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionRefTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcOrderActionRefType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstallCountTypeһװ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcInstallCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstallIDTypeһװ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcInstallIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcErrorIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSettlementIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFrontIDTypeһǰñ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFrontIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSessionIDTypeһỰ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSessionIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSequenceNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandNoTypeһDB +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCommandNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMillisecTypeһʱ䣨룩 +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMillisecType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeMultipleTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcVolumeMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingSegmentSNTypeһ׽׶α +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradingSegmentSNType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRequestIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRequestIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYearTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcYearType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMonthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBoolTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBoolType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcPriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombOffsetFlagTypeһϿƽ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombOffsetFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombHedgeFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRatioTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcRatioType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLargeVolumeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcLargeVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceSeriesTypeһϵк +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcSequenceSeriesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommPhaseNoTypeһͨѶʱα +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcCommPhaseNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceLabelTypeһб +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSequenceLabelType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUnderlyingMultipleTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcUnderlyingMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriorityTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcPriorityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContractCodeTypeһͬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcContractCodeType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCityTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCityType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsStockTypeһǷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIsStockType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcChannelTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcChannelType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAddressTypeһͨѶַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAddressType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcZipCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcZipCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTelephoneTypeһϵ绰 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTelephoneType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFaxTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFaxType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMobileTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMobileType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEMailTypeһʼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEMailType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMemoTypeһע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMemoType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCompanyCodeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCompanyCodeType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWebsiteTypeһվַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWebsiteType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTaxNoTypeһ˰ǼǺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTaxNoType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBatchStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δϴ +#define THOST_FTDC_BS_NoUpload '1' +///ϴ +#define THOST_FTDC_BS_Uploaded '2' +///ʧ +#define THOST_FTDC_BS_Failed '3' + +typedef char TThostFtdcBatchStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyIDTypeһԴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLicenseNoTypeһӪҵִպ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLicenseNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentIDTypeһ˴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentGroupIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentGroupIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentGroupNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentGroupNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnStyleTypeһƷַʽ +///////////////////////////////////////////////////////////////////////// +///Ʒ +#define THOST_FTDC_RS_All '1' +///Ʒ +#define THOST_FTDC_RS_ByProduct '2' + +typedef char TThostFtdcReturnStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnPatternTypeһģʽ +///////////////////////////////////////////////////////////////////////// +///ɽ +#define THOST_FTDC_RP_ByVolume '1' +/// +#define THOST_FTDC_RP_ByFeeOnHand '2' + +typedef char TThostFtdcReturnPatternType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnLevelTypeһ +///////////////////////////////////////////////////////////////////////// +///1 +#define THOST_FTDC_RL_Level1 '1' +///2 +#define THOST_FTDC_RL_Level2 '2' +///3 +#define THOST_FTDC_RL_Level3 '3' +///4 +#define THOST_FTDC_RL_Level4 '4' +///5 +#define THOST_FTDC_RL_Level5 '5' +///6 +#define THOST_FTDC_RL_Level6 '6' +///7 +#define THOST_FTDC_RL_Level7 '7' +///8 +#define THOST_FTDC_RL_Level8 '8' +///9 +#define THOST_FTDC_RL_Level9 '9' + +typedef char TThostFtdcReturnLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnStandardTypeһ׼ +///////////////////////////////////////////////////////////////////////// +///ֽ׶η +#define THOST_FTDC_RSD_ByPeriod '1' +///ijһ׼ +#define THOST_FTDC_RSD_ByStandard '2' + +typedef char TThostFtdcReturnStandardType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMortgageTypeTypeһѺ +///////////////////////////////////////////////////////////////////////// +///ʳ +#define THOST_FTDC_MT_Out '0' +/// +#define THOST_FTDC_MT_In '1' + +typedef char TThostFtdcMortgageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorSettlementParamIDTypeһͶ߽ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_ISPI_MortgageRatio '4' +///֤㷨 +#define THOST_FTDC_ISPI_MarginWay '5' +///㵥ǷѺ +#define THOST_FTDC_ISPI_BillDeposit '9' + +typedef char TThostFtdcInvestorSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeSettlementParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_ESPI_MortgageRatio '1' +///ʽ +#define THOST_FTDC_ESPI_OtherFundItem '2' +///ʽ뽻 +#define THOST_FTDC_ESPI_OtherFundImport '3' +///нͿý +#define THOST_FTDC_ESPI_CFFEXMinPrepa '6' +///֣㷽ʽ +#define THOST_FTDC_ESPI_CZCESettlementType '7' +///ȡʽ +#define THOST_FTDC_ESPI_ExchDelivFeeMode '9' +///Ͷ߽ȡʽ +#define THOST_FTDC_ESPI_DelivFeeMode '0' +///֣ϳֱֲ֤ȡʽ +#define THOST_FTDC_ESPI_CZCEComMarginType 'A' +///֤ǷŻ +#define THOST_FTDC_ESPI_DceComMarginType 'B' +///ֵȨ֤Żݱ +#define THOST_FTDC_ESPI_OptOutDisCountRate 'a' +///ͱϵ +#define THOST_FTDC_ESPI_OptMiniGuarantee 'b' + +typedef char TThostFtdcExchangeSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemParamIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +///ͶߴС +#define THOST_FTDC_SPI_InvestorIDMinLength '1' +///ͶʺŴС +#define THOST_FTDC_SPI_AccountIDMinLength '2' +///Ͷ߿Ĭϵ¼Ȩ +#define THOST_FTDC_SPI_UserRightLogon '3' +///Ͷ߽׽㵥ɽܷʽ +#define THOST_FTDC_SPI_SettlementBillTrade '4' +///ͳһ½ױ뷽ʽ +#define THOST_FTDC_SPI_TradingCode '5' +///Ƿжϴδ˵ijͷʽ +#define THOST_FTDC_SPI_CheckFund '6' +///ǷģȨ +#define THOST_FTDC_SPI_CommModelRight '7' +///Ƿñ֤ģȨ +#define THOST_FTDC_SPI_MarginModelRight '9' +///Ƿ淶ûܼ +#define THOST_FTDC_SPI_IsStandardActive '8' +///ϴĽļ· +#define THOST_FTDC_SPI_UploadSettlementFile 'U' +///ϱ֤ļ· +#define THOST_FTDC_SPI_DownloadCSRCFile 'D' +///ɵĽ㵥ļ· +#define THOST_FTDC_SPI_SettlementBillFile 'S' +///֤ļʶ +#define THOST_FTDC_SPI_CSRCOthersFile 'C' +///ͶƬ· +#define THOST_FTDC_SPI_InvestorPhoto 'P' +///ȫᾭ͹˾ϴļ· +#define THOST_FTDC_SPI_CSRCData 'R' +///¼뷽ʽ +#define THOST_FTDC_SPI_InvestorPwdModel 'I' +///Ͷнļ· +#define THOST_FTDC_SPI_CFFEXInvestorSettleFile 'F' +///Ͷߴ뷽ʽ +#define THOST_FTDC_SPI_InvestorIDType 'a' +///߻Ȩ +#define THOST_FTDC_SPI_FreezeMaxReMain 'r' +///زʵʱϳ +#define THOST_FTDC_SPI_IsSync 'A' +///Ȩ +#define THOST_FTDC_SPI_RelieveOpenLimit 'O' +///Ƿ淶û +#define THOST_FTDC_SPI_IsStandardFreeze 'X' +///֣Ƿ񿪷Ʒױ +#define THOST_FTDC_SPI_CZCENormalProductHedge 'B' + +typedef char TThostFtdcSystemParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeParamIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +///ϵͳ㷨 +#define THOST_FTDC_TPID_EncryptionStandard 'E' +///ϵͳ㷨 +#define THOST_FTDC_TPID_RiskMode 'R' +///ϵͳ㷨Ƿȫ 0- 1- +#define THOST_FTDC_TPID_RiskModeGlobal 'G' +///㷨 +#define THOST_FTDC_TPID_modeEncode 'P' +///۸Сλ +#define THOST_FTDC_TPID_tickMode 'T' +///ûỰ +#define THOST_FTDC_TPID_SingleUserSessionMaxNum 'S' +///¼ʧ +#define THOST_FTDC_TPID_LoginFailMaxNum 'L' +///Ƿǿ֤ +#define THOST_FTDC_TPID_IsAuthForce 'A' +///Ƿ񶳽֤ȯֲ +#define THOST_FTDC_TPID_IsPosiFreeze 'F' +///Ƿ޲ +#define THOST_FTDC_TPID_IsPosiLimit 'M' +///֣ѯʱ +#define THOST_FTDC_TPID_ForQuoteTimeInterval 'Q' +///Ƿڻ޲ +#define THOST_FTDC_TPID_IsFuturePosiLimit 'B' +///ǷڻµƵ +#define THOST_FTDC_TPID_IsFutureOrderFreq 'C' +///Ƿ񱨵 +#define THOST_FTDC_TPID_IsOrderTypeLimit 'D' +///ȨǷӯ +#define THOST_FTDC_TPID_IsExecOrderProfit 'H' + +typedef char TThostFtdcTradeParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementParamValueTypeһֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettlementParamValueType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCounterIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCounterIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorGroupNameTypeһͶ߷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorGroupNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrandCodeTypeһƺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrandCodeType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWarehouseTypeһֿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWarehouseType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductDateType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGradeTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcGradeType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClassifyTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClassifyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPositionType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYieldlyTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcYieldlyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWeightTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWeightType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubEntryFundNoTypeһʽˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSubEntryFundNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileIDTypeһļʶ +///////////////////////////////////////////////////////////////////////// +///ʽ +#define THOST_FTDC_FI_SettlementFund 'F' +///ɽ +#define THOST_FTDC_FI_Trade 'T' +///Ͷֲ߳ +#define THOST_FTDC_FI_InvestorPosition 'P' +///Ͷ߷ʽ +#define THOST_FTDC_FI_SubEntryFund 'O' +///ϳֲ +#define THOST_FTDC_FI_CZCECombinationPos 'C' +///ϱ֤ +#define THOST_FTDC_FI_CSRCData 'R' +///֣ƽ˽ +#define THOST_FTDC_FI_CZCEClose 'L' +///֣ƽ˽ +#define THOST_FTDC_FI_CZCENoClose 'N' +///ֲϸ +#define THOST_FTDC_FI_PositionDtl 'D' +///Ȩִļ +#define THOST_FTDC_FI_OptionStrike 'S' +///۱ȶļ +#define THOST_FTDC_FI_SettlementPriceComparison 'M' +///dzֱֲ䶯ϸ +#define THOST_FTDC_FI_NonTradePosChange 'B' + +typedef char TThostFtdcFileIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFileNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileTypeTypeһļϴ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FUT_Settlement '0' +///˶ +#define THOST_FTDC_FUT_Check '1' + +typedef char TThostFtdcFileTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileFormatTypeһļʽ +///////////////////////////////////////////////////////////////////////// +///ıļ(.txt) +#define THOST_FTDC_FFT_Txt '0' +///ѹļ(.zip) +#define THOST_FTDC_FFT_Zip '1' +///DBFļ(.dbf) +#define THOST_FTDC_FFT_DBF '2' + +typedef char TThostFtdcFileFormatType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileUploadStatusTypeһļ״̬ +///////////////////////////////////////////////////////////////////////// +///ϴɹ +#define THOST_FTDC_FUS_SucceedUpload '1' +///ϴʧ +#define THOST_FTDC_FUS_FailedUpload '2' +///ɹ +#define THOST_FTDC_FUS_SucceedLoad '3' +///벿ֳɹ +#define THOST_FTDC_FUS_PartSucceedLoad '4' +///ʧ +#define THOST_FTDC_FUS_FailedLoad '5' + +typedef char TThostFtdcFileUploadStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferDirectionTypeһƲַ +///////////////////////////////////////////////////////////////////////// +///Ƴ +#define THOST_FTDC_TD_Out '0' +/// +#define THOST_FTDC_TD_In '1' + +typedef char TThostFtdcTransferDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUploadModeTypeһϴļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUploadModeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountIDTypeһͶʺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAccountIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankFlagTypeһͳһʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankFlagType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenNameTypeһ˻Ŀ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOpenNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenBankTypeһ˻Ŀ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOpenBankType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPublishPathTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPublishPathType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperatorIDType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthCountTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMonthCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAdvanceMonthArrayTypeһ·ǰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAdvanceMonthArrayType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDateExprTypeһڱʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDateExprType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDExprTypeһԼʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDExprType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentNameExprTypeһԼƱʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentNameExprType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSpecialCreateRuleTypeһĴ +///////////////////////////////////////////////////////////////////////// +///ûⴴ +#define THOST_FTDC_SC_NoSpecialRule '0' +/// +#define THOST_FTDC_SC_NoSpringFestival '1' + +typedef char TThostFtdcSpecialCreateRuleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBasisPriceTypeTypeһƻ׼ +///////////////////////////////////////////////////////////////////////// +///һԼ +#define THOST_FTDC_IPT_LastSettlement '1' +///һԼ̼ +#define THOST_FTDC_IPT_LaseClose '2' + +typedef char TThostFtdcBasisPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductLifePhaseTypeһƷ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_PLP_Active '1' +///Ծ +#define THOST_FTDC_PLP_NonActive '2' +///ע +#define THOST_FTDC_PLP_Canceled '3' + +typedef char TThostFtdcProductLifePhaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeliveryModeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///ֽ𽻸 +#define THOST_FTDC_DM_CashDeliv '1' +///ʵサ +#define THOST_FTDC_DM_CommodityDeliv '2' + +typedef char TThostFtdcDeliveryModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLogLevelTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLogLevelType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessNameTypeһ洢 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperationMemoTypeһժҪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperationMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundIOTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FIOT_FundIO '1' +///ת +#define THOST_FTDC_FIOT_Transfer '2' +///ڻ +#define THOST_FTDC_FIOT_SwapCurrency '3' + +typedef char TThostFtdcFundIOTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundTypeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_FT_Deposite '1' +///ʽ +#define THOST_FTDC_FT_ItemFund '2' +///˾ +#define THOST_FTDC_FT_Company '3' +///ʽת +#define THOST_FTDC_FT_InnerTransfer '4' + +typedef char TThostFtdcFundTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FD_In '1' +/// +#define THOST_FTDC_FD_Out '2' + +typedef char TThostFtdcFundDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundStatusTypeһʽ״̬ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_FS_Record '1' +///Ѹ +#define THOST_FTDC_FS_Check '2' +///ѳ +#define THOST_FTDC_FS_Charge '3' + +typedef char TThostFtdcFundStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillNoTypeһƱݺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBillNoType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillNameTypeһƱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBillNameType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPublishStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PS_None '1' +///ڷ +#define THOST_FTDC_PS_Publishing '2' +///ѷ +#define THOST_FTDC_PS_Published '3' + +typedef char TThostFtdcPublishStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueIDTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueIDType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueTypeTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueLabelTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueLabelType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueResultTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueResultType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemStatusTypeһϵͳ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_ES_NonActive '1' +/// +#define THOST_FTDC_ES_Startup '2' +///׿ʼʼ +#define THOST_FTDC_ES_Initialize '3' +///ɳʼ +#define THOST_FTDC_ES_Initialized '4' +///пʼ +#define THOST_FTDC_ES_Close '5' +/// +#define THOST_FTDC_ES_Closed '6' +/// +#define THOST_FTDC_ES_Settlement '7' + +typedef char TThostFtdcSystemStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ʼ +#define THOST_FTDC_STS_Initialize '0' +/// +#define THOST_FTDC_STS_Settlementing '1' +///ѽ +#define THOST_FTDC_STS_Settlemented '2' +/// +#define THOST_FTDC_STS_Finished '3' + +typedef char TThostFtdcSettlementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntTypeTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntFromTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntFromType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntToTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntToType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionIDTypeһܴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionIDType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionValueCodeTypeһܱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionValueCodeType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleIDTypeһɫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRoleIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleNameTypeһɫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRoleNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDescriptionTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDescriptionType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombineIDTypeһϱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombineIDType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombineTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombineTypeType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CT_Person '0' +/// +#define THOST_FTDC_CT_Company '1' +///Ͷʻ +#define THOST_FTDC_CT_Fund '2' +///ⷨ +#define THOST_FTDC_CT_SpecialOrgan '3' +///ʹܻ +#define THOST_FTDC_CT_Asset '4' + +typedef char TThostFtdcInvestorTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerTypeTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +///׻Ա +#define THOST_FTDC_BT_Trade '0' +///׽Ա +#define THOST_FTDC_BT_TradeSettle '1' + +typedef char TThostFtdcBrokerTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskLevelTypeһյȼ +///////////////////////////////////////////////////////////////////////// +///ͷտͻ +#define THOST_FTDC_FAS_Low '1' +///ͨͻ +#define THOST_FTDC_FAS_Normal '2' +///עͻ +#define THOST_FTDC_FAS_Focus '3' +///տͻ +#define THOST_FTDC_FAS_Risk '4' + +typedef char TThostFtdcRiskLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFeeAcceptStyleTypeһȡʽ +///////////////////////////////////////////////////////////////////////// +///ȡ +#define THOST_FTDC_FAS_ByTrade '1' +///ȡ +#define THOST_FTDC_FAS_ByDeliv '2' +/// +#define THOST_FTDC_FAS_None '3' +///ָȡ +#define THOST_FTDC_FAS_FixFee '4' + +typedef char TThostFtdcFeeAcceptStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PWDT_Trade '1' +///ʽ +#define THOST_FTDC_PWDT_Account '2' + +typedef char TThostFtdcPasswordTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAlgorithmTypeһӯ㷨 +///////////////////////////////////////////////////////////////////////// +///ӯ +#define THOST_FTDC_AG_All '1' +///ӯƣ +#define THOST_FTDC_AG_OnlyLost '2' +///ӯƣ +#define THOST_FTDC_AG_OnlyGain '3' +///ӯ +#define THOST_FTDC_AG_None '4' + +typedef char TThostFtdcAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIncludeCloseProfitTypeһǷƽӯ +///////////////////////////////////////////////////////////////////////// +///ƽӯ +#define THOST_FTDC_ICP_Include '0' +///ƽӯ +#define THOST_FTDC_ICP_NotInclude '2' + +typedef char TThostFtdcIncludeCloseProfitType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAllWithoutTradeTypeһǷܿ +///////////////////////////////////////////////////////////////////////// +///޲޳ɽܿ +#define THOST_FTDC_AWT_Enable '0' +///ܿ +#define THOST_FTDC_AWT_Disable '2' +///޲ֲܿ +#define THOST_FTDC_AWT_NoHoldEnable '3' + +typedef char TThostFtdcAllWithoutTradeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommentTypeһӯ㷨˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommentType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVersionTypeһ汾 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcVersionType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeCodeTypeһ״ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeSerialType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSerialNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradeSerialNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureIDTypeһڻ˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankIDTypeһд +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankBrchIDTypeһзĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankBrchIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankBranchIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankBranchIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperNoTypeһ׹Ա +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperNoType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeviceIDTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDeviceIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRecordNumTypeһ¼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRecordNumType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccountTypeһڻʽ˺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccountType[22]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFuturePwdFlagTypeһʽ˶Ա־ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_FPWD_UnCheck '0' +///˶ +#define THOST_FTDC_FPWD_Check '1' + +typedef char TThostFtdcFuturePwdFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferTypeTypeһת +///////////////////////////////////////////////////////////////////////// +///תڻ +#define THOST_FTDC_TT_BankToFuture '0' +///ڻת +#define THOST_FTDC_TT_FutureToBank '1' + +typedef char TThostFtdcTransferTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccPwdTypeһڻʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccPwdType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyCodeType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRetCodeTypeһӦ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRetCodeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRetInfoTypeһӦϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRetInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeAmtTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUseAmtTypeһп +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUseAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFetchAmtTypeһпȡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFetchAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferValidFlagTypeһתЧ־ +///////////////////////////////////////////////////////////////////////// +///Чʧ +#define THOST_FTDC_TVF_Invalid '0' +///Ч +#define THOST_FTDC_TVF_Valid '1' +/// +#define THOST_FTDC_TVF_Reverse '2' + +typedef char TThostFtdcTransferValidFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCertCodeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCertCodeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReasonTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_RN_CD '0' +///ʽ; +#define THOST_FTDC_RN_ZT '1' +/// +#define THOST_FTDC_RN_QT '2' + +typedef char TThostFtdcReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundProjectIDTypeһʽĿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFundProjectIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSexTypeһԱ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_SEX_None '0' +/// +#define THOST_FTDC_SEX_Man '1' +///Ů +#define THOST_FTDC_SEX_Woman '2' + +typedef char TThostFtdcSexType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProfessionTypeһְҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProfessionType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNationalTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNationalType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProvinceTypeһʡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProvinceType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRegionTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRegionType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCountryTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCountryType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLicenseNOTypeһӪҵִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLicenseNOType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCompanyTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCompanyTypeType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessScopeTypeһӪΧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessScopeType[1001]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCapitalCurrencyTypeһעʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCapitalCurrencyType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserTypeTypeһû +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_UT_Investor '0' +///Ա +#define THOST_FTDC_UT_Operator '1' +///Ա +#define THOST_FTDC_UT_SuperUser '2' + +typedef char TThostFtdcUserTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchIDTypeһӪҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBranchIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_RATETYPE_MarginRate '2' + +typedef char TThostFtdcRateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNoteTypeTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +///׽㵥 +#define THOST_FTDC_NOTETYPE_TradeSettleBill '1' +///׽± +#define THOST_FTDC_NOTETYPE_TradeSettleMonth '2' +///׷ӱ֤֪ͨ +#define THOST_FTDC_NOTETYPE_CallMarginNotes '3' +///ǿƽ֪ͨ +#define THOST_FTDC_NOTETYPE_ForceCloseNotes '4' +///ɽ֪ͨ +#define THOST_FTDC_NOTETYPE_TradeNotes '5' +///֪ͨ +#define THOST_FTDC_NOTETYPE_DelivNotes '6' + +typedef char TThostFtdcNoteTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementStyleTypeһ㵥ʽ +///////////////////////////////////////////////////////////////////////// +///ն +#define THOST_FTDC_SBS_Day '1' +///ʶԳ +#define THOST_FTDC_SBS_Volume '2' + +typedef char TThostFtdcSettlementStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerDNSTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerDNSType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSentenceTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSentenceType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementBillTypeTypeһ㵥 +///////////////////////////////////////////////////////////////////////// +///ձ +#define THOST_FTDC_ST_Day '0' +///± +#define THOST_FTDC_ST_Month '1' + +typedef char TThostFtdcSettlementBillTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserRightTypeTypeһͻȨ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_URT_Logon '1' +///ת +#define THOST_FTDC_URT_Transfer '2' +///ʼĽ㵥 +#define THOST_FTDC_URT_EMail '3' +///㵥 +#define THOST_FTDC_URT_Fax '4' +/// +#define THOST_FTDC_URT_ConditionOrder '5' + +typedef char TThostFtdcUserRightTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginPriceTypeTypeһ֤۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_MPT_PreSettlementPrice '1' +///¼ +#define THOST_FTDC_MPT_SettlementPrice '2' +///ɽ +#define THOST_FTDC_MPT_AveragePrice '3' +///ּ +#define THOST_FTDC_MPT_OpenPrice '4' + +typedef char TThostFtdcMarginPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillGenStatusTypeһ㵥״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_BGS_None '0' +/// +#define THOST_FTDC_BGS_NoGenerated '1' +/// +#define THOST_FTDC_BGS_Generated '2' + +typedef char TThostFtdcBillGenStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAlgoTypeTypeһ㷨 +///////////////////////////////////////////////////////////////////////// +///ֲִ㷨 +#define THOST_FTDC_AT_HandlePositionAlgo '1' +///Ѱұ֤㷨 +#define THOST_FTDC_AT_FindMarginRateAlgo '2' + +typedef char TThostFtdcAlgoTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandlePositionAlgoIDTypeһֲִ㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HPA_Base '1' +///Ʒ +#define THOST_FTDC_HPA_DCE '2' +///֣Ʒ +#define THOST_FTDC_HPA_CZCE '3' + +typedef char TThostFtdcHandlePositionAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFindMarginRateAlgoIDTypeһѰұ֤㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FMRA_Base '1' +///Ʒ +#define THOST_FTDC_FMRA_DCE '2' +///֣Ʒ +#define THOST_FTDC_FMRA_CZCE '3' + +typedef char TThostFtdcFindMarginRateAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandleTradingAccountAlgoIDTypeһʽ㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HTAA_Base '1' +///Ʒ +#define THOST_FTDC_HTAA_DCE '2' +///֣Ʒ +#define THOST_FTDC_HTAA_CZCE '3' + +typedef char TThostFtdcHandleTradingAccountAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPersonTypeTypeһϵ +///////////////////////////////////////////////////////////////////////// +///ָµ +#define THOST_FTDC_PST_Order '1' +///Ȩ +#define THOST_FTDC_PST_Open '2' +///ʽ +#define THOST_FTDC_PST_Fund '3' +///㵥ȷ +#define THOST_FTDC_PST_Settlement '4' +/// +#define THOST_FTDC_PST_Company '5' +///˴ +#define THOST_FTDC_PST_Corporation '6' +///Ͷϵ +#define THOST_FTDC_PST_LinkMan '7' +///ֻʲ +#define THOST_FTDC_PST_Ledger '8' +///У +#define THOST_FTDC_PST_Trustee '9' +///Уܻ˴ +#define THOST_FTDC_PST_TrusteeCorporation 'A' +///УܻȨ +#define THOST_FTDC_PST_TrusteeOpen 'B' +///Уܻϵ +#define THOST_FTDC_PST_TrusteeContact 'C' +///Ȼ˲ο֤ +#define THOST_FTDC_PST_ForeignerRefer 'D' +///˴ο֤ +#define THOST_FTDC_PST_CorporationRefer 'E' + +typedef char TThostFtdcPersonTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQueryInvestorRangeTypeһѯΧ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_QIR_All '1' +///ѯ +#define THOST_FTDC_QIR_Group '2' +///һͶ +#define THOST_FTDC_QIR_Single '3' + +typedef char TThostFtdcQueryInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorRiskStatusTypeһͶ߷״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IRS_Normal '1' +/// +#define THOST_FTDC_IRS_Warn '2' +///׷ +#define THOST_FTDC_IRS_Call '3' +///ǿƽ +#define THOST_FTDC_IRS_Force '4' +///쳣 +#define THOST_FTDC_IRS_Exception '5' + +typedef char TThostFtdcInvestorRiskStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLegIDTypeһȱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLegIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLegMultipleTypeһȳ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLegMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcImplyLevelTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcImplyLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearAccountType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganNOTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganNOType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearbarchIDTypeһ˻к +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearbarchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventTypeTypeһû¼ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_UET_Login '1' +///dz +#define THOST_FTDC_UET_Logout '2' +///׳ɹ +#define THOST_FTDC_UET_Trading '3' +///ʧ +#define THOST_FTDC_UET_TradingError '4' +///޸ +#define THOST_FTDC_UET_UpdatePassword '5' +///ͻ֤ +#define THOST_FTDC_UET_Authenticate '6' +/// +#define THOST_FTDC_UET_Other '9' + +typedef char TThostFtdcUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventInfoTypeһû¼Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserEventInfoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCloseStyleTypeһƽַʽ +///////////////////////////////////////////////////////////////////////// +///ȿƽ +#define THOST_FTDC_ICS_Close '0' +///ƽƽ +#define THOST_FTDC_ICS_CloseToday '1' + +typedef char TThostFtdcCloseStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStatModeTypeһͳƷʽ +///////////////////////////////////////////////////////////////////////// +///---- +#define THOST_FTDC_SM_Non '0' +///Լͳ +#define THOST_FTDC_SM_Instrument '1' +///Ʒͳ +#define THOST_FTDC_SM_Product '2' +///Ͷͳ +#define THOST_FTDC_SM_Investor '3' + +typedef char TThostFtdcStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParkedOrderStatusTypeһԤ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PAOS_NotSend '1' +///ѷ +#define THOST_FTDC_PAOS_Send '2' +///ɾ +#define THOST_FTDC_PAOS_Deleted '3' + +typedef char TThostFtdcParkedOrderStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParkedOrderIDTypeһԤ񱨵 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParkedOrderIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParkedOrderActionIDTypeһԤ񳷵 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParkedOrderActionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirDealStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ڴ +#define THOST_FTDC_VDS_Dealing '1' +///ɹ +#define THOST_FTDC_VDS_DeaclSucceed '2' + +typedef char TThostFtdcVirDealStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrgSystemIDTypeһԭϵͳ +///////////////////////////////////////////////////////////////////////// +///ۺϽƽ̨ +#define THOST_FTDC_ORGS_Standard '0' +///ʢϵͳ +#define THOST_FTDC_ORGS_ESunny '1' +///˴V6ϵͳ +#define THOST_FTDC_ORGS_KingStarV6 '2' + +typedef char TThostFtdcOrgSystemIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirTradeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VTS_NaturalDeal '0' +///ɹ +#define THOST_FTDC_VTS_SucceedEnd '1' +///ʧܽ +#define THOST_FTDC_VTS_FailedEND '2' +///쳣 +#define THOST_FTDC_VTS_Exception '3' +///˹쳣 +#define THOST_FTDC_VTS_ManualDeal '4' +///ͨѶ쳣 ˹ +#define THOST_FTDC_VTS_MesException '5' +///ϵͳ˹ +#define THOST_FTDC_VTS_SysException '6' + +typedef char TThostFtdcVirTradeStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirBankAccTypeTypeһʻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VBAT_BankBook '1' +/// +#define THOST_FTDC_VBAT_BankCard '2' +///ÿ +#define THOST_FTDC_VBAT_CreditCard '3' + +typedef char TThostFtdcVirBankAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementStatusTypeһʻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VMS_Natural '0' +/// +#define THOST_FTDC_VMS_Canceled '9' + +typedef char TThostFtdcVirementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementAvailAbilityTypeһЧ־ +///////////////////////////////////////////////////////////////////////// +///δȷ +#define THOST_FTDC_VAA_NoAvailAbility '0' +///Ч +#define THOST_FTDC_VAA_AvailAbility '1' +/// +#define THOST_FTDC_VAA_Repeal '2' + +typedef char TThostFtdcVirementAvailAbilityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementTradeCodeTypeһ״ +///////////////////////////////////////////////////////////////////////// +///зʽתڻ +#define THOST_FTDC_VTC_BankBankToFuture '102001' +///зڻʽת +#define THOST_FTDC_VTC_BankFutureToBank '102002' +///ڻʽתڻ +#define THOST_FTDC_VTC_FutureBankToFuture '202001' +///ڻڻʽת +#define THOST_FTDC_VTC_FutureFutureToBank '202002' + +typedef char TThostFtdcVirementTradeCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoTypeNameTypeһӰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoTypeNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoTypeIDTypeһӰʹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoTypeIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoNameTypeһӰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoNameType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTopicIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTopicIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReportTypeIDTypeһױͱʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcReportTypeIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCharacterIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCharacterIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLParamIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInvestorTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInvestorTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLIdCardTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLIdCardTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradeDirectTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradeDirectType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradeModelTypeһʽʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradeModelType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLParamIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLOpParamValueTypeһҵֵ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcAMLOpParamValueType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCustomerCardTypeTypeһͻ֤/֤ļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCustomerCardTypeType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionNameTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLDistrictIDTypeһڻڵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLDistrictIDType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLRelationShipTypeһڻ׵Ĺϵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLRelationShipType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionTypeTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionIDTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLAccountTypeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradingTypeTypeһ׷ʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradingTypeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTransactClassTypeһ֧׷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTransactClassType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCapitalIOTypeһʽոʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCapitalIOType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSiteTypeһ׵ص +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSiteType[10]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCapitalPurposeTypeһʽ; +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCapitalPurposeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLReportTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLReportTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSerialNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSerialNoType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLStatusType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLGenStatusTypeһAmlɷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_GEN_Program '0' +///˹ +#define THOST_FTDC_GEN_HandWork '1' + +typedef char TThostFtdcAMLGenStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSeqCodeTypeһҵʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSeqCodeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLFileNameTypeһAMLļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLFileNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLMoneyTypeһϴǮʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcAMLMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLFileAmountTypeһϴǮʽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcAMLFileAmountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCKeyTypeһԿ(֤) +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCFMMCKeyType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCTokenTypeһ(֤) +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCFMMCTokenType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCKeyKindTypeһ̬Կ(֤) +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CFMMCKK_REQUEST 'R' +///CFMMCԶ +#define THOST_FTDC_CFMMCKK_AUTO 'A' +///CFMMCֶ +#define THOST_FTDC_CFMMCKK_MANUAL 'M' + +typedef char TThostFtdcCFMMCKeyKindType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLReportNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLReportNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBFComdTypeTypeһDBF +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDBFComdTypeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBFComTimeTypeһDBFʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDBFComTimeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBFComNoTypeһDBFˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDBFComNoType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBFFdNameTypeһDBFֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDBFFdNameType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBFFdContentTypeһDBFֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDBFFdContentType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIndividualNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIndividualNameType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyIDTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustNumberTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCustNumberType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganCodeType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSuperOrganCodeTypeһϼ,ڻ˾ܲ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSuperOrganCodeType[12]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubBranchIDTypeһ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSubBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubBranchNameTypeһ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSubBranchNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchNetCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBranchNetCodeType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchNetNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBranchNetNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganFlagTypeһʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankCodingForFutureTypeһжڻ˾ı +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankCodingForFutureType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankReturnCodeTypeһжԷĶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankReturnCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPlateReturnCodeTypeһתƽ̨ԷĶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPlateReturnCodeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankSubBranchIDTypeһз֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankSubBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureBranchIDTypeһڻ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnCodeTypeһش +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcReturnCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorCodeTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperatorCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearDepIDTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearDepIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearBrchIDTypeһʻк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearBrchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearNameTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountNameTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvDepIDTypeһͶ˺Ż +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvDepIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvBrchIDTypeһͶк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvBrchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMessageFormatVersionTypeһϢʽ汾 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMessageFormatVersionType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDigestTypeһժҪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDigestType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthenticDataTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthenticDataType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPasswordKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccountNameTypeһڻʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccountNameType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMobilePhoneTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMobilePhoneType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureMainKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureMainKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureWorkKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureWorkKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureTransKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureTransKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankMainKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankMainKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankWorkKeyTypeһйԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankWorkKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankTransKeyTypeһдԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankTransKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankServerDescriptionTypeһзϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankServerDescriptionType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAddInfoTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAddInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDescrInfoForReturnCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDescrInfoForReturnCodeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCountryCodeTypeһҴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCountryCodeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPlateSerialTypeһƽ̨ˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcPlateSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankSerialType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCorrectSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCorrectSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureSerialTypeһڻ˾ˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFutureSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplicationIDTypeһӦñʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcApplicationIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankProxyIDTypeһдʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBankProxyIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTCoreIDTypeһתʺϵͳʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBTCoreIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServerPortTypeһ˿ں +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServerPortType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepealedTimesTypeһѾ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRepealedTimesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepealTimeIntervalTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRepealTimeIntervalType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTotalTimesTypeһÿۼתʴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTotalTimesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTRequestIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBTRequestIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeAmountTypeһ׽Ԫ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcTradeAmountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustFeeTypeһӦտͻãԪ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCustFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureFeeTypeһӦڻ˾ãԪ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcFutureFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSingleMaxAmtTypeһ޶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcSingleMaxAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSingleMinAmtTypeһ޶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcSingleMinAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTotalAmtTypeһÿۼתʶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcTotalAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCertificationTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_CFT_IDCard '0' +/// +#define THOST_FTDC_CFT_Passport '1' +///֤ +#define THOST_FTDC_CFT_OfficerIDCard '2' +///ʿ֤ +#define THOST_FTDC_CFT_SoldierIDCard '3' +///֤ +#define THOST_FTDC_CFT_HomeComingCard '4' +///ڲ +#define THOST_FTDC_CFT_HouseholdRegister '5' +///Ӫҵִպ +#define THOST_FTDC_CFT_LicenseNo '6' +///֤֯ +#define THOST_FTDC_CFT_InstitutionCodeCard '7' +///ʱӪҵִպ +#define THOST_FTDC_CFT_TempLicenseNo '8' +///ҵǼ֤ +#define THOST_FTDC_CFT_NoEnterpriseLicenseNo '9' +///֤ +#define THOST_FTDC_CFT_OtherCard 'x' +///ܲ +#define THOST_FTDC_CFT_SuperDepAgree 'a' + +typedef char TThostFtdcCertificationTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileBusinessCodeTypeһļҵ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBC_Others '0' +///ת˽ϸ +#define THOST_FTDC_FBC_TransferDetails '1' +///ͻ˻״̬ +#define THOST_FTDC_FBC_CustAccStatus '2' +///˻ཻϸ +#define THOST_FTDC_FBC_AccountTradeDetails '3' +///ڻ˻Ϣϸ +#define THOST_FTDC_FBC_FutureAccountChangeInfoDetails '4' +///ͻʽ̨ϸ +#define THOST_FTDC_FBC_CustMoneyDetail '5' +///ͻϢϸ +#define THOST_FTDC_FBC_CustCancelAccountInfo '6' +///ͻʽ˽ +#define THOST_FTDC_FBC_CustMoneyResult '7' +///쳣ļ +#define THOST_FTDC_FBC_OthersExceptionResult '8' +///ͻϢϸ +#define THOST_FTDC_FBC_CustInterestNetMoneyDetails '9' +///ͻʽϸ +#define THOST_FTDC_FBC_CustMoneySendAndReceiveDetails 'a' +///˴ʽջ +#define THOST_FTDC_FBC_CorporationMoneyTotal 'b' +///ʽջ +#define THOST_FTDC_FBC_MainbodyMoneyTotal 'c' +///ܷƽ +#define THOST_FTDC_FBC_MainPartMonitorData 'd' +///б +#define THOST_FTDC_FBC_PreparationMoney 'e' +///Эʽ +#define THOST_FTDC_FBC_BankMoneyMonitorData 'f' + +typedef char TThostFtdcFileBusinessCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCashExchangeCodeTypeһ㳮־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CEC_Exchange '1' +/// +#define THOST_FTDC_CEC_Cash '2' + +typedef char TThostFtdcCashExchangeCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYesNoIndicatorTypeһǻʶ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_YNI_Yes '0' +/// +#define THOST_FTDC_YNI_No '1' + +typedef char TThostFtdcYesNoIndicatorType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBanlanceTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ǰ +#define THOST_FTDC_BLT_CurrentMoney '0' +/// +#define THOST_FTDC_BLT_UsableMoney '1' +///ȡ +#define THOST_FTDC_BLT_FetchableMoney '2' +/// +#define THOST_FTDC_BLT_FreezeMoney '3' + +typedef char TThostFtdcBanlanceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGenderTypeһԱ +///////////////////////////////////////////////////////////////////////// +///δ֪״̬ +#define THOST_FTDC_GD_Unknown '0' +/// +#define THOST_FTDC_GD_Male '1' +///Ů +#define THOST_FTDC_GD_Female '2' + +typedef char TThostFtdcGenderType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFeePayFlagTypeһ֧־ +///////////////////////////////////////////////////////////////////////// +///淽֧ +#define THOST_FTDC_FPF_BEN '0' +///ɷͷ֧ +#define THOST_FTDC_FPF_OUR '1' +///ɷͷ֧ķã淽֧ܵķ +#define THOST_FTDC_FPF_SHA '2' + +typedef char TThostFtdcFeePayFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPassWordKeyTypeTypeһԿ +///////////////////////////////////////////////////////////////////////// +///Կ +#define THOST_FTDC_PWKT_ExchangeKey '0' +///Կ +#define THOST_FTDC_PWKT_PassWordKey '1' +///MACԿ +#define THOST_FTDC_PWKT_MACKey '2' +///Կ +#define THOST_FTDC_PWKT_MessageKey '3' + +typedef char TThostFtdcPassWordKeyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTPassWordTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ѯ +#define THOST_FTDC_PWT_Query '0' +///ȡ +#define THOST_FTDC_PWT_Fetch '1' +///ת +#define THOST_FTDC_PWT_Transfer '2' +/// +#define THOST_FTDC_PWT_Trade '3' + +typedef char TThostFtdcFBTPassWordTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTEncryModeTypeһܷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EM_NoEncry '0' +///DES +#define THOST_FTDC_EM_DES '1' +///3DES +#define THOST_FTDC_EM_3DES '2' + +typedef char TThostFtdcFBTEncryModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankRepealFlagTypeһг־ +///////////////////////////////////////////////////////////////////////// +///Զ +#define THOST_FTDC_BRF_BankNotNeedRepeal '0' +///дԶ +#define THOST_FTDC_BRF_BankWaitingRepeal '1' +///Զ +#define THOST_FTDC_BRF_BankBeenRepealed '2' + +typedef char TThostFtdcBankRepealFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerRepealFlagTypeһ̳־ +///////////////////////////////////////////////////////////////////////// +///Զ +#define THOST_FTDC_BRORF_BrokerNotNeedRepeal '0' +///̴Զ +#define THOST_FTDC_BRORF_BrokerWaitingRepeal '1' +///Զ +#define THOST_FTDC_BRORF_BrokerBeenRepealed '2' + +typedef char TThostFtdcBrokerRepealFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstitutionTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TS_Bank '0' +/// +#define THOST_FTDC_TS_Future '1' +///ȯ +#define THOST_FTDC_TS_Store '2' + +typedef char TThostFtdcInstitutionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastFragmentTypeһƬ־ +///////////////////////////////////////////////////////////////////////// +///Ƭ +#define THOST_FTDC_LF_Yes '0' +///Ƭ +#define THOST_FTDC_LF_No '1' + +typedef char TThostFtdcLastFragmentType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccStatusTypeһ˻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_BAS_Normal '0' +/// +#define THOST_FTDC_BAS_Freeze '1' +///ʧ +#define THOST_FTDC_BAS_ReportLoss '2' + +typedef char TThostFtdcBankAccStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoneyAccountStatusTypeһʽ˻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_MAS_Normal '0' +/// +#define THOST_FTDC_MAS_Cancel '1' + +typedef char TThostFtdcMoneyAccountStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcManageStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ָ +#define THOST_FTDC_MSS_Point '0' +///Ԥָ +#define THOST_FTDC_MSS_PrePoint '1' +///ָ +#define THOST_FTDC_MSS_CancelPoint '2' + +typedef char TThostFtdcManageStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemTypeTypeһӦϵͳ +///////////////////////////////////////////////////////////////////////// +///ת +#define THOST_FTDC_SYT_FutureBankTransfer '0' +///֤ת +#define THOST_FTDC_SYT_StockBankTransfer '1' +/// +#define THOST_FTDC_SYT_TheThirdPartStore '2' + +typedef char TThostFtdcSystemTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTxnEndFlagTypeһתʻת־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TEF_NormalProcessing '0' +///ɹ +#define THOST_FTDC_TEF_Success '1' +///ʧܽ +#define THOST_FTDC_TEF_Failed '2' +///쳣 +#define THOST_FTDC_TEF_Abnormal '3' +///˹쳣 +#define THOST_FTDC_TEF_ManualProcessedForException '4' +///ͨѶ쳣 ˹ +#define THOST_FTDC_TEF_CommuFailedNeedManualProcess '5' +///ϵͳ˹ +#define THOST_FTDC_TEF_SysErrorNeedManualProcess '6' + +typedef char TThostFtdcTxnEndFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessStatusTypeһתʷ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PSS_NotProcess '0' +///ʼ +#define THOST_FTDC_PSS_StartProcess '1' +/// +#define THOST_FTDC_PSS_Finished '2' + +typedef char TThostFtdcProcessStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustTypeTypeһͻ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CUSTT_Person '0' +/// +#define THOST_FTDC_CUSTT_Institution '1' + +typedef char TThostFtdcCustTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTTransferDirectionTypeһתʷ +///////////////////////////////////////////////////////////////////////// +///תڻ +#define THOST_FTDC_FBTTD_FromBankToFuture '1' +///ڻת +#define THOST_FTDC_FBTTD_FromFutureToBank '2' + +typedef char TThostFtdcFBTTransferDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenOrDestroyTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OOD_Open '1' +/// +#define THOST_FTDC_OOD_Destroy '0' + +typedef char TThostFtdcOpenOrDestroyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAvailabilityFlagTypeһЧ־ +///////////////////////////////////////////////////////////////////////// +///δȷ +#define THOST_FTDC_AVAF_Invalid '0' +///Ч +#define THOST_FTDC_AVAF_Valid '1' +/// +#define THOST_FTDC_AVAF_Repeal '2' + +typedef char TThostFtdcAvailabilityFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_OT_Bank '1' +///ǰ +#define THOST_FTDC_OT_Future '2' +///תƽ̨ +#define THOST_FTDC_OT_PlateForm '9' + +typedef char TThostFtdcOrganTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganLevelTypeһ +///////////////////////////////////////////////////////////////////////// +///лܲ +#define THOST_FTDC_OL_HeadQuarters '1' +///зĻڻ˾Ӫҵ +#define THOST_FTDC_OL_Branch '2' + +typedef char TThostFtdcOrganLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProtocalIDTypeһЭ +///////////////////////////////////////////////////////////////////////// +///Э +#define THOST_FTDC_PID_FutureProtocal '0' +///Э +#define THOST_FTDC_PID_ICBCProtocal '1' +///ũЭ +#define THOST_FTDC_PID_ABCProtocal '2' +///йЭ +#define THOST_FTDC_PID_CBCProtocal '3' +///Э +#define THOST_FTDC_PID_CCBProtocal '4' +///Э +#define THOST_FTDC_PID_BOCOMProtocal '5' +///תƽ̨Э +#define THOST_FTDC_PID_FBTPlateFormProtocal 'X' + +typedef char TThostFtdcProtocalIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcConnectModeTypeһ׽ӷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CM_ShortConnect '0' +/// +#define THOST_FTDC_CM_LongConnect '1' + +typedef char TThostFtdcConnectModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncModeTypeһ׽ͨŷʽ +///////////////////////////////////////////////////////////////////////// +///첽 +#define THOST_FTDC_SRM_ASync '0' +///ͬ +#define THOST_FTDC_SRM_Sync '1' + +typedef char TThostFtdcSyncModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccTypeTypeһʺ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_BAT_BankBook '1' +/// +#define THOST_FTDC_BAT_SavingCard '2' +///ÿ +#define THOST_FTDC_BAT_CreditCard '3' + +typedef char TThostFtdcBankAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccTypeTypeһڻ˾ʺ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_FAT_BankBook '1' +/// +#define THOST_FTDC_FAT_SavingCard '2' +///ÿ +#define THOST_FTDC_FAT_CreditCard '3' + +typedef char TThostFtdcFutureAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OS_Ready '0' +///ǩ +#define THOST_FTDC_OS_CheckIn '1' +///ǩ +#define THOST_FTDC_OS_CheckOut '2' +///ļ +#define THOST_FTDC_OS_CheckFileArrived '3' +/// +#define THOST_FTDC_OS_CheckDetail '4' +/// +#define THOST_FTDC_OS_DayEndClean '5' +///ע +#define THOST_FTDC_OS_Invalid '9' + +typedef char TThostFtdcOrganStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCCBFeeModeTypeһշģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CCBFM_ByAmount '1' +///¿ +#define THOST_FTDC_CCBFM_ByMonth '2' + +typedef char TThostFtdcCCBFeeModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommApiTypeTypeһͨѶAPI +///////////////////////////////////////////////////////////////////////// +///ͻ +#define THOST_FTDC_CAPIT_Client '1' +/// +#define THOST_FTDC_CAPIT_Server '2' +///ϵͳUserApi +#define THOST_FTDC_CAPIT_UserApi '3' + +typedef char TThostFtdcCommApiTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServiceIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceLineNoTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServiceLineNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcServiceNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLinkStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿ +#define THOST_FTDC_LS_Connected '1' +///û +#define THOST_FTDC_LS_Disconnected '2' + +typedef char TThostFtdcLinkStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommApiPointerTypeһͨѶAPIָ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCommApiPointerType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPwdFlagTypeһ˶Ա־ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_BPWDF_NoCheck '0' +///ĺ˶ +#define THOST_FTDC_BPWDF_BlankCheck '1' +///ĺ˶ +#define THOST_FTDC_BPWDF_EncryptCheck '2' + +typedef char TThostFtdcPwdFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSecuAccTypeTypeһڻʺ +///////////////////////////////////////////////////////////////////////// +///ʽʺ +#define THOST_FTDC_SAT_AccountID '1' +///ʽ𿨺 +#define THOST_FTDC_SAT_CardID '2' +///Ϻɶʺ +#define THOST_FTDC_SAT_SHStockholderID '3' +///ڹɶʺ +#define THOST_FTDC_SAT_SZStockholderID '4' + +typedef char TThostFtdcSecuAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferStatusTypeһת˽״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TRFS_Normal '0' +/// +#define THOST_FTDC_TRFS_Repealed '1' + +typedef char TThostFtdcTransferStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSponsorTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SPTYPE_Broker '0' +/// +#define THOST_FTDC_SPTYPE_Bank '1' + +typedef char TThostFtdcSponsorTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReqRspTypeTypeһӦ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_REQRSP_Request '0' +///Ӧ +#define THOST_FTDC_REQRSP_Response '1' + +typedef char TThostFtdcReqRspTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTUserEventTypeTypeһתû¼ +///////////////////////////////////////////////////////////////////////// +///ǩ +#define THOST_FTDC_FBTUET_SignIn '0' +///תڻ +#define THOST_FTDC_FBTUET_FromBankToFuture '1' +///ڻת +#define THOST_FTDC_FBTUET_FromFutureToBank '2' +/// +#define THOST_FTDC_FBTUET_OpenAccount '3' +/// +#define THOST_FTDC_FBTUET_CancelAccount '4' +///˻ +#define THOST_FTDC_FBTUET_ChangeAccount '5' +///תڻ +#define THOST_FTDC_FBTUET_RepealFromBankToFuture '6' +///ڻת +#define THOST_FTDC_FBTUET_RepealFromFutureToBank '7' +///ѯ˻ +#define THOST_FTDC_FBTUET_QueryBankAccount '8' +///ѯڻ˻ +#define THOST_FTDC_FBTUET_QueryFutureAccount '9' +///ǩ +#define THOST_FTDC_FBTUET_SignOut 'A' +///Կͬ +#define THOST_FTDC_FBTUET_SyncKey 'B' +/// +#define THOST_FTDC_FBTUET_Other 'Z' + +typedef char TThostFtdcFBTUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankIDByBankTypeһԼı +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankIDByBankType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankOperNoTypeһвԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankOperNoType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankCustNoTypeһпͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankCustNoType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBOPSeqNoTypeһк +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDBOPSeqNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTableNameTypeһFBT +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTableNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPKNameTypeһFBT +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPKNameType[201]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPKValueTypeһFBTֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPKValueType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBOperationTypeһ¼ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_DBOP_Insert '0' +/// +#define THOST_FTDC_DBOP_Update '1' +///ɾ +#define THOST_FTDC_DBOP_Delete '2' + +typedef char TThostFtdcDBOperationType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncFlagTypeһͬ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_SYNF_Yes '0' +///δͬ +#define THOST_FTDC_SYNF_No '1' + +typedef char TThostFtdcSyncFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTargetIDTypeһͬĿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTargetIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncTypeTypeһͬ +///////////////////////////////////////////////////////////////////////// +///һͬ +#define THOST_FTDC_SYNT_OneOffSync '0' +///ʱͬ +#define THOST_FTDC_SYNT_TimerSync '1' +///ʱȫͬ +#define THOST_FTDC_SYNT_TimerFullSync '2' + +typedef char TThostFtdcSyncTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBETimeTypeһֻʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBETimeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankNoTypeһк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBECertNoTypeһƾ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBECertNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExDirectionTypeһ㷽 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBEDIR_Settlement '0' +///ۻ +#define THOST_FTDC_FBEDIR_Sale '1' + +typedef char TThostFtdcExDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankAccountType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankAccountNameTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankAccountNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEAmtTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcFBEAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBusinessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEPostScriptTypeһ㸽 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEPostScriptType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBERemarkTypeһ㱸ע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBERemarkType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExRateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcExRateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEResultFlagTypeһɹ־ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_FBERES_Success '0' +///˻ +#define THOST_FTDC_FBERES_InsufficientBalance '1' +///׽δ֪ +#define THOST_FTDC_FBERES_UnknownTrading '8' +///ʧ +#define THOST_FTDC_FBERES_Fail 'x' + +typedef char TThostFtdcFBEResultFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBERtnMsgTypeһ㷵Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBERtnMsgType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEExtendMsgTypeһչϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEExtendMsgType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBusinessSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBusinessSerialType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBESystemSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBESystemSerialType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBETotalExCntTypeһ㽻ܱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBETotalExCntType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEExchStatusTypeһ㽻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBEES_Normal '0' +///ط +#define THOST_FTDC_FBEES_ReExchange '1' + +typedef char TThostFtdcFBEExchStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEFileFlagTypeһļ־ +///////////////////////////////////////////////////////////////////////// +///ݰ +#define THOST_FTDC_FBEFG_DataPackage '0' +///ļ +#define THOST_FTDC_FBEFG_File '1' + +typedef char TThostFtdcFBEFileFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEAlreadyTradeTypeһѽױ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FBEAT_NotTrade '0' +///ѽ +#define THOST_FTDC_FBEAT_Trade '1' + +typedef char TThostFtdcFBEAlreadyTradeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEOpenBankTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEOpenBankType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEUserEventTypeTypeһڻû¼ +///////////////////////////////////////////////////////////////////////// +///ǩ +#define THOST_FTDC_FBEUET_SignIn '0' +/// +#define THOST_FTDC_FBEUET_Exchange '1' +///ط +#define THOST_FTDC_FBEUET_ReExchange '2' +///˻ѯ +#define THOST_FTDC_FBEUET_QueryBankAccount '3' +///ϸѯ +#define THOST_FTDC_FBEUET_QueryExchDetial '4' +///ܲѯ +#define THOST_FTDC_FBEUET_QueryExchSummary '5' +///ʲѯ +#define THOST_FTDC_FBEUET_QueryExchRate '6' +///ļ֪ͨ +#define THOST_FTDC_FBEUET_CheckBankAccount '7' +///ǩ +#define THOST_FTDC_FBEUET_SignOut '8' +/// +#define THOST_FTDC_FBEUET_Other 'Z' + +typedef char TThostFtdcFBEUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEFileNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBatchSerialTypeһκ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBatchSerialType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEReqFlagTypeһ㷢ͱ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FBERF_UnProcessed '0' +///ȴ +#define THOST_FTDC_FBERF_WaitSend '1' +///ͳɹ +#define THOST_FTDC_FBERF_SendSuccess '2' +///ʧ +#define THOST_FTDC_FBERF_SendFailed '3' +///ȴط +#define THOST_FTDC_FBERF_WaitReSend '4' + +typedef char TThostFtdcFBEReqFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNotifyClassTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_NC_NOERROR '0' +///ʾ +#define THOST_FTDC_NC_Warn '1' +///׷ +#define THOST_FTDC_NC_Call '2' +///ǿƽ +#define THOST_FTDC_NC_Force '3' +/// +#define THOST_FTDC_NC_CHUANCANG '4' +///쳣 +#define THOST_FTDC_NC_Exception '5' + +typedef char TThostFtdcNotifyClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNofityInfoTypeһͻ֪ͨϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRiskNofityInfoType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseSceneIdTypeһǿƽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcForceCloseSceneIdType[24]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseTypeTypeһǿƽ +///////////////////////////////////////////////////////////////////////// +///ֹǿƽ +#define THOST_FTDC_FCT_Manual '0' +///һͶ߸ǿƽ +#define THOST_FTDC_FCT_Single '1' +///Ͷ߸ǿƽ +#define THOST_FTDC_FCT_Group '2' + +typedef char TThostFtdcForceCloseTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDsTypeһƷ,+ָ,cu+zn +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDsType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNotifyMethodTypeһ֪ͨ; +///////////////////////////////////////////////////////////////////////// +///ϵͳ֪ͨ +#define THOST_FTDC_RNM_System '0' +///֪ͨ +#define THOST_FTDC_RNM_SMS '1' +///ʼ֪ͨ +#define THOST_FTDC_RNM_EMail '2' +///˹֪ͨ +#define THOST_FTDC_RNM_Manual '3' + +typedef char TThostFtdcRiskNotifyMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNotifyStatusTypeһ֪ͨ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_RNS_NotGen '0' +///δ +#define THOST_FTDC_RNS_Generated '1' +///ʧ +#define THOST_FTDC_RNS_SendError '2' +///ѷδ +#define THOST_FTDC_RNS_SendOk '3' +///ѽδȷ +#define THOST_FTDC_RNS_Received '4' +///ȷ +#define THOST_FTDC_RNS_Confirmed '5' + +typedef char TThostFtdcRiskNotifyStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskUserEventTypeһû¼ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_RUE_ExportData '0' + +typedef char TThostFtdcRiskUserEventType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParamNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamValueTypeһֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParamValueType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcConditionalOrderSortTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ʹ¼ +#define THOST_FTDC_COST_LastPriceAsc '0' +///ʹ¼۽ +#define THOST_FTDC_COST_LastPriceDesc '1' +///ʹ +#define THOST_FTDC_COST_AskPriceAsc '2' +///ʹ۽ +#define THOST_FTDC_COST_AskPriceDesc '3' +///ʹ +#define THOST_FTDC_COST_BidPriceAsc '4' +///ʹ۽ +#define THOST_FTDC_COST_BidPriceDesc '5' + +typedef char TThostFtdcConditionalOrderSortTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSendTypeTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UOAST_NoSend '0' +///ѷ +#define THOST_FTDC_UOAST_Sended '1' +/// +#define THOST_FTDC_UOAST_Generated '2' +///ʧ +#define THOST_FTDC_UOAST_SendFail '3' +///ճɹ +#define THOST_FTDC_UOAST_Success '4' +///ʧ +#define THOST_FTDC_UOAST_Fail '5' +///ȡ +#define THOST_FTDC_UOAST_Cancel '6' + +typedef char TThostFtdcSendTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDStatusTypeһױ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UOACS_NoApply '1' +///ύ +#define THOST_FTDC_UOACS_Submited '2' +///ѷ +#define THOST_FTDC_UOACS_Sended '3' +/// +#define THOST_FTDC_UOACS_Success '4' +///ܾ +#define THOST_FTDC_UOACS_Refuse '5' +///ѳ +#define THOST_FTDC_UOACS_Cancel '6' + +typedef char TThostFtdcClientIDStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIndustryIDTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIndustryIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionIDTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcQuestionIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionContentTypeһϢ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcQuestionContentType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionIDTypeһѡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOptionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionContentTypeһѡ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOptionContentType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionTypeTypeһϢ +///////////////////////////////////////////////////////////////////////// +///ѡ +#define THOST_FTDC_QT_Radio '1' +///ѡ +#define THOST_FTDC_QT_Option '2' +/// +#define THOST_FTDC_QT_Blank '3' + +typedef char TThostFtdcQuestionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessIDTypeһҵˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSeqNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSeqNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAProcessStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAProcessStatusType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessTypeTypeһ̹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_BT_Request '1' +///Ӧ +#define THOST_FTDC_BT_Response '2' +///֪ͨ +#define THOST_FTDC_BT_Notice '3' + +typedef char TThostFtdcBusinessTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCfmmcReturnCodeTypeһķ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_CRC_Success '0' +///ÿͻѾڴ +#define THOST_FTDC_CRC_Working '1' +///пͻϼʧ +#define THOST_FTDC_CRC_InfoFail '2' +///ʵƼʧ +#define THOST_FTDC_CRC_IDCardFail '3' +/// +#define THOST_FTDC_CRC_OtherFail '4' + +typedef char TThostFtdcCfmmcReturnCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExReturnCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcExReturnCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientTypeTypeһͻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CfMMCCT_All '0' +/// +#define THOST_FTDC_CfMMCCT_Person '1' +///λ +#define THOST_FTDC_CfMMCCT_Company '2' +/// +#define THOST_FTDC_CfMMCCT_Other '3' +///ⷨ +#define THOST_FTDC_CfMMCCT_SpecialOrgan '4' +///ʹܻ +#define THOST_FTDC_CfMMCCT_Asset '5' + +typedef char TThostFtdcClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeIDTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///Ϻڻ +#define THOST_FTDC_EIDT_SHFE 'S' +///֣Ʒ +#define THOST_FTDC_EIDT_CZCE 'Z' +///Ʒ +#define THOST_FTDC_EIDT_DCE 'D' +///йڻ +#define THOST_FTDC_EIDT_CFFEX 'J' +///ϺԴĹɷ޹˾ +#define THOST_FTDC_EIDT_INE 'N' +///Ϻ֤ȯ +#define THOST_FTDC_EIDT_SSE 'A' +///֤ȯ +#define THOST_FTDC_EIDT_SZSE 'E' + +typedef char TThostFtdcExchangeIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExClientIDTypeTypeһױ +///////////////////////////////////////////////////////////////////////// +///ױ +#define THOST_FTDC_ECIDT_Hedge '1' +/// +#define THOST_FTDC_ECIDT_Arbitrage '2' +///Ͷ +#define THOST_FTDC_ECIDT_Speculation '3' + +typedef char TThostFtdcExClientIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientClassifyTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientClassifyType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAOrganTypeTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAOrganTypeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOACountryCodeTypeһҴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOACountryCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAreaCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAreaCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFuturesIDTypeһΪͻĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFuturesIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffmcDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffmcDateType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffmcTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffmcTimeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNocIDTypeһ֯ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNocIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUpdateFlagTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UF_NoUpdate '0' +///ȫϢɹ +#define THOST_FTDC_UF_Success '1' +///ȫϢʧ +#define THOST_FTDC_UF_Fail '2' +///½ױɹ +#define THOST_FTDC_UF_TCSuccess '3' +///½ױʧ +#define THOST_FTDC_UF_TCFail '4' +///Ѷ +#define THOST_FTDC_UF_Cancel '5' + +typedef char TThostFtdcUpdateFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyOperateIDTypeһ붯 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AOID_OpenInvestor '1' +///޸Ϣ +#define THOST_FTDC_AOID_ModifyIDCard '2' +///޸һϢ +#define THOST_FTDC_AOID_ModifyNoIDCard '3' +///뽻ױ +#define THOST_FTDC_AOID_ApplyTradingCode '4' +///ױ +#define THOST_FTDC_AOID_CancelTradingCode '5' +/// +#define THOST_FTDC_AOID_CancelInvestor '6' +///˻ +#define THOST_FTDC_AOID_FreezeAccount '8' +///˻ +#define THOST_FTDC_AOID_ActiveFreezeAccount '9' + +typedef char TThostFtdcApplyOperateIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyStatusIDTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δȫ +#define THOST_FTDC_ASID_NoComplete '1' +///ύ +#define THOST_FTDC_ASID_Submited '2' +/// +#define THOST_FTDC_ASID_Checked '3' +///Ѿܾ +#define THOST_FTDC_ASID_Refused '4' +///ɾ +#define THOST_FTDC_ASID_Deleted '5' + +typedef char TThostFtdcApplyStatusIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSendMethodTypeһͷʽ +///////////////////////////////////////////////////////////////////////// +///ļ +#define THOST_FTDC_UOASM_ByAPI '1' +///ӷ +#define THOST_FTDC_UOASM_ByFile '2' + +typedef char TThostFtdcSendMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEventTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEventTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEventModeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EvM_ADD '1' +///޸ +#define THOST_FTDC_EvM_UPDATE '2' +///ɾ +#define THOST_FTDC_EvM_DELETE '3' +/// +#define THOST_FTDC_EvM_CHECK '4' +/// +#define THOST_FTDC_EvM_COPY '5' +///ע +#define THOST_FTDC_EvM_CANCEL '6' +/// +#define THOST_FTDC_EvM_Reverse '7' + +typedef char TThostFtdcEventModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAAutoSendTypeһͳһԶ +///////////////////////////////////////////////////////////////////////// +///ԶͲ +#define THOST_FTDC_UOAA_ASR '1' +///ԶͣԶ +#define THOST_FTDC_UOAA_ASNR '2' +///ԶͣԶ +#define THOST_FTDC_UOAA_NSAR '3' +///ԶͣҲԶ +#define THOST_FTDC_UOAA_NSR '4' + +typedef char TThostFtdcUOAAutoSendType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQueryDepthTypeһѯ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcQueryDepthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataCenterIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDataCenterIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFlowIDTypeһID +///////////////////////////////////////////////////////////////////////// +///Ͷ߶ӦͶ +#define THOST_FTDC_EvM_InvestorGroupFlow '1' +///Ͷ +#define THOST_FTDC_EvM_InvestorRate '2' +///Ͷģϵ +#define THOST_FTDC_EvM_InvestorCommRateModel '3' + +typedef char TThostFtdcFlowIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckLevelTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///㼶 +#define THOST_FTDC_CL_Zero '0' +///һ +#define THOST_FTDC_CL_One '1' +/// +#define THOST_FTDC_CL_Two '2' + +typedef char TThostFtdcCheckLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCheckNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckStatusTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_CHS_Init '0' +/// +#define THOST_FTDC_CHS_Checking '1' +///Ѹ +#define THOST_FTDC_CHS_Checked '2' +///ܾ +#define THOST_FTDC_CHS_Refuse '3' +/// +#define THOST_FTDC_CHS_Cancel '4' + +typedef char TThostFtdcCheckStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUsedStatusTypeһЧ״̬ +///////////////////////////////////////////////////////////////////////// +///δЧ +#define THOST_FTDC_CHU_Unused '0' +///Ч +#define THOST_FTDC_CHU_Used '1' +///Чʧ +#define THOST_FTDC_CHU_Fail '2' + +typedef char TThostFtdcUsedStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTemplateNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRateTemplateNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyStringTypeһڲѯͶֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyStringType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAcountOriginTypeһ˻Դ +///////////////////////////////////////////////////////////////////////// +///ֹ¼ +#define THOST_FTDC_BAO_ByAccProperty '0' +///ת +#define THOST_FTDC_BAO_ByFBTransfer '1' + +typedef char TThostFtdcBankAcountOriginType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthBillTradeSumTypeһ㵥±ɽܷʽ +///////////////////////////////////////////////////////////////////////// +///ͬͬԼ +#define THOST_FTDC_MBTS_ByInstrument '0' +///ͬͬԼͬ۸ +#define THOST_FTDC_MBTS_ByDayInsPrc '1' +///ͬԼ +#define THOST_FTDC_MBTS_ByDayIns '2' + +typedef char TThostFtdcMonthBillTradeSumType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTTradeCodeEnumTypeһڽ״ö +///////////////////////////////////////////////////////////////////////// +///зתڻ +#define THOST_FTDC_FTC_BankLaunchBankToBroker '102001' +///ڻתڻ +#define THOST_FTDC_FTC_BrokerLaunchBankToBroker '202001' +///зڻת +#define THOST_FTDC_FTC_BankLaunchBrokerToBank '102002' +///ڻڻת +#define THOST_FTDC_FTC_BrokerLaunchBrokerToBank '202002' + +typedef char TThostFtdcFBTTradeCodeEnumType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTemplateIDTypeһģʹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRateTemplateIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskRateTypeһն +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRiskRateType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimestampTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTimestampType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDRuleNameTypeһŶι +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDRuleNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDRuleExprTypeһŶιʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDRuleExprType[513]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastDriftTypeһϴOTPƯֵ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLastDriftType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastSuccessTypeһϴOTPɹֵ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLastSuccessType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthKeyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialNumberTypeһк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSerialNumberType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPTypeTypeһ̬ +///////////////////////////////////////////////////////////////////////// +///޶̬ +#define THOST_FTDC_OTP_NONE '0' +///ʱ +#define THOST_FTDC_OTP_TOTP '1' + +typedef char TThostFtdcOTPTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPVendorsIDTypeһ̬ṩ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOTPVendorsIDType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPVendorsNameTypeһ̬ṩ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOTPVendorsNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPStatusTypeһ̬״̬ +///////////////////////////////////////////////////////////////////////// +///δʹ +#define THOST_FTDC_OTPS_Unused '0' +///ʹ +#define THOST_FTDC_OTPS_Used '1' +///ע +#define THOST_FTDC_OTPS_Disuse '2' + +typedef char TThostFtdcOTPStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerUserTypeTypeһù˾û +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_BUT_Investor '1' +///Ա +#define THOST_FTDC_BUT_BrokerUser '2' + +typedef char TThostFtdcBrokerUserTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureTypeTypeһڻ +///////////////////////////////////////////////////////////////////////// +///Ʒڻ +#define THOST_FTDC_FUTT_Commodity '1' +///ڻ +#define THOST_FTDC_FUTT_Financial '2' + +typedef char TThostFtdcFutureTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundEventTypeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///ת޶ +#define THOST_FTDC_FET_Restriction '0' +///ת޶ +#define THOST_FTDC_FET_TodayRestriction '1' +///ˮ +#define THOST_FTDC_FET_Transfer '2' +///ʽ𶳽 +#define THOST_FTDC_FET_Credit '3' +///Ͷ߿ʽ +#define THOST_FTDC_FET_InvestorWithdrawAlm '4' +///ʻת޶ +#define THOST_FTDC_FET_BankRestriction '5' +///ǩԼ˻ +#define THOST_FTDC_FET_Accountregister '6' +/// +#define THOST_FTDC_FET_ExchangeFundIO '7' +///Ͷ߳ +#define THOST_FTDC_FET_InvestorFundIO '8' + +typedef char TThostFtdcFundEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountSourceTypeTypeһʽ˻Դ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_AST_FBTransfer '0' +///ֹ¼ +#define THOST_FTDC_AST_ManualEntry '1' + +typedef char TThostFtdcAccountSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCodeSourceTypeTypeһױԴ +///////////////////////////////////////////////////////////////////////// +///ͳһ(ѹ淶) +#define THOST_FTDC_CST_UnifyAccount '0' +///ֹ¼(δ淶) +#define THOST_FTDC_CST_ManualEntry '1' + +typedef char TThostFtdcCodeSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserRangeTypeһԱΧ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_UR_All '0' +///һԱ +#define THOST_FTDC_UR_Single '1' + +typedef char TThostFtdcUserRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeSpanTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTimeSpanType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcImportSequenceIDTypeһ̬Ƶα +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcImportSequenceIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcByGroupTypeһͳƱͻͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Ͷͳ +#define THOST_FTDC_BG_Investor '2' +///ͳ +#define THOST_FTDC_BG_Group '1' + +typedef char TThostFtdcByGroupType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSumStatModeTypeһͳƱΧͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Լͳ +#define THOST_FTDC_TSSM_Instrument '1' +///Ʒͳ +#define THOST_FTDC_TSSM_Product '2' +///ͳ +#define THOST_FTDC_TSSM_Exchange '3' + +typedef char TThostFtdcTradeSumStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcComTypeTypeһϳɽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcComTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductIDTypeһƷʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductNameTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductMemoTypeһƷ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductMemoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCCancelFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCCancelFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCDateType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCInvestorNameTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCInvestorNameType[201]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOpenInvestorNameTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOpenInvestorNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCInvestorIDTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCInvestorIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCIdentifiedCardNoTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCIdentifiedCardNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCClientIDTypeһױ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCClientIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCBankFlagTypeһбʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCBankFlagType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCBankAccountType[23]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOpenNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOpenNameType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMemoTypeһ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMemoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTimeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTradeIDTypeһɽˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTradeIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCExchangeInstIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMortgageNameTypeһѺƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMortgageNameType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCReasonTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCReasonType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsSettlementTypeһǷΪǽԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIsSettlementType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCPriceTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCPriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOptionsTypeTypeһȨ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOptionsTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCStrikePriceTypeһִм +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCStrikePriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTargetProductIDTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTargetProductIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTargetInstrIDTypeһĺԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTargetInstrIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommModelNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommModelNameType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommModelMemoTypeһģ屸ע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommModelMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExprSetModeTypeһڱʽ +///////////////////////////////////////////////////////////////////////// +///й +#define THOST_FTDC_ESM_Relative '1' +/// +#define THOST_FTDC_ESM_Typical '2' + +typedef char TThostFtdcExprSetModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +///˾׼ +#define THOST_FTDC_RIR_All '1' +///ģ +#define THOST_FTDC_RIR_Model '2' +///һͶ +#define THOST_FTDC_RIR_Single '3' + +typedef char TThostFtdcRateInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentBrokerIDTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentBrokerIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDRIdentityIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDRIdentityIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDRIdentityNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDRIdentityNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBLinkIDTypeһDBLinkʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDBLinkIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncDataStatusTypeһϵͳͬ״̬ +///////////////////////////////////////////////////////////////////////// +///δͬ +#define THOST_FTDC_SDS_Initialize '0' +///ͬ +#define THOST_FTDC_SDS_Settlementing '1' +///ͬ +#define THOST_FTDC_SDS_Settlemented '2' + +typedef char TThostFtdcSyncDataStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSourceTypeһɽԴ +///////////////////////////////////////////////////////////////////////// +///Խͨر +#define THOST_FTDC_TSRC_NORMAL '0' +///Բѯ +#define THOST_FTDC_TSRC_QUERY '1' + +typedef char TThostFtdcTradeSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFlexStatModeTypeһƷԼͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Ʒͳ +#define THOST_FTDC_FSM_Product '1' +///ͳ +#define THOST_FTDC_FSM_Exchange '2' +///ͳ +#define THOST_FTDC_FSM_All '3' + +typedef char TThostFtdcFlexStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcByInvestorRangeTypeһͶ߷ΧͳƷʽ +///////////////////////////////////////////////////////////////////////// +///ͳ +#define THOST_FTDC_BIR_Property '1' +///ͳ +#define THOST_FTDC_BIR_All '2' + +typedef char TThostFtdcByInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSRiskRateTypeһն +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSRiskRateType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceNo12Typeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSequenceNo12Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PIR_All '1' +///Ͷ +#define THOST_FTDC_PIR_Property '2' +///һͶ +#define THOST_FTDC_PIR_Single '3' + +typedef char TThostFtdcPropertyInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileStatusTypeһļ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FIS_NoCreate '0' +/// +#define THOST_FTDC_FIS_Created '1' +///ʧ +#define THOST_FTDC_FIS_Failed '2' + +typedef char TThostFtdcFileStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileGenStyleTypeһļɷʽ +///////////////////////////////////////////////////////////////////////// +///· +#define THOST_FTDC_FGS_FileTransmit '0' +/// +#define THOST_FTDC_FGS_FileGen '1' + +typedef char TThostFtdcFileGenStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysOperModeTypeһϵͳ־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SoM_Add '1' +///޸ +#define THOST_FTDC_SoM_Update '2' +///ɾ +#define THOST_FTDC_SoM_Delete '3' +/// +#define THOST_FTDC_SoM_Copy '4' +/// +#define THOST_FTDC_SoM_AcTive '5' +///ע +#define THOST_FTDC_SoM_CanCel '6' +/// +#define THOST_FTDC_SoM_ReSet '7' + +typedef char TThostFtdcSysOperModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysOperTypeTypeһϵͳ־ +///////////////////////////////////////////////////////////////////////// +///޸IJԱ +#define THOST_FTDC_SoT_UpdatePassword '0' +///Աܹ֯ϵ +#define THOST_FTDC_SoT_UserDepartment '1' +///ɫ +#define THOST_FTDC_SoT_RoleManager '2' +///ɫ +#define THOST_FTDC_SoT_RoleFunction '3' +/// +#define THOST_FTDC_SoT_BaseParam '4' +///òԱ +#define THOST_FTDC_SoT_SetUserID '5' +///ûɫ +#define THOST_FTDC_SoT_SetUserRole '6' +///ûIP +#define THOST_FTDC_SoT_UserIpRestriction '7' +///ܹ֯ +#define THOST_FTDC_SoT_DepartmentManager '8' +///ܹ֯ѯิ +#define THOST_FTDC_SoT_DepartmentCopy '9' +///ױ +#define THOST_FTDC_SoT_Tradingcode 'A' +///Ͷ״̬ά +#define THOST_FTDC_SoT_InvestorStatus 'B' +///ͶȨ޹ +#define THOST_FTDC_SoT_InvestorAuthority 'C' +/// +#define THOST_FTDC_SoT_PropertySet 'D' +///Ͷ +#define THOST_FTDC_SoT_ReSetInvestorPasswd 'E' +///Ͷ߸Ϣά +#define THOST_FTDC_SoT_InvestorPersonalityInfo 'F' + +typedef char TThostFtdcSysOperTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCDataQueyTypeTypeһϱݲѯ +///////////////////////////////////////////////////////////////////////// +///ѯǰձ͵ +#define THOST_FTDC_CSRCQ_Current '0' +///ѯʷ͵Ĵ͹˾ +#define THOST_FTDC_CSRCQ_History '1' + +typedef char TThostFtdcCSRCDataQueyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFreezeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_FRS_Normal '1' +/// +#define THOST_FTDC_FRS_Freeze '0' + +typedef char TThostFtdcFreezeStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStandardStatusTypeһ淶״̬ +///////////////////////////////////////////////////////////////////////// +///ѹ淶 +#define THOST_FTDC_STST_Standard '0' +///δ淶 +#define THOST_FTDC_STST_NonStandard '1' + +typedef char TThostFtdcStandardStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCFreezeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCFreezeStatusType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightParamTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///߻ +#define THOST_FTDC_RPT_Freeze '1' +///߻ +#define THOST_FTDC_RPT_FreezeActive '2' +///Ȩ +#define THOST_FTDC_RPT_OpenLimit '3' +///Ȩ +#define THOST_FTDC_RPT_RelieveOpenLimit '4' + +typedef char TThostFtdcRightParamTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightTemplateIDTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRightTemplateIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightTemplateNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRightTemplateNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataStatusTypeһϴǮ˱״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMLDS_Normal '0' +///ɾ +#define THOST_FTDC_AMLDS_Deleted '1' + +typedef char TThostFtdcDataStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCheckStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_AMLCHS_Init '0' +/// +#define THOST_FTDC_AMLCHS_Checking '1' +///Ѹ +#define THOST_FTDC_AMLCHS_Checked '2' +///ܾϱ +#define THOST_FTDC_AMLCHS_RefuseReport '3' + +typedef char TThostFtdcAMLCheckStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlDateTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMLDT_DrawDay '0' +/// +#define THOST_FTDC_AMLDT_TouchDay '1' + +typedef char TThostFtdcAmlDateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlCheckLevelTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///㼶 +#define THOST_FTDC_AMLCL_CheckLevel0 '0' +///һ +#define THOST_FTDC_AMLCL_CheckLevel1 '1' +/// +#define THOST_FTDC_AMLCL_CheckLevel2 '2' +/// +#define THOST_FTDC_AMLCL_CheckLevel3 '3' + +typedef char TThostFtdcAmlCheckLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlCheckFlowTypeһϴǮݳȡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAmlCheckFlowType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDataTypeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExportFileTypeTypeһļ +///////////////////////////////////////////////////////////////////////// +///CSV +#define THOST_FTDC_EFT_CSV '0' +///Excel +#define THOST_FTDC_EFT_EXCEL '1' +///DBF +#define THOST_FTDC_EFT_DBF '2' + +typedef char TThostFtdcExportFileTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ǰ׼ +#define THOST_FTDC_SMT_Before '1' +/// +#define THOST_FTDC_SMT_Settlement '2' +///˶ +#define THOST_FTDC_SMT_After '3' +/// +#define THOST_FTDC_SMT_Settlemented '4' + +typedef char TThostFtdcSettleManagerTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerIDTypeһô +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettleManagerIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettleManagerNameType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerLevelTypeһõȼ +///////////////////////////////////////////////////////////////////////// +///Ҫ +#define THOST_FTDC_SML_Must '1' +/// +#define THOST_FTDC_SML_Alarm '2' +///ʾ +#define THOST_FTDC_SML_Prompt '3' +/// +#define THOST_FTDC_SML_Ignore '4' + +typedef char TThostFtdcSettleManagerLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerGroupTypeһģ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_SMG_Exhcange '1' +///ڲ˶ +#define THOST_FTDC_SMG_ASP '2' +///ϱݺ˶ +#define THOST_FTDC_SMG_CSRC '3' + +typedef char TThostFtdcSettleManagerGroupType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckResultMemoTypeһ˶Խ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCheckResultMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionUrlTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionUrlType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthInfoTypeһͻ֤Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthCodeTypeһͻ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLimitUseTypeTypeһֵʹ +///////////////////////////////////////////////////////////////////////// +///ظʹ +#define THOST_FTDC_LUT_Repeatable '1' +///ظʹ +#define THOST_FTDC_LUT_Unrepeatable '2' + +typedef char TThostFtdcLimitUseTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataResourceTypeһԴ +///////////////////////////////////////////////////////////////////////// +///ϵͳ +#define THOST_FTDC_DAR_Settle '1' +/// +#define THOST_FTDC_DAR_Exchange '2' +/// +#define THOST_FTDC_DAR_CSRC '3' + +typedef char TThostFtdcDataResourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_MGT_ExchMarginRate '0' +///Ͷ֤߱ +#define THOST_FTDC_MGT_InstrMarginRate '1' +///Ͷ߽ױ֤ +#define THOST_FTDC_MGT_InstrMarginRateTrade '2' + +typedef char TThostFtdcMarginTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActiveTypeTypeһЧ +///////////////////////////////////////////////////////////////////////// +///Ч +#define THOST_FTDC_ACT_Intraday '1' +///Ч +#define THOST_FTDC_ACT_Long '2' + +typedef char TThostFtdcActiveTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginRateTypeTypeһͻ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_MRT_Exchange '1' +///Ͷ֤߱ +#define THOST_FTDC_MRT_Investor '2' +///Ͷ߽ױ֤ +#define THOST_FTDC_MRT_InvestorTrade '3' + +typedef char TThostFtdcMarginRateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBackUpStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δɱ +#define THOST_FTDC_BUS_UnBak '0' +/// +#define THOST_FTDC_BUS_BakUp '1' +///ɱ +#define THOST_FTDC_BUS_BakUped '2' +///ʧ +#define THOST_FTDC_BUS_BakFail '3' + +typedef char TThostFtdcBackUpStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInitSettlementTypeһʼ״̬ +///////////////////////////////////////////////////////////////////////// +///ʼδʼ +#define THOST_FTDC_SIS_UnInitialize '0' +///ʼ +#define THOST_FTDC_SIS_Initialize '1' +///ʼ +#define THOST_FTDC_SIS_Initialized '2' + +typedef char TThostFtdcInitSettlementType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReportStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δɱ +#define THOST_FTDC_SRS_NoCreate '0' +/// +#define THOST_FTDC_SRS_Create '1' +///ɱ +#define THOST_FTDC_SRS_Created '2' +///ɱʧ +#define THOST_FTDC_SRS_CreateFail '3' + +typedef char TThostFtdcReportStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSaveStatusTypeһݹ鵵״̬ +///////////////////////////////////////////////////////////////////////// +///鵵δ +#define THOST_FTDC_SSS_UnSaveData '0' +///鵵 +#define THOST_FTDC_SSS_SaveDatad '1' + +typedef char TThostFtdcSaveStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettArchiveStatusTypeһȷݹ鵵״̬ +///////////////////////////////////////////////////////////////////////// +///δ鵵 +#define THOST_FTDC_SAS_UnArchived '0' +///ݹ鵵 +#define THOST_FTDC_SAS_Archiving '1' +///ѹ鵵 +#define THOST_FTDC_SAS_Archived '2' +///鵵ʧ +#define THOST_FTDC_SAS_ArchiveFail '3' + +typedef char TThostFtdcSettArchiveStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCTPTypeTypeһCTPϵͳ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_CTPT_Unkown '0' +/// +#define THOST_FTDC_CTPT_MainCenter '1' +/// +#define THOST_FTDC_CTPT_BackUp '2' + +typedef char TThostFtdcCTPTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcToolIDTypeһߴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcToolIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcToolNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcToolNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCloseDealTypeTypeһƽִ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CDT_Normal '0' +///Ͷƽ +#define THOST_FTDC_CDT_SpecFirst '1' + +typedef char TThostFtdcCloseDealTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMortgageFundUseRangeTypeһѺʽ÷Χ +///////////////////////////////////////////////////////////////////////// +///ʹ +#define THOST_FTDC_MFUR_None '0' +///ڱ֤ +#define THOST_FTDC_MFUR_Margin '1' +///ѡӯ֤ +#define THOST_FTDC_MFUR_All '2' + +typedef char TThostFtdcMortgageFundUseRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyUnitTypeһֵλ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCurrencyUnitType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeRateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcExchangeRateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSpecProductTypeTypeһƷ +///////////////////////////////////////////////////////////////////////// +///֣ױƷ +#define THOST_FTDC_SPT_CzceHedge '1' +///ѺƷ +#define THOST_FTDC_SPT_IneForeignCurrency '2' +///߿ƽֲƷ +#define THOST_FTDC_SPT_DceOpenClose '3' + +typedef char TThostFtdcSpecProductTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortgageTypeTypeһѺ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_FMT_Mortgage '1' +/// +#define THOST_FTDC_FMT_Redemption '2' + +typedef char TThostFtdcFundMortgageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountSettlementParamIDTypeһͶ˻ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_ASPI_BaseMargin '1' +///Ȩ׼ +#define THOST_FTDC_ASPI_LowestInterest '2' + +typedef char TThostFtdcAccountSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyNameType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySignTypeһַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencySignType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortDirectionTypeһѺ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FMD_In '1' +///ʳ +#define THOST_FTDC_FMD_Out '2' + +typedef char TThostFtdcFundMortDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessClassTypeһ +///////////////////////////////////////////////////////////////////////// +///ӯ +#define THOST_FTDC_BT_Profit '0' +/// +#define THOST_FTDC_BT_Loss '1' +/// +#define THOST_FTDC_BT_Other 'Z' + +typedef char TThostFtdcBusinessClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSwapSourceTypeTypeһԴ +///////////////////////////////////////////////////////////////////////// +///ֹ +#define THOST_FTDC_SST_Manual '0' +///Զ +#define THOST_FTDC_SST_Automatic '1' + +typedef char TThostFtdcSwapSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrExDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CED_Settlement '0' +///ۻ +#define THOST_FTDC_CED_Sale '1' + +typedef char TThostFtdcCurrExDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySwapStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_CSS_Entry '1' +/// +#define THOST_FTDC_CSS_Approve '2' +///Ѿܾ +#define THOST_FTDC_CSS_Refuse '3' +///ѳ +#define THOST_FTDC_CSS_Revoke '4' +///ѷ +#define THOST_FTDC_CSS_Send '5' +///ɹ +#define THOST_FTDC_CSS_Success '6' +///ʧ +#define THOST_FTDC_CSS_Failure '7' + +typedef char TThostFtdcCurrencySwapStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrExchCertNoTypeһƾ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrExchCertNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBatchSerialNoTypeһκ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBatchSerialNoType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReqFlagTypeһ㷢ͱ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_REQF_NoSend '0' +///ͳɹ +#define THOST_FTDC_REQF_SendSuccess '1' +///ʧ +#define THOST_FTDC_REQF_SendFailed '2' +///ȴط +#define THOST_FTDC_REQF_WaitReSend '3' + +typedef char TThostFtdcReqFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcResFlagTypeһ㷵سɹ־ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_RESF_Success '0' +///˻ +#define THOST_FTDC_RESF_InsuffiCient '1' +///׽δ֪ +#define THOST_FTDC_RESF_UnKnown '8' + +typedef char TThostFtdcResFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPageControlTypeһҳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPageControlType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRecordCountTypeһ¼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRecordCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySwapMemoTypeһȷϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencySwapMemoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExStatusTypeһ޸״̬ +///////////////////////////////////////////////////////////////////////// +///޸ǰ +#define THOST_FTDC_EXS_Before '0' +///޸ĺ +#define THOST_FTDC_EXS_After '1' + +typedef char TThostFtdcExStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientRegionTypeһͻ +///////////////////////////////////////////////////////////////////////// +///ڿͻ +#define THOST_FTDC_CR_Domestic '1' +///۰̨ͻ +#define THOST_FTDC_CR_GMT '2' +///ͻ +#define THOST_FTDC_CR_Foreign '3' + +typedef char TThostFtdcClientRegionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWorkPlaceTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWorkPlaceType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessPeriodTypeһӪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessPeriodType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWebSiteTypeһַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWebSiteType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAIdCardTypeTypeһͳһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAIdCardTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientModeTypeһģʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientModeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorFullNameTypeһͶȫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorFullNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOABrokerIDTypeһнID +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOABrokerIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAZipCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAZipCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAEMailTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAEMailType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOldCityTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOldCityType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCorporateIdentifiedCardNoTypeһ˴֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCorporateIdentifiedCardNoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHasBoardTypeһǷж» +///////////////////////////////////////////////////////////////////////// +///û +#define THOST_FTDC_HB_No '0' +/// +#define THOST_FTDC_HB_Yes '1' + +typedef char TThostFtdcHasBoardType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStartModeTypeһģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SM_Normal '1' +///Ӧ +#define THOST_FTDC_SM_Emerge '2' +///ָ +#define THOST_FTDC_SM_Restore '3' + +typedef char TThostFtdcStartModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTemplateTypeTypeһģ +///////////////////////////////////////////////////////////////////////// +///ȫ +#define THOST_FTDC_TPT_Full '1' +/// +#define THOST_FTDC_TPT_Increment '2' +/// +#define THOST_FTDC_TPT_BackUp '3' + +typedef char TThostFtdcTemplateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLoginModeTypeһ¼ģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_LM_Trade '0' +///ת +#define THOST_FTDC_LM_Transfer '1' + +typedef char TThostFtdcLoginModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPromptTypeTypeһʾ +///////////////////////////////////////////////////////////////////////// +///Լ +#define THOST_FTDC_CPT_Instrument '1' +///ֶ֤Ч +#define THOST_FTDC_CPT_Margin '2' + +typedef char TThostFtdcPromptTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLedgerManageIDTypeһֻʲ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLedgerManageIDType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestVarietyTypeһͶƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestVarietyType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLedgerManageBankTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLedgerManageBankType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffexDepartmentNameTypeһӪҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffexDepartmentNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffexDepartmentCodeTypeһӪҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffexDepartmentCodeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHasTrusteeTypeһǷй +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HT_Yes '1' +///û +#define THOST_FTDC_HT_No '0' + +typedef char TThostFtdcHasTrusteeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMemo1Typeһ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMemo1Type[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrCFullNameTypeһʲҵڻ˾ȫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrCFullNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrApprovalNOTypeһʲҵĺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrApprovalNOType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrMgrNameTypeһʲҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrMgrNameType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMT_Bank '1' +///֤ȯ˾ +#define THOST_FTDC_AMT_Securities '2' +///˾ +#define THOST_FTDC_AMT_Fund '3' +///չ˾ +#define THOST_FTDC_AMT_Insurance '4' +///й˾ +#define THOST_FTDC_AMT_Trust '5' +/// +#define THOST_FTDC_AMT_Other '9' + +typedef char TThostFtdcAmTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCAmTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCAmTypeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCFundIOTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CFIOT_FundIO '0' +///ڻ +#define THOST_FTDC_CFIOT_SwapCurrency '1' + +typedef char TThostFtdcCSRCFundIOTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCusAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +///ڻ˻ +#define THOST_FTDC_CAT_Futures '1' +///ڻʹҵµʹܽ˻ +#define THOST_FTDC_CAT_AssetmgrFuture '2' +///ۺʹҵµڻʹй˻ +#define THOST_FTDC_CAT_AssetmgrTrustee '3' +///ۺʹҵµʽת˻ +#define THOST_FTDC_CAT_AssetmgrTransfer '4' + +typedef char TThostFtdcCusAccountTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCNationalTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCNationalType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCSecAgentIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCSecAgentIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLanguageTypeTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_LT_Chinese '1' +///Ӣ +#define THOST_FTDC_LT_English '2' + +typedef char TThostFtdcLanguageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmAccountTypeһͶ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAmAccountType[23]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrClientTypeTypeһʲͻ +///////////////////////////////////////////////////////////////////////// +///ʹܿͻ +#define THOST_FTDC_AMCT_Person '1' +///λʹܿͻ +#define THOST_FTDC_AMCT_Organ '2' +///ⵥλʹܿͻ +#define THOST_FTDC_AMCT_SpecialOrgan '4' + +typedef char TThostFtdcAssetmgrClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_ASST_Futures '3' +///ۺ +#define THOST_FTDC_ASST_SpecialOrgan '4' + +typedef char TThostFtdcAssetmgrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOMTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOMType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEInstLifePhaseTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSHFEInstLifePhaseType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEProductClassTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSHFEProductClassType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceDecimalTypeһ۸Сλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPriceDecimalType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInTheMoneyFlagTypeһƽֵȨ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInTheMoneyFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckInstrTypeTypeһԼȽ +///////////////////////////////////////////////////////////////////////// +///Լ +#define THOST_FTDC_CIT_HasExch '0' +///Լϵͳ +#define THOST_FTDC_CIT_HasATP '1' +///ԼȽϲһ +#define THOST_FTDC_CIT_HasDiff '2' + +typedef char TThostFtdcCheckInstrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeliveryTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ֹ +#define THOST_FTDC_DT_HandDeliv '1' +///ڽ +#define THOST_FTDC_DT_PersonDeliv '2' + +typedef char TThostFtdcDeliveryTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBigMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcBigMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMaxMarginSideAlgorithmTypeһ֤߱㷨 +///////////////////////////////////////////////////////////////////////// +///ʹô֤߱㷨 +#define THOST_FTDC_MMSA_NO '0' +///ʹô֤߱㷨 +#define THOST_FTDC_MMSA_YES '1' + +typedef char TThostFtdcMaxMarginSideAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDAClientTypeTypeһʲͻ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CACT_Person '0' +/// +#define THOST_FTDC_CACT_Company '1' +/// +#define THOST_FTDC_CACT_Other '2' + +typedef char TThostFtdcDAClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinInstrIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombinInstrIDType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinSettlePriceTypeһȽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombinSettlePriceType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDCEPriorityTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDCEPriorityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeGroupIDTypeһɽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradeGroupIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsCheckPrepaTypeһǷУ鿪ʽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcIsCheckPrepaType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAAssetmgrTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_UOAAT_Futures '1' +///ۺ +#define THOST_FTDC_UOAAT_SpecialOrgan '2' + +typedef char TThostFtdcUOAAssetmgrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDirectionEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Buy +#define THOST_FTDC_DEN_Buy '0' +///Sell +#define THOST_FTDC_DEN_Sell '1' + +typedef char TThostFtdcDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetFlagEnTypeһƽ־ +///////////////////////////////////////////////////////////////////////// +///Position Opening +#define THOST_FTDC_OFEN_Open '0' +///Position Close +#define THOST_FTDC_OFEN_Close '1' +///Forced Liquidation +#define THOST_FTDC_OFEN_ForceClose '2' +///Close Today +#define THOST_FTDC_OFEN_CloseToday '3' +///Close Prev. +#define THOST_FTDC_OFEN_CloseYesterday '4' +///Forced Reduction +#define THOST_FTDC_OFEN_ForceOff '5' +///Local Forced Liquidation +#define THOST_FTDC_OFEN_LocalForceClose '6' + +typedef char TThostFtdcOffsetFlagEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHedgeFlagEnTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Speculation +#define THOST_FTDC_HFEN_Speculation '1' +///Arbitrage +#define THOST_FTDC_HFEN_Arbitrage '2' +///Hedge +#define THOST_FTDC_HFEN_Hedge '3' + +typedef char TThostFtdcHedgeFlagEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundIOTypeEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Deposit/Withdrawal +#define THOST_FTDC_FIOTEN_FundIO '1' +///Bank-Futures Transfer +#define THOST_FTDC_FIOTEN_Transfer '2' +///Bank-Futures FX Exchange +#define THOST_FTDC_FIOTEN_SwapCurrency '3' + +typedef char TThostFtdcFundIOTypeEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundTypeEnTypeһʽ +///////////////////////////////////////////////////////////////////////// +///Bank Deposit +#define THOST_FTDC_FTEN_Deposite '1' +///Payment/Fee +#define THOST_FTDC_FTEN_ItemFund '2' +///Brokerage Adj +#define THOST_FTDC_FTEN_Company '3' +///Internal Transfer +#define THOST_FTDC_FTEN_InnerTransfer '4' + +typedef char TThostFtdcFundTypeEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundDirectionEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Deposit +#define THOST_FTDC_FDEN_In '1' +///Withdrawal +#define THOST_FTDC_FDEN_Out '2' + +typedef char TThostFtdcFundDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortDirectionEnTypeһѺ +///////////////////////////////////////////////////////////////////////// +///Pledge +#define THOST_FTDC_FMDEN_In '1' +///Redemption +#define THOST_FTDC_FMDEN_Out '2' + +typedef char TThostFtdcFundMortDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSwapBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSwapBusinessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionsTypeTypeһȨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CP_CallOptions '1' +/// +#define THOST_FTDC_CP_PutOptions '2' + +typedef char TThostFtdcOptionsTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeModeTypeһִзʽ +///////////////////////////////////////////////////////////////////////// +///ŷʽ +#define THOST_FTDC_STM_Continental '0' +///ʽ +#define THOST_FTDC_STM_American '1' +///Ľ +#define THOST_FTDC_STM_Bermuda '2' + +typedef char TThostFtdcStrikeModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeTypeTypeһִ +///////////////////////////////////////////////////////////////////////// +///Գ +#define THOST_FTDC_STT_Hedge '0' +///ƥִ +#define THOST_FTDC_STT_Match '1' + +typedef char TThostFtdcStrikeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyTypeTypeһнȨִ +///////////////////////////////////////////////////////////////////////// +///ִ +#define THOST_FTDC_APPT_NotStrikeNum '4' + +typedef char TThostFtdcApplyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGiveUpDataSourceTypeһִԴ +///////////////////////////////////////////////////////////////////////// +///ϵͳ +#define THOST_FTDC_GUDS_Gen '0' +///ֹ +#define THOST_FTDC_GUDS_Hand '1' + +typedef char TThostFtdcGiveUpDataSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderSysIDTypeһִϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExecOrderSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecResultTypeһִн +///////////////////////////////////////////////////////////////////////// +///ûִ +#define THOST_FTDC_OER_NoExec 'n' +///Ѿȡ +#define THOST_FTDC_OER_Canceled 'c' +///ִгɹ +#define THOST_FTDC_OER_OK '0' +///Ȩֲֲ +#define THOST_FTDC_OER_NoPosition '1' +///ʽ𲻹 +#define THOST_FTDC_OER_NoDeposit '2' +///Ա +#define THOST_FTDC_OER_NoParticipant '3' +///ͻ +#define THOST_FTDC_OER_NoClient '4' +///Լ +#define THOST_FTDC_OER_NoInstrument '6' +///ûִȨ +#define THOST_FTDC_OER_NoRight '7' +/// +#define THOST_FTDC_OER_InvalidVolume '8' +///û㹻ʷɽ +#define THOST_FTDC_OER_NoEnoughHistoryTrade '9' +///δ֪ +#define THOST_FTDC_OER_Unknown 'a' + +typedef char TThostFtdcExecResultType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeSequenceTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcStrikeSequenceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeTimeTypeһִʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcStrikeTimeType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinationTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_COMBT_Future '0' +///ֱ۲BUL +#define THOST_FTDC_COMBT_BUL '1' +///ֱ۲BER +#define THOST_FTDC_COMBT_BER '2' +///ʽ +#define THOST_FTDC_COMBT_STD '3' +///ʽ +#define THOST_FTDC_COMBT_STG '4' +/// +#define THOST_FTDC_COMBT_PRT '5' +///ʱ۲ +#define THOST_FTDC_COMBT_CLD '6' + +typedef char TThostFtdcCombinationTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionRoyaltyPriceTypeTypeһȨȨ۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ORPT_PreSettlementPrice '1' +///ּ +#define THOST_FTDC_ORPT_OpenPrice '4' + +typedef char TThostFtdcOptionRoyaltyPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBalanceAlgorithmTypeһȨ㷨 +///////////////////////////////////////////////////////////////////////// +///Ȩֵӯ +#define THOST_FTDC_BLAG_Default '1' +///Ȩֵ +#define THOST_FTDC_BLAG_IncludeOptValLost '2' + +typedef char TThostFtdcBalanceAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActionTypeTypeһִ +///////////////////////////////////////////////////////////////////////// +///ִ +#define THOST_FTDC_ACTP_Exec '1' +/// +#define THOST_FTDC_ACTP_Abandon '2' + +typedef char TThostFtdcActionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForQuoteStatusTypeһѯ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_FQST_Submitted 'a' +///Ѿ +#define THOST_FTDC_FQST_Accepted 'b' +///Ѿܾ +#define THOST_FTDC_FQST_Rejected 'c' + +typedef char TThostFtdcForQuoteStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcValueMethodTypeһȡֵʽ +///////////////////////////////////////////////////////////////////////// +///ֵ +#define THOST_FTDC_VM_Absolute '0' +/// +#define THOST_FTDC_VM_Ratio '1' + +typedef char TThostFtdcValueMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderPositionFlagTypeһȨȨǷڻͷı +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EOPF_Reserve '0' +/// +#define THOST_FTDC_EOPF_UnReserve '1' + +typedef char TThostFtdcExecOrderPositionFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderCloseFlagTypeһȨȨɵͷǷԶƽ +///////////////////////////////////////////////////////////////////////// +///Զƽ +#define THOST_FTDC_EOCF_AutoClose '0' +///Զƽ +#define THOST_FTDC_EOCF_NotToClose '1' + +typedef char TThostFtdcExecOrderCloseFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductTypeTypeһƷ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_PTE_Futures '1' +///Ȩ +#define THOST_FTDC_PTE_Options '2' + +typedef char TThostFtdcProductTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCZCEUploadFileNameTypeһ֣ļ +///////////////////////////////////////////////////////////////////////// +///^\d{8}_zz_\d{4} +#define THOST_FTDC_CUFN_CUFN_O 'O' +///^\d{8}ɽ +#define THOST_FTDC_CUFN_CUFN_T 'T' +///^\d{8}ȳֱֲnew +#define THOST_FTDC_CUFN_CUFN_P 'P' +///^\d{8}ƽ˽ +#define THOST_FTDC_CUFN_CUFN_N 'N' +///^\d{8}ƽֱ +#define THOST_FTDC_CUFN_CUFN_L 'L' +///^\d{8}ʽ +#define THOST_FTDC_CUFN_CUFN_F 'F' +///^\d{8}ϳֱֲ +#define THOST_FTDC_CUFN_CUFN_C 'C' +///^\d{8}֤ +#define THOST_FTDC_CUFN_CUFN_M 'M' + +typedef char TThostFtdcCZCEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDCEUploadFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +///^\d{8}_dl_\d{3} +#define THOST_FTDC_DUFN_DUFN_O 'O' +///^\d{8}_ɽ +#define THOST_FTDC_DUFN_DUFN_T 'T' +///^\d{8}_ֱֲ +#define THOST_FTDC_DUFN_DUFN_P 'P' +///^\d{8}_ʽ +#define THOST_FTDC_DUFN_DUFN_F 'F' +///^\d{8}_Żϳֲϸ +#define THOST_FTDC_DUFN_DUFN_C 'C' +///^\d{8}_ֲϸ +#define THOST_FTDC_DUFN_DUFN_D 'D' +///^\d{8}_֤ +#define THOST_FTDC_DUFN_DUFN_M 'M' +///^\d{8}_Ȩִб +#define THOST_FTDC_DUFN_DUFN_S 'S' + +typedef char TThostFtdcDCEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEUploadFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +///^\d{4}_\d{8}_\d{8}_DailyFundChg +#define THOST_FTDC_SUFN_SUFN_O 'O' +///^\d{4}_\d{8}_\d{8}_Trade +#define THOST_FTDC_SUFN_SUFN_T 'T' +///^\d{4}_\d{8}_\d{8}_SettlementDetail +#define THOST_FTDC_SUFN_SUFN_P 'P' +///^\d{4}_\d{8}_\d{8}_Capital +#define THOST_FTDC_SUFN_SUFN_F 'F' + +typedef char TThostFtdcSHFEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFFEXUploadFileNameTypeһнļ +///////////////////////////////////////////////////////////////////////// +///^\d{4}_SG\d{1}_\d{8}_\d{1}_Trade +#define THOST_FTDC_CFUFN_SUFN_T 'T' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_SettlementDetail +#define THOST_FTDC_CFUFN_SUFN_P 'P' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_Capital +#define THOST_FTDC_CFUFN_SUFN_F 'F' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_OptionExec +#define THOST_FTDC_CFUFN_SUFN_S 'S' + +typedef char TThostFtdcCFFEXUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombDirectionTypeһָ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CMDR_Comb '0' +/// +#define THOST_FTDC_CMDR_UnComb '1' + +typedef char TThostFtdcCombDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLockTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_LCKT_Lock '1' +/// +#define THOST_FTDC_LCKT_Unlock '2' + +typedef char TThostFtdcLockTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBizTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_BZTP_Future '1' +///֤ȯ +#define THOST_FTDC_BZTP_Stock '2' + +typedef char TThostFtdcBizTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDesignateTypeTypeһָ +///////////////////////////////////////////////////////////////////////// +///ָǼ +#define THOST_FTDC_DSTP_Register '1' +///ָ +#define THOST_FTDC_DSTP_Cancel '2' + +typedef char TThostFtdcDesignateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFreezeReasonTypeTypeһԭ +///////////////////////////////////////////////////////////////////////// +///ʼ +#define THOST_FTDC_FRTP_Init '1' +/// +#define THOST_FTDC_FRTP_Lock '2' +///ִ +#define THOST_FTDC_FRTP_Exec '3' +///λУ +#define THOST_FTDC_FRTP_Check '4' +///E+1ִж +#define THOST_FTDC_FRTP_ExecFreeze '5' + +typedef char TThostFtdcFreezeReasonTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFreezeTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FZTP_Freeze '1' +///ⶳ +#define THOST_FTDC_FZTP_Unfreeze '2' +///ǿִ +#define THOST_FTDC_FZTP_Force '3' + +typedef char TThostFtdcFreezeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSystemTypeTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +///δ֪ϵͳ +#define THOST_FTDC_TSTP_Unknow '0' +///ڻϵͳ +#define THOST_FTDC_TSTP_Future '1' +///ϵͳ +#define THOST_FTDC_TSTP_IShare '2' + +typedef char TThostFtdcTradeSystemTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStockDisposalTypeTypeһ֤ȯ÷ +///////////////////////////////////////////////////////////////////////// +///뾭͹˾˻ +#define THOST_FTDC_STPT_ToBroker '1' +///Ͷ˻ +#define THOST_FTDC_STPT_ToInvestor '2' + +typedef char TThostFtdcStockDisposalTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStockDisposalSysIDTypeһ֤ȯñ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcStockDisposalSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStockDisposalStatusTypeһ֤ȯ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_SDPS_Submitted 'a' +///Ѿ +#define THOST_FTDC_SDPS_Accepted 'b' +///Ѿܾ +#define THOST_FTDC_SDPS_Rejected 'c' +///Ѿ +#define THOST_FTDC_SDPS_Cancelled 'd' + +typedef char TThostFtdcStockDisposalStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstructionRightTypeTypeһָȨ +///////////////////////////////////////////////////////////////////////// +///޼۵ +#define THOST_FTDC_ISTR_Limit '1' +///޼ȫɽȡ +#define THOST_FTDC_ISTR_Limit_FOK '2' +///м۶ʣת޼ +#define THOST_FTDC_ISTR_Market_RemainLimit '3' +///м۶ʣ೷ +#define THOST_FTDC_ISTR_Market_FAK '4' +///мȫɽȡ +#define THOST_FTDC_ISTR_Market_FOK '5' +///֤ȯ +#define THOST_FTDC_ISTR_Lock '6' +///֤ȯ +#define THOST_FTDC_ISTR_Unlock '7' + +typedef char TThostFtdcInstructionRightTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLevelTypeTypeһͶ߷ּ +///////////////////////////////////////////////////////////////////////// +///һͶ +#define THOST_FTDC_IVLV_FirstLevel '1' +///Ͷ +#define THOST_FTDC_IVLV_SecondLevel '2' +///Ͷ +#define THOST_FTDC_IVLV_ThirdLevel '3' + +typedef char TThostFtdcLevelTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeOffsetTypeTypeһȨƫ +///////////////////////////////////////////////////////////////////////// +///ʵֵ +#define THOST_FTDC_STOV_RealValue '1' +///ӯ +#define THOST_FTDC_STOV_ProfitValue '2' +///ʵֵ +#define THOST_FTDC_STOV_RealRatio '3' +///ӯ +#define THOST_FTDC_STOV_ProfitRatio '4' + +typedef char TThostFtdcStrikeOffsetTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLoginRemarkTypeһ¼ע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLoginRemarkType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestUnitIDTypeһͶʵԪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestUnitIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBulletinIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBulletinIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNewsTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNewsTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNewsUrgencyTypeһ̶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNewsUrgencyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAbstractTypeһϢժҪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAbstractType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcComeFromTypeһϢԴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcComeFromType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcURLLinkTypeһWEBַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcURLLinkType[201]; + +#endif diff --git a/include/CTP_SOPT/ThostFtdcUserApiStruct.h b/include/CTP_SOPT/ThostFtdcUserApiStruct.h new file mode 100644 index 0000000..3240012 --- /dev/null +++ b/include/CTP_SOPT/ThostFtdcUserApiStruct.h @@ -0,0 +1,9447 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company ϺڻϢ޹˾ +///@file ThostFtdcUserApiStruct.h +///@brief ˿ͻ˽ӿʹõҵݽṹ +///@history +///20060106 Ժ ļ +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCSTRUCT_H) +#define THOST_FTDCSTRUCT_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ThostFtdcUserApiDataType.h" + +///Ϣַ +struct CThostFtdcDisseminationField +{ + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///к + TThostFtdcSequenceNoType SequenceNo; +}; + +///û¼ +struct CThostFtdcReqUserLoginField +{ + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///նIPַ + TThostFtdcIPAddressType ClientIPAddress; + ///¼ע + TThostFtdcLoginRemarkType LoginRemark; +}; + +///û¼Ӧ +struct CThostFtdcRspUserLoginField +{ + /// + TThostFtdcDateType TradingDay; + ///¼ɹʱ + TThostFtdcTimeType LoginTime; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Դʱ + TThostFtdcTimeType INETime; +}; + +///ûdz +struct CThostFtdcUserLogoutField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ǿƽԱ˳ +struct CThostFtdcForceUserLogoutField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ͻ֤ +struct CThostFtdcReqAuthenticateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤ + TThostFtdcAuthCodeType AuthCode; +}; + +///ͻ֤Ӧ +struct CThostFtdcRspAuthenticateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; +}; + +///ͻ֤Ϣ +struct CThostFtdcAuthenticationInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤Ϣ + TThostFtdcAuthInfoType AuthInfo; + ///ǷΪ֤ + TThostFtdcBoolType IsResult; +}; + +///תʱͷ +struct CThostFtdcTransferHeaderField +{ + ///汾ţ1.0 + TThostFtdcVersionType Version; + ///״룬 + TThostFtdcTradeCodeType TradeCode; + ///ڣʽyyyymmdd + TThostFtdcTradeDateType TradeDate; + ///ʱ䣬ʽhhmmss + TThostFtdcTradeTimeType TradeTime; + ///ˮţN/A + TThostFtdcTradeSerialType TradeSerial; + ///ڻ˾룬 + TThostFtdcFutureIDType FutureID; + ///д룬ݲѯеõ + TThostFtdcBankIDType BankID; + ///зĴ룬ݲѯеõ + TThostFtdcBankBrchIDType BankBrchID; + ///ԱN/A + TThostFtdcOperNoType OperNo; + ///豸ͣN/A + TThostFtdcDeviceIDType DeviceID; + ///¼N/A + TThostFtdcRecordNumType RecordNum; + ///ỰţN/A + TThostFtdcSessionIDType SessionID; + ///ţN/A + TThostFtdcRequestIDType RequestID; +}; + +///ʽתڻTradeCode=202001 +struct CThostFtdcTransferBankToFutureReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ʽתڻӦ +struct CThostFtdcTransferBankToFutureRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ڻʽתTradeCode=202002 +struct CThostFtdcTransferFutureToBankReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ڻʽתӦ +struct CThostFtdcTransferFutureToBankRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ѯʽTradeCode=204002 +struct CThostFtdcTransferQryBankReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ѯʽӦ +struct CThostFtdcTransferQryBankRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + /// + TThostFtdcMoneyType TradeAmt; + ///п + TThostFtdcMoneyType UseAmt; + ///пȡ + TThostFtdcMoneyType FetchAmt; + /// + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ѯнϸTradeCode=204999 +struct CThostFtdcTransferQryDetailReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; +}; + +///ѯнϸӦ +struct CThostFtdcTransferQryDetailRspField +{ + /// + TThostFtdcDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///ڻˮ + TThostFtdcTradeSerialNoType FutureSerial; + ///ڻ˾ + TThostFtdcFutureIDType FutureID; + ///ʽʺ + TThostFtdcFutureAccountType FutureAccount; + ///ˮ + TThostFtdcTradeSerialNoType BankSerial; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + ///˺ + TThostFtdcBankAccountType BankAccount; + ///֤ + TThostFtdcCertCodeType CertCode; + ///Ҵ + TThostFtdcCurrencyCodeType CurrencyCode; + /// + TThostFtdcMoneyType TxAmount; + ///Ч־ + TThostFtdcTransferValidFlagType Flag; +}; + +///ӦϢ +struct CThostFtdcRspInfoField +{ + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +/// +struct CThostFtdcExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcExchangeNameType ExchangeName; + /// + TThostFtdcExchangePropertyType ExchangeProperty; +}; + +///Ʒ +struct CThostFtdcProductField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductNameType ProductName; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceType PriceTick; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///ֲ + TThostFtdcPositionTypeType PositionType; + ///ֲ + TThostFtdcPositionDateTypeType PositionDateType; + ///ƽִ + TThostFtdcCloseDealTypeType CloseDealType; + ///ױ + TThostFtdcCurrencyIDType TradeCurrencyID; + ///Ѻʽ÷Χ + TThostFtdcMortgageFundUseRangeType MortgageFundUseRange; + ///Ʒ + TThostFtdcInstrumentIDType ExchangeProductID; + ///ԼƷ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; +}; + +///Լ +struct CThostFtdcInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentNameType InstrumentName; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + /// + TThostFtdcYearType DeliveryYear; + /// + TThostFtdcMonthType DeliveryMonth; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceType PriceTick; + /// + TThostFtdcDateType CreateDate; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcDateType ExpireDate; + ///ʼ + TThostFtdcDateType StartDelivDate; + /// + TThostFtdcDateType EndDelivDate; + ///Լ״̬ + TThostFtdcInstLifePhaseType InstLifePhase; + ///ǰǷ + TThostFtdcBoolType IsTrading; + ///ֲ + TThostFtdcPositionTypeType PositionType; + ///ֲ + TThostFtdcPositionDateTypeType PositionDateType; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatio; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatio; + ///Ƿʹô֤߱㷨 + TThostFtdcMaxMarginSideAlgorithmType MaxMarginSideAlgorithm; + ///Ʒ + TThostFtdcInstrumentIDType UnderlyingInstrID; + ///ִм + TThostFtdcPriceType StrikePrice; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType; + ///ԼƷ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; + /// + TThostFtdcCombinationTypeType CombinationType; + ///Сµλ + TThostFtdcVolumeType MinBuyVolume; + ///Сµλ + TThostFtdcVolumeType MinSellVolume; + ///Լʶ + TThostFtdcInstrumentCodeType InstrumentCode; +}; + +///͹˾ +struct CThostFtdcBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ + TThostFtdcBrokerAbbrType BrokerAbbr; + ///͹˾ + TThostFtdcBrokerNameType BrokerName; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///Ա +struct CThostFtdcTraderField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallCountType InstallCount; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///Ͷ +struct CThostFtdcInvestorField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcDateType OpenDate; + ///ֻ + TThostFtdcMobileType Mobile; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ױ +struct CThostFtdcTradingCodeField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ҵ + TThostFtdcBizTypeType BizType; +}; + +///Ա;͹˾ձ +struct CThostFtdcPartBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///û +struct CThostFtdcSuperUserField +{ + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + /// + TThostFtdcPasswordType Password; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///ûȨ +struct CThostFtdcSuperUserFunctionField +{ + ///û + TThostFtdcUserIDType UserID; + ///ܴ + TThostFtdcFunctionCodeType FunctionCode; +}; + +///Ͷ +struct CThostFtdcInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ߷ + TThostFtdcInvestorGroupNameType InvestorGroupName; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ϴѺ + TThostFtdcMoneyType PreMortgage; + ///ϴö + TThostFtdcMoneyType PreCredit; + ///ϴδ + TThostFtdcMoneyType PreDeposit; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///Ϣ + TThostFtdcMoneyType InterestBase; + ///Ϣ + TThostFtdcMoneyType Interest; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + ///ʽ + TThostFtdcMoneyType Available; + ///ȡʽ + TThostFtdcMoneyType WithdrawQuota; + ///׼ + TThostFtdcMoneyType Reserve; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ö + TThostFtdcMoneyType Credit; + ///Ѻ + TThostFtdcMoneyType Mortgage; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///Ͷ߽֤ + TThostFtdcMoneyType DeliveryMargin; + ///֤ + TThostFtdcMoneyType ExchangeDeliveryMargin; + ///ڻ׼ + TThostFtdcMoneyType ReserveBalance; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ϴλ + TThostFtdcMoneyType PreFundMortgageIn; + ///ϴλʳ + TThostFtdcMoneyType PreFundMortgageOut; + /// + TThostFtdcMoneyType FundMortgageIn; + ///ʳ + TThostFtdcMoneyType FundMortgageOut; + ///Ѻ + TThostFtdcMoneyType FundMortgageAvailable; + ///Ѻҽ + TThostFtdcMoneyType MortgageableFund; + ///Ʒռñ֤ + TThostFtdcMoneyType SpecProductMargin; + ///Ʒᱣ֤ + TThostFtdcMoneyType SpecProductFrozenMargin; + ///Ʒ + TThostFtdcMoneyType SpecProductCommission; + ///Ʒ + TThostFtdcMoneyType SpecProductFrozenCommission; + ///Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfit; + ///Ʒƽӯ + TThostFtdcMoneyType SpecProductCloseProfit; + ///ݳֲӯ㷨Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfitByAlg; + ///Ʒ֤ + TThostFtdcMoneyType SpecProductExchangeMargin; + ///ҵ + TThostFtdcBizTypeType BizType; +}; + +///Ͷֲ߳ +struct CThostFtdcInvestorPositionField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcPositionDateType PositionDate; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ճֲ + TThostFtdcVolumeType Position; + ///ͷ + TThostFtdcVolumeType LongFrozen; + ///ͷ + TThostFtdcVolumeType ShortFrozen; + ///ֶ + TThostFtdcMoneyType LongFrozenAmount; + ///ֶ + TThostFtdcMoneyType ShortFrozenAmount; + /// + TThostFtdcVolumeType OpenVolume; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ֽ + TThostFtdcMoneyType OpenAmount; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ֲֳɱ + TThostFtdcMoneyType PositionCost; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ֳɱ + TThostFtdcMoneyType OpenCost; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///ϳɽγɵijֲ + TThostFtdcVolumeType CombPosition; + ///϶ͷ + TThostFtdcVolumeType CombLongFrozen; + ///Ͽͷ + TThostFtdcVolumeType CombShortFrozen; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///ճֲ + TThostFtdcVolumeType TodayPosition; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ִж + TThostFtdcVolumeType StrikeFrozen; + ///ִж + TThostFtdcMoneyType StrikeFrozenAmount; + ///ִж + TThostFtdcVolumeType AbandonFrozen; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִж + TThostFtdcVolumeType YdStrikeFrozen; +}; + +///Լ֤ +struct CThostFtdcInstrumentMarginRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; +}; + +///Լ +struct CThostFtdcInstrumentCommissionRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ҵ + TThostFtdcBizTypeType BizType; +}; + +/// +struct CThostFtdcDepthMarketDataField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; + ///վ + TThostFtdcPriceType AveragePrice; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +///ͶߺԼȨ +struct CThostFtdcInstrumentTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ȩ + TThostFtdcTradingRightType TradingRight; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ҵ + TThostFtdcBizTypeType BizType; +}; + +///͹˾û +struct CThostFtdcBrokerUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + ///û + TThostFtdcUserTypeType UserType; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///Ƿʹ + TThostFtdcBoolType IsUsingOTP; +}; + +///͹˾û +struct CThostFtdcBrokerUserPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; +}; + +///͹˾ûȨ +struct CThostFtdcBrokerUserFunctionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///͹˾ܴ + TThostFtdcBrokerFunctionCodeType BrokerFunctionCode; +}; + +///Ա̻ +struct CThostFtdcTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ϯλɽ + TThostFtdcTradeIDType MaxTradeID; + ///ϯλ󱨵 + TThostFtdcReturnCodeType MaxOrderMessageReference; + ///ҵ + TThostFtdcBizTypeType BizType; +}; + +///Ͷ߽ +struct CThostFtdcSettlementInfoField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType Content; +}; + +///Լ֤ʵ +struct CThostFtdcInstrumentMarginRateAdjustField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; +}; + +///֤ +struct CThostFtdcExchangeMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; +}; + +///֤ʵ +struct CThostFtdcExchangeMarginRateAdjustField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///潻Ͷ߶ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///潻Ͷ߶ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///潻Ͷ߿ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///潻Ͷ߿ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ExchLongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ExchLongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ExchShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ExchShortMarginRatioByVolume; + ///潻Ͷ߶ͷ֤ + TThostFtdcRatioType NoLongMarginRatioByMoney; + ///潻Ͷ߶ͷ֤ + TThostFtdcMoneyType NoLongMarginRatioByVolume; + ///潻Ͷ߿ͷ֤ + TThostFtdcRatioType NoShortMarginRatioByMoney; + ///潻Ͷ߿ͷ֤ + TThostFtdcMoneyType NoShortMarginRatioByVolume; +}; + +/// +struct CThostFtdcExchangeRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Դֵλ + TThostFtdcCurrencyUnitType FromCurrencyUnit; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; + /// + TThostFtdcExchangeRateType ExchangeRate; +}; + +/// +struct CThostFtdcSettlementRefField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; +}; + +///ǰʱ +struct CThostFtdcCurrentTimeField +{ + ///ǰ + TThostFtdcDateType CurrDate; + ///ǰʱ + TThostFtdcTimeType CurrTime; + ///ǰʱ䣨룩 + TThostFtdcMillisecType CurrMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +///ͨѶ׶ +struct CThostFtdcCommPhaseField +{ + /// + TThostFtdcDateType TradingDay; + ///ͨѶʱα + TThostFtdcCommPhaseNoType CommPhaseNo; + ///ϵͳ + TThostFtdcSystemIDType SystemID; +}; + +///¼Ϣ +struct CThostFtdcLoginInfoField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + /// + TThostFtdcPasswordType Password; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///Դʱ + TThostFtdcTimeType INETime; + ///¼ע + TThostFtdcLoginRemarkType LoginRemark; +}; + +///¼Ϣ +struct CThostFtdcLogoutAllField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; +}; + +///ǰ״̬ +struct CThostFtdcFrontStatusField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///û +struct CThostFtdcUserPasswordUpdateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; +}; + +///뱨 +struct CThostFtdcInputOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///־ + TThostFtdcBoolType IsSwapOrder; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ + TThostFtdcVolumeType ZCETotalTradedVolume; + ///־ + TThostFtdcBoolType IsSwapOrder; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcExchangeOrderField +{ + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ʧ +struct CThostFtdcExchangeOrderInsertErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///뱨 +struct CThostFtdcInputOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcExchangeOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ʧ +struct CThostFtdcExchangeOrderActionErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ɽ +struct CThostFtdcExchangeTradeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ɽԴ + TThostFtdcTradeSourceType TradeSource; +}; + +///ɽ +struct CThostFtdcTradeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ɽԴ + TThostFtdcTradeSourceType TradeSource; +}; + +///ûỰ +struct CThostFtdcUserSessionField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///¼ע + TThostFtdcLoginRemarkType LoginRemark; +}; + +///ѯ󱨵 +struct CThostFtdcQueryMaxOrderVolumeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ͷ߽ȷϢ +struct CThostFtdcSettlementInfoConfirmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ȷ + TThostFtdcDateType ConfirmDate; + ///ȷʱ + TThostFtdcTimeType ConfirmTime; +}; + +///ͬ +struct CThostFtdcSyncDepositField +{ + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcMoneyType Deposit; + ///Ƿǿƽ + TThostFtdcBoolType IsForce; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ҵ + TThostFtdcBizTypeType BizType; +}; + +///Ѻͬ +struct CThostFtdcSyncFundMortgageField +{ + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Ѻ + TThostFtdcMoneyType MortgageAmount; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; +}; + +///͹˾ͬ +struct CThostFtdcBrokerSyncField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ͬеͶ +struct CThostFtdcSyncingInvestorField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcDateType OpenDate; + ///ֻ + TThostFtdcMobileType Mobile; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ͬеĽ״ +struct CThostFtdcSyncingTradingCodeField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///ͬеͶ߷ +struct CThostFtdcSyncingInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ߷ + TThostFtdcInvestorGroupNameType InvestorGroupName; +}; + +///ͬеĽ˺ +struct CThostFtdcSyncingTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ϴѺ + TThostFtdcMoneyType PreMortgage; + ///ϴö + TThostFtdcMoneyType PreCredit; + ///ϴδ + TThostFtdcMoneyType PreDeposit; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///Ϣ + TThostFtdcMoneyType InterestBase; + ///Ϣ + TThostFtdcMoneyType Interest; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + ///ʽ + TThostFtdcMoneyType Available; + ///ȡʽ + TThostFtdcMoneyType WithdrawQuota; + ///׼ + TThostFtdcMoneyType Reserve; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ö + TThostFtdcMoneyType Credit; + ///Ѻ + TThostFtdcMoneyType Mortgage; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///Ͷ߽֤ + TThostFtdcMoneyType DeliveryMargin; + ///֤ + TThostFtdcMoneyType ExchangeDeliveryMargin; + ///ڻ׼ + TThostFtdcMoneyType ReserveBalance; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ϴλ + TThostFtdcMoneyType PreFundMortgageIn; + ///ϴλʳ + TThostFtdcMoneyType PreFundMortgageOut; + /// + TThostFtdcMoneyType FundMortgageIn; + ///ʳ + TThostFtdcMoneyType FundMortgageOut; + ///Ѻ + TThostFtdcMoneyType FundMortgageAvailable; + ///Ѻҽ + TThostFtdcMoneyType MortgageableFund; + ///Ʒռñ֤ + TThostFtdcMoneyType SpecProductMargin; + ///Ʒᱣ֤ + TThostFtdcMoneyType SpecProductFrozenMargin; + ///Ʒ + TThostFtdcMoneyType SpecProductCommission; + ///Ʒ + TThostFtdcMoneyType SpecProductFrozenCommission; + ///Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfit; + ///Ʒƽӯ + TThostFtdcMoneyType SpecProductCloseProfit; + ///ݳֲӯ㷨Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfitByAlg; + ///Ʒ֤ + TThostFtdcMoneyType SpecProductExchangeMargin; +}; + +///ͬеͶֲ߳ +struct CThostFtdcSyncingInvestorPositionField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcPositionDateType PositionDate; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ճֲ + TThostFtdcVolumeType Position; + ///ͷ + TThostFtdcVolumeType LongFrozen; + ///ͷ + TThostFtdcVolumeType ShortFrozen; + ///ֶ + TThostFtdcMoneyType LongFrozenAmount; + ///ֶ + TThostFtdcMoneyType ShortFrozenAmount; + /// + TThostFtdcVolumeType OpenVolume; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ֽ + TThostFtdcMoneyType OpenAmount; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ֲֳɱ + TThostFtdcMoneyType PositionCost; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ֳɱ + TThostFtdcMoneyType OpenCost; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///ϳɽγɵijֲ + TThostFtdcVolumeType CombPosition; + ///϶ͷ + TThostFtdcVolumeType CombLongFrozen; + ///Ͽͷ + TThostFtdcVolumeType CombShortFrozen; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///ճֲ + TThostFtdcVolumeType TodayPosition; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ִж + TThostFtdcVolumeType StrikeFrozen; + ///ִж + TThostFtdcMoneyType StrikeFrozenAmount; + ///ִж + TThostFtdcVolumeType AbandonFrozen; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִж + TThostFtdcVolumeType YdStrikeFrozen; +}; + +///ͬеĺԼ֤ +struct CThostFtdcSyncingInstrumentMarginRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; +}; + +///ͬеĺԼ +struct CThostFtdcSyncingInstrumentCommissionRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ͬеĺԼȨ +struct CThostFtdcSyncingInstrumentTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ȩ + TThostFtdcTradingRightType TradingRight; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ +struct CThostFtdcQryOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ѯɽ +struct CThostFtdcQryTradeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + ///ʼʱ + TThostFtdcTimeType TradeTimeStart; + ///ʱ + TThostFtdcTimeType TradeTimeEnd; +}; + +///ѯͶֲ߳ +struct CThostFtdcQryInvestorPositionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯʽ˻ +struct CThostFtdcQryTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ҵ + TThostFtdcBizTypeType BizType; +}; + +///ѯͶ +struct CThostFtdcQryInvestorField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ѯױ +struct CThostFtdcQryTradingCodeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; +}; + +///ѯͶ +struct CThostFtdcQryInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯԼ֤ +struct CThostFtdcQryInstrumentMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯ +struct CThostFtdcQryInstrumentCommissionRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯԼȨ +struct CThostFtdcQryInstrumentTradingRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ͹˾ +struct CThostFtdcQryBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯԱ +struct CThostFtdcQryTraderField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯûȨ +struct CThostFtdcQrySuperUserFunctionField +{ + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯûỰ +struct CThostFtdcQryUserSessionField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ͹˾Ա +struct CThostFtdcQryPartBrokerField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; +}; + +///ѯǰ״̬ +struct CThostFtdcQryFrontStatusField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; +}; + +///ѯ +struct CThostFtdcQryExchangeOrderField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯ +struct CThostFtdcQryOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ +struct CThostFtdcQryExchangeOrderActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯû +struct CThostFtdcQrySuperUserField +{ + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ +struct CThostFtdcQryExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯƷ +struct CThostFtdcQryProductField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯԼ +struct CThostFtdcQryInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; +}; + +///ѯ +struct CThostFtdcQryDepthMarketDataField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ͹˾û +struct CThostFtdcQryBrokerUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ͹˾ûȨ +struct CThostFtdcQryBrokerUserFunctionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯԱ̻ +struct CThostFtdcQryTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯˮ +struct CThostFtdcQrySyncDepositField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; +}; + +///ѯͶ߽ +struct CThostFtdcQrySettlementInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; +}; + +///ѯ֤ +struct CThostFtdcQryExchangeMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯ֤ +struct CThostFtdcQryExchangeMarginRateAdjustField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯ +struct CThostFtdcQryExchangeRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; +}; + +///ѯѺˮ +struct CThostFtdcQrySyncFundMortgageField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; +}; + +///ѯ +struct CThostFtdcQryHisOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; +}; + +///ǰȨԼС֤ +struct CThostFtdcOptionInstrMiniMarginField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///λ֣ȨԼС֤ + TThostFtdcMoneyType MinMargin; + ///ȡֵʽ + TThostFtdcValueMethodType ValueMethod; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ǰȨԼ֤ϵ +struct CThostFtdcOptionInstrMarginAdjustField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷͷ֤ϵ + TThostFtdcRatioType SShortMarginRatioByMoney; + ///Ͷͷ֤ϵ + TThostFtdcMoneyType SShortMarginRatioByVolume; + ///ֵͷ֤ϵ + TThostFtdcRatioType HShortMarginRatioByMoney; + ///ֵͷ֤ϵ + TThostFtdcMoneyType HShortMarginRatioByVolume; + ///ͷ֤ϵ + TThostFtdcRatioType AShortMarginRatioByMoney; + ///ͷ֤ϵ + TThostFtdcMoneyType AShortMarginRatioByVolume; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; + /// + TThostFtdcExchangeIDType ExchangeID; + ///̿ͷ֤ϵ + TThostFtdcRatioType MShortMarginRatioByMoney; + ///̿ͷ֤ϵ + TThostFtdcMoneyType MShortMarginRatioByVolume; +}; + +///ǰȨԼѵϸ +struct CThostFtdcOptionInstrCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///ִ + TThostFtdcRatioType StrikeRatioByMoney; + ///ִ + TThostFtdcRatioType StrikeRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ȩ׳ɱ +struct CThostFtdcOptionInstrTradeCostField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType FixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType MiniMargin; + ///ȨԼȨ + TThostFtdcMoneyType Royalty; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType ExchFixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType ExchMiniMargin; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ȩ׳ɱѯ +struct CThostFtdcQryOptionInstrTradeCostField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ + TThostFtdcPriceType InputPrice; + ///ļ۸,0 + TThostFtdcPriceType UnderlyingPrice; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ȩʲѯ +struct CThostFtdcQryOptionInstrCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ָָֻ +struct CThostFtdcIndexPriceField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ָֻ̼ + TThostFtdcPriceType ClosePrice; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ִ +struct CThostFtdcInputExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ִ +struct CThostFtdcInputExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ִ +struct CThostFtdcExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerExecOrderSeq; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ִ +struct CThostFtdcExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ִѯ +struct CThostFtdcQryExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ִϢ +struct CThostFtdcExchangeExecOrderField +{ + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ִѯ +struct CThostFtdcQryExchangeExecOrderField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ִѯ +struct CThostFtdcQryExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ִ +struct CThostFtdcExchangeExecOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ִѯ +struct CThostFtdcQryExchangeExecOrderActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ִ +struct CThostFtdcErrExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯִ +struct CThostFtdcQryErrExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ִ +struct CThostFtdcErrExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯִ +struct CThostFtdcQryErrExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ͶȨԼȨ +struct CThostFtdcOptionInstrTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDirectionType Direction; + ///Ȩ + TThostFtdcTradingRightType TradingRight; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯȨԼȨ +struct CThostFtdcQryOptionInstrTradingRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ +struct CThostFtdcInputForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ѯ +struct CThostFtdcForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ѯ۱ + TThostFtdcSequenceNoType BrokerForQutoSeq; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///ѯ۲ѯ +struct CThostFtdcQryForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ѯϢ +struct CThostFtdcExchangeForQuoteField +{ + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///ѯ۲ѯ +struct CThostFtdcQryExchangeForQuoteField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ı +struct CThostFtdcInputQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///뱨۲ +struct CThostFtdcInputQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾۱ + TThostFtdcSequenceNoType BrokerQuoteSeq; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///۲ +struct CThostFtdcQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///۲ѯ +struct CThostFtdcQryQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///Ϣ +struct CThostFtdcExchangeQuoteField +{ + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///۲ѯ +struct CThostFtdcQryExchangeQuoteField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///۲ѯ +struct CThostFtdcQryQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///۲ +struct CThostFtdcExchangeQuoteActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///۲ѯ +struct CThostFtdcQryExchangeQuoteActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ȨԼdeltaֵ +struct CThostFtdcOptionInstrDeltaField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Deltaֵ + TThostFtdcRatioType Delta; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///̵ѯ +struct CThostFtdcForQuoteRspField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///ѯʱ + TThostFtdcTimeType ForQuoteTime; + ///ҵ + TThostFtdcDateType ActionDay; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ǰȨԼִƫֵϸ +struct CThostFtdcStrikeOffsetField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִƫֵ + TThostFtdcMoneyType Offset; + ///Ȩƫ + TThostFtdcStrikeOffsetTypeType OffsetType; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ȩִƫֵѯ +struct CThostFtdcQryStrikeOffsetField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///¼ +struct CThostFtdcInputLockField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType LockRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcLockTypeType LockType; + /// + TThostFtdcExchangeIDType ExchangeID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcLockField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType LockRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcLockTypeType LockType; + /// + TThostFtdcOrderLocalIDType LockLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType LockSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderActionStatusType LockStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerLockSeq; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ѯ +struct CThostFtdcQryLockField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType LockSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///֤ȯλ +struct CThostFtdcLockPositionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcVolumeType FrozenVolume; +}; + +///ѯ֤ȯλ +struct CThostFtdcQryLockPositionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ǰETFȨԼѵϸ +struct CThostFtdcETFOptionInstrCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///ִ + TThostFtdcRatioType StrikeRatioByMoney; + ///ִ + TThostFtdcRatioType StrikeRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲַ + TThostFtdcPosiDirectionType PosiDirection; +}; + +///ETFȨʲѯ +struct CThostFtdcQryETFOptionInstrCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ijֲֶ +struct CThostFtdcPosiFreezeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcVolumeType Volume; + ///ԭ + TThostFtdcFreezeReasonTypeType FreezeReasonType; + /// + TThostFtdcFreezeTypeType FreezeType; +}; + +///ѯ +struct CThostFtdcQryExchangeLockField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +/// +struct CThostFtdcExchangeLockField +{ + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcLockTypeType LockType; + /// + TThostFtdcOrderLocalIDType LockLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType LockSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderActionStatusType LockStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcExchangeExecOrderActionErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +/// +struct CThostFtdcInputBatchOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///û + TThostFtdcUserIDType UserID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcBatchOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcExchangeBatchOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ѯ +struct CThostFtdcQryBatchOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ͷֲ߳ +struct CThostFtdcLimitPosiField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType TotalVolume; + ///ͷ + TThostFtdcVolumeType LongVolume; + ///նͷ + TThostFtdcVolumeType OpenVolume; + ///ͷֲֽ,ʹ + TThostFtdcMoneyType LongAmount; + /// + TThostFtdcVolumeType TotalVolumeFrozen; + ///ͷ + TThostFtdcVolumeType LongVolumeFrozen; + ///տ + TThostFtdcVolumeType OpenVolumeFrozen; + ///ͷֲֽ,ʹ + TThostFtdcMoneyType LongAmountFrozen; +}; + +///ѯͶֲ߳ +struct CThostFtdcQryLimitPosiField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///͹˾ֲ +struct CThostFtdcBrokerLimitPosiField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcLargeVolumeType TotalVolume; + ///ͷ + TThostFtdcLargeVolumeType LongVolume; + /// + TThostFtdcLargeVolumeType TotalVolumeFrozen; + ///ͷ + TThostFtdcLargeVolumeType LongVolumeFrozen; +}; + +///ѯ͹˾ֲ +struct CThostFtdcQryBrokerLimitPosiField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ͷ֤ȯֲ +struct CThostFtdcLimitPosiSField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType TotalVolume; + ///տ + TThostFtdcVolumeType OpenVolume; + /// + TThostFtdcVolumeType TotalVolumeFrozen; + ///տ + TThostFtdcVolumeType OpenVolumeFrozen; +}; + +///ѯͶ֤ȯֲ +struct CThostFtdcQryLimitPosiSField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ͷֲ߳Ʋ +struct CThostFtdcLimitPosiParamField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType TotalVolume; + ///ͷ + TThostFtdcVolumeType LongVolume; + ///տ + TThostFtdcVolumeType OpenVolume; + ///ͷֲֽ,ʹ + TThostFtdcMoneyType LongAmount; +}; + +///͹˾ֲƲ +struct CThostFtdcBrokerLimitPosiParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcLargeVolumeType TotalVolume; + ///ͷ + TThostFtdcLargeVolumeType LongVolume; +}; + +///Ͷ֤ȯֲƲ +struct CThostFtdcLimitPosiParamSField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType TotalVolume; + ///տ + TThostFtdcVolumeType OpenVolume; +}; + +///֤ȯò +struct CThostFtdcInputStockDisposalActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯò + TThostFtdcOrderActionRefType StockDisposalActionRef; + ///֤ȯ + TThostFtdcOrderRefType StockDisposalRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///֤ȯò +struct CThostFtdcStockDisposalActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯò + TThostFtdcOrderActionRefType StockDisposalActionRef; + ///֤ȯ + TThostFtdcOrderRefType StockDisposalRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///֤ȯòѯ +struct CThostFtdcQryStockDisposalActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///֤ȯò +struct CThostFtdcExchangeStockDisposalActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///֤ȯò +struct CThostFtdcQryExchangeStockDisposalActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯ֤ȯò +struct CThostFtdcQryErrStockDisposalActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///֤ȯò +struct CThostFtdcExchangeStockDisposalActionErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯñ + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///֤ȯò +struct CThostFtdcErrStockDisposalActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯò + TThostFtdcOrderActionRefType StockDisposalActionRef; + ///֤ȯ + TThostFtdcOrderRefType StockDisposalRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///Ͷ߷ּ +struct CThostFtdcInvestorLevelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ͷ߷ּ + TThostFtdcLevelTypeType LevelType; +}; + +///ϺԼȫϵ +struct CThostFtdcCombInstrumentGuardField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcRatioType GuarantRatio; +}; + +///ϺԼȫϵѯ +struct CThostFtdcQryCombInstrumentGuardField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +/// +struct CThostFtdcInputCombActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +/// +struct CThostFtdcCombActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϱ + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///״̬ + TThostFtdcOrderActionStatusType ActionStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///ϲѯ +struct CThostFtdcQryCombActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ϣ +struct CThostFtdcExchangeCombActionField +{ + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϱ + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///״̬ + TThostFtdcOrderActionStatusType ActionStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///ϲѯ +struct CThostFtdcQryExchangeCombActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///Ʒۻ +struct CThostFtdcProductExchRateField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///۱ + TThostFtdcCurrencyIDType QuoteCurrencyID; + /// + TThostFtdcExchangeRateType ExchangeRate; +}; + +///Ʒۻʲѯ +struct CThostFtdcQryProductExchRateField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; +}; + +///ָ +struct CThostFtdcInputDesignateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ָǼ + TThostFtdcOrderRefType DesignateRef; + ///û + TThostFtdcUserIDType UserID; + ///ָ + TThostFtdcDesignateTypeType DesignateType; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ָ +struct CThostFtdcDesignateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ָǼ + TThostFtdcOrderRefType DesignateRef; + ///û + TThostFtdcUserIDType UserID; + ///ָ + TThostFtdcDesignateTypeType DesignateType; + ///ָ + TThostFtdcOrderLocalIDType DesignateLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ָ״̬ + TThostFtdcOrderActionStatusType DesignateStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///ָ +struct CThostFtdcQryDesignateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ָϢ +struct CThostFtdcExchangeDesignateField +{ + ///ָ + TThostFtdcDesignateTypeType DesignateType; + ///ָ + TThostFtdcOrderLocalIDType DesignateLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ָ״̬ + TThostFtdcOrderActionStatusType DesignateStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; +}; + +///֤ȯ +struct CThostFtdcInputStockDisposalField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯõǼ + TThostFtdcOrderRefType StockDisposalRef; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcVolumeType Volume; + ///֤ȯ÷ + TThostFtdcStockDisposalTypeType StockDisposalType; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///֤ȯ +struct CThostFtdcStockDisposalField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯõǼ + TThostFtdcOrderRefType StockDisposalRef; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcVolumeType Volume; + ///֤ȯ÷ + TThostFtdcStockDisposalTypeType StockDisposalType; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯ״̬ + TThostFtdcStockDisposalStatusType StockDisposalStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; +}; + +///֤ȯ +struct CThostFtdcQryStockDisposalField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///֤ȯϢ +struct CThostFtdcExchangeStockDisposalField +{ + /// + TThostFtdcVolumeType Volume; + ///֤ȯ÷ + TThostFtdcStockDisposalTypeType StockDisposalType; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯ״̬ + TThostFtdcStockDisposalStatusType StockDisposalStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; +}; + +///ѯͶ߷ּ +struct CThostFtdcQryInvestorLevelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯѯۼ۲ +struct CThostFtdcQryForQuoteParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯۼ۲ +struct CThostFtdcForQuoteParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///¼ + TThostFtdcPriceType LastPrice; + ///۲ + TThostFtdcPriceType PriceInterval; +}; + +///ѯȨ +struct CThostFtdcQryExecFreezeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ȩ +struct CThostFtdcExecFreezeField +{ + ///ĺԼ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType; + ///_λ + TThostFtdcVolumeType Volume; + /// + TThostFtdcMoneyType FrozenAmount; +}; + +///ǰȨԼѵϸ +struct CThostFtdcMMOptionInstrCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///ִ + TThostFtdcRatioType StrikeRatioByMoney; + ///ִ + TThostFtdcRatioType StrikeRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ȩʲѯ +struct CThostFtdcQryMMOptionInstrCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///̺Լ +struct CThostFtdcMMInstrumentCommissionRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ̺Լ +struct CThostFtdcQryMMInstrumentCommissionRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ǰѵϸ +struct CThostFtdcInstrumentOrderCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcRatioType OrderCommByVolume; + /// + TThostFtdcRatioType OrderActionCommByVolume; +}; + +///ʲѯ +struct CThostFtdcQryInstrumentOrderCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ͷ߽ +struct CThostFtdcLimitAmountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͷֲֽ + TThostFtdcMoneyType LongAmount; + ///ͷֲֽ + TThostFtdcMoneyType LongAmountFrozen; +}; + +///ѯͶ߽ +struct CThostFtdcQryLimitAmountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ͷ߽Ʋ +struct CThostFtdcLimitAmountParamField +{ + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͷֲֽ + TThostFtdcMoneyType LongAmount; +}; + +///ǰȨԼ֤ϵ +struct CThostFtdcOptionInstrMarginGuardField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷͷ֤ϵ + TThostFtdcRatioType SShortMarginRatioByMoney; + ///Ͷͷ֤ϵ + TThostFtdcMoneyType SShortMarginRatioByVolume; + ///ֵͷ֤ϵ + TThostFtdcRatioType HShortMarginRatioByMoney; + ///ֵͷ֤ϵ + TThostFtdcMoneyType HShortMarginRatioByVolume; + ///ͷ֤ϵ + TThostFtdcRatioType AShortMarginRatioByMoney; + ///ͷ֤ϵ + TThostFtdcMoneyType AShortMarginRatioByVolume; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///г +struct CThostFtdcMarketDataField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +/// +struct CThostFtdcMarketDataBaseField +{ + /// + TThostFtdcDateType TradingDay; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + ///ʵ + TThostFtdcRatioType PreDelta; +}; + +///龲̬ +struct CThostFtdcMarketDataStaticField +{ + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcPriceType ClosePrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ʵ + TThostFtdcRatioType CurrDelta; +}; + +///³ɽ +struct CThostFtdcMarketDataLastMatchField +{ + ///¼ + TThostFtdcPriceType LastPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; +}; + +///ż +struct CThostFtdcMarketDataBestPriceField +{ + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; +}; + +/// +struct CThostFtdcMarketDataBid23Field +{ + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; +}; + +/// +struct CThostFtdcMarketDataAsk23Field +{ + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; +}; + +///ġ +struct CThostFtdcMarketDataBid45Field +{ + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; +}; + +///ġ +struct CThostFtdcMarketDataAsk45Field +{ + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; +}; + +///ʱ +struct CThostFtdcMarketDataUpdateTimeField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///齻 +struct CThostFtdcMarketDataExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ָĺԼ +struct CThostFtdcSpecificInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///Լ״̬ +struct CThostFtdcInstrumentStatusField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcSettlementGroupIDType SettlementGroupID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Լ״̬ + TThostFtdcInstrumentStatusType InstrumentStatus; + ///׽׶α + TThostFtdcTradingSegmentSNType TradingSegmentSN; + ///뱾״̬ʱ + TThostFtdcTimeType EnterTime; + ///뱾״̬ԭ + TThostFtdcInstStatusEnterReasonType EnterReason; +}; + +///ѯԼ״̬ +struct CThostFtdcQryInstrumentStatusField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; +}; + +///Ͷ˻ +struct CThostFtdcInvestorAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ҵ + TThostFtdcBizTypeType BizType; +}; + +///ӯ㷨 +struct CThostFtdcPositionProfitAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///ע + TThostFtdcMemoType Memo; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///Աʽۿ +struct CThostFtdcDiscountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʽۿ۱ + TThostFtdcRatioType Discount; +}; + +///ѯת +struct CThostFtdcQryTransferBankField +{ + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; +}; + +///ת +struct CThostFtdcTransferBankField +{ + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///ѯͶֲ߳ϸ +struct CThostFtdcQryInvestorPositionDetailField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ͷֲ߳ϸ +struct CThostFtdcInvestorPositionDetailField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcDateType OpenDate; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcVolumeType Volume; + ///ּ + TThostFtdcPriceType OpenPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///նгֲӯ + TThostFtdcMoneyType PositionProfitByDate; + ///ʶԳֲӯ + TThostFtdcMoneyType PositionProfitByTrade; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + /// + TThostFtdcPriceType LastSettlementPrice; + /// + TThostFtdcPriceType SettlementPrice; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///鱨̻ +struct CThostFtdcMDTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ϯλɽ + TThostFtdcTradeIDType MaxTradeID; + ///ϯλ󱨵 + TThostFtdcReturnCodeType MaxOrderMessageReference; + ///ҵ + TThostFtdcBizTypeType BizType; +}; + +///ѯ鱨̻ +struct CThostFtdcQryMDTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯͻ֪ͨ +struct CThostFtdcQryNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ͻ֪ͨ +struct CThostFtdcNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ϣ + TThostFtdcContentType Content; + ///͹˾֪ͨк + TThostFtdcSequenceLabelType SequenceLabel; +}; + +///ûȨ +struct CThostFtdcUserRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ͻȨ + TThostFtdcUserRightTypeType UserRightType; + ///Ƿֹ + TThostFtdcBoolType IsForbidden; +}; + +///ѯϢȷ +struct CThostFtdcQrySettlementInfoConfirmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///װؽϢ +struct CThostFtdcLoadSettlementInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///͹˾ʽ㷨 +struct CThostFtdcBrokerWithdrawAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ㷨 + TThostFtdcAlgorithmType WithdrawAlgorithm; + ///ʽʹ + TThostFtdcRatioType UsingRatio; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType IncludeCloseProfit; + ///޲޳ɽͻǷܿ + TThostFtdcAllWithoutTradeType AllWithoutTrade; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///Ƿû¼ + TThostFtdcBoolType IsBrokerUserEvent; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; + ///Ȩ㷨 + TThostFtdcBalanceAlgorithmType BalanceAlgorithm; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordUpdateV1Field +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordUpdateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯϺԼ +struct CThostFtdcQryCombinationLegField +{ + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; +}; + +///ѯϺԼ +struct CThostFtdcQrySyncStatusField +{ + /// + TThostFtdcDateType TradingDay; +}; + +///Ͻ׺Լĵ +struct CThostFtdcCombinationLegField +{ + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + /// + TThostFtdcImplyLevelType ImplyLevel; +}; + +///ͬ״̬ +struct CThostFtdcSyncStatusField +{ + /// + TThostFtdcDateType TradingDay; + ///ͬ״̬ + TThostFtdcDataSyncStatusType DataSyncStatus; +}; + +///ѯϵ +struct CThostFtdcQryLinkManField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ϵ +struct CThostFtdcLinkManField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵ + TThostFtdcPersonTypeType PersonType; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + /// + TThostFtdcPartyNameType PersonName; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcZipCodeType ZipCode; + ///ȼ + TThostFtdcPriorityType Priority; + /// + TThostFtdcUOAZipCodeType UOAZipCode; + ///ȫ + TThostFtdcInvestorFullNameType PersonFullName; +}; + +///ѯ͹˾û¼ +struct CThostFtdcQryBrokerUserEventField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; +}; + +///ѯ͹˾û¼ +struct CThostFtdcBrokerUserEventField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; + ///û¼ + TThostFtdcSequenceNoType EventSequenceNo; + ///¼ + TThostFtdcDateType EventDate; + ///¼ʱ + TThostFtdcTimeType EventTime; + ///û¼Ϣ + TThostFtdcUserEventInfoType UserEventInfo; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯǩԼ +struct CThostFtdcQryContractBankField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; +}; + +///ѯǩԼӦ +struct CThostFtdcContractBankField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; +}; + +///Ͷϳֲϸ +struct CThostFtdcInvestorPositionCombineDetailField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///ϱ + TThostFtdcTradeIDType TradeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + ///ֲ + TThostFtdcVolumeType TotalAmt; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ɽ + TThostFtdcTradeGroupIDType TradeGroupID; +}; + +///Ԥ +struct CThostFtdcParkedOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ԥ񱨵 + TThostFtdcParkedOrderIDType ParkedOrderID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ״̬ + TThostFtdcParkedOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///Ԥ񵥲 +struct CThostFtdcParkedOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ԥ񳷵 + TThostFtdcParkedOrderActionIDType ParkedOrderActionID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ񳷵״̬ + TThostFtdcParkedOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ѯԤ +struct CThostFtdcQryParkedOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯԤ񳷵 +struct CThostFtdcQryParkedOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ɾԤ +struct CThostFtdcRemoveParkedOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񱨵 + TThostFtdcParkedOrderIDType ParkedOrderID; +}; + +///ɾԤ񳷵 +struct CThostFtdcRemoveParkedOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񳷵 + TThostFtdcParkedOrderActionIDType ParkedOrderActionID; +}; + +///͹˾ʽ㷨 +struct CThostFtdcInvestorWithdrawAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʽ + TThostFtdcRatioType UsingRatio; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; +}; + +///ѯϳֲϸ +struct CThostFtdcQryInvestorPositionCombineDetailField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; +}; + +///ɽ +struct CThostFtdcMarketDataAveragePriceField +{ + ///վ + TThostFtdcPriceType AveragePrice; +}; + +///УͶ +struct CThostFtdcVerifyInvestorPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcPasswordType Password; +}; + +///ûIP +struct CThostFtdcUserIPField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///IPַ + TThostFtdcIPAddressType IPMask; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///û¼֪ͨϢ +struct CThostFtdcTradingNoticeInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʱ + TThostFtdcTimeType SendTime; + ///Ϣ + TThostFtdcContentType FieldContent; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///к + TThostFtdcSequenceNoType SequenceNo; +}; + +///û¼֪ͨ +struct CThostFtdcTradingNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///û + TThostFtdcUserIDType UserID; + ///ʱ + TThostFtdcTimeType SendTime; + ///к + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType FieldContent; +}; + +///ѯ¼֪ͨ +struct CThostFtdcQryTradingNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ѯ󱨵 +struct CThostFtdcQryErrOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///󱨵 +struct CThostFtdcErrOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ױ + TThostFtdcClientIDType ClientID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ѯ󱨵 +struct CThostFtdcErrorConditionalOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ + TThostFtdcVolumeType ZCETotalTradedVolume; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///ʽ˺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ѯ󱨵 +struct CThostFtdcQryErrOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///󱨵 +struct CThostFtdcErrOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ͶʵԪ + TThostFtdcInvestUnitIDType InvestUnitID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///Macַ + TThostFtdcMacAddressType MacAddress; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ״̬ +struct CThostFtdcQryExchangeSequenceField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///״̬ +struct CThostFtdcExchangeSequenceField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Լ״̬ + TThostFtdcInstrumentStatusType MarketStatus; +}; + +///ݼ۸ѯ󱨵 +struct CThostFtdcQueryMaxOrderVolumeWithPriceField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ͹˾ײ +struct CThostFtdcQryBrokerTradingParamsField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///͹˾ײ +struct CThostFtdcBrokerTradingParamsField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤۸ + TThostFtdcMarginPriceTypeType MarginPriceType; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ȨȨ۸ + TThostFtdcOptionRoyaltyPriceTypeType OptionRoyaltyPriceType; +}; + +///ѯ͹˾㷨 +struct CThostFtdcQryBrokerTradingAlgosField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///͹˾㷨 +struct CThostFtdcBrokerTradingAlgosField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ֲִ㷨 + TThostFtdcHandlePositionAlgoIDType HandlePositionAlgoID; + ///Ѱұ֤㷨 + TThostFtdcFindMarginRateAlgoIDType FindMarginRateAlgoID; + ///ʽ㷨 + TThostFtdcHandleTradingAccountAlgoIDType HandleTradingAccountAlgoID; +}; + +///ѯ͹˾ʽ +struct CThostFtdcQueryBrokerDepositField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///͹˾ʽ +struct CThostFtdcBrokerDepositField +{ + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ʽ + TThostFtdcMoneyType Available; + ///׼ + TThostFtdcMoneyType Reserve; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; +}; + +///ѯ֤ϵͳ͹˾Կ +struct CThostFtdcQryCFMMCBrokerKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///֤ϵͳ͹˾Կ +struct CThostFtdcCFMMCBrokerKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Կ + TThostFtdcDateType CreateDate; + ///Կʱ + TThostFtdcTimeType CreateTime; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬Կ + TThostFtdcCFMMCKeyType CurrentKey; + ///̬Կ + TThostFtdcCFMMCKeyKindType KeyKind; +}; + +///֤ϵͳ͹˾ʽ˻Կ +struct CThostFtdcCFMMCTradingAccountKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬Կ + TThostFtdcCFMMCKeyType CurrentKey; +}; + +///ѯ֤ϵͳ͹˾ʽ˻Կ +struct CThostFtdcQryCFMMCTradingAccountKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///û̬Ʋ +struct CThostFtdcBrokerUserOTPParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ṩ + TThostFtdcOTPVendorsIDType OTPVendorsID; + ///̬к + TThostFtdcSerialNumberType SerialNumber; + ///Կ + TThostFtdcAuthKeyType AuthKey; + ///Ưֵ + TThostFtdcLastDriftType LastDrift; + ///ɹֵ + TThostFtdcLastSuccessType LastSuccess; + ///̬ + TThostFtdcOTPTypeType OTPType; +}; + +///ֹͬû̬ +struct CThostFtdcManualSyncBrokerUserOTPField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ + TThostFtdcOTPTypeType OTPType; + ///һ̬ + TThostFtdcPasswordType FirstOTP; + ///ڶ̬ + TThostFtdcPasswordType SecondOTP; +}; + +///Ͷģ +struct CThostFtdcCommRateModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///ģ + TThostFtdcCommModelNameType CommModelName; +}; + +///ѯͶģ +struct CThostFtdcQryCommRateModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; +}; + +///Ͷ֤߱ģ +struct CThostFtdcMarginModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + ///ģ + TThostFtdcCommModelNameType MarginModelName; +}; + +///ѯͶ֤߱ģ +struct CThostFtdcQryMarginModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ֵ۵Ϣ +struct CThostFtdcEWarrantOffsetField +{ + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType Volume; +}; + +///ѯֵ۵Ϣ +struct CThostFtdcQryEWarrantOffsetField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯͶƷ/Ʒֱ֤ +struct CThostFtdcQryInvestorProductGroupMarginField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ͶƷ/Ʒֱ֤ +struct CThostFtdcInvestorProductGroupMarginField +{ + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType LongFrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType ShortFrozenMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ͷ֤ + TThostFtdcMoneyType LongUseMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortUseMargin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///ͷ֤ + TThostFtdcMoneyType LongExchMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortExchMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + /// + TThostFtdcMoneyType FrozenCommission; + /// + TThostFtdcMoneyType Commission; + ///ʽ + TThostFtdcMoneyType FrozenCash; + ///ʽ + TThostFtdcMoneyType CashIn; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///۵ܽ + TThostFtdcMoneyType OffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortOffsetAmount; + ///۵ܽ + TThostFtdcMoneyType ExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortExchOffsetAmount; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯû +struct CThostFtdcQueryCFMMCTradingAccountTokenField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///û +struct CThostFtdcCFMMCTradingAccountTokenField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬ + TThostFtdcCFMMCTokenType Token; +}; + +///ͶָȨ +struct CThostFtdcInstructionRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ָȨ + TThostFtdcInstructionRightTypeType InstructionRight; + ///Ƿֹ + TThostFtdcBoolType IsForbidden; +}; + +///ѯƷ +struct CThostFtdcQryProductGroupField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ͶƷ/Ʒֱ֤Ʒ +struct CThostFtdcProductGroupField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductGroupID; +}; + +/// +struct CThostFtdcBulletinField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcBulletinIDType BulletinID; + ///к + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcNewsTypeType NewsType; + ///̶ + TThostFtdcNewsUrgencyType NewsUrgency; + ///ʱ + TThostFtdcTimeType SendTime; + ///ϢժҪ + TThostFtdcAbstractType Abstract; + ///ϢԴ + TThostFtdcComeFromType ComeFrom; + ///Ϣ + TThostFtdcContentType Content; + ///WEBַ + TThostFtdcURLLinkType URLLink; + ///г + TThostFtdcMarketIDType MarketID; +}; + +///ѯ +struct CThostFtdcQryBulletinField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcBulletinIDType BulletinID; + ///к + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcNewsTypeType NewsType; + ///̶ + TThostFtdcNewsUrgencyType NewsUrgency; +}; + +///תʿ +struct CThostFtdcReqOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; +}; + +///ת +struct CThostFtdcReqCancelAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; +}; + +///˻ +struct CThostFtdcReqChangeAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ת +struct CThostFtdcReqTransferField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; +}; + +///зʽתڻӦ +struct CThostFtdcRspTransferField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +/// +struct CThostFtdcReqRepealField +{ + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; +}; + +///Ӧ +struct CThostFtdcRspRepealField +{ + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ˻Ϣ +struct CThostFtdcReqQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ѯ˻ϢӦ +struct CThostFtdcRspQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; +}; + +///ǩǩ +struct CThostFtdcFutureSignIOField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ǩӦ +struct CThostFtdcRspFutureSignInField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; +}; + +///ǩ +struct CThostFtdcReqFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ǩӦ +struct CThostFtdcRspFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯָˮŵĽ׽ +struct CThostFtdcReqQueryTradeResultBySerialField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ˮ + TThostFtdcSerialType Reference; + ///ˮŷߵĻ + TThostFtdcInstitutionTypeType RefrenceIssureType; + ///ˮŷ߻ + TThostFtdcOrganCodeType RefrenceIssure; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ѯָˮŵĽ׽Ӧ +struct CThostFtdcRspQueryTradeResultBySerialField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///ˮ + TThostFtdcSerialType Reference; + ///ˮŷߵĻ + TThostFtdcInstitutionTypeType RefrenceIssureType; + ///ˮŷ߻ + TThostFtdcOrganCodeType RefrenceIssure; + ///ԭʼش + TThostFtdcReturnCodeType OriginReturnCode; + ///ԭʼ + TThostFtdcDescrInfoForReturnCodeType OriginDescrInfoForReturnCode; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ļ +struct CThostFtdcReqDayEndFileReadyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ļҵ + TThostFtdcFileBusinessCodeType FileBusinessCode; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ؽ +struct CThostFtdcReturnResultField +{ + ///ش + TThostFtdcReturnCodeType ReturnCode; + /// + TThostFtdcDescrInfoForReturnCodeType DescrInfoForReturnCode; +}; + +///֤ڻʽ +struct CThostFtdcVerifyFuturePasswordField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///װ + TThostFtdcInstallIDType InstallID; + ///ID + TThostFtdcTIDType TID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///֤ͻϢ +struct CThostFtdcVerifyCustInfoField +{ + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; +}; + +///֤ڻʽͿͻϢ +struct CThostFtdcVerifyFuturePasswordAndCustInfoField +{ + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///֤ڻʽͿͻϢ +struct CThostFtdcDepositResultInformField +{ + ///ˮţˮΪڱ̷صˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcRequestIDType RequestID; + ///ش + TThostFtdcReturnCodeType ReturnCode; + /// + TThostFtdcDescrInfoForReturnCodeType DescrInfoForReturnCode; +}; + +///׺ڱ̷Կͬ +struct CThostFtdcReqSyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///׺ڱ̷ԿͬӦ +struct CThostFtdcRspSyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ˻Ϣ֪ͨ +struct CThostFtdcNotifyQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ת˽ˮ +struct CThostFtdcTransferSerialField +{ + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateSerial; + ///׷ + TThostFtdcTradeDateType TradeDate; + /// + TThostFtdcDateType TradingDay; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///Ự + TThostFtdcSessionIDType SessionID; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///ڻ˾ʺ + TThostFtdcFutureAccTypeType FutureAccType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///׽ + TThostFtdcTradeAmountType TradeAmount; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///Ч־ + TThostFtdcAvailabilityFlagType AvailabilityFlag; + ///Ա + TThostFtdcOperatorCodeType OperatorCode; + ///ʺ + TThostFtdcBankAccountType BankNewAccount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯתˮ +struct CThostFtdcQryTransferSerialField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ǩ֪ͨ +struct CThostFtdcNotifyFutureSignInField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; +}; + +///ǩ֪ͨ +struct CThostFtdcNotifyFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///׺ڱ̷Կ֪ͬͨ +struct CThostFtdcNotifySyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯǩԼϵ +struct CThostFtdcQryAccountregisterField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ͻϢ +struct CThostFtdcAccountregisterField +{ + /// + TThostFtdcTradeDateType TradeDay; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///ڻ˾֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcOpenOrDestroyType OpenOrDestroy; + ///ǩԼ + TThostFtdcTradeDateType RegDate; + ///Լ + TThostFtdcTradeDateType OutDate; + ///ID + TThostFtdcTIDType TID; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; +}; + +///ڿϢ +struct CThostFtdcOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///Ϣ +struct CThostFtdcCancelAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ڱ˺Ϣ +struct CThostFtdcChangeAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ԱȨ +struct CThostFtdcSecAgentACIDMapField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcCurrencyIDType CurrencyID; + ///нʽʺ + TThostFtdcAccountIDType BrokerSecAgentID; +}; + +///ԱȨ޲ѯ +struct CThostFtdcQrySecAgentACIDMapField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ֱĽȨ +struct CThostFtdcUserRightsAssignField +{ + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; +}; + +///ù˾ǷڱʾĽȨ +struct CThostFtdcBrokerUserRightAssignField +{ + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; + ///ܷ + TThostFtdcBoolType Tradeable; +}; + +///ֱת +struct CThostFtdcDRTransferField +{ + ///ԭĴ + TThostFtdcDRIdentityIDType OrigDRIdentityID; + ///Ŀ꽻Ĵ + TThostFtdcDRIdentityIDType DestDRIdentityID; + ///ԭӦõԪ + TThostFtdcBrokerIDType OrigBrokerID; + ///ĿõԪ + TThostFtdcBrokerIDType DestBrokerID; +}; + +///FensûϢ +struct CThostFtdcFensUserInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ģʽ + TThostFtdcLoginModeType LoginMode; +}; + +///ǰ +struct CThostFtdcCurrTransferIdentityField +{ + ///Ĵ + TThostFtdcDRIdentityIDType IdentityID; +}; + +///ֹ¼û +struct CThostFtdcLoginForbiddenUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; +}; + +///ѯֹ¼û +struct CThostFtdcQryLoginForbiddenUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///UDP鲥Ϣ +struct CThostFtdcMulticastGroupInfoField +{ + ///鲥IPַ + TThostFtdcIPAddressType GroupIP; + ///鲥IP˿ + TThostFtdcIPPortType GroupPort; + ///Դַ + TThostFtdcIPAddressType SourceIP; +}; + +///ʽ˻׼ +struct CThostFtdcTradingAccountReserveField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///׼ + TThostFtdcMoneyType Reserve; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///DBF¼ +struct CThostFtdcDBFRecordField +{ + ///DBF + TThostFtdcDBFComdTypeType DBFComdType; + ///DBFʱ + TThostFtdcDBFComTimeType DBFComTime; + ///DBFԭʼˮ + TThostFtdcDBFComNoType DBFOComNo; + ///DBFˮ + TThostFtdcDBFComNoType DBFComNo; + ///DBFֶ + TThostFtdcDBFFdNameType DBFFdName1; + ///DBFֶ + TThostFtdcDBFFdContentType DBFFdContent1; + ///DBFֶ + TThostFtdcDBFFdNameType DBFFdName2; + ///DBFֶ + TThostFtdcDBFFdContentType DBFFdContent2; + ///DBFֶ + TThostFtdcDBFFdNameType DBFFdName3; + ///DBFֶ + TThostFtdcDBFFdContentType DBFFdContent3; + ///DBFֶ + TThostFtdcDBFFdNameType DBFFdName4; + ///DBFֶ + TThostFtdcDBFFdContentType DBFFdContent4; +}; + + + +#endif diff --git a/include/CTP_SOPT/error.dtd b/include/CTP_SOPT/error.dtd new file mode 100644 index 0000000..15e50b7 --- /dev/null +++ b/include/CTP_SOPT/error.dtd @@ -0,0 +1,9 @@ + + + + + diff --git a/include/CTP_SOPT/error.xml b/include/CTP_SOPT/error.xml new file mode 100644 index 0000000..00ba65e --- /dev/null +++ b/include/CTP_SOPT/error.xml @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/CTP_SOPT/win32/thostmduserapi.dll b/include/CTP_SOPT/win32/thostmduserapi.dll new file mode 100644 index 0000000..752f259 Binary files /dev/null and b/include/CTP_SOPT/win32/thostmduserapi.dll differ diff --git a/include/CTP_SOPT/win32/thostmduserapi.lib b/include/CTP_SOPT/win32/thostmduserapi.lib new file mode 100644 index 0000000..fc22327 Binary files /dev/null and b/include/CTP_SOPT/win32/thostmduserapi.lib differ diff --git a/include/CTP_SOPT/win32/thosttraderapi.dll b/include/CTP_SOPT/win32/thosttraderapi.dll new file mode 100644 index 0000000..841ac45 Binary files /dev/null and b/include/CTP_SOPT/win32/thosttraderapi.dll differ diff --git a/include/CTP_SOPT/win32/thosttraderapi.lib b/include/CTP_SOPT/win32/thosttraderapi.lib new file mode 100644 index 0000000..cccca3d Binary files /dev/null and b/include/CTP_SOPT/win32/thosttraderapi.lib differ diff --git a/include/ChinaStock.cpp b/include/ChinaStock.cpp index 2b16aa6..3054e2a 100644 --- a/include/ChinaStock.cpp +++ b/include/ChinaStock.cpp @@ -3,10 +3,17 @@ #include +//http://www.jisilu.cn/question/37830 +//提问:如何识别哪些分级是上海分级基金? +//回答:上海分级母基、A和B份额的代码是以50开头的,深交所的分级A和B类的代码以15开头,母基的代码以16开头。 + +//http://www.sse.com.cn/assortment/fund/list/ +//http://lefu.szse.cn/ InstrumentType InstrumentID_2_InstrumentType_SSE(int In) { // 只有6位,8位的期权已经提前过滤 int prefix1 = In / 100000; + int prefix2 = In / 10000; int prefix3 = In / 1000; switch (prefix1) { @@ -32,6 +39,13 @@ InstrumentType InstrumentID_2_InstrumentType_SSE(int In) case 3: return InstrumentType::InstrumentType_Future; case 5: + switch (prefix2) + { + case 50: + return InstrumentType::InstrumentType_LOF; // + case 51: + return InstrumentType::InstrumentType_ETF; // + } switch (prefix3) { case 500: @@ -57,11 +71,12 @@ InstrumentType InstrumentID_2_InstrumentType_SSE(int In) } } -InstrumentType InstrumentID_2_InstrumentType_SZE(int In) +InstrumentType InstrumentID_2_InstrumentType_SZSE(int In) { // 只有6位,取前2 int prefix1 = In / 100000; int prefix2 = In / 10000; + int prefix3 = In / 1000; switch (prefix2) { case 0: @@ -76,6 +91,15 @@ InstrumentType InstrumentID_2_InstrumentType_SZE(int In) case 12: case 13: return InstrumentType::InstrumentType_Bond; + case 15:// AB + switch (prefix3) + { + case 159: + return InstrumentType::InstrumentType_ETF; + } + return InstrumentType::InstrumentType_LOF; + case 16:// 母基 + return InstrumentType::InstrumentType_LOF; case 17: case 18: return InstrumentType::InstrumentType_ETF; @@ -104,6 +128,7 @@ PriceType InstrumentID_2_PriceTick_SSE(int In) { // 只有6位,8位的期权已经提前过滤 int prefix1 = In / 100000; + int prefix2 = In / 10000; int prefix3 = In / 1000; switch (prefix1) { @@ -132,11 +157,12 @@ PriceType InstrumentID_2_PriceTick_SSE(int In) return 0.01; } -PriceType InstrumentID_2_PriceTick_SZE(int In) +PriceType InstrumentID_2_PriceTick_SZSE(int In) { // 只有6位,取前2 int prefix1 = In / 100000; int prefix2 = In / 10000; + int prefix3 = In / 1000; switch (prefix2) { case 0: @@ -151,6 +177,9 @@ PriceType InstrumentID_2_PriceTick_SZE(int In) case 12: case 13: return 0.001; + case 15: + case 16: + return 0.001; case 17: case 18: return 0.001; diff --git a/include/ChinaStock.h b/include/ChinaStock.h index 38dd081..82f0047 100644 --- a/include/ChinaStock.h +++ b/include/ChinaStock.h @@ -11,9 +11,9 @@ InstrumentType InstrumentID_2_InstrumentType_SSE(int In); -InstrumentType InstrumentID_2_InstrumentType_SZE(int In); +InstrumentType InstrumentID_2_InstrumentType_SZSE(int In); InstrumentType InstrumentID_2_InstrumentType_NEEQ(int In); PriceType InstrumentID_2_PriceTick_SSE(int In); -PriceType InstrumentID_2_PriceTick_SZE(int In); +PriceType InstrumentID_2_PriceTick_SZSE(int In); PriceType InstrumentID_2_PriceTick_NEEQ(int In); #endif \ No newline at end of file diff --git a/include/CrossPlatform.h b/include/CrossPlatform.h index ecc29e5..b6ecbe8 100644 --- a/include/CrossPlatform.h +++ b/include/CrossPlatform.h @@ -27,5 +27,20 @@ #endif +#ifdef BUILDING_QUEUE_DLL +#define QUEUE_DLL_PUBLIC DLL_PUBLIC +#else +#define QUEUE_DLL_PUBLIC +#endif + +#ifndef _WIN32 + +#define MAX_PATH 1024 +// #define min(x, y) ((x) < (y) ? (x) : (y)) +#ifndef __stdcall + #define __stdcall +#endif + +#endif #endif // _CROSS_PLATFORM_H_ diff --git a/include/IDGenerator.cpp b/include/IDGenerator.cpp index c672cca..be8d768 100644 --- a/include/IDGenerator.cpp +++ b/include/IDGenerator.cpp @@ -1,5 +1,8 @@ -#include "stdafx.h" +#include "stdafx.h" #include "IDGenerator.h" +#include +#include +#include CIDGenerator::CIDGenerator() { @@ -17,13 +20,27 @@ void CIDGenerator::SetPrefix(const char* prefix) strncpy(m_Prefix, prefix, 32); } -long CIDGenerator::GetID() +unsigned int CIDGenerator::GetID() { - return m_id++; + return ++m_id; +} + +unsigned int CIDGenerator::GetTimeID() +{ + time_t lt; + lt = time(nullptr); + struct tm *ptr; + ptr = localtime(<); + // 1970年开始移动到2015年开始 + // long 其实是无符号int,所以*10000会溢出 + // *1000 在当天下单数超过1000时才会影响前面的秒 + // 如果快速的重复登录,出现第一次已经下到1000笔,第二次登录时在1秒后又下,才会出现ID重复 + unsigned int x = ((ptr->tm_wday * 24 + ptr->tm_hour) * 450 + (ptr->tm_min * 60 + ptr->tm_sec)) * 100 + GetID(); + return x; } const char* CIDGenerator::GetIDString() { - sprintf(m_IDString, "%s:%d", m_Prefix, m_id++); + snprintf(m_IDString, sizeof(m_IDString), "%s:%ld", m_Prefix, ++m_id); return m_IDString; -} \ No newline at end of file +} diff --git a/include/IDGenerator.h b/include/IDGenerator.h index 430f955..3c4047c 100644 --- a/include/IDGenerator.h +++ b/include/IDGenerator.h @@ -16,10 +16,15 @@ class CIDGenerator void SetPrefix(const char* prefix); const char* GetIDString(); - long GetID(); + unsigned int GetID(); + // ֤첻ظ + unsigned int GetTimeID(); + + const unsigned int sec_per_year = 86400 * 365; private: - atomic m_id; + atomic m_id; OrderIDType m_IDString; OrderIDType m_Prefix; + }; diff --git a/include/Kingstar/IncEx/KSCosApi.h b/include/Kingstar/IncEx/KSCosApi.h new file mode 100644 index 0000000..d58d75c --- /dev/null +++ b/include/Kingstar/IncEx/KSCosApi.h @@ -0,0 +1,118 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSCosApi.h +///@brief ˿ͻӿ +///////////////////////////////////////////////////////////////////////// + +#ifndef __KSCOSAPI_H_INCLUDED_ +#define __KSCOSAPI_H_INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "KSUserApiStructEx.h" +#include "KSVocApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) && !defined(KSTRADEAPI_STATIC_LIB) + +#ifdef LIB_TRADER_API_EXPORT +#define TRADER_COSAPI_EXPORT __declspec(dllexport) +#else +#define TRADER_COSAPI_EXPORT __declspec(dllimport) +#endif +#else +#ifdef WIN32 +#define TRADER_COSAPI_EXPORT +#else +#define TRADER_COSAPI_EXPORT __attribute__((visibility("default"))) +#endif + +#endif + +namespace KingstarAPI +{ + + class CKSCosSpi + { + public: + ///¼Ӧ + virtual void OnRspInitInsertConditionalOrder(CKSConditionalOrderOperResultField *pInitInsertConditionalOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ѯӦ + virtual void OnRspQueryConditionalOrder(CKSConditionalOrderOperResultField *pQueryConditionalOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///޸Ӧ + virtual void OnRspModifyConditionalOrder(CKSConditionalOrderOperResultField *pModifyConditionalOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ͣӦ + virtual void OnRspPauseConditionalOrder(CKSConditionalOrderOperResultField *pPauseConditionalOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ɾӦ + virtual void OnRspRemoveConditionalOrder(CKSConditionalOrderRspResultField *pRemoveConditionalOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ѡӦ + virtual void OnRspSelectConditionalOrder(CKSConditionalOrderRspResultField *pSelectConditionalOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ֹֹӯ¼Ӧ + virtual void OnRspInsertProfitAndLossOrder(CKSProfitAndLossOrderOperResultField *pInsertProfitAndLossOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ֹֹӯ޸Ӧ + virtual void OnRspModifyProfitAndLossOrder(CKSProfitAndLossOrderOperResultField *pModifyProfitAndLossOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ֹֹӯɾӦ + virtual void OnRspRemoveProfitAndLossOrder(CKSProfitAndLossOrderRemoveField *pRemoveProfitAndLossOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ֹֹӯѯӦ + virtual void OnRspQueryProfitAndLossOrder(CKSProfitAndLossOrderOperResultField *pQueryProfitAndLossOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ѡ֪ͨ + virtual void OnRtnCOSAskSelect(CKSCOSAskSelectField *pCOSAskSelect) {}; + + ///״̬֪ͨ + virtual void OnRtnCOSStatus(CKSCOSStatusField *pCOSStatus) {}; + + ///ֹֹӯ״̬֪ͨ + virtual void OnRtnPLStatus(CKSPLStatusField *pPLStatus) {}; + }; + + class TRADER_COSAPI_EXPORT CKSCosApi + { + public: + ///¼ + virtual int ReqInitInsertConditionalOrder(CKSConditionalOrderInitInsert *pConditionalOrderInitInsert, int nRequestID) = 0; + + ///ѯ + virtual int ReqQueryConditionalOrder(CKSConditionalOrderQuery *pConditionalOrderQuery, int nRequestID) = 0; + + ///޸ + virtual int ReqModifyConditionalOrder(CKSConditionalOrderModify *pConditionalOrderModify, int nRequestID) = 0; + + ///ɾ + virtual int ReqRemoveConditionalOrder(CKSConditionalOrderRemove *pConditionalOrderRemove, int nRequestID) = 0; + + ///ͣ򼤻 + virtual int ReqStateAlterConditionalOrder(CKSConditionalOrderStateAlter *pConditionalOrderStateAlter, int nRequestID) = 0; + + ///ѡ + virtual int ReqSelectConditionalOrder(CKSConditionalOrderSelect *pConditionalOrderSelect, int nRequestID) = 0; + + ///ֹֹӯ¼ + virtual int ReqInsertProfitAndLossOrder(CKSProfitAndLossOrderInsert *pProfitAndLossOrderInsert, int nRequestID) = 0; + + ///ֹֹӯ޸ + virtual int ReqModifyProfitAndLossOrder(CKSProfitAndLossOrderModify *pProfitAndLossOrderModify, int nRequestID) = 0; + + ///ֹֹӯɾ + virtual int ReqRemoveProfitAndLossOrder(CKSProfitAndLossOrderRemove *pProfitAndLossOrderRemove, int nRequestID) = 0; + + ///ֹֹӯѯ + virtual int ReqQueryProfitAndLossOrder(CKSProfitAndLossOrderQuery *pProfitAndLossOrderQuery, int nRequestID) = 0; + + protected: + ~CKSCosApi(){}; + }; + +} // end of namespace KingstarAPI +#endif \ No newline at end of file diff --git a/include/Kingstar/IncEx/KSMdApiEx.h b/include/Kingstar/IncEx/KSMdApiEx.h new file mode 100644 index 0000000..deae2f8 --- /dev/null +++ b/include/Kingstar/IncEx/KSMdApiEx.h @@ -0,0 +1,173 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSMdApiEx.h +///@brief ˿ͻ˽ӿ +///////////////////////////////////////////////////////////////////////// + +#if !defined(KINSTARAPI_FTDCMDAPI_H) +#define KINSTARAPI_FTDCMDAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "KSUserApiStructEx.h" +#include "KSVocApiDataType.h" + +#if defined(ISLIB) && defined(WIN32)&& !defined(KSMDAPI_STATIC_LIB) +#ifdef LIB_MD_API_EXPORT +#define MD_API_EXPORT __declspec(dllexport) +#else +#define MD_API_EXPORT __declspec(dllimport) +#endif +#else +#ifdef WIN32 +#define MD_API_EXPORT +#else +#define MD_API_EXPORT __attribute__((visibility("default"))) +#endif +#endif + +namespace KingstarAPI +{ + + class CThostFtdcMdSpi + { + public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡӦ + virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡѯӦ + virtual void OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) {}; + + ///ѯ֪ͨ + virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {}; + }; + + class MD_API_EXPORT CThostFtdcMdApi + { + public: + ///MdApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + ///modify for udp marketdata + static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp=false, const bool bIsMulticast=false); + + ///ȡAPIİ汾Ϣ + ///@retrun ȡİ汾 + static const char *GetApiVersion(); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcMdSpi *pSpi) = 0; + + ///顣 + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeMarketData(char *ppInstrumentID[], int nCount) = 0; + + ///˶顣 + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeMarketData(char *ppInstrumentID[], int nCount) = 0; + + ///ѯۡ + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0; + + ///˶ѯۡ + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0; + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; + + ///չAPIʵ + virtual void * LoadExtMdApi(void *pSpi, KS_EXTAPI_TYPE nExtApiType) = 0; + + protected: + ~CThostFtdcMdApi(){}; + }; + +} // end of namespace KingstarAPI + +#endif diff --git a/include/Kingstar/IncEx/KSOptionApi.h b/include/Kingstar/IncEx/KSOptionApi.h new file mode 100644 index 0000000..c40b7eb --- /dev/null +++ b/include/Kingstar/IncEx/KSOptionApi.h @@ -0,0 +1,140 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSOptionApi.h +///@brief ˿ͻȨӿ +///////////////////////////////////////////////////////////////////////// + +#ifndef __KSOPTIONAPI_H_INCLUDED__ +#define __KSOPTIONAPI_H_INCLUDED__ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "KSVocApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) && !defined(KSTRADEAPI_STATIC_LIB) +#ifdef LIB_TRADER_API_EXPORT +#define TRADER_OPTIONAPI_EXPORT __declspec(dllexport) +#else +#define TRADER_OPTIONAPI_EXPORT __declspec(dllimport) +#endif +#else +#ifdef WIN32 +#define TRADER_OPTIONAPI_EXPORT +#else +#define TRADER_OPTIONAPI_EXPORT __attribute__((visibility("default"))) +#endif + +#endif + +namespace KingstarAPI +{ + + class CKSOptionSpi + { + public: + ///ѯָָֻ + virtual void OnRspQryIndexPrice(CKSIndexPriceField *pIndexPrice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ѯָָֻ + virtual void OnRspQryOptionInstrGuard(CKSOptionInstrGuardField *pOptionInstrGuard, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ѯӦ + virtual void OnRspQryExecOrderVolume(CKSExecOrderVolumeField *pExecOrderVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ѯȨָϢӦ + virtual void OnRspQryStockOptionAssignment(CKSStockOptionAssignmentField *pStockOptionAssignment, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͻ׼Ӧ + virtual void OnRspQryInvestorTradeLevel(CKSInvestorTradeLevelField *pInvestorTradeLevel, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ޹Ӧ + virtual void OnRspQryPurchaseLimitAmt(CKSPurchaseLimitAmtField *pPurchaseLimitAmt, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ޲ֶӦ + virtual void OnRspQryPositionLimitVol(CKSPositionLimitVolField *pPositionLimitVol, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʷӦ + virtual void OnRspQryHistoryOrder(CKSHistoryOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʷɽӦ + virtual void OnRspQryHistoryTrade(CKSHistoryTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʷȨָϸӦ + virtual void OnRspQryStockOptionHistoryAssignment(CKSHistoryAssignmentField *pHistoryAssignment, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨϸӦ + virtual void OnRspQryStockOptionDelivDetail(CKSSODelivDetailField *pSODelivDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ԶȨִвӦ + virtual void OnRspAutoExecOrderAction(CKSAutoExecOrderActionField *pAutoExecOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspCombActionInsert(CKSInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯϳֲϸӦ + virtual void OnRspQryInvestorCombinePosition(CKSInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ɿϿɲӦ + virtual void OnRspQryCombActionVolume(CKSCombActionVolumeField *pCombActionVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ϲί֪ͨ + virtual void OnRtnCombAction(CKSCombActionField *pCombAction) {}; + }; + + class TRADER_OPTIONAPI_EXPORT CKSOptionApi + { + public: + ///ѯָָֻ + virtual int ReqQryIndexPrice(CKSQryIndexPriceField *pIndexPrice, int nRequestID) = 0; + + ///ѯȨԼϵ + virtual int ReqQryOptionInstrGuard(CKSQryOptionInstrGuardField *pQryOptionInstrGuard, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExecOrderVolume(CKSQryExecOrderVolumeField *pQryExecOrderVolume, int nRequestID) = 0; + + ///ѯȨָϢ + virtual int ReqQryStockOptionAssignment(CKSQryStockOptionAssignmentField *pQryStockOptionAssignment, int nRequestID) = 0; + + ///ѯͻ׼ + virtual int ReqQryInvestorTradeLevel(CKSQryInvestorTradeLevelField *pQryInvestorTradeLevel, int nRequestID) = 0; + + ///ѯ޹ + virtual int ReqQryPurchaseLimitAmt(CKSQryPurchaseLimitAmtField *pQryPurchaseLimitAmt, int nRequestID) = 0; + + ///ѯ޲ֶ + virtual int ReqQryPositionLimitVol(CKSQryPositionLimitVolField *pQryPositionLimitVol, int nRequestID) = 0; + + ///ѯʷ + virtual int ReqQryHistoryOrder(CKSQryHistoryOrderField *pQryHistoryOrder, int nRequestID) = 0; + + ///ѯʷɽ + virtual int ReqQryHistoryTrade(CKSQryHistoryTradeField *pQryHistoryTrade, int nRequestID) = 0; + + ///ѯʷȨָϸ + virtual int ReqQryStockOptionHistoryAssignment(CKSQryHistoryAssignmentField *pQryHistoryAssignment, int nRequestID) = 0; + + ///ѯȨϸ + virtual int ReqQryStockOptionDelivDetail(CKSQrySODelivDetailField *pQrySODelivDetail, int nRequestID) = 0; + + ///ԶȨִв + virtual int ReqAutoExecOrderAction(CKSAutoExecOrderActionField *pAutoExecOrderAction, int nRequestID) = 0; + + ///ϲί + virtual int ReqCombActionInsert(CKSInputCombActionField *pInputCombAction, int nRequestID) = 0; + + ///ѯϳֲϸ + virtual int ReqQryInvestorCombinePosition(CKSQryInvestorPositionCombineDetailField *pQryInvestorCombinePosition, int nRequestID) = 0; + + ///ѯɿϿɲ + virtual int ReqQryCombActionVolume(CKSQryCombActionVolumeField *pQryCombActionVolume, int nRequestID) = 0; + + protected: + ~CKSOptionApi(){}; + }; + +} // end of namespace KingstarAPI +#endif \ No newline at end of file diff --git a/include/Kingstar/IncEx/KSPrdApi.h b/include/Kingstar/IncEx/KSPrdApi.h new file mode 100644 index 0000000..3db5e8c --- /dev/null +++ b/include/Kingstar/IncEx/KSPrdApi.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSPrdApi.h +///@brief ˿ͻҵӿ +///////////////////////////////////////////////////////////////////////// + +#ifndef __KSPRDAPI_H_INCLUDED__ +#define __KSPRDAPI_H_INCLUDED__ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "KSUserApiStructEx.h" +#include "KSVocApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) && !defined(KSTRADEAPI_STATIC_LIB) + +#ifdef LIB_TRADER_API_EXPORT +#define TRADER_PRDAPI_EXPORT __declspec(dllexport) +#else +#define TRADER_PRDAPI_EXPORT __declspec(dllimport) +#endif +#else +#ifdef WIN32 +#define TRADER_PRDAPI_EXPORT +#else +#define TRADER_PRDAPI_EXPORT __attribute__((visibility("default"))) +#endif + +#endif + +namespace KingstarAPI +{ + class CKSPrdSpi + { + public: + ///ҵӦ + virtual void OnRspSubPrimeData(CKSPrimeDataBusinessField *pPrimeDataBusiness, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + }; + + class TRADER_PRDAPI_EXPORT CKSPrdApi + { + ///ҵ + virtual int ReqSubPrimeData(CKSSubPrimeDataBusinessField *pSubPrimeDataBusiness, int nRequestID) = 0; + + protected: + ~CKSPrdApi(){}; + }; + +} // end of namespace KingstarAPI +#endif \ No newline at end of file diff --git a/include/Kingstar/IncEx/KSTraderApiEx.h b/include/Kingstar/IncEx/KSTraderApiEx.h new file mode 100644 index 0000000..2e02643 --- /dev/null +++ b/include/Kingstar/IncEx/KSTraderApiEx.h @@ -0,0 +1,668 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file ThostFtdcTraderApi.h +///@brief ˿ͻ˽ӿ +///////////////////////////////////////////////////////////////////////// + +#if !defined(KINSTARAPI_FTDCTRADERAPI_H) +#define KINSTARAPI_FTDCTRADERAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "KSUserApiStructEx.h" +#include "KSVocApiDataType.h" + +#if defined(ISLIB) && defined(WIN32) && !defined(KSTRADEAPI_STATIC_LIB) + +#ifdef LIB_TRADER_API_EXPORT +#define TRADER_API_EXPORT __declspec(dllexport) +#else +#define TRADER_API_EXPORT __declspec(dllimport) +#endif + +#else +#ifdef WIN32 +#define TRADER_API_EXPORT +#else +#define TRADER_API_EXPORT __attribute__((visibility("default"))) +#endif + +#endif + +namespace KingstarAPI +{ + + class CThostFtdcTraderSpi + { + public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + ///ͻ֤Ӧ + virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ûӦ + virtual void OnRspUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ʽ˻Ӧ + virtual void OnRspTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ԥ¼Ӧ + virtual void OnRspParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ԥ񳷵¼Ӧ + virtual void OnRspParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ󱨵Ӧ + virtual void OnRspQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ͷ߽ȷӦ + virtual void OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ɾԤӦ + virtual void OnRspRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ɾԤ񳷵Ӧ + virtual void OnRspRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ִ¼Ӧ + virtual void OnRspExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ִӦ + virtual void OnRspExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ¼Ӧ + virtual void OnRspForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///۲Ӧ + virtual void OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspLockInsert(CThostFtdcInputLockField *pInputLock, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯɽӦ + virtual void OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳Ӧ + virtual void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʽ˻Ӧ + virtual void OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶӦ + virtual void OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯױӦ + virtual void OnRspQryTradingCode(CThostFtdcTradingCodeField *pTradingCode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼ֤Ӧ + virtual void OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchange(CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷӦ + virtual void OnRspQryProduct(CThostFtdcProductField *pProduct, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶ߽Ӧ + virtual void OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯתӦ + virtual void OnRspQryTransferBank(CThostFtdcTransferBankField *pTransferBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionDetail(CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͻ֪ͨӦ + virtual void OnRspQryNotice(CThostFtdcNoticeField *pNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯϢȷӦ + virtual void OnRspQrySettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionCombineDetail(CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤ϵͳ͹˾ʽ˻ԿӦ + virtual void OnRspQryCFMMCTradingAccountKey(CThostFtdcCFMMCTradingAccountKeyField *pCFMMCTradingAccountKey, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯֵ۵ϢӦ + virtual void OnRspQryEWarrantOffset(CThostFtdcEWarrantOffsetField *pEWarrantOffset, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶƷ/Ʒֱ֤Ӧ + virtual void OnRspQryInvestorProductGroupMargin(CThostFtdcInvestorProductGroupMarginField *pInvestorProductGroupMargin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤Ӧ + virtual void OnRspQryExchangeMarginRate(CThostFtdcExchangeMarginRateField *pExchangeMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤Ӧ + virtual void OnRspQryExchangeMarginRateAdjust(CThostFtdcExchangeMarginRateAdjustField *pExchangeMarginRateAdjust, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchangeRate(CThostFtdcExchangeRateField *pExchangeRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԱȨӦ + virtual void OnRspQrySecAgentACIDMap(CThostFtdcSecAgentACIDMapField *pSecAgentACIDMap, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷۻ + virtual void OnRspQryProductExchRate(CThostFtdcProductExchRateField *pProductExchRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷ + virtual void OnRspQryProductGroup(CThostFtdcProductGroupField *pProductGroup, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryInstrumentOrderCommRate(CThostFtdcInstrumentOrderCommRateField *pInstrumentOrderCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨ׳ɱӦ + virtual void OnRspQryOptionInstrTradeCost(CThostFtdcOptionInstrTradeCostField *pOptionInstrTradeCost, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨԼӦ + virtual void OnRspQryOptionInstrCommRate(CThostFtdcOptionInstrCommRateField *pOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯִӦ + virtual void OnRspQryExecOrder(CThostFtdcExecOrderField *pExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯѯӦ + virtual void OnRspQryForQuote(CThostFtdcForQuoteField *pForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryLock(CThostFtdcLockField *pLock, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤ȯλӦ + virtual void OnRspQryLockPosition(CThostFtdcLockPositionField *pLockPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯϺԼȫϵӦ + virtual void OnRspQryCombInstrumentGuard(CThostFtdcCombInstrumentGuardField *pCombInstrumentGuard, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryCombAction(CThostFtdcCombActionField *pCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯתˮӦ + virtual void OnRspQryTransferSerial(CThostFtdcTransferSerialField *pTransferSerial, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯǩԼϵӦ + virtual void OnRspQryAccountregister(CThostFtdcAccountregisterField *pAccountregister, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnOrder(CThostFtdcOrderField *pOrder) {}; + + ///ɽ֪ͨ + virtual void OnRtnTrade(CThostFtdcTradeField *pTrade) {}; + + ///¼ر + virtual void OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ر + virtual void OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///Լ״̬֪ͨ + virtual void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) {}; + + ///֪ͨ + virtual void OnRtnTradingNotice(CThostFtdcTradingNoticeInfoField *pTradingNoticeInfo) {}; + + ///ʾУ + virtual void OnRtnErrorConditionalOrder(CThostFtdcErrorConditionalOrderField *pErrorConditionalOrder) {}; + + ///ִ֪ͨ + virtual void OnRtnExecOrder(CThostFtdcExecOrderField *pExecOrder) {}; + + ///ִ¼ر + virtual void OnErrRtnExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ִر + virtual void OnErrRtnExecOrderAction(CThostFtdcExecOrderActionField *pExecOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯ¼ر + virtual void OnErrRtnForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo) {}; + + ///֪ͨ + virtual void OnRtnQuote(CThostFtdcQuoteField *pQuote) {}; + + ///¼ر + virtual void OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo) {}; + + ///۲ر + virtual void OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯ֪ͨ + virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {}; + + ///֤û + virtual void OnRtnCFMMCTradingAccountToken(CThostFtdcCFMMCTradingAccountTokenField *pCFMMCTradingAccountToken) {}; + + ///֪ͨ + virtual void OnRtnLock(CThostFtdcLockField *pLock) {}; + + ///֪ͨ + virtual void OnErrRtnLockInsert(CThostFtdcInputLockField *pInputLock, CThostFtdcRspInfoField *pRspInfo) {}; + + ///֪ͨ + virtual void OnRtnCombAction(CThostFtdcCombActionField *pCombAction) {}; + + ///¼ر + virtual void OnErrRtnCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯǩԼӦ + virtual void OnRspQryContractBank(CThostFtdcContractBankField *pContractBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԤӦ + virtual void OnRspQryParkedOrder(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԤ񳷵Ӧ + virtual void OnRspQryParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֪ͨӦ + virtual void OnRspQryTradingNotice(CThostFtdcTradingNoticeField *pTradingNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ͹˾ײӦ + virtual void OnRspQryBrokerTradingParams(CThostFtdcBrokerTradingParamsField *pBrokerTradingParams, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ͹˾㷨Ӧ + virtual void OnRspQryBrokerTradingAlgos(CThostFtdcBrokerTradingAlgosField *pBrokerTradingAlgos, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯû + virtual void OnRspQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///зʽתڻ֪ͨ + virtual void OnRtnFromBankToFutureByBank(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///зڻʽת֪ͨ + virtual void OnRtnFromFutureToBankByBank(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///зתڻ֪ͨ + virtual void OnRtnRepealFromBankToFutureByBank(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///зڻת֪ͨ + virtual void OnRtnRepealFromFutureToBankByBank(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻʽתڻ֪ͨ + virtual void OnRtnFromBankToFutureByFuture(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///ڻڻʽת֪ͨ + virtual void OnRtnFromFutureToBankByFuture(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///ϵͳʱڻֹתڻдϺ̷ص֪ͨ + virtual void OnRtnRepealFromBankToFutureByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ϵͳʱڻֹڻתдϺ̷ص֪ͨ + virtual void OnRtnRepealFromFutureToBankByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻѯ֪ͨ + virtual void OnRtnQueryBankBalanceByFuture(CThostFtdcNotifyQueryAccountField *pNotifyQueryAccount) {}; + + ///ڻʽתڻر + virtual void OnErrRtnBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻڻʽתдر + virtual void OnErrRtnFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ϵͳʱڻֹתڻر + virtual void OnErrRtnRepealBankToFutureByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ϵͳʱڻֹڻתдر + virtual void OnErrRtnRepealFutureToBankByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻѯر + virtual void OnErrRtnQueryBankBalanceByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻתڻдϺ̷ص֪ͨ + virtual void OnRtnRepealFromBankToFutureByFuture(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻڻתдϺ̷ص֪ͨ + virtual void OnRtnRepealFromFutureToBankByFuture(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻʽתڻӦ + virtual void OnRspFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ڻڻʽתӦ + virtual void OnRspFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ڻѯӦ + virtual void OnRspQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///зڿ֪ͨ + virtual void OnRtnOpenAccountByBank(CThostFtdcOpenAccountField *pOpenAccount) {}; + + ///з֪ͨ + virtual void OnRtnCancelAccountByBank(CThostFtdcCancelAccountField *pCancelAccount) {}; + + ///з˺֪ͨ + virtual void OnRtnChangeAccountByBank(CThostFtdcChangeAccountField *pChangeAccount) {}; + }; + + class TRADER_API_EXPORT CThostFtdcTraderApi + { + public: + ///TraderApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + static CThostFtdcTraderApi *CreateFtdcTraderApi(const char *pszFlowPath = ""); + + ///ȡAPIİ汾Ϣ + ///@retrun ȡİ汾 + static const char *GetApiVersion(); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcTraderSpi *pSpi) = 0; + + ///˽ + ///@param nResumeType ˽شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼˽ + ///@remark ÷ҪInitǰá򲻻յ˽ݡ + virtual void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///Ĺ + ///@param nResumeType شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼󹫹 + ///@remark ÷ҪInitǰá򲻻յݡ + virtual void SubscribePublicTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///ͻ֤ + virtual int ReqAuthenticate(CThostFtdcReqAuthenticateField *pReqAuthenticateField, int nRequestID) = 0; + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; + + ///û + virtual int ReqUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, int nRequestID) = 0; + + ///ʽ˻ + virtual int ReqTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, int nRequestID) = 0; + + ///¼ + virtual int ReqOrderInsert(CThostFtdcInputOrderField *pInputOrder, int nRequestID) = 0; + + ///Ԥ¼ + virtual int ReqParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, int nRequestID) = 0; + + ///Ԥ񳷵¼ + virtual int ReqParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, int nRequestID) = 0; + + /// + virtual int ReqOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, int nRequestID) = 0; + + ///ѯ󱨵 + virtual int ReqQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, int nRequestID) = 0; + + ///Ͷ߽ȷ + virtual int ReqSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, int nRequestID) = 0; + + ///ɾԤ + virtual int ReqRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, int nRequestID) = 0; + + ///ɾԤ񳷵 + virtual int ReqRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, int nRequestID) = 0; + + ///ִ¼ + virtual int ReqExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, int nRequestID) = 0; + + ///ִ + virtual int ReqExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, int nRequestID) = 0; + + ///ѯ¼ + virtual int ReqForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, int nRequestID) = 0; + + ///¼ + virtual int ReqQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, int nRequestID) = 0; + + ///۲ + virtual int ReqQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, int nRequestID) = 0; + + /// + virtual int ReqLockInsert(CThostFtdcInputLockField *pInputLock, int nRequestID) = 0; + + ///¼ + virtual int ReqCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryOrder(CThostFtdcQryOrderField *pQryOrder, int nRequestID) = 0; + + ///ѯɽ + virtual int ReqQryTrade(CThostFtdcQryTradeField *pQryTrade, int nRequestID) = 0; + + ///ѯͶֲ߳ + virtual int ReqQryInvestorPosition(CThostFtdcQryInvestorPositionField *pQryInvestorPosition, int nRequestID) = 0; + + ///ѯʽ˻ + virtual int ReqQryTradingAccount(CThostFtdcQryTradingAccountField *pQryTradingAccount, int nRequestID) = 0; + + ///ѯͶ + virtual int ReqQryInvestor(CThostFtdcQryInvestorField *pQryInvestor, int nRequestID) = 0; + + ///ѯױ + virtual int ReqQryTradingCode(CThostFtdcQryTradingCodeField *pQryTradingCode, int nRequestID) = 0; + + ///ѯԼ֤ + virtual int ReqQryInstrumentMarginRate(CThostFtdcQryInstrumentMarginRateField *pQryInstrumentMarginRate, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrumentCommissionRate(CThostFtdcQryInstrumentCommissionRateField *pQryInstrumentCommissionRate, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchange(CThostFtdcQryExchangeField *pQryExchange, int nRequestID) = 0; + + ///ѯƷ + virtual int ReqQryProduct(CThostFtdcQryProductField *pQryProduct, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrument(CThostFtdcQryInstrumentField *pQryInstrument, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryDepthMarketData(CThostFtdcQryDepthMarketDataField *pQryDepthMarketData, int nRequestID) = 0; + + ///ѯͶ߽ + virtual int ReqQrySettlementInfo(CThostFtdcQrySettlementInfoField *pQrySettlementInfo, int nRequestID) = 0; + + ///ѯת + virtual int ReqQryTransferBank(CThostFtdcQryTransferBankField *pQryTransferBank, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionDetail(CThostFtdcQryInvestorPositionDetailField *pQryInvestorPositionDetail, int nRequestID) = 0; + + ///ѯͻ֪ͨ + virtual int ReqQryNotice(CThostFtdcQryNoticeField *pQryNotice, int nRequestID) = 0; + + ///ѯϢȷ + virtual int ReqQrySettlementInfoConfirm(CThostFtdcQrySettlementInfoConfirmField *pQrySettlementInfoConfirm, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionCombineDetail(CThostFtdcQryInvestorPositionCombineDetailField *pQryInvestorPositionCombineDetail, int nRequestID) = 0; + + ///ѯ֤ϵͳ͹˾ʽ˻Կ + virtual int ReqQryCFMMCTradingAccountKey(CThostFtdcQryCFMMCTradingAccountKeyField *pQryCFMMCTradingAccountKey, int nRequestID) = 0; + + ///ѯֵ۵Ϣ + virtual int ReqQryEWarrantOffset(CThostFtdcQryEWarrantOffsetField *pQryEWarrantOffset, int nRequestID) = 0; + + ///ѯͶƷ/Ʒֱ֤ + virtual int ReqQryInvestorProductGroupMargin(CThostFtdcQryInvestorProductGroupMarginField *pQryInvestorProductGroupMargin, int nRequestID) = 0; + + ///ѯ֤ + virtual int ReqQryExchangeMarginRate(CThostFtdcQryExchangeMarginRateField *pQryExchangeMarginRate, int nRequestID) = 0; + + ///ѯ֤ + virtual int ReqQryExchangeMarginRateAdjust(CThostFtdcQryExchangeMarginRateAdjustField *pQryExchangeMarginRateAdjust, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchangeRate(CThostFtdcQryExchangeRateField *pQryExchangeRate, int nRequestID) = 0; + + ///ѯԱȨ + virtual int ReqQrySecAgentACIDMap(CThostFtdcQrySecAgentACIDMapField *pQrySecAgentACIDMap, int nRequestID) = 0; + + ///ѯƷۻ + virtual int ReqQryProductExchRate(CThostFtdcQryProductExchRateField *pQryProductExchRate, int nRequestID) = 0; + + ///ѯƷ + virtual int ReqQryProductGroup(CThostFtdcQryProductGroupField *pQryProductGroup, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryInstrumentOrderCommRate(CThostFtdcQryInstrumentOrderCommRateField *pQryInstrumentOrderCommRate, int nRequestID) = 0; + + ///ѯȨ׳ɱ + virtual int ReqQryOptionInstrTradeCost(CThostFtdcQryOptionInstrTradeCostField *pQryOptionInstrTradeCost, int nRequestID) = 0; + + ///ѯȨԼ + virtual int ReqQryOptionInstrCommRate(CThostFtdcQryOptionInstrCommRateField *pQryOptionInstrCommRate, int nRequestID) = 0; + + ///ѯִ + virtual int ReqQryExecOrder(CThostFtdcQryExecOrderField *pQryExecOrder, int nRequestID) = 0; + + ///ѯѯ + virtual int ReqQryForQuote(CThostFtdcQryForQuoteField *pQryForQuote, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryQuote(CThostFtdcQryQuoteField *pQryQuote, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryLock(CThostFtdcQryLockField *pQryLock, int nRequestID) = 0; + + ///ѯ֤ȯλ + virtual int ReqQryLockPosition(CThostFtdcQryLockPositionField *pQryLockPosition, int nRequestID) = 0; + + ///ѯϺԼȫϵ + virtual int ReqQryCombInstrumentGuard(CThostFtdcQryCombInstrumentGuardField *pQryCombInstrumentGuard, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryCombAction(CThostFtdcQryCombActionField *pQryCombAction, int nRequestID) = 0; + + ///ѯתˮ + virtual int ReqQryTransferSerial(CThostFtdcQryTransferSerialField *pQryTransferSerial, int nRequestID) = 0; + + ///ѯǩԼϵ + virtual int ReqQryAccountregister(CThostFtdcQryAccountregisterField *pQryAccountregister, int nRequestID) = 0; + + ///ѯǩԼ + virtual int ReqQryContractBank(CThostFtdcQryContractBankField *pQryContractBank, int nRequestID) = 0; + + ///ѯԤ + virtual int ReqQryParkedOrder(CThostFtdcQryParkedOrderField *pQryParkedOrder, int nRequestID) = 0; + + ///ѯԤ񳷵 + virtual int ReqQryParkedOrderAction(CThostFtdcQryParkedOrderActionField *pQryParkedOrderAction, int nRequestID) = 0; + + ///ѯ֪ͨ + virtual int ReqQryTradingNotice(CThostFtdcQryTradingNoticeField *pQryTradingNotice, int nRequestID) = 0; + + ///ѯ͹˾ײ + virtual int ReqQryBrokerTradingParams(CThostFtdcQryBrokerTradingParamsField *pQryBrokerTradingParams, int nRequestID) = 0; + + ///ѯ͹˾㷨 + virtual int ReqQryBrokerTradingAlgos(CThostFtdcQryBrokerTradingAlgosField *pQryBrokerTradingAlgos, int nRequestID) = 0; + + ///ѯû + virtual int ReqQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, int nRequestID) = 0; + + ///ڻʽתڻ + virtual int ReqFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID) = 0; + + ///ڻڻʽת + virtual int ReqFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID) = 0; + + ///ڻѯ + virtual int ReqQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, int nRequestID) = 0; + + ///չAPIʵ + virtual void * LoadExtApi(void *pSpi, KS_EXTAPI_TYPE nExtApiType) = 0; + + protected: + ~CThostFtdcTraderApi(){}; + }; + +} // end of namespace KingstarAPI + +#endif diff --git a/include/Kingstar/IncEx/KSUserApiDataTypeEx.h b/include/Kingstar/IncEx/KSUserApiDataTypeEx.h new file mode 100644 index 0000000..a5c0138 --- /dev/null +++ b/include/Kingstar/IncEx/KSUserApiDataTypeEx.h @@ -0,0 +1,6420 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSUserApiDataTypeEx.h +///@brief ˿ͻ˽ӿʹõҵ +///////////////////////////////////////////////////////////////////////// + +#ifndef KINSTARAPI_FTDCDATATYPE_H + #define KINSTARAPI_FTDCDATATYPE_H + +namespace KingstarAPI +{ + + enum THOST_TE_RESUME_TYPE + { + THOST_TERT_RESTART = 0, + THOST_TERT_RESUME, + THOST_TERT_QUICK + }; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTraderIDTypeһԱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTraderIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestorIDTypeһͶߴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInvestorIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrokerIDTypeһ͹˾ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBrokerIDType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrokerAbbrTypeһ͹˾ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBrokerAbbrType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrokerNameTypeһ͹˾ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBrokerNameType[81]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangeInstIDTypeһԼڽĴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcExchangeInstIDType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderRefTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOrderRefType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcParticipantIDTypeһԱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcParticipantIDType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserIDTypeһû + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUserIDType[16]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPasswordTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPasswordType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClientIDTypeһױ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcClientIDType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstrumentIDTypeһԼ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInstrumentIDType[81]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstrumentCodeTypeһԼʶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInstrumentCodeType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMarketIDTypeһг + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcMarketIDType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProductNameTypeһƷ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcProductNameType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangeIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcExchangeIDType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangeNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcExchangeNameType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangeAbbrTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcExchangeAbbrType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangeFlagTypeһ־ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcExchangeFlagType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMacAddressTypeһMacַ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcMacAddressType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSystemIDTypeһϵͳ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSystemIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangePropertyTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_EXP_Normal '0' + ///ݳɽɱ + #define THOST_FTDC_EXP_GenOrderByTrade '1' + + typedef char TThostFtdcExchangePropertyType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDateTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDateType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTimeTypeһʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTimeType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLongTimeTypeһʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcLongTimeType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstrumentNameTypeһԼ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInstrumentNameType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettlementGroupIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSettlementGroupIDType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderSysIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOrderSysIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeIDTypeһɽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTradeIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCommandTypeTypeһDB + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCommandTypeType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIPAddressTypeһIPַ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcIPAddressType[16]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIPPortTypeһIP˿ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcIPPortType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProductInfoTypeһƷϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcProductInfoType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProtocolInfoTypeһЭϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcProtocolInfoType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBusinessUnitTypeһҵԪ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBusinessUnitType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDepositSeqNoTypeһˮ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDepositSeqNoType[15]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIdentifiedCardNoTypeһ֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcIdentifiedCardNoType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIdCardTypeTypeһ֤ + ///////////////////////////////////////////////////////////////////////// + ///֯ + #define THOST_FTDC_ICT_EID '0' + ///й֤ + #define THOST_FTDC_ICT_IDCard '1' + ///֤ + #define THOST_FTDC_ICT_OfficerIDCard '2' + ///֤ + #define THOST_FTDC_ICT_PoliceIDCard '3' + ///ʿ֤ + #define THOST_FTDC_ICT_SoldierIDCard '4' + ///ڲ + #define THOST_FTDC_ICT_HouseholdRegister '5' + /// + #define THOST_FTDC_ICT_Passport '6' + ///̨֤ + #define THOST_FTDC_ICT_TaiwanCompatriotIDCard '7' + ///֤ + #define THOST_FTDC_ICT_HomeComingCard '8' + ///Ӫҵִպ + #define THOST_FTDC_ICT_LicenseNo '9' + ///˰ǼǺ/˰ID + #define THOST_FTDC_ICT_TaxNo 'A' + ///۰ľڵ֤ͨ + #define THOST_FTDC_ICT_HMMainlandTravelPermit 'B' + ///̨½֤ͨ + #define THOST_FTDC_ICT_TwMainlandTravelPermit 'C' + /// + #define THOST_FTDC_ICT_DrivingLicense 'D' + ///籣ID + #define THOST_FTDC_ICT_SocialID 'F' + ///֤ + #define THOST_FTDC_ICT_LocalID 'G' + ///ҵǼ֤ + #define THOST_FTDC_ICT_BusinessRegistration 'H' + ///۰Ծ֤ + #define THOST_FTDC_ICT_HKMCIDCard 'I' + ///п֤ + #define THOST_FTDC_ICT_AccountsPermits 'J' + ///֤ + #define THOST_FTDC_ICT_OtherCard 'x' + + typedef char TThostFtdcIdCardTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderLocalIDTypeһر + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOrderLocalIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserNameTypeһû + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUserNameType[81]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPartyNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPartyNameType[81]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcErrorMsgTypeһϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcErrorMsgType[256]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFieldNameTypeһֶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFieldNameType[2049]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFieldContentTypeһֶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFieldContentType[2049]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSystemNameTypeһϵͳ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSystemNameType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcContentTypeһϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcContentType[501]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestorRangeTypeһͶ߷Χ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_IR_All '1' + ///Ͷ + #define THOST_FTDC_IR_Group '2' + ///һͶ + #define THOST_FTDC_IR_Single '3' + + typedef char TThostFtdcInvestorRangeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDepartmentRangeTypeһͶ߷Χ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_DR_All '1' + ///ܹ֯ + #define THOST_FTDC_DR_Group '2' + ///һͶ + #define THOST_FTDC_DR_Single '3' + + typedef char TThostFtdcDepartmentRangeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDataSyncStatusTypeһͬ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δͬ + #define THOST_FTDC_DS_Asynchronous '1' + ///ͬ + #define THOST_FTDC_DS_Synchronizing '2' + ///ͬ + #define THOST_FTDC_DS_Synchronized '3' + + typedef char TThostFtdcDataSyncStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrokerDataSyncStatusTypeһ͹˾ͬ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ͬ + #define THOST_FTDC_BDS_Synchronized '1' + ///ͬ + #define THOST_FTDC_BDS_Synchronizing '2' + + typedef char TThostFtdcBrokerDataSyncStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangeConnectStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ûκ + #define THOST_FTDC_ECS_NoConnection '1' + ///ѾԼѯ + #define THOST_FTDC_ECS_QryInstrumentSent '2' + ///ѾȡϢ + #define THOST_FTDC_ECS_GotInformation '9' + + typedef char TThostFtdcExchangeConnectStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTraderConnectStatusTypeһԱ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ûκ + #define THOST_FTDC_TCS_NotConnected '1' + ///Ѿ + #define THOST_FTDC_TCS_Connected '2' + ///ѾԼѯ + #define THOST_FTDC_TCS_QryInstrumentSent '3' + ///˽ + #define THOST_FTDC_TCS_SubPrivateFlow '4' + + typedef char TThostFtdcTraderConnectStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFunctionCodeTypeһܴ + ///////////////////////////////////////////////////////////////////////// + ///첽 + #define THOST_FTDC_FC_DataAsync '1' + ///ǿûdz + #define THOST_FTDC_FC_ForceUserLogout '2' + ///û + #define THOST_FTDC_FC_UserPasswordUpdate '3' + ///͹˾ + #define THOST_FTDC_FC_BrokerPasswordUpdate '4' + ///Ͷ߿ + #define THOST_FTDC_FC_InvestorPasswordUpdate '5' + /// + #define THOST_FTDC_FC_OrderInsert '6' + /// + #define THOST_FTDC_FC_OrderAction '7' + ///ͬϵͳ + #define THOST_FTDC_FC_SyncSystemData '8' + ///ͬ͹˾ + #define THOST_FTDC_FC_SyncBrokerData '9' + ///ͬ͹˾ + #define THOST_FTDC_FC_BachSyncBrokerData 'A' + ///ѯ + #define THOST_FTDC_FC_SuperQuery 'B' + ///Ԥ񱨵 + #define THOST_FTDC_FC_ParkedOrderInsert 'C' + ///Ԥ񱨵 + #define THOST_FTDC_FC_ParkedOrderAction 'D' + ///̬ͬ + #define THOST_FTDC_FC_SyncOTP 'E' + ///ɾδ֪ + #define THOST_FTDC_FC_DeleteOrder 'F' + ///Ȩ + #define THOST_FTDC_FC_LockInsert 'G' + + typedef char TThostFtdcFunctionCodeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrokerFunctionCodeTypeһ͹˾ܴ + ///////////////////////////////////////////////////////////////////////// + ///ǿûdz + #define THOST_FTDC_BFC_ForceUserLogout '1' + ///û + #define THOST_FTDC_BFC_UserPasswordUpdate '2' + ///ͬ͹˾ + #define THOST_FTDC_BFC_SyncBrokerData '3' + ///ͬ͹˾ + #define THOST_FTDC_BFC_BachSyncBrokerData '4' + /// + #define THOST_FTDC_BFC_OrderInsert '5' + /// + #define THOST_FTDC_BFC_OrderAction '6' + ///ȫѯ + #define THOST_FTDC_BFC_AllQuery '7' + ///ϵͳܣ/dz/޸ + #define THOST_FTDC_BFC_log 'a' + ///ѯѯݣԼȳ + #define THOST_FTDC_BFC_BaseQry 'b' + ///ײѯɽί + #define THOST_FTDC_BFC_TradeQry 'c' + ///׹ܣ + #define THOST_FTDC_BFC_Trade 'd' + ///ת + #define THOST_FTDC_BFC_Virement 'e' + ///ռ + #define THOST_FTDC_BFC_Risk 'f' + ///ѯ/ѯỰ˵ + #define THOST_FTDC_BFC_Session 'g' + ///֪ͨ + #define THOST_FTDC_BFC_RiskNoticeCtl 'h' + ///֪ͨ + #define THOST_FTDC_BFC_RiskNotice 'i' + ///쿴͹˾ʽȨ + #define THOST_FTDC_BFC_BrokerDeposit 'j' + ///ʽѯ + #define THOST_FTDC_BFC_QueryFund 'k' + ///ѯ + #define THOST_FTDC_BFC_QueryOrder 'l' + ///ɽѯ + #define THOST_FTDC_BFC_QueryTrade 'm' + ///ֲֲѯ + #define THOST_FTDC_BFC_QueryPosition 'n' + ///ѯ + #define THOST_FTDC_BFC_QueryMarketData 'o' + ///û¼ѯ + #define THOST_FTDC_BFC_QueryUserEvent 'p' + ///֪ͨѯ + #define THOST_FTDC_BFC_QueryRiskNotify 'q' + ///ѯ + #define THOST_FTDC_BFC_QueryFundChange 'r' + ///ͶϢѯ + #define THOST_FTDC_BFC_QueryInvestor 's' + ///ױѯ + #define THOST_FTDC_BFC_QueryTradingCode 't' + ///ǿƽ + #define THOST_FTDC_BFC_ForceClose 'u' + ///ѹ + #define THOST_FTDC_BFC_PressTest 'v' + ///Ȩ淴 + #define THOST_FTDC_BFC_RemainCalc 'w' + ///ֱֲָ֤ + #define THOST_FTDC_BFC_NetPositionInd 'x' + ///Ԥ + #define THOST_FTDC_BFC_RiskPredict 'y' + ///ݵ + #define THOST_FTDC_BFC_DataExport 'z' + ///ָ + #define THOST_FTDC_BFC_RiskTargetSetup 'A' + ///Ԥ + #define THOST_FTDC_BFC_MarketDataWarn 'B' + ///ҵ֪ͨѯ + #define THOST_FTDC_BFC_QryBizNotice 'C' + ///ҵ֪ͨģ + #define THOST_FTDC_BFC_CfgBizNotice 'D' + ///̬ͬ + #define THOST_FTDC_BFC_SyncOTP 'E' + ///ҵ֪ͨ + #define THOST_FTDC_BFC_SendBizNotice 'F' + ///ռ׼ + #define THOST_FTDC_BFC_CfgRiskLevelStd 'G' + ///նӦ + #define THOST_FTDC_BFC_TbCommand 'H' + ///ɾδ֪ + #define THOST_FTDC_BFC_DeleteOrder 'J' + ///Ԥ񱨵 + #define THOST_FTDC_BFC_ParkedOrderInsert 'K' + ///Ԥ񱨵 + #define THOST_FTDC_BFC_ParkedOrderAction 'L' + ///Ȩ + #define THOST_FTDC_BFC_LockInsert 'M' + + typedef char TThostFtdcBrokerFunctionCodeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderActionStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///Ѿύ + #define THOST_FTDC_OAS_Submitted 'a' + ///Ѿ + #define THOST_FTDC_OAS_Accepted 'b' + ///Ѿܾ + #define THOST_FTDC_OAS_Rejected 'c' + + typedef char TThostFtdcOrderActionStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ȫɽ + #define THOST_FTDC_OST_AllTraded '0' + ///ֳɽڶ + #define THOST_FTDC_OST_PartTradedQueueing '1' + ///ֳɽڶ + #define THOST_FTDC_OST_PartTradedNotQueueing '2' + ///δɽڶ + #define THOST_FTDC_OST_NoTradeQueueing '3' + ///δɽڶ + #define THOST_FTDC_OST_NoTradeNotQueueing '4' + /// + #define THOST_FTDC_OST_Canceled '5' + ///δ֪ + #define THOST_FTDC_OST_Unknown 'a' + ///δ + #define THOST_FTDC_OST_NotTouched 'b' + ///Ѵ + #define THOST_FTDC_OST_Touched 'c' + + typedef char TThostFtdcOrderStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderSubmitStatusTypeһύ״̬ + ///////////////////////////////////////////////////////////////////////// + ///Ѿύ + #define THOST_FTDC_OSS_InsertSubmitted '0' + ///Ѿύ + #define THOST_FTDC_OSS_CancelSubmitted '1' + ///޸Ѿύ + #define THOST_FTDC_OSS_ModifySubmitted '2' + ///Ѿ + #define THOST_FTDC_OSS_Accepted '3' + ///Ѿܾ + #define THOST_FTDC_OSS_InsertRejected '4' + ///Ѿܾ + #define THOST_FTDC_OSS_CancelRejected '5' + ///ĵѾܾ + #define THOST_FTDC_OSS_ModifyRejected '6' + + typedef char TThostFtdcOrderSubmitStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPositionDateTypeһֲ + ///////////////////////////////////////////////////////////////////////// + ///ճֲ + #define THOST_FTDC_PSD_Today '1' + ///ʷֲ + #define THOST_FTDC_PSD_History '2' + + typedef char TThostFtdcPositionDateType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPositionDateTypeTypeһֲ + ///////////////////////////////////////////////////////////////////////// + ///ʹʷֲ + #define THOST_FTDC_PDT_UseHistory '1' + ///ʹʷֲ + #define THOST_FTDC_PDT_NoUseHistory '2' + + typedef char TThostFtdcPositionDateTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradingRoleTypeһ׽ɫ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_ER_Broker '1' + ///Ӫ + #define THOST_FTDC_ER_Host '2' + /// + #define THOST_FTDC_ER_Maker '3' + + typedef char TThostFtdcTradingRoleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProductClassTypeһƷ + ///////////////////////////////////////////////////////////////////////// + ///ڻ + #define THOST_FTDC_PC_Futures '1' + ///ڻȨ + #define THOST_FTDC_PC_Options '2' + /// + #define THOST_FTDC_PC_Combination '3' + /// + #define THOST_FTDC_PC_Spot '4' + ///ת + #define THOST_FTDC_PC_EFP '5' + ///ֻȨ + #define THOST_FTDC_PC_SpotOption '6' + ///Ȩ + #define THOST_FTDC_PC_ETFOption '7' + ///֤ȯ + #define THOST_FTDC_PC_Stock '8' + + typedef char TThostFtdcProductClassType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstLifePhaseTypeһԼ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_IP_NotStart '0' + /// + #define THOST_FTDC_IP_Started '1' + ///ͣ + #define THOST_FTDC_IP_Pause '2' + /// + #define THOST_FTDC_IP_Expired '3' + + typedef char TThostFtdcInstLifePhaseType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDirectionTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_D_Buy '0' + /// + #define THOST_FTDC_D_Sell '1' + + typedef char TThostFtdcDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPositionTypeTypeһֲ + ///////////////////////////////////////////////////////////////////////// + ///ֲ + #define THOST_FTDC_PT_Net '1' + ///ۺϳֲ + #define THOST_FTDC_PT_Gross '2' + + typedef char TThostFtdcPositionTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPosiDirectionTypeһֲֶշ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_PD_Net '1' + ///ͷ + #define THOST_FTDC_PD_Long '2' + ///ͷ + #define THOST_FTDC_PD_Short '3' + + typedef char TThostFtdcPosiDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSysSettlementStatusTypeһϵͳ״̬ + ///////////////////////////////////////////////////////////////////////// + ///Ծ + #define THOST_FTDC_SS_NonActive '1' + /// + #define THOST_FTDC_SS_Startup '2' + /// + #define THOST_FTDC_SS_Operating '3' + /// + #define THOST_FTDC_SS_Settlement '4' + /// + #define THOST_FTDC_SS_SettlementFinished '5' + + typedef char TThostFtdcSysSettlementStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRatioAttrTypeһ + ///////////////////////////////////////////////////////////////////////// + ///׷ + #define THOST_FTDC_RA_Trade '0' + /// + #define THOST_FTDC_RA_Settlement '1' + + typedef char TThostFtdcRatioAttrType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcHedgeFlagTypeһͶױ־ + ///////////////////////////////////////////////////////////////////////// + ///Ͷ + #define THOST_FTDC_HF_Speculation '1' + /// + #define THOST_FTDC_HF_Arbitrage '2' + ///ױ + #define THOST_FTDC_HF_Hedge '3' + /// + #define THOST_FTDC_HF_Covered '4' + + typedef char TThostFtdcHedgeFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBillHedgeFlagTypeһͶױ־ + ///////////////////////////////////////////////////////////////////////// + ///Ͷ + #define THOST_FTDC_BHF_Speculation '1' + /// + #define THOST_FTDC_BHF_Arbitrage '2' + ///ױ + #define THOST_FTDC_BHF_Hedge '3' + + typedef char TThostFtdcBillHedgeFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClientIDTypeTypeһױ + ///////////////////////////////////////////////////////////////////////// + ///Ͷ + #define THOST_FTDC_CIDT_Speculation '1' + /// + #define THOST_FTDC_CIDT_Arbitrage '2' + ///ױ + #define THOST_FTDC_CIDT_Hedge '3' + + typedef char TThostFtdcClientIDTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderPriceTypeTypeһ۸ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_OPT_AnyPrice '1' + ///޼ + #define THOST_FTDC_OPT_LimitPrice '2' + ///ż + #define THOST_FTDC_OPT_BestPrice '3' + ///¼ + #define THOST_FTDC_OPT_LastPrice '4' + ///¼۸ϸ1ticks + #define THOST_FTDC_OPT_LastPricePlusOneTicks '5' + ///¼۸ϸ2ticks + #define THOST_FTDC_OPT_LastPricePlusTwoTicks '6' + ///¼۸ϸ3ticks + #define THOST_FTDC_OPT_LastPricePlusThreeTicks '7' + ///һ + #define THOST_FTDC_OPT_AskPrice1 '8' + ///һ۸ϸ1ticks + #define THOST_FTDC_OPT_AskPrice1PlusOneTicks '9' + ///һ۸ϸ2ticks + #define THOST_FTDC_OPT_AskPrice1PlusTwoTicks 'A' + ///һ۸ϸ3ticks + #define THOST_FTDC_OPT_AskPrice1PlusThreeTicks 'B' + ///һ + #define THOST_FTDC_OPT_BidPrice1 'C' + ///һ۸ϸ1ticks + #define THOST_FTDC_OPT_BidPrice1PlusOneTicks 'D' + ///һ۸ϸ2ticks + #define THOST_FTDC_OPT_BidPrice1PlusTwoTicks 'E' + ///һ۸ϸ3ticks + #define THOST_FTDC_OPT_BidPrice1PlusThreeTicks 'F' + ///嵵 + #define THOST_FTDC_OPT_FiveLevelPrice 'G' + + typedef char TThostFtdcOrderPriceTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOffsetFlagTypeһƽ־ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_OF_Open '0' + ///ƽ + #define THOST_FTDC_OF_Close '1' + ///ǿƽ + #define THOST_FTDC_OF_ForceClose '2' + ///ƽ + #define THOST_FTDC_OF_CloseToday '3' + ///ƽ + #define THOST_FTDC_OF_CloseYesterday '4' + ///ǿ + #define THOST_FTDC_OF_ForceOff '5' + ///ǿƽ + #define THOST_FTDC_OF_LocalForceClose '6' + + typedef char TThostFtdcOffsetFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcForceCloseReasonTypeһǿƽԭ + ///////////////////////////////////////////////////////////////////////// + ///ǿƽ + #define THOST_FTDC_FCC_NotForceClose '0' + ///ʽ + #define THOST_FTDC_FCC_LackDeposit '1' + ///ͻ + #define THOST_FTDC_FCC_ClientOverPositionLimit '2' + ///Ա + #define THOST_FTDC_FCC_MemberOverPositionLimit '3' + ///ֲַ + #define THOST_FTDC_FCC_NotMultiple '4' + ///Υ + #define THOST_FTDC_FCC_Violation '5' + /// + #define THOST_FTDC_FCC_Other '6' + ///Ȼٽ + #define THOST_FTDC_FCC_PersonDeliv '7' + + typedef char TThostFtdcForceCloseReasonType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_ORDT_Normal '0' + /// + #define THOST_FTDC_ORDT_DeriveFromQuote '1' + /// + #define THOST_FTDC_ORDT_DeriveFromCombination '2' + ///ϱ + #define THOST_FTDC_ORDT_Combination '3' + /// + #define THOST_FTDC_ORDT_ConditionalOrder '4' + /// + #define THOST_FTDC_ORDT_Swap '5' + + typedef char TThostFtdcOrderTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTimeConditionTypeһЧ + ///////////////////////////////////////////////////////////////////////// + ///ɣ + #define THOST_FTDC_TC_IOC '1' + ///Ч + #define THOST_FTDC_TC_GFS '2' + ///Ч + #define THOST_FTDC_TC_GFD '3' + ///ָǰЧ + #define THOST_FTDC_TC_GTD '4' + ///ǰЧ + #define THOST_FTDC_TC_GTC '5' + ///ϾЧ + #define THOST_FTDC_TC_GFA '6' + + typedef char TThostFtdcTimeConditionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVolumeConditionTypeһɽ + ///////////////////////////////////////////////////////////////////////// + ///κ + #define THOST_FTDC_VC_AV '1' + ///С + #define THOST_FTDC_VC_MV '2' + ///ȫ + #define THOST_FTDC_VC_CV '3' + + typedef char TThostFtdcVolumeConditionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcContingentConditionTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CC_Immediately '1' + ///ֹ + #define THOST_FTDC_CC_Touch '2' + ///ֹӮ + #define THOST_FTDC_CC_TouchProfit '3' + ///Ԥ + #define THOST_FTDC_CC_ParkedOrder '4' + ///¼۴ + #define THOST_FTDC_CC_LastPriceGreaterThanStopPrice '5' + ///¼۴ڵ + #define THOST_FTDC_CC_LastPriceGreaterEqualStopPrice '6' + ///¼С + #define THOST_FTDC_CC_LastPriceLesserThanStopPrice '7' + ///¼Сڵ + #define THOST_FTDC_CC_LastPriceLesserEqualStopPrice '8' + ///һ۴ + #define THOST_FTDC_CC_AskPriceGreaterThanStopPrice '9' + ///һ۴ڵ + #define THOST_FTDC_CC_AskPriceGreaterEqualStopPrice 'A' + ///һС + #define THOST_FTDC_CC_AskPriceLesserThanStopPrice 'B' + ///һСڵ + #define THOST_FTDC_CC_AskPriceLesserEqualStopPrice 'C' + ///һ۴ + #define THOST_FTDC_CC_BidPriceGreaterThanStopPrice 'D' + ///һ۴ڵ + #define THOST_FTDC_CC_BidPriceGreaterEqualStopPrice 'E' + ///һС + #define THOST_FTDC_CC_BidPriceLesserThanStopPrice 'F' + ///һСڵ + #define THOST_FTDC_CC_BidPriceLesserEqualStopPrice 'H' + + typedef char TThostFtdcContingentConditionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcActionFlagTypeһ־ + ///////////////////////////////////////////////////////////////////////// + ///ɾ + #define THOST_FTDC_AF_Delete '0' + ///޸ + #define THOST_FTDC_AF_Modify '3' + + typedef char TThostFtdcActionFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradingRightTypeһȨ + ///////////////////////////////////////////////////////////////////////// + ///Խ + #define THOST_FTDC_TR_Allow '0' + ///ֻƽ + #define THOST_FTDC_TR_CloseOnly '1' + ///ܽ + #define THOST_FTDC_TR_Forbidden '2' + + typedef char TThostFtdcTradingRightType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderSourceTypeһԴ + ///////////////////////////////////////////////////////////////////////// + ///Բ + #define THOST_FTDC_OSRC_Participant '0' + ///ԹԱ + #define THOST_FTDC_OSRC_Administrator '1' + + typedef char TThostFtdcOrderSourceType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeTypeTypeһɽ + ///////////////////////////////////////////////////////////////////////// + ///ϳֲֲΪһֲ,ʼӦ͵ijֲ + #define THOST_FTDC_TRDT_SplitCombination '#' + ///ͨɽ + #define THOST_FTDC_TRDT_Common '0' + ///Ȩִ + #define THOST_FTDC_TRDT_OptionsExecution '1' + ///OTCɽ + #define THOST_FTDC_TRDT_OTC '2' + ///תɽ + #define THOST_FTDC_TRDT_EFPDerived '3' + ///ɽ + #define THOST_FTDC_TRDT_CombinationDerived '4' + + typedef char TThostFtdcTradeTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPriceSourceTypeһɽԴ + ///////////////////////////////////////////////////////////////////////// + ///ǰɽ + #define THOST_FTDC_PSRC_LastPrice '0' + ///ίм + #define THOST_FTDC_PSRC_Buy '1' + ///ίм + #define THOST_FTDC_PSRC_Sell '2' + + typedef char TThostFtdcPriceSourceType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstrumentStatusTypeһԼ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ǰ + #define THOST_FTDC_IS_BeforeTrading '0' + ///ǽ + #define THOST_FTDC_IS_NoTrading '1' + /// + #define THOST_FTDC_IS_Continous '2' + ///Ͼ۱ + #define THOST_FTDC_IS_AuctionOrdering '3' + ///Ͼۼ۸ƽ + #define THOST_FTDC_IS_AuctionBalance '4' + ///Ͼ۴ + #define THOST_FTDC_IS_AuctionMatch '5' + /// + #define THOST_FTDC_IS_Closed '6' + + typedef char TThostFtdcInstrumentStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstStatusEnterReasonTypeһƷֽ뽻״̬ԭ + ///////////////////////////////////////////////////////////////////////// + ///Զл + #define THOST_FTDC_IER_Automatic '1' + ///ֶл + #define THOST_FTDC_IER_Manual '2' + ///۶ + #define THOST_FTDC_IER_Fuse '3' + + typedef char TThostFtdcInstStatusEnterReasonType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrderActionRefTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcOrderActionRefType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstallCountTypeһװ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcInstallCountType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstallIDTypeһװ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcInstallIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcErrorIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcErrorIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettlementIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcSettlementIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVolumeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcVolumeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFrontIDTypeһǰñ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcFrontIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSessionIDTypeһỰ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcSessionIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSequenceNoTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcSequenceNoType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCommandNoTypeһDB + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcCommandNoType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMillisecTypeһʱ䣨룩 + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcMillisecType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVolumeMultipleTypeһԼ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcVolumeMultipleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradingSegmentSNTypeһ׽׶α + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcTradingSegmentSNType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRequestIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcRequestIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcYearTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcYearType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMonthTypeһ· + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcMonthType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBoolTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcBoolType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPriceTypeһ۸ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcPriceType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCombOffsetFlagTypeһϿƽ־ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCombOffsetFlagType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCombHedgeFlagTypeһͶױ־ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCombHedgeFlagType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRatioTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcRatioType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMoneyTypeһʽ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcMoneyType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLargeVolumeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcLargeVolumeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSequenceSeriesTypeһϵк + ///////////////////////////////////////////////////////////////////////// + typedef short TThostFtdcSequenceSeriesType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCommPhaseNoTypeһͨѶʱα + ///////////////////////////////////////////////////////////////////////// + typedef short TThostFtdcCommPhaseNoType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSequenceLabelTypeһб + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSequenceLabelType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUnderlyingMultipleTypeһƷ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcUnderlyingMultipleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPriorityTypeһȼ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcPriorityType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcContractCodeTypeһͬ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcContractCodeType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCityTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCityType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIsStockTypeһǷ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcIsStockType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcChannelTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcChannelType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAddressTypeһͨѶַ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAddressType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcZipCodeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcZipCodeType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTelephoneTypeһϵ绰 + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTelephoneType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFaxTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFaxType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMobileTypeһֻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcMobileType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcEMailTypeһʼ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcEMailType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMemoTypeһע + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcMemoType[161]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCompanyCodeTypeһҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCompanyCodeType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcWebsiteTypeһվַ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcWebsiteType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTaxNoTypeһ˰ǼǺ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTaxNoType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBatchStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δϴ + #define THOST_FTDC_BS_NoUpload '1' + ///ϴ + #define THOST_FTDC_BS_Uploaded '2' + ///ʧ + #define THOST_FTDC_BS_Failed '3' + + typedef char TThostFtdcBatchStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPropertyIDTypeһԴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPropertyIDType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPropertyNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPropertyNameType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLicenseNoTypeһӪҵִպ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcLicenseNoType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAgentIDTypeһ˴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAgentIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAgentNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAgentNameType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAgentGroupIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAgentGroupIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAgentGroupNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAgentGroupNameType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReturnStyleTypeһƷַʽ + ///////////////////////////////////////////////////////////////////////// + ///Ʒ + #define THOST_FTDC_RS_All '1' + ///Ʒ + #define THOST_FTDC_RS_ByProduct '2' + + typedef char TThostFtdcReturnStyleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReturnPatternTypeһģʽ + ///////////////////////////////////////////////////////////////////////// + ///ɽ + #define THOST_FTDC_RP_ByVolume '1' + /// + #define THOST_FTDC_RP_ByFeeOnHand '2' + + typedef char TThostFtdcReturnPatternType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReturnLevelTypeһ + ///////////////////////////////////////////////////////////////////////// + ///1 + #define THOST_FTDC_RL_Level1 '1' + ///2 + #define THOST_FTDC_RL_Level2 '2' + ///3 + #define THOST_FTDC_RL_Level3 '3' + ///4 + #define THOST_FTDC_RL_Level4 '4' + ///5 + #define THOST_FTDC_RL_Level5 '5' + ///6 + #define THOST_FTDC_RL_Level6 '6' + ///7 + #define THOST_FTDC_RL_Level7 '7' + ///8 + #define THOST_FTDC_RL_Level8 '8' + ///9 + #define THOST_FTDC_RL_Level9 '9' + + typedef char TThostFtdcReturnLevelType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReturnStandardTypeһ׼ + ///////////////////////////////////////////////////////////////////////// + ///ֽ׶η + #define THOST_FTDC_RSD_ByPeriod '1' + ///ijһ׼ + #define THOST_FTDC_RSD_ByStandard '2' + + typedef char TThostFtdcReturnStandardType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMortgageTypeTypeһѺ + ///////////////////////////////////////////////////////////////////////// + ///ʳ + #define THOST_FTDC_MT_Out '0' + /// + #define THOST_FTDC_MT_In '1' + + typedef char TThostFtdcMortgageTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestorSettlementParamIDTypeһͶ߽ + ///////////////////////////////////////////////////////////////////////// + ///Ѻ + #define THOST_FTDC_ISPI_MortgageRatio '4' + ///֤㷨 + #define THOST_FTDC_ISPI_MarginWay '5' + ///㵥ǷѺ + #define THOST_FTDC_ISPI_BillDeposit '9' + + typedef char TThostFtdcInvestorSettlementParamIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangeSettlementParamIDTypeһ + ///////////////////////////////////////////////////////////////////////// + ///Ѻ + #define THOST_FTDC_ESPI_MortgageRatio '1' + ///ʽ + #define THOST_FTDC_ESPI_OtherFundItem '2' + ///ʽ뽻 + #define THOST_FTDC_ESPI_OtherFundImport '3' + ///нͿý + #define THOST_FTDC_ESPI_CFFEXMinPrepa '6' + ///֣㷽ʽ + #define THOST_FTDC_ESPI_CZCESettlementType '7' + ///ȡʽ + #define THOST_FTDC_ESPI_ExchDelivFeeMode '9' + ///Ͷ߽ȡʽ + #define THOST_FTDC_ESPI_DelivFeeMode '0' + ///֣ϳֱֲ֤ȡʽ + #define THOST_FTDC_ESPI_CZCEComMarginType 'A' + ///֤ǷŻ + #define THOST_FTDC_ESPI_DceComMarginType 'B' + ///ֵȨ֤Żݱ + #define THOST_FTDC_ESPI_OptOutDisCountRate 'a' + ///ͱϵ + #define THOST_FTDC_ESPI_OptMiniGuarantee 'b' + + typedef char TThostFtdcExchangeSettlementParamIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSystemParamIDTypeһϵͳ + ///////////////////////////////////////////////////////////////////////// + ///ͶߴС + #define THOST_FTDC_SPI_InvestorIDMinLength '1' + ///ͶʺŴС + #define THOST_FTDC_SPI_AccountIDMinLength '2' + ///Ͷ߿Ĭϵ¼Ȩ + #define THOST_FTDC_SPI_UserRightLogon '3' + ///Ͷ߽׽㵥ɽܷʽ + #define THOST_FTDC_SPI_SettlementBillTrade '4' + ///ͳһ½ױ뷽ʽ + #define THOST_FTDC_SPI_TradingCode '5' + ///Ƿжϴδ˵ijͷʽ + #define THOST_FTDC_SPI_CheckFund '6' + ///ǷģȨ + #define THOST_FTDC_SPI_CommModelRight '7' + ///Ƿñ֤ģȨ + #define THOST_FTDC_SPI_MarginModelRight '9' + ///Ƿ淶ûܼ + #define THOST_FTDC_SPI_IsStandardActive '8' + ///ϴĽļ· + #define THOST_FTDC_SPI_UploadSettlementFile 'U' + ///ϱ֤ļ· + #define THOST_FTDC_SPI_DownloadCSRCFile 'D' + ///ɵĽ㵥ļ· + #define THOST_FTDC_SPI_SettlementBillFile 'S' + ///֤ļʶ + #define THOST_FTDC_SPI_CSRCOthersFile 'C' + ///ͶƬ· + #define THOST_FTDC_SPI_InvestorPhoto 'P' + ///ȫᾭ͹˾ϴļ· + #define THOST_FTDC_SPI_CSRCData 'R' + ///¼뷽ʽ + #define THOST_FTDC_SPI_InvestorPwdModel 'I' + ///Ͷнļ· + #define THOST_FTDC_SPI_CFFEXInvestorSettleFile 'F' + ///Ͷߴ뷽ʽ + #define THOST_FTDC_SPI_InvestorIDType 'a' + ///߻Ȩ + #define THOST_FTDC_SPI_FreezeMaxReMain 'r' + ///زʵʱϳ + #define THOST_FTDC_SPI_IsSync 'A' + ///Ȩ + #define THOST_FTDC_SPI_RelieveOpenLimit 'O' + ///Ƿ淶û + #define THOST_FTDC_SPI_IsStandardFreeze 'X' + ///֣Ƿ񿪷Ʒױ + #define THOST_FTDC_SPI_CZCENormalProductHedge 'B' + + typedef char TThostFtdcSystemParamIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeParamIDTypeһϵͳ + ///////////////////////////////////////////////////////////////////////// + ///ϵͳ㷨 + #define THOST_FTDC_TPID_EncryptionStandard 'E' + ///ϵͳ㷨 + #define THOST_FTDC_TPID_RiskMode 'R' + ///ϵͳ㷨Ƿȫ 0- 1- + #define THOST_FTDC_TPID_RiskModeGlobal 'G' + ///㷨 + #define THOST_FTDC_TPID_modeEncode 'P' + ///۸Сλ + #define THOST_FTDC_TPID_tickMode 'T' + ///ûỰ + #define THOST_FTDC_TPID_SingleUserSessionMaxNum 'S' + ///¼ʧ + #define THOST_FTDC_TPID_LoginFailMaxNum 'L' + ///Ƿǿ֤ + #define THOST_FTDC_TPID_IsAuthForce 'A' + ///ǷǮͬ + #define THOST_FTDC_TPID_IsPositionInOut 'I' + + typedef char TThostFtdcTradeParamIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettlementParamValueTypeһֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSettlementParamValueType[256]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCounterIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCounterIDType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestorGroupNameTypeһͶ߷ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInvestorGroupNameType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrandCodeTypeһƺ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBrandCodeType[257]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcWarehouseTypeһֿ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcWarehouseType[257]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProductDateTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcProductDateType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcGradeTypeһȼ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcGradeType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClassifyTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcClassifyType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPositionTypeһλ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPositionType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcYieldlyTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcYieldlyType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcWeightTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcWeightType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSubEntryFundNoTypeһʽˮ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcSubEntryFundNoType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFileIDTypeһļʶ + ///////////////////////////////////////////////////////////////////////// + ///ʽ + #define THOST_FTDC_FI_SettlementFund 'F' + ///ɽ + #define THOST_FTDC_FI_Trade 'T' + ///Ͷֲ߳ + #define THOST_FTDC_FI_InvestorPosition 'P' + ///Ͷ߷ʽ + #define THOST_FTDC_FI_SubEntryFund 'O' + ///ϳֲ + #define THOST_FTDC_FI_CZCECombinationPos 'C' + ///ϱ֤ + #define THOST_FTDC_FI_CSRCData 'R' + ///֣ƽ˽ + #define THOST_FTDC_FI_CZCEClose 'L' + ///֣ƽ˽ + #define THOST_FTDC_FI_CZCENoClose 'N' + ///ֲϸ + #define THOST_FTDC_FI_PositionDtl 'D' + ///Ȩִļ + #define THOST_FTDC_FI_OptionStrike 'S' + ///۱ȶļ + #define THOST_FTDC_FI_SettlementPriceComparison 'M' + ///dzֱֲ䶯ϸ + #define THOST_FTDC_FI_NonTradePosChange 'B' + + typedef char TThostFtdcFileIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFileNameTypeһļ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFileNameType[257]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFileTypeTypeһļϴ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_FUT_Settlement '0' + ///˶ + #define THOST_FTDC_FUT_Check '1' + + typedef char TThostFtdcFileTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFileFormatTypeһļʽ + ///////////////////////////////////////////////////////////////////////// + ///ıļ(.txt) + #define THOST_FTDC_FFT_Txt '0' + ///ѹļ(.zip) + #define THOST_FTDC_FFT_Zip '1' + ///DBFļ(.dbf) + #define THOST_FTDC_FFT_DBF '2' + + typedef char TThostFtdcFileFormatType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFileUploadStatusTypeһļ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ϴɹ + #define THOST_FTDC_FUS_SucceedUpload '1' + ///ϴʧ + #define THOST_FTDC_FUS_FailedUpload '2' + ///ɹ + #define THOST_FTDC_FUS_SucceedLoad '3' + ///벿ֳɹ + #define THOST_FTDC_FUS_PartSucceedLoad '4' + ///ʧ + #define THOST_FTDC_FUS_FailedLoad '5' + + typedef char TThostFtdcFileUploadStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTransferDirectionTypeһƲַ + ///////////////////////////////////////////////////////////////////////// + ///Ƴ + #define THOST_FTDC_TD_Out '0' + /// + #define THOST_FTDC_TD_In '1' + + typedef char TThostFtdcTransferDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUploadModeTypeһϴļ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUploadModeType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAccountIDTypeһͶʺ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAccountIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankFlagTypeһͳһʶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankFlagType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankAccountTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankAccountType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOpenNameTypeһ˻Ŀ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOpenNameType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOpenBankTypeһ˻Ŀ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOpenBankType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankNameType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPublishPathTypeһ· + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPublishPathType[257]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOperatorIDTypeһԱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOperatorIDType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMonthCountTypeһ· + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcMonthCountType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAdvanceMonthArrayTypeһ·ǰ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAdvanceMonthArrayType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDateExprTypeһڱʽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDateExprType[1025]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstrumentIDExprTypeһԼʽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInstrumentIDExprType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstrumentNameExprTypeһԼƱʽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInstrumentNameExprType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSpecialCreateRuleTypeһĴ + ///////////////////////////////////////////////////////////////////////// + ///ûⴴ + #define THOST_FTDC_SC_NoSpecialRule '0' + /// + #define THOST_FTDC_SC_NoSpringFestival '1' + + typedef char TThostFtdcSpecialCreateRuleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBasisPriceTypeTypeһƻ׼ + ///////////////////////////////////////////////////////////////////////// + ///һԼ + #define THOST_FTDC_IPT_LastSettlement '1' + ///һԼ̼ + #define THOST_FTDC_IPT_LaseClose '2' + + typedef char TThostFtdcBasisPriceTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProductLifePhaseTypeһƷ״̬ + ///////////////////////////////////////////////////////////////////////// + ///Ծ + #define THOST_FTDC_PLP_Active '1' + ///Ծ + #define THOST_FTDC_PLP_NonActive '2' + ///ע + #define THOST_FTDC_PLP_Canceled '3' + + typedef char TThostFtdcProductLifePhaseType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDeliveryModeTypeһʽ + ///////////////////////////////////////////////////////////////////////// + ///ֽ𽻸 + #define THOST_FTDC_DM_CashDeliv '1' + ///ʵサ + #define THOST_FTDC_DM_CommodityDeliv '2' + + typedef char TThostFtdcDeliveryModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLogLevelTypeһ־ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcLogLevelType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProcessNameTypeһ洢 + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcProcessNameType[257]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOperationMemoTypeһժҪ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOperationMemoType[1025]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundIOTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_FIOT_FundIO '1' + ///ת + #define THOST_FTDC_FIOT_Transfer '2' + ///ڻ + #define THOST_FTDC_FIOT_SwapCurrency '3' + + typedef char TThostFtdcFundIOTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundTypeTypeһʽ + ///////////////////////////////////////////////////////////////////////// + ///д + #define THOST_FTDC_FT_Deposite '1' + ///ʽ + #define THOST_FTDC_FT_ItemFund '2' + ///˾ + #define THOST_FTDC_FT_Company '3' + ///ʽת + #define THOST_FTDC_FT_InnerTransfer '4' + + typedef char TThostFtdcFundTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundDirectionTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_FD_In '1' + /// + #define THOST_FTDC_FD_Out '2' + + typedef char TThostFtdcFundDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundStatusTypeһʽ״̬ + ///////////////////////////////////////////////////////////////////////// + ///¼ + #define THOST_FTDC_FS_Record '1' + ///Ѹ + #define THOST_FTDC_FS_Check '2' + ///ѳ + #define THOST_FTDC_FS_Charge '3' + + typedef char TThostFtdcFundStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBillNoTypeһƱݺ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBillNoType[15]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBillNameTypeһƱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBillNameType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPublishStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_PS_None '1' + ///ڷ + #define THOST_FTDC_PS_Publishing '2' + ///ѷ + #define THOST_FTDC_PS_Published '3' + + typedef char TThostFtdcPublishStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcEnumValueIDTypeһöֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcEnumValueIDType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcEnumValueTypeTypeһöֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcEnumValueTypeType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcEnumValueLabelTypeһöֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcEnumValueLabelType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcEnumValueResultTypeһöֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcEnumValueResultType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSystemStatusTypeһϵͳ״̬ + ///////////////////////////////////////////////////////////////////////// + ///Ծ + #define THOST_FTDC_ES_NonActive '1' + /// + #define THOST_FTDC_ES_Startup '2' + ///׿ʼʼ + #define THOST_FTDC_ES_Initialize '3' + ///ɳʼ + #define THOST_FTDC_ES_Initialized '4' + ///пʼ + #define THOST_FTDC_ES_Close '5' + /// + #define THOST_FTDC_ES_Closed '6' + /// + #define THOST_FTDC_ES_Settlement '7' + + typedef char TThostFtdcSystemStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettlementStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ʼ + #define THOST_FTDC_STS_Initialize '0' + /// + #define THOST_FTDC_STS_Settlementing '1' + ///ѽ + #define THOST_FTDC_STS_Settlemented '2' + /// + #define THOST_FTDC_STS_Finished '3' + + typedef char TThostFtdcSettlementStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRangeIntTypeTypeһ޶ֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRangeIntTypeType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRangeIntFromTypeһ޶ֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRangeIntFromType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRangeIntToTypeһ޶ֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRangeIntToType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFunctionIDTypeһܴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFunctionIDType[25]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFunctionValueCodeTypeһܱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFunctionValueCodeType[257]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFunctionNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFunctionNameType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRoleIDTypeһɫ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRoleIDType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRoleNameTypeһɫ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRoleNameType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDescriptionTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDescriptionType[401]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCombineIDTypeһϱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCombineIDType[25]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCombineTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCombineTypeType[25]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestorTypeTypeһͶ + ///////////////////////////////////////////////////////////////////////// + ///Ȼ + #define THOST_FTDC_CT_Person '0' + /// + #define THOST_FTDC_CT_Company '1' + ///Ͷʻ + #define THOST_FTDC_CT_Fund '2' + ///ⷨ + #define THOST_FTDC_CT_SpecialOrgan '3' + ///ʹܻ + #define THOST_FTDC_CT_Asset '4' + + typedef char TThostFtdcInvestorTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrokerTypeTypeһ͹˾ + ///////////////////////////////////////////////////////////////////////// + ///׻Ա + #define THOST_FTDC_BT_Trade '0' + ///׽Ա + #define THOST_FTDC_BT_TradeSettle '1' + + typedef char TThostFtdcBrokerTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRiskLevelTypeһյȼ + ///////////////////////////////////////////////////////////////////////// + ///ͷտͻ + #define THOST_FTDC_FAS_Low '1' + ///ͨͻ + #define THOST_FTDC_FAS_Normal '2' + ///עͻ + #define THOST_FTDC_FAS_Focus '3' + ///տͻ + #define THOST_FTDC_FAS_Risk '4' + + typedef char TThostFtdcRiskLevelType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFeeAcceptStyleTypeһȡʽ + ///////////////////////////////////////////////////////////////////////// + ///ȡ + #define THOST_FTDC_FAS_ByTrade '1' + ///ȡ + #define THOST_FTDC_FAS_ByDeliv '2' + /// + #define THOST_FTDC_FAS_None '3' + ///ָȡ + #define THOST_FTDC_FAS_FixFee '4' + + typedef char TThostFtdcFeeAcceptStyleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPasswordTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_PWDT_Trade '1' + ///ʽ + #define THOST_FTDC_PWDT_Account '2' + + typedef char TThostFtdcPasswordTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAlgorithmTypeһӯ㷨 + ///////////////////////////////////////////////////////////////////////// + ///ӯ + #define THOST_FTDC_AG_All '1' + ///ӯƣ + #define THOST_FTDC_AG_OnlyLost '2' + ///ӯƣ + #define THOST_FTDC_AG_OnlyGain '3' + ///ӯ + #define THOST_FTDC_AG_None '4' + + typedef char TThostFtdcAlgorithmType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIncludeCloseProfitTypeһǷƽӯ + ///////////////////////////////////////////////////////////////////////// + ///ƽӯ + #define THOST_FTDC_ICP_Include '0' + ///ƽӯ + #define THOST_FTDC_ICP_NotInclude '2' + + typedef char TThostFtdcIncludeCloseProfitType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAllWithoutTradeTypeһǷܿ + ///////////////////////////////////////////////////////////////////////// + ///޲޳ɽܿ + #define THOST_FTDC_AWT_Enable '0' + ///ܿ + #define THOST_FTDC_AWT_Disable '2' + ///޲ֲܿ + #define THOST_FTDC_AWT_NoHoldEnable '3' + + typedef char TThostFtdcAllWithoutTradeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCommentTypeһӯ㷨˵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCommentType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVersionTypeһ汾 + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcVersionType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeCodeTypeһ״ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTradeCodeType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeDateTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTradeDateType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeTimeTypeһʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTradeTimeType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeSerialTypeһˮ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTradeSerialType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeSerialNoTypeһˮ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcTradeSerialNoType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureIDTypeһڻ˾ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFutureIDType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankIDTypeһд + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankIDType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankBrchIDTypeһзĴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankBrchIDType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankBranchIDTypeһĴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankBranchIDType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOperNoTypeһ׹Ա + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOperNoType[17]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDeviceIDTypeһ־ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDeviceIDType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRecordNumTypeһ¼ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRecordNumType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureAccountTypeһڻʽ˺ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFutureAccountType[22]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFuturePwdFlagTypeһʽ˶Ա־ + ///////////////////////////////////////////////////////////////////////// + ///˶ + #define THOST_FTDC_FPWD_UnCheck '0' + ///˶ + #define THOST_FTDC_FPWD_Check '1' + + typedef char TThostFtdcFuturePwdFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTransferTypeTypeһת + ///////////////////////////////////////////////////////////////////////// + ///תڻ + #define THOST_FTDC_TT_BankToFuture '0' + ///ڻת + #define THOST_FTDC_TT_FutureToBank '1' + + typedef char TThostFtdcTransferTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureAccPwdTypeһڻʽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFutureAccPwdType[17]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCurrencyCodeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCurrencyCodeType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRetCodeTypeһӦ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRetCodeType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRetInfoTypeһӦϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRetInfoType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeAmtTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTradeAmtType[20]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUseAmtTypeһп + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUseAmtType[20]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFetchAmtTypeһпȡ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFetchAmtType[20]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTransferValidFlagTypeһתЧ־ + ///////////////////////////////////////////////////////////////////////// + ///Чʧ + #define THOST_FTDC_TVF_Invalid '0' + ///Ч + #define THOST_FTDC_TVF_Valid '1' + /// + #define THOST_FTDC_TVF_Reverse '2' + + typedef char TThostFtdcTransferValidFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCertCodeTypeһ֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCertCodeType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReasonTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_RN_CD '0' + ///ʽ; + #define THOST_FTDC_RN_ZT '1' + /// + #define THOST_FTDC_RN_QT '2' + + typedef char TThostFtdcReasonType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundProjectIDTypeһʽĿ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFundProjectIDType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSexTypeһԱ + ///////////////////////////////////////////////////////////////////////// + ///δ֪ + #define THOST_FTDC_SEX_None '0' + /// + #define THOST_FTDC_SEX_Man '1' + ///Ů + #define THOST_FTDC_SEX_Woman '2' + + typedef char TThostFtdcSexType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProfessionTypeһְҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcProfessionType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcNationalTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcNationalType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProvinceTypeһʡ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcProvinceType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRegionTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRegionType[16]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCountryTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCountryType[16]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLicenseNOTypeһӪҵִ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcLicenseNOType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCompanyTypeTypeһҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCompanyTypeType[16]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBusinessScopeTypeһӪΧ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBusinessScopeType[1001]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCapitalCurrencyTypeһעʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCapitalCurrencyType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserTypeTypeһû + ///////////////////////////////////////////////////////////////////////// + ///Ͷ + #define THOST_FTDC_UT_Investor '0' + ///Ա + #define THOST_FTDC_UT_Operator '1' + ///Ա + #define THOST_FTDC_UT_SuperUser '2' + + typedef char TThostFtdcUserTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBranchIDTypeһӪҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBranchIDType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRateTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///֤ + #define THOST_FTDC_RATETYPE_MarginRate '2' + + typedef char TThostFtdcRateTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcNoteTypeTypeһ֪ͨ + ///////////////////////////////////////////////////////////////////////// + ///׽㵥 + #define THOST_FTDC_NOTETYPE_TradeSettleBill '1' + ///׽± + #define THOST_FTDC_NOTETYPE_TradeSettleMonth '2' + ///׷ӱ֤֪ͨ + #define THOST_FTDC_NOTETYPE_CallMarginNotes '3' + ///ǿƽ֪ͨ + #define THOST_FTDC_NOTETYPE_ForceCloseNotes '4' + ///ɽ֪ͨ + #define THOST_FTDC_NOTETYPE_TradeNotes '5' + ///֪ͨ + #define THOST_FTDC_NOTETYPE_DelivNotes '6' + + typedef char TThostFtdcNoteTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettlementStyleTypeһ㵥ʽ + ///////////////////////////////////////////////////////////////////////// + ///ն + #define THOST_FTDC_SBS_Day '1' + ///ʶԳ + #define THOST_FTDC_SBS_Volume '2' + + typedef char TThostFtdcSettlementStyleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrokerDNSTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBrokerDNSType[256]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSentenceTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSentenceType[501]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettlementBillTypeTypeһ㵥 + ///////////////////////////////////////////////////////////////////////// + ///ձ + #define THOST_FTDC_ST_Day '0' + ///± + #define THOST_FTDC_ST_Month '1' + + typedef char TThostFtdcSettlementBillTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserRightTypeTypeһͻȨ + ///////////////////////////////////////////////////////////////////////// + ///¼ + #define THOST_FTDC_URT_Logon '1' + ///ת + #define THOST_FTDC_URT_Transfer '2' + ///ʼĽ㵥 + #define THOST_FTDC_URT_EMail '3' + ///㵥 + #define THOST_FTDC_URT_Fax '4' + /// + #define THOST_FTDC_URT_ConditionOrder '5' + + typedef char TThostFtdcUserRightTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMarginPriceTypeTypeһ֤۸ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_MPT_PreSettlementPrice '1' + ///¼ + #define THOST_FTDC_MPT_SettlementPrice '2' + ///ɽ + #define THOST_FTDC_MPT_AveragePrice '3' + ///ּ + #define THOST_FTDC_MPT_OpenPrice '4' + + typedef char TThostFtdcMarginPriceTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBillGenStatusTypeһ㵥״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_BGS_None '0' + /// + #define THOST_FTDC_BGS_NoGenerated '1' + /// + #define THOST_FTDC_BGS_Generated '2' + + typedef char TThostFtdcBillGenStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAlgoTypeTypeһ㷨 + ///////////////////////////////////////////////////////////////////////// + ///ֲִ㷨 + #define THOST_FTDC_AT_HandlePositionAlgo '1' + ///Ѱұ֤㷨 + #define THOST_FTDC_AT_FindMarginRateAlgo '2' + + typedef char TThostFtdcAlgoTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcHandlePositionAlgoIDTypeһֲִ㷨 + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_HPA_Base '1' + ///Ʒ + #define THOST_FTDC_HPA_DCE '2' + ///֣Ʒ + #define THOST_FTDC_HPA_CZCE '3' + + typedef char TThostFtdcHandlePositionAlgoIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFindMarginRateAlgoIDTypeһѰұ֤㷨 + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_FMRA_Base '1' + ///Ʒ + #define THOST_FTDC_FMRA_DCE '2' + ///֣Ʒ + #define THOST_FTDC_FMRA_CZCE '3' + + typedef char TThostFtdcFindMarginRateAlgoIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcHandleTradingAccountAlgoIDTypeһʽ㷨 + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_HTAA_Base '1' + ///Ʒ + #define THOST_FTDC_HTAA_DCE '2' + ///֣Ʒ + #define THOST_FTDC_HTAA_CZCE '3' + + typedef char TThostFtdcHandleTradingAccountAlgoIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPersonTypeTypeһϵ + ///////////////////////////////////////////////////////////////////////// + ///ָµ + #define THOST_FTDC_PST_Order '1' + ///Ȩ + #define THOST_FTDC_PST_Open '2' + ///ʽ + #define THOST_FTDC_PST_Fund '3' + ///㵥ȷ + #define THOST_FTDC_PST_Settlement '4' + /// + #define THOST_FTDC_PST_Company '5' + ///˴ + #define THOST_FTDC_PST_Corporation '6' + ///Ͷϵ + #define THOST_FTDC_PST_LinkMan '7' + ///ֻʲ + #define THOST_FTDC_PST_Ledger '8' + ///У + #define THOST_FTDC_PST_Trustee '9' + ///Уܻ˴ + #define THOST_FTDC_PST_TrusteeCorporation 'A' + ///УܻȨ + #define THOST_FTDC_PST_TrusteeOpen 'B' + ///Уܻϵ + #define THOST_FTDC_PST_TrusteeContact 'C' + ///Ȼ˲ο֤ + #define THOST_FTDC_PST_ForeignerRefer 'D' + ///˴ο֤ + #define THOST_FTDC_PST_CorporationRefer 'E' + + typedef char TThostFtdcPersonTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcQueryInvestorRangeTypeһѯΧ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_QIR_All '1' + ///ѯ + #define THOST_FTDC_QIR_Group '2' + ///һͶ + #define THOST_FTDC_QIR_Single '3' + + typedef char TThostFtdcQueryInvestorRangeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestorRiskStatusTypeһͶ߷״̬ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_IRS_Normal '1' + /// + #define THOST_FTDC_IRS_Warn '2' + ///׷ + #define THOST_FTDC_IRS_Call '3' + ///ǿƽ + #define THOST_FTDC_IRS_Force '4' + ///쳣 + #define THOST_FTDC_IRS_Exception '5' + + typedef char TThostFtdcInvestorRiskStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLegIDTypeһȱ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcLegIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLegMultipleTypeһȳ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcLegMultipleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcImplyLevelTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcImplyLevelType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClearAccountTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcClearAccountType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrganNOTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOrganNOType[6]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClearbarchIDTypeһ˻к + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcClearbarchIDType[6]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserEventTypeTypeһû¼ + ///////////////////////////////////////////////////////////////////////// + ///¼ + #define THOST_FTDC_UET_Login '1' + ///dz + #define THOST_FTDC_UET_Logout '2' + ///׳ɹ + #define THOST_FTDC_UET_Trading '3' + ///ʧ + #define THOST_FTDC_UET_TradingError '4' + ///޸ + #define THOST_FTDC_UET_UpdatePassword '5' + ///ͻ֤ + #define THOST_FTDC_UET_Authenticate '6' + /// + #define THOST_FTDC_UET_Other '9' + + typedef char TThostFtdcUserEventTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserEventInfoTypeһû¼Ϣ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUserEventInfoType[1025]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCloseStyleTypeһƽַʽ + ///////////////////////////////////////////////////////////////////////// + ///ȿƽ + #define THOST_FTDC_ICS_Close '0' + ///ƽƽ + #define THOST_FTDC_ICS_CloseToday '1' + + typedef char TThostFtdcCloseStyleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStatModeTypeһͳƷʽ + ///////////////////////////////////////////////////////////////////////// + ///---- + #define THOST_FTDC_SM_Non '0' + ///Լͳ + #define THOST_FTDC_SM_Instrument '1' + ///Ʒͳ + #define THOST_FTDC_SM_Product '2' + ///Ͷͳ + #define THOST_FTDC_SM_Investor '3' + + typedef char TThostFtdcStatModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcParkedOrderStatusTypeһԤ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_PAOS_NotSend '1' + ///ѷ + #define THOST_FTDC_PAOS_Send '2' + ///ɾ + #define THOST_FTDC_PAOS_Deleted '3' + + typedef char TThostFtdcParkedOrderStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcParkedOrderIDTypeһԤ񱨵 + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcParkedOrderIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcParkedOrderActionIDTypeһԤ񳷵 + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcParkedOrderActionIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVirDealStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ڴ + #define THOST_FTDC_VDS_Dealing '1' + ///ɹ + #define THOST_FTDC_VDS_DeaclSucceed '2' + + typedef char TThostFtdcVirDealStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrgSystemIDTypeһԭϵͳ + ///////////////////////////////////////////////////////////////////////// + ///ۺϽƽ̨ + #define THOST_FTDC_ORGS_Standard '0' + ///ʢϵͳ + #define THOST_FTDC_ORGS_ESunny '1' + ///˴V6ϵͳ + #define THOST_FTDC_ORGS_KingStarV6 '2' + + typedef char TThostFtdcOrgSystemIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVirTradeStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_VTS_NaturalDeal '0' + ///ɹ + #define THOST_FTDC_VTS_SucceedEnd '1' + ///ʧܽ + #define THOST_FTDC_VTS_FailedEND '2' + ///쳣 + #define THOST_FTDC_VTS_Exception '3' + ///˹쳣 + #define THOST_FTDC_VTS_ManualDeal '4' + ///ͨѶ쳣 ˹ + #define THOST_FTDC_VTS_MesException '5' + ///ϵͳ˹ + #define THOST_FTDC_VTS_SysException '6' + + typedef char TThostFtdcVirTradeStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVirBankAccTypeTypeһʻ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_VBAT_BankBook '1' + /// + #define THOST_FTDC_VBAT_BankCard '2' + ///ÿ + #define THOST_FTDC_VBAT_CreditCard '3' + + typedef char TThostFtdcVirBankAccTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVirementStatusTypeһʻ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_VMS_Natural '0' + /// + #define THOST_FTDC_VMS_Canceled '9' + + typedef char TThostFtdcVirementStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVirementAvailAbilityTypeһЧ־ + ///////////////////////////////////////////////////////////////////////// + ///δȷ + #define THOST_FTDC_VAA_NoAvailAbility '0' + ///Ч + #define THOST_FTDC_VAA_AvailAbility '1' + /// + #define THOST_FTDC_VAA_Repeal '2' + + typedef char TThostFtdcVirementAvailAbilityType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcVirementTradeCodeTypeһ״ + ///////////////////////////////////////////////////////////////////////// + ///зʽתڻ + #define THOST_FTDC_VTC_BankBankToFuture '102001' + ///зڻʽת + #define THOST_FTDC_VTC_BankFutureToBank '102002' + ///ڻʽתڻ + #define THOST_FTDC_VTC_FutureBankToFuture '202001' + ///ڻڻʽת + #define THOST_FTDC_VTC_FutureFutureToBank '202002' + + typedef char TThostFtdcVirementTradeCodeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPhotoTypeNameTypeһӰ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPhotoTypeNameType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPhotoTypeIDTypeһӰʹ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPhotoTypeIDType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPhotoNameTypeһӰ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPhotoNameType[161]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTopicIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcTopicIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReportTypeIDTypeһױͱʶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcReportTypeIDType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCharacterIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCharacterIDType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLParamIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLParamIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLInvestorTypeTypeһͶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLInvestorTypeType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLIdCardTypeTypeһ֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLIdCardTypeType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLTradeDirectTypeһʽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLTradeDirectType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLTradeModelTypeһʽʽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLTradeModelType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLParamIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLParamIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLOpParamValueTypeһҵֵ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcAMLOpParamValueType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLCustomerCardTypeTypeһͻ֤/֤ļ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLCustomerCardTypeType[81]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLInstitutionNameTypeһڻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLInstitutionNameType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLDistrictIDTypeһڻڵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLDistrictIDType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLRelationShipTypeһڻ׵Ĺϵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLRelationShipType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLInstitutionTypeTypeһڻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLInstitutionTypeType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLInstitutionIDTypeһڻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLInstitutionIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLAccountTypeTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLAccountTypeType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLTradingTypeTypeһ׷ʽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLTradingTypeType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLTransactClassTypeһ֧׷ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLTransactClassType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLCapitalIOTypeһʽոʶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLCapitalIOType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLSiteTypeһ׵ص + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLSiteType[10]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLCapitalPurposeTypeһʽ; + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLCapitalPurposeType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLReportTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLReportTypeType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLSerialNoTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLSerialNoType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLStatusType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLGenStatusTypeһAmlɷʽ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_GEN_Program '0' + ///˹ + #define THOST_FTDC_GEN_HandWork '1' + + typedef char TThostFtdcAMLGenStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLSeqCodeTypeһҵʶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLSeqCodeType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLFileNameTypeһAMLļ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLFileNameType[257]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLMoneyTypeһϴǮʽ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcAMLMoneyType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLFileAmountTypeһϴǮʽ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcAMLFileAmountType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCFMMCKeyTypeһԿ(֤) + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCFMMCKeyType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCFMMCTokenTypeһ(֤) + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCFMMCTokenType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCFMMCKeyKindTypeһ̬Կ(֤) + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CFMMCKK_REQUEST 'R' + ///CFMMCԶ + #define THOST_FTDC_CFMMCKK_AUTO 'A' + ///CFMMCֶ + #define THOST_FTDC_CFMMCKK_MANUAL 'M' + + typedef char TThostFtdcCFMMCKeyKindType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLReportNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAMLReportNameType[81]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDBFComdTypeTypeһDBF + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDBFComdTypeType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDBFComTimeTypeһDBFʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDBFComTimeType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDBFComNoTypeһDBFˮ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDBFComNoType[17]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDBFFdNameTypeһDBFֶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDBFFdNameType[256]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDBFFdContentTypeһDBFֶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDBFFdContentType[256]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIndividualNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcIndividualNameType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCurrencyIDTypeһִ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCurrencyIDType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCustNumberTypeһͻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCustNumberType[36]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrganCodeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOrganCodeType[36]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrganNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOrganNameType[71]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSuperOrganCodeTypeһϼ,ڻ˾ܲ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSuperOrganCodeType[12]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSubBranchIDTypeһ֧ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSubBranchIDType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSubBranchNameTypeһ֧ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSubBranchNameType[71]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBranchNetCodeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBranchNetCodeType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBranchNetNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBranchNetNameType[71]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrganFlagTypeһʶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOrganFlagType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankCodingForFutureTypeһжڻ˾ı + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankCodingForFutureType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankReturnCodeTypeһжԷĶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankReturnCodeType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPlateReturnCodeTypeһתƽ̨ԷĶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPlateReturnCodeType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankSubBranchIDTypeһз֧ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankSubBranchIDType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureBranchIDTypeһڻ֧ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFutureBranchIDType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReturnCodeTypeһش + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcReturnCodeType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOperatorCodeTypeһԱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOperatorCodeType[17]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClearDepIDTypeһʻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcClearDepIDType[6]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClearBrchIDTypeһʻк + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcClearBrchIDType[6]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClearNameTypeһʻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcClearNameType[71]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankAccountNameTypeһʻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankAccountNameType[71]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvDepIDTypeһͶ˺Ż + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInvDepIDType[6]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvBrchIDTypeһͶк + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInvBrchIDType[6]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMessageFormatVersionTypeһϢʽ汾 + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcMessageFormatVersionType[36]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDigestTypeһժҪ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDigestType[36]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAuthenticDataTypeһ֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAuthenticDataType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPasswordKeyTypeһԿ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPasswordKeyType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureAccountNameTypeһڻʻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFutureAccountNameType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMobilePhoneTypeһֻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcMobilePhoneType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureMainKeyTypeһڻ˾Կ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFutureMainKeyType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureWorkKeyTypeһڻ˾Կ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFutureWorkKeyType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureTransKeyTypeһڻ˾Կ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFutureTransKeyType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankMainKeyTypeһԿ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankMainKeyType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankWorkKeyTypeһйԿ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankWorkKeyType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankTransKeyTypeһдԿ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankTransKeyType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankServerDescriptionTypeһзϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankServerDescriptionType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAddInfoTypeһϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAddInfoType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDescrInfoForReturnCodeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDescrInfoForReturnCodeType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCountryCodeTypeһҴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCountryCodeType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSerialTypeһˮ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcSerialType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPlateSerialTypeһƽ̨ˮ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcPlateSerialType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankSerialTypeһˮ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankSerialType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCorrectSerialTypeһˮ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcCorrectSerialType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureSerialTypeһڻ˾ˮ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcFutureSerialType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcApplicationIDTypeһӦñʶ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcApplicationIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankProxyIDTypeһдʶ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcBankProxyIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBTCoreIDTypeһתʺϵͳʶ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcFBTCoreIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcServerPortTypeһ˿ں + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcServerPortType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRepealedTimesTypeһѾ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcRepealedTimesType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRepealTimeIntervalTypeһʱ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcRepealTimeIntervalType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTotalTimesTypeһÿۼתʴ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcTotalTimesType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBTRequestIDTypeһID + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcFBTRequestIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTIDTypeһID + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcTIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeAmountTypeһ׽Ԫ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcTradeAmountType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCustFeeTypeһӦտͻãԪ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcCustFeeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureFeeTypeһӦڻ˾ãԪ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcFutureFeeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSingleMaxAmtTypeһ޶ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcSingleMaxAmtType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSingleMinAmtTypeһ޶ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcSingleMinAmtType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTotalAmtTypeһÿۼתʶ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcTotalAmtType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCertificationTypeTypeһ֤ + ///////////////////////////////////////////////////////////////////////// + ///֤ + #define THOST_FTDC_CFT_IDCard '0' + /// + #define THOST_FTDC_CFT_Passport '1' + ///֤ + #define THOST_FTDC_CFT_OfficerIDCard '2' + ///ʿ֤ + #define THOST_FTDC_CFT_SoldierIDCard '3' + ///֤ + #define THOST_FTDC_CFT_HomeComingCard '4' + ///ڲ + #define THOST_FTDC_CFT_HouseholdRegister '5' + ///Ӫҵִպ + #define THOST_FTDC_CFT_LicenseNo '6' + ///֤֯ + #define THOST_FTDC_CFT_InstitutionCodeCard '7' + ///ʱӪҵִպ + #define THOST_FTDC_CFT_TempLicenseNo '8' + ///ҵǼ֤ + #define THOST_FTDC_CFT_NoEnterpriseLicenseNo '9' + ///֤ + #define THOST_FTDC_CFT_OtherCard 'x' + ///ܲ + #define THOST_FTDC_CFT_SuperDepAgree 'a' + + typedef char TThostFtdcCertificationTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFileBusinessCodeTypeһļҵ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_FBC_Others '0' + ///ת˽ϸ + #define THOST_FTDC_FBC_TransferDetails '1' + ///ͻ˻״̬ + #define THOST_FTDC_FBC_CustAccStatus '2' + ///˻ཻϸ + #define THOST_FTDC_FBC_AccountTradeDetails '3' + ///ڻ˻Ϣϸ + #define THOST_FTDC_FBC_FutureAccountChangeInfoDetails '4' + ///ͻʽ̨ϸ + #define THOST_FTDC_FBC_CustMoneyDetail '5' + ///ͻϢϸ + #define THOST_FTDC_FBC_CustCancelAccountInfo '6' + ///ͻʽ˽ + #define THOST_FTDC_FBC_CustMoneyResult '7' + ///쳣ļ + #define THOST_FTDC_FBC_OthersExceptionResult '8' + ///ͻϢϸ + #define THOST_FTDC_FBC_CustInterestNetMoneyDetails '9' + ///ͻʽϸ + #define THOST_FTDC_FBC_CustMoneySendAndReceiveDetails 'a' + ///˴ʽջ + #define THOST_FTDC_FBC_CorporationMoneyTotal 'b' + ///ʽջ + #define THOST_FTDC_FBC_MainbodyMoneyTotal 'c' + ///ܷƽ + #define THOST_FTDC_FBC_MainPartMonitorData 'd' + ///б + #define THOST_FTDC_FBC_PreparationMoney 'e' + ///Эʽ + #define THOST_FTDC_FBC_BankMoneyMonitorData 'f' + + typedef char TThostFtdcFileBusinessCodeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCashExchangeCodeTypeһ㳮־ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CEC_Exchange '1' + /// + #define THOST_FTDC_CEC_Cash '2' + + typedef char TThostFtdcCashExchangeCodeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcYesNoIndicatorTypeһǻʶ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_YNI_Yes '0' + /// + #define THOST_FTDC_YNI_No '1' + + typedef char TThostFtdcYesNoIndicatorType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBanlanceTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///ǰ + #define THOST_FTDC_BLT_CurrentMoney '0' + /// + #define THOST_FTDC_BLT_UsableMoney '1' + ///ȡ + #define THOST_FTDC_BLT_FetchableMoney '2' + /// + #define THOST_FTDC_BLT_FreezeMoney '3' + + typedef char TThostFtdcBanlanceTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcGenderTypeһԱ + ///////////////////////////////////////////////////////////////////////// + ///δ֪״̬ + #define THOST_FTDC_GD_Unknown '0' + /// + #define THOST_FTDC_GD_Male '1' + ///Ů + #define THOST_FTDC_GD_Female '2' + + typedef char TThostFtdcGenderType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFeePayFlagTypeһ֧־ + ///////////////////////////////////////////////////////////////////////// + ///淽֧ + #define THOST_FTDC_FPF_BEN '0' + ///ɷͷ֧ + #define THOST_FTDC_FPF_OUR '1' + ///ɷͷ֧ķã淽֧ܵķ + #define THOST_FTDC_FPF_SHA '2' + + typedef char TThostFtdcFeePayFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPassWordKeyTypeTypeһԿ + ///////////////////////////////////////////////////////////////////////// + ///Կ + #define THOST_FTDC_PWKT_ExchangeKey '0' + ///Կ + #define THOST_FTDC_PWKT_PassWordKey '1' + ///MACԿ + #define THOST_FTDC_PWKT_MACKey '2' + ///Կ + #define THOST_FTDC_PWKT_MessageKey '3' + + typedef char TThostFtdcPassWordKeyTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBTPassWordTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///ѯ + #define THOST_FTDC_PWT_Query '0' + ///ȡ + #define THOST_FTDC_PWT_Fetch '1' + ///ת + #define THOST_FTDC_PWT_Transfer '2' + /// + #define THOST_FTDC_PWT_Trade '3' + + typedef char TThostFtdcFBTPassWordTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBTEncryModeTypeһܷʽ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_EM_NoEncry '0' + ///DES + #define THOST_FTDC_EM_DES '1' + ///3DES + #define THOST_FTDC_EM_3DES '2' + + typedef char TThostFtdcFBTEncryModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankRepealFlagTypeһг־ + ///////////////////////////////////////////////////////////////////////// + ///Զ + #define THOST_FTDC_BRF_BankNotNeedRepeal '0' + ///дԶ + #define THOST_FTDC_BRF_BankWaitingRepeal '1' + ///Զ + #define THOST_FTDC_BRF_BankBeenRepealed '2' + + typedef char TThostFtdcBankRepealFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrokerRepealFlagTypeһ̳־ + ///////////////////////////////////////////////////////////////////////// + ///Զ + #define THOST_FTDC_BRORF_BrokerNotNeedRepeal '0' + ///̴Զ + #define THOST_FTDC_BRORF_BrokerWaitingRepeal '1' + ///Զ + #define THOST_FTDC_BRORF_BrokerBeenRepealed '2' + + typedef char TThostFtdcBrokerRepealFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstitutionTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_TS_Bank '0' + /// + #define THOST_FTDC_TS_Future '1' + ///ȯ + #define THOST_FTDC_TS_Store '2' + + typedef char TThostFtdcInstitutionTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLastFragmentTypeһƬ־ + ///////////////////////////////////////////////////////////////////////// + ///Ƭ + #define THOST_FTDC_LF_Yes '0' + ///Ƭ + #define THOST_FTDC_LF_No '1' + + typedef char TThostFtdcLastFragmentType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankAccStatusTypeһ˻״̬ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_BAS_Normal '0' + /// + #define THOST_FTDC_BAS_Freeze '1' + ///ʧ + #define THOST_FTDC_BAS_ReportLoss '2' + + typedef char TThostFtdcBankAccStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMoneyAccountStatusTypeһʽ˻״̬ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_MAS_Normal '0' + /// + #define THOST_FTDC_MAS_Cancel '1' + + typedef char TThostFtdcMoneyAccountStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcManageStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ָ + #define THOST_FTDC_MSS_Point '0' + ///Ԥָ + #define THOST_FTDC_MSS_PrePoint '1' + ///ָ + #define THOST_FTDC_MSS_CancelPoint '2' + + typedef char TThostFtdcManageStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSystemTypeTypeһӦϵͳ + ///////////////////////////////////////////////////////////////////////// + ///ת + #define THOST_FTDC_SYT_FutureBankTransfer '0' + ///֤ת + #define THOST_FTDC_SYT_StockBankTransfer '1' + /// + #define THOST_FTDC_SYT_TheThirdPartStore '2' + + typedef char TThostFtdcSystemTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTxnEndFlagTypeһתʻת־ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_TEF_NormalProcessing '0' + ///ɹ + #define THOST_FTDC_TEF_Success '1' + ///ʧܽ + #define THOST_FTDC_TEF_Failed '2' + ///쳣 + #define THOST_FTDC_TEF_Abnormal '3' + ///˹쳣 + #define THOST_FTDC_TEF_ManualProcessedForException '4' + ///ͨѶ쳣 ˹ + #define THOST_FTDC_TEF_CommuFailedNeedManualProcess '5' + ///ϵͳ˹ + #define THOST_FTDC_TEF_SysErrorNeedManualProcess '6' + + typedef char TThostFtdcTxnEndFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProcessStatusTypeһתʷ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_PSS_NotProcess '0' + ///ʼ + #define THOST_FTDC_PSS_StartProcess '1' + /// + #define THOST_FTDC_PSS_Finished '2' + + typedef char TThostFtdcProcessStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCustTypeTypeһͻ + ///////////////////////////////////////////////////////////////////////// + ///Ȼ + #define THOST_FTDC_CUSTT_Person '0' + /// + #define THOST_FTDC_CUSTT_Institution '1' + + typedef char TThostFtdcCustTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBTTransferDirectionTypeһתʷ + ///////////////////////////////////////////////////////////////////////// + ///תڻ + #define THOST_FTDC_FBTTD_FromBankToFuture '1' + ///ڻת + #define THOST_FTDC_FBTTD_FromFutureToBank '2' + + typedef char TThostFtdcFBTTransferDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOpenOrDestroyTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_OOD_Open '1' + /// + #define THOST_FTDC_OOD_Destroy '0' + + typedef char TThostFtdcOpenOrDestroyType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAvailabilityFlagTypeһЧ־ + ///////////////////////////////////////////////////////////////////////// + ///δȷ + #define THOST_FTDC_AVAF_Invalid '0' + ///Ч + #define THOST_FTDC_AVAF_Valid '1' + /// + #define THOST_FTDC_AVAF_Repeal '2' + + typedef char TThostFtdcAvailabilityFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrganTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///д + #define THOST_FTDC_OT_Bank '1' + ///ǰ + #define THOST_FTDC_OT_Future '2' + ///תƽ̨ + #define THOST_FTDC_OT_PlateForm '9' + + typedef char TThostFtdcOrganTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrganLevelTypeһ + ///////////////////////////////////////////////////////////////////////// + ///лܲ + #define THOST_FTDC_OL_HeadQuarters '1' + ///зĻڻ˾Ӫҵ + #define THOST_FTDC_OL_Branch '2' + + typedef char TThostFtdcOrganLevelType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProtocalIDTypeһЭ + ///////////////////////////////////////////////////////////////////////// + ///Э + #define THOST_FTDC_PID_FutureProtocal '0' + ///Э + #define THOST_FTDC_PID_ICBCProtocal '1' + ///ũЭ + #define THOST_FTDC_PID_ABCProtocal '2' + ///йЭ + #define THOST_FTDC_PID_CBCProtocal '3' + ///Э + #define THOST_FTDC_PID_CCBProtocal '4' + ///Э + #define THOST_FTDC_PID_BOCOMProtocal '5' + ///תƽ̨Э + #define THOST_FTDC_PID_FBTPlateFormProtocal 'X' + + typedef char TThostFtdcProtocalIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcConnectModeTypeһ׽ӷʽ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CM_ShortConnect '0' + /// + #define THOST_FTDC_CM_LongConnect '1' + + typedef char TThostFtdcConnectModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSyncModeTypeһ׽ͨŷʽ + ///////////////////////////////////////////////////////////////////////// + ///첽 + #define THOST_FTDC_SRM_ASync '0' + ///ͬ + #define THOST_FTDC_SRM_Sync '1' + + typedef char TThostFtdcSyncModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankAccTypeTypeһʺ + ///////////////////////////////////////////////////////////////////////// + ///д + #define THOST_FTDC_BAT_BankBook '1' + /// + #define THOST_FTDC_BAT_SavingCard '2' + ///ÿ + #define THOST_FTDC_BAT_CreditCard '3' + + typedef char TThostFtdcBankAccTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureAccTypeTypeһڻ˾ʺ + ///////////////////////////////////////////////////////////////////////// + ///д + #define THOST_FTDC_FAT_BankBook '1' + /// + #define THOST_FTDC_FAT_SavingCard '2' + ///ÿ + #define THOST_FTDC_FAT_CreditCard '3' + + typedef char TThostFtdcFutureAccTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOrganStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_OS_Ready '0' + ///ǩ + #define THOST_FTDC_OS_CheckIn '1' + ///ǩ + #define THOST_FTDC_OS_CheckOut '2' + ///ļ + #define THOST_FTDC_OS_CheckFileArrived '3' + /// + #define THOST_FTDC_OS_CheckDetail '4' + /// + #define THOST_FTDC_OS_DayEndClean '5' + ///ע + #define THOST_FTDC_OS_Invalid '9' + + typedef char TThostFtdcOrganStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCCBFeeModeTypeһշģʽ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CCBFM_ByAmount '1' + ///¿ + #define THOST_FTDC_CCBFM_ByMonth '2' + + typedef char TThostFtdcCCBFeeModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCommApiTypeTypeһͨѶAPI + ///////////////////////////////////////////////////////////////////////// + ///ͻ + #define THOST_FTDC_CAPIT_Client '1' + /// + #define THOST_FTDC_CAPIT_Server '2' + ///ϵͳUserApi + #define THOST_FTDC_CAPIT_UserApi '3' + + typedef char TThostFtdcCommApiTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcServiceIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcServiceIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcServiceLineNoTypeһ· + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcServiceLineNoType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcServiceNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcServiceNameType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLinkStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///Ѿ + #define THOST_FTDC_LS_Connected '1' + ///û + #define THOST_FTDC_LS_Disconnected '2' + + typedef char TThostFtdcLinkStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCommApiPointerTypeһͨѶAPIָ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcCommApiPointerType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPwdFlagTypeһ˶Ա־ + ///////////////////////////////////////////////////////////////////////// + ///˶ + #define THOST_FTDC_BPWDF_NoCheck '0' + ///ĺ˶ + #define THOST_FTDC_BPWDF_BlankCheck '1' + ///ĺ˶ + #define THOST_FTDC_BPWDF_EncryptCheck '2' + + typedef char TThostFtdcPwdFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSecuAccTypeTypeһڻʺ + ///////////////////////////////////////////////////////////////////////// + ///ʽʺ + #define THOST_FTDC_SAT_AccountID '1' + ///ʽ𿨺 + #define THOST_FTDC_SAT_CardID '2' + ///Ϻɶʺ + #define THOST_FTDC_SAT_SHStockholderID '3' + ///ڹɶʺ + #define THOST_FTDC_SAT_SZStockholderID '4' + + typedef char TThostFtdcSecuAccTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTransferStatusTypeһת˽״̬ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_TRFS_Normal '0' + /// + #define THOST_FTDC_TRFS_Repealed '1' + + typedef char TThostFtdcTransferStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSponsorTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_SPTYPE_Broker '0' + /// + #define THOST_FTDC_SPTYPE_Bank '1' + + typedef char TThostFtdcSponsorTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReqRspTypeTypeһӦ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_REQRSP_Request '0' + ///Ӧ + #define THOST_FTDC_REQRSP_Response '1' + + typedef char TThostFtdcReqRspTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBTUserEventTypeTypeһתû¼ + ///////////////////////////////////////////////////////////////////////// + ///ǩ + #define THOST_FTDC_FBTUET_SignIn '0' + ///תڻ + #define THOST_FTDC_FBTUET_FromBankToFuture '1' + ///ڻת + #define THOST_FTDC_FBTUET_FromFutureToBank '2' + /// + #define THOST_FTDC_FBTUET_OpenAccount '3' + /// + #define THOST_FTDC_FBTUET_CancelAccount '4' + ///˻ + #define THOST_FTDC_FBTUET_ChangeAccount '5' + ///תڻ + #define THOST_FTDC_FBTUET_RepealFromBankToFuture '6' + ///ڻת + #define THOST_FTDC_FBTUET_RepealFromFutureToBank '7' + ///ѯ˻ + #define THOST_FTDC_FBTUET_QueryBankAccount '8' + ///ѯڻ˻ + #define THOST_FTDC_FBTUET_QueryFutureAccount '9' + ///ǩ + #define THOST_FTDC_FBTUET_SignOut 'A' + ///Կͬ + #define THOST_FTDC_FBTUET_SyncKey 'B' + /// + #define THOST_FTDC_FBTUET_Other 'Z' + + typedef char TThostFtdcFBTUserEventTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankIDByBankTypeһԼı + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankIDByBankType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankOperNoTypeһвԱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankOperNoType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankCustNoTypeһпͻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankCustNoType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDBOPSeqNoTypeһк + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcDBOPSeqNoType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTableNameTypeһFBT + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTableNameType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPKNameTypeһFBT + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPKNameType[201]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPKValueTypeһFBTֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPKValueType[501]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDBOperationTypeһ¼ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_DBOP_Insert '0' + /// + #define THOST_FTDC_DBOP_Update '1' + ///ɾ + #define THOST_FTDC_DBOP_Delete '2' + + typedef char TThostFtdcDBOperationType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSyncFlagTypeһͬ + ///////////////////////////////////////////////////////////////////////// + ///ͬ + #define THOST_FTDC_SYNF_Yes '0' + ///δͬ + #define THOST_FTDC_SYNF_No '1' + + typedef char TThostFtdcSyncFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTargetIDTypeһͬĿ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTargetIDType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSyncTypeTypeһͬ + ///////////////////////////////////////////////////////////////////////// + ///һͬ + #define THOST_FTDC_SYNT_OneOffSync '0' + ///ʱͬ + #define THOST_FTDC_SYNT_TimerSync '1' + ///ʱȫͬ + #define THOST_FTDC_SYNT_TimerFullSync '2' + + typedef char TThostFtdcSyncTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBETimeTypeһֻʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBETimeType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEBankNoTypeһк + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEBankNoType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBECertNoTypeһƾ֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBECertNoType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExDirectionTypeһ㷽 + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_FBEDIR_Settlement '0' + ///ۻ + #define THOST_FTDC_FBEDIR_Sale '1' + + typedef char TThostFtdcExDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEBankAccountTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEBankAccountType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEBankAccountNameTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEBankAccountNameType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEAmtTypeһֻ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcFBEAmtType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEBusinessTypeTypeһҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEBusinessTypeType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEPostScriptTypeһ㸽 + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEPostScriptType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBERemarkTypeһ㱸ע + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBERemarkType[71]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExRateTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcExRateType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEResultFlagTypeһɹ־ + ///////////////////////////////////////////////////////////////////////// + ///ɹ + #define THOST_FTDC_FBERES_Success '0' + ///˻ + #define THOST_FTDC_FBERES_InsufficientBalance '1' + ///׽δ֪ + #define THOST_FTDC_FBERES_UnknownTrading '8' + ///ʧ + #define THOST_FTDC_FBERES_Fail 'x' + + typedef char TThostFtdcFBEResultFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBERtnMsgTypeһ㷵Ϣ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBERtnMsgType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEExtendMsgTypeһչϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEExtendMsgType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEBusinessSerialTypeһˮ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEBusinessSerialType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBESystemSerialTypeһˮ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBESystemSerialType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBETotalExCntTypeһ㽻ܱ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcFBETotalExCntType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEExchStatusTypeһ㽻״̬ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_FBEES_Normal '0' + ///ط + #define THOST_FTDC_FBEES_ReExchange '1' + + typedef char TThostFtdcFBEExchStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEFileFlagTypeһļ־ + ///////////////////////////////////////////////////////////////////////// + ///ݰ + #define THOST_FTDC_FBEFG_DataPackage '0' + ///ļ + #define THOST_FTDC_FBEFG_File '1' + + typedef char TThostFtdcFBEFileFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEAlreadyTradeTypeһѽױ־ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_FBEAT_NotTrade '0' + ///ѽ + #define THOST_FTDC_FBEAT_Trade '1' + + typedef char TThostFtdcFBEAlreadyTradeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEOpenBankTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEOpenBankType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEUserEventTypeTypeһڻû¼ + ///////////////////////////////////////////////////////////////////////// + ///ǩ + #define THOST_FTDC_FBEUET_SignIn '0' + /// + #define THOST_FTDC_FBEUET_Exchange '1' + ///ط + #define THOST_FTDC_FBEUET_ReExchange '2' + ///˻ѯ + #define THOST_FTDC_FBEUET_QueryBankAccount '3' + ///ϸѯ + #define THOST_FTDC_FBEUET_QueryExchDetial '4' + ///ܲѯ + #define THOST_FTDC_FBEUET_QueryExchSummary '5' + ///ʲѯ + #define THOST_FTDC_FBEUET_QueryExchRate '6' + ///ļ֪ͨ + #define THOST_FTDC_FBEUET_CheckBankAccount '7' + ///ǩ + #define THOST_FTDC_FBEUET_SignOut '8' + /// + #define THOST_FTDC_FBEUET_Other 'Z' + + typedef char TThostFtdcFBEUserEventTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEFileNameTypeһļ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEFileNameType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEBatchSerialTypeһκ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFBEBatchSerialType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBEReqFlagTypeһ㷢ͱ־ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_FBERF_UnProcessed '0' + ///ȴ + #define THOST_FTDC_FBERF_WaitSend '1' + ///ͳɹ + #define THOST_FTDC_FBERF_SendSuccess '2' + ///ʧ + #define THOST_FTDC_FBERF_SendFailed '3' + ///ȴط + #define THOST_FTDC_FBERF_WaitReSend '4' + + typedef char TThostFtdcFBEReqFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcNotifyClassTypeһ֪ͨ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_NC_NOERROR '0' + ///ʾ + #define THOST_FTDC_NC_Warn '1' + ///׷ + #define THOST_FTDC_NC_Call '2' + ///ǿƽ + #define THOST_FTDC_NC_Force '3' + /// + #define THOST_FTDC_NC_CHUANCANG '4' + ///쳣 + #define THOST_FTDC_NC_Exception '5' + + typedef char TThostFtdcNotifyClassType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRiskNofityInfoTypeһͻ֪ͨϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRiskNofityInfoType[257]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcForceCloseSceneIdTypeһǿƽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcForceCloseSceneIdType[24]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcForceCloseTypeTypeһǿƽ + ///////////////////////////////////////////////////////////////////////// + ///ֹǿƽ + #define THOST_FTDC_FCT_Manual '0' + ///һͶ߸ǿƽ + #define THOST_FTDC_FCT_Single '1' + ///Ͷ߸ǿƽ + #define THOST_FTDC_FCT_Group '2' + + typedef char TThostFtdcForceCloseTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInstrumentIDsTypeһƷ,+ָ,cu+zn + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInstrumentIDsType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRiskNotifyMethodTypeһ֪ͨ; + ///////////////////////////////////////////////////////////////////////// + ///ϵͳ֪ͨ + #define THOST_FTDC_RNM_System '0' + ///֪ͨ + #define THOST_FTDC_RNM_SMS '1' + ///ʼ֪ͨ + #define THOST_FTDC_RNM_EMail '2' + ///˹֪ͨ + #define THOST_FTDC_RNM_Manual '3' + + typedef char TThostFtdcRiskNotifyMethodType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRiskNotifyStatusTypeһ֪ͨ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_RNS_NotGen '0' + ///δ + #define THOST_FTDC_RNS_Generated '1' + ///ʧ + #define THOST_FTDC_RNS_SendError '2' + ///ѷδ + #define THOST_FTDC_RNS_SendOk '3' + ///ѽδȷ + #define THOST_FTDC_RNS_Received '4' + ///ȷ + #define THOST_FTDC_RNS_Confirmed '5' + + typedef char TThostFtdcRiskNotifyStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRiskUserEventTypeһû¼ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_RUE_ExportData '0' + + typedef char TThostFtdcRiskUserEventType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcParamIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcParamIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcParamNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcParamNameType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcParamValueTypeһֵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcParamValueType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcConditionalOrderSortTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///ʹ¼ + #define THOST_FTDC_COST_LastPriceAsc '0' + ///ʹ¼۽ + #define THOST_FTDC_COST_LastPriceDesc '1' + ///ʹ + #define THOST_FTDC_COST_AskPriceAsc '2' + ///ʹ۽ + #define THOST_FTDC_COST_AskPriceDesc '3' + ///ʹ + #define THOST_FTDC_COST_BidPriceAsc '4' + ///ʹ۽ + #define THOST_FTDC_COST_BidPriceDesc '5' + + typedef char TThostFtdcConditionalOrderSortTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSendTypeTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_UOAST_NoSend '0' + ///ѷ + #define THOST_FTDC_UOAST_Sended '1' + /// + #define THOST_FTDC_UOAST_Generated '2' + ///ʧ + #define THOST_FTDC_UOAST_SendFail '3' + ///ճɹ + #define THOST_FTDC_UOAST_Success '4' + ///ʧ + #define THOST_FTDC_UOAST_Fail '5' + ///ȡ + #define THOST_FTDC_UOAST_Cancel '6' + + typedef char TThostFtdcSendTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClientIDStatusTypeһױ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_UOACS_NoApply '1' + ///ύ + #define THOST_FTDC_UOACS_Submited '2' + ///ѷ + #define THOST_FTDC_UOACS_Sended '3' + /// + #define THOST_FTDC_UOACS_Success '4' + ///ܾ + #define THOST_FTDC_UOACS_Refuse '5' + ///ѳ + #define THOST_FTDC_UOACS_Cancel '6' + + typedef char TThostFtdcClientIDStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIndustryIDTypeһҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcIndustryIDType[17]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcQuestionIDTypeһϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcQuestionIDType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcQuestionContentTypeһϢ˵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcQuestionContentType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOptionIDTypeһѡ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOptionIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOptionContentTypeһѡ˵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOptionContentType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcQuestionTypeTypeһϢ + ///////////////////////////////////////////////////////////////////////// + ///ѡ + #define THOST_FTDC_QT_Radio '1' + ///ѡ + #define THOST_FTDC_QT_Option '2' + /// + #define THOST_FTDC_QT_Blank '3' + + typedef char TThostFtdcQuestionTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProcessIDTypeһҵˮ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcProcessIDType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSeqNoTypeһˮ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcSeqNoType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOAProcessStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUOAProcessStatusType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProcessTypeTypeһ̹ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcProcessTypeType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBusinessTypeTypeһҵ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_BT_Request '1' + ///Ӧ + #define THOST_FTDC_BT_Response '2' + ///֪ͨ + #define THOST_FTDC_BT_Notice '3' + + typedef char TThostFtdcBusinessTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCfmmcReturnCodeTypeһķ + ///////////////////////////////////////////////////////////////////////// + ///ɹ + #define THOST_FTDC_CRC_Success '0' + ///ÿͻѾڴ + #define THOST_FTDC_CRC_Working '1' + ///пͻϼʧ + #define THOST_FTDC_CRC_InfoFail '2' + ///ʵƼʧ + #define THOST_FTDC_CRC_IDCardFail '3' + /// + #define THOST_FTDC_CRC_OtherFail '4' + + typedef char TThostFtdcCfmmcReturnCodeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExReturnCodeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcExReturnCodeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClientTypeTypeһͻ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CfMMCCT_All '0' + /// + #define THOST_FTDC_CfMMCCT_Person '1' + ///λ + #define THOST_FTDC_CfMMCCT_Company '2' + /// + #define THOST_FTDC_CfMMCCT_Other '3' + ///ⷨ + #define THOST_FTDC_CfMMCCT_SpecialOrgan '4' + ///ʹܻ + #define THOST_FTDC_CfMMCCT_Asset '5' + + typedef char TThostFtdcClientTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangeIDTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///Ϻڻ + #define THOST_FTDC_EIDT_SHFE 'S' + ///֣Ʒ + #define THOST_FTDC_EIDT_CZCE 'Z' + ///Ʒ + #define THOST_FTDC_EIDT_DCE 'D' + ///йڻ + #define THOST_FTDC_EIDT_CFFEX 'J' + ///ϺԴĹɷ޹˾ + #define THOST_FTDC_EIDT_INE 'N' + + typedef char TThostFtdcExchangeIDTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExClientIDTypeTypeһױ + ///////////////////////////////////////////////////////////////////////// + ///ױ + #define THOST_FTDC_ECIDT_Hedge '1' + /// + #define THOST_FTDC_ECIDT_Arbitrage '2' + ///Ͷ + #define THOST_FTDC_ECIDT_Speculation '3' + + typedef char TThostFtdcExClientIDTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClientClassifyTypeһͻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcClientClassifyType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOAOrganTypeTypeһλ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUOAOrganTypeType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOACountryCodeTypeһҴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUOACountryCodeType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAreaCodeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAreaCodeType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFuturesIDTypeһΪͻĴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFuturesIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCffmcDateTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCffmcDateType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCffmcTimeTypeһʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCffmcTimeType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcNocIDTypeһ֯ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcNocIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUpdateFlagTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_UF_NoUpdate '0' + ///ȫϢɹ + #define THOST_FTDC_UF_Success '1' + ///ȫϢʧ + #define THOST_FTDC_UF_Fail '2' + ///½ױɹ + #define THOST_FTDC_UF_TCSuccess '3' + ///½ױʧ + #define THOST_FTDC_UF_TCFail '4' + ///Ѷ + #define THOST_FTDC_UF_Cancel '5' + + typedef char TThostFtdcUpdateFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcApplyOperateIDTypeһ붯 + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_AOID_OpenInvestor '1' + ///޸Ϣ + #define THOST_FTDC_AOID_ModifyIDCard '2' + ///޸һϢ + #define THOST_FTDC_AOID_ModifyNoIDCard '3' + ///뽻ױ + #define THOST_FTDC_AOID_ApplyTradingCode '4' + ///ױ + #define THOST_FTDC_AOID_CancelTradingCode '5' + /// + #define THOST_FTDC_AOID_CancelInvestor '6' + ///˻ + #define THOST_FTDC_AOID_FreezeAccount '8' + ///˻ + #define THOST_FTDC_AOID_ActiveFreezeAccount '9' + + typedef char TThostFtdcApplyOperateIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcApplyStatusIDTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δȫ + #define THOST_FTDC_ASID_NoComplete '1' + ///ύ + #define THOST_FTDC_ASID_Submited '2' + /// + #define THOST_FTDC_ASID_Checked '3' + ///Ѿܾ + #define THOST_FTDC_ASID_Refused '4' + ///ɾ + #define THOST_FTDC_ASID_Deleted '5' + + typedef char TThostFtdcApplyStatusIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSendMethodTypeһͷʽ + ///////////////////////////////////////////////////////////////////////// + ///ļ + #define THOST_FTDC_UOASM_ByAPI '1' + ///ӷ + #define THOST_FTDC_UOASM_ByFile '2' + + typedef char TThostFtdcSendMethodType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcEventTypeTypeһҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcEventTypeType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcEventModeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_EvM_ADD '1' + ///޸ + #define THOST_FTDC_EvM_UPDATE '2' + ///ɾ + #define THOST_FTDC_EvM_DELETE '3' + /// + #define THOST_FTDC_EvM_CHECK '4' + /// + #define THOST_FTDC_EvM_COPY '5' + ///ע + #define THOST_FTDC_EvM_CANCEL '6' + /// + #define THOST_FTDC_EvM_Reverse '7' + + typedef char TThostFtdcEventModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOAAutoSendTypeһͳһԶ + ///////////////////////////////////////////////////////////////////////// + ///ԶͲ + #define THOST_FTDC_UOAA_ASR '1' + ///ԶͣԶ + #define THOST_FTDC_UOAA_ASNR '2' + ///ԶͣԶ + #define THOST_FTDC_UOAA_NSAR '3' + ///ԶͣҲԶ + #define THOST_FTDC_UOAA_NSR '4' + + typedef char TThostFtdcUOAAutoSendType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcQueryDepthTypeһѯ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcQueryDepthType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDataCenterIDTypeһĴ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcDataCenterIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFlowIDTypeһID + ///////////////////////////////////////////////////////////////////////// + ///Ͷ߶ӦͶ + #define THOST_FTDC_EvM_InvestorGroupFlow '1' + ///Ͷ + #define THOST_FTDC_EvM_InvestorRate '2' + ///Ͷģϵ + #define THOST_FTDC_EvM_InvestorCommRateModel '3' + + typedef char TThostFtdcFlowIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCheckLevelTypeһ˼ + ///////////////////////////////////////////////////////////////////////// + ///㼶 + #define THOST_FTDC_CL_Zero '0' + ///һ + #define THOST_FTDC_CL_One '1' + /// + #define THOST_FTDC_CL_Two '2' + + typedef char TThostFtdcCheckLevelType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCheckNoTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcCheckNoType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCheckStatusTypeһ˼ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_CHS_Init '0' + /// + #define THOST_FTDC_CHS_Checking '1' + ///Ѹ + #define THOST_FTDC_CHS_Checked '2' + ///ܾ + #define THOST_FTDC_CHS_Refuse '3' + /// + #define THOST_FTDC_CHS_Cancel '4' + + typedef char TThostFtdcCheckStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUsedStatusTypeһЧ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δЧ + #define THOST_FTDC_CHU_Unused '0' + ///Ч + #define THOST_FTDC_CHU_Used '1' + ///Чʧ + #define THOST_FTDC_CHU_Fail '2' + + typedef char TThostFtdcUsedStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRateTemplateNameTypeһģ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRateTemplateNameType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPropertyStringTypeһڲѯͶֶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPropertyStringType[2049]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankAcountOriginTypeһ˻Դ + ///////////////////////////////////////////////////////////////////////// + ///ֹ¼ + #define THOST_FTDC_BAO_ByAccProperty '0' + ///ת + #define THOST_FTDC_BAO_ByFBTransfer '1' + + typedef char TThostFtdcBankAcountOriginType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMonthBillTradeSumTypeһ㵥±ɽܷʽ + ///////////////////////////////////////////////////////////////////////// + ///ͬͬԼ + #define THOST_FTDC_MBTS_ByInstrument '0' + ///ͬͬԼͬ۸ + #define THOST_FTDC_MBTS_ByDayInsPrc '1' + ///ͬԼ + #define THOST_FTDC_MBTS_ByDayIns '2' + + typedef char TThostFtdcMonthBillTradeSumType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFBTTradeCodeEnumTypeһڽ״ö + ///////////////////////////////////////////////////////////////////////// + ///зתڻ + #define THOST_FTDC_FTC_BankLaunchBankToBroker '102001' + ///ڻתڻ + #define THOST_FTDC_FTC_BrokerLaunchBankToBroker '202001' + ///зڻת + #define THOST_FTDC_FTC_BankLaunchBrokerToBank '102002' + ///ڻڻת + #define THOST_FTDC_FTC_BrokerLaunchBrokerToBank '202002' + + typedef char TThostFtdcFBTTradeCodeEnumType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRateTemplateIDTypeһģʹ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRateTemplateIDType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRiskRateTypeһն + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRiskRateType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTimestampTypeһʱ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcTimestampType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestorIDRuleNameTypeһŶι + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInvestorIDRuleNameType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestorIDRuleExprTypeһŶιʽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInvestorIDRuleExprType[513]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLastDriftTypeһϴOTPƯֵ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcLastDriftType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLastSuccessTypeһϴOTPɹֵ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcLastSuccessType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAuthKeyTypeһԿ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAuthKeyType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSerialNumberTypeһк + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSerialNumberType[17]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOTPTypeTypeһ̬ + ///////////////////////////////////////////////////////////////////////// + ///޶̬ + #define THOST_FTDC_OTP_NONE '0' + ///ʱ + #define THOST_FTDC_OTP_TOTP '1' + + typedef char TThostFtdcOTPTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOTPVendorsIDTypeһ̬ṩ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOTPVendorsIDType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOTPVendorsNameTypeһ̬ṩ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOTPVendorsNameType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOTPStatusTypeһ̬״̬ + ///////////////////////////////////////////////////////////////////////// + ///δʹ + #define THOST_FTDC_OTPS_Unused '0' + ///ʹ + #define THOST_FTDC_OTPS_Used '1' + ///ע + #define THOST_FTDC_OTPS_Disuse '2' + + typedef char TThostFtdcOTPStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBrokerUserTypeTypeһù˾û + ///////////////////////////////////////////////////////////////////////// + ///Ͷ + #define THOST_FTDC_BUT_Investor '1' + ///Ա + #define THOST_FTDC_BUT_BrokerUser '2' + + typedef char TThostFtdcBrokerUserTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFutureTypeTypeһڻ + ///////////////////////////////////////////////////////////////////////// + ///Ʒڻ + #define THOST_FTDC_FUTT_Commodity '1' + ///ڻ + #define THOST_FTDC_FUTT_Financial '2' + + typedef char TThostFtdcFutureTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundEventTypeTypeһʽ + ///////////////////////////////////////////////////////////////////////// + ///ת޶ + #define THOST_FTDC_FET_Restriction '0' + ///ת޶ + #define THOST_FTDC_FET_TodayRestriction '1' + ///ˮ + #define THOST_FTDC_FET_Transfer '2' + ///ʽ𶳽 + #define THOST_FTDC_FET_Credit '3' + ///Ͷ߿ʽ + #define THOST_FTDC_FET_InvestorWithdrawAlm '4' + ///ʻת޶ + #define THOST_FTDC_FET_BankRestriction '5' + ///ǩԼ˻ + #define THOST_FTDC_FET_Accountregister '6' + /// + #define THOST_FTDC_FET_ExchangeFundIO '7' + ///Ͷ߳ + #define THOST_FTDC_FET_InvestorFundIO '8' + + typedef char TThostFtdcFundEventTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAccountSourceTypeTypeһʽ˻Դ + ///////////////////////////////////////////////////////////////////////// + ///ͬ + #define THOST_FTDC_AST_FBTransfer '0' + ///ֹ¼ + #define THOST_FTDC_AST_ManualEntry '1' + + typedef char TThostFtdcAccountSourceTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCodeSourceTypeTypeһױԴ + ///////////////////////////////////////////////////////////////////////// + ///ͳһ(ѹ淶) + #define THOST_FTDC_CST_UnifyAccount '0' + ///ֹ¼(δ淶) + #define THOST_FTDC_CST_ManualEntry '1' + + typedef char TThostFtdcCodeSourceTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserRangeTypeһԱΧ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_UR_All '0' + ///һԱ + #define THOST_FTDC_UR_Single '1' + + typedef char TThostFtdcUserRangeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTimeSpanTypeһʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcTimeSpanType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcImportSequenceIDTypeһ̬Ƶα + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcImportSequenceIDType[17]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcByGroupTypeһͳƱͻͳƷʽ + ///////////////////////////////////////////////////////////////////////// + ///Ͷͳ + #define THOST_FTDC_BG_Investor '2' + ///ͳ + #define THOST_FTDC_BG_Group '1' + + typedef char TThostFtdcByGroupType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeSumStatModeTypeһͳƱΧͳƷʽ + ///////////////////////////////////////////////////////////////////////// + ///Լͳ + #define THOST_FTDC_TSSM_Instrument '1' + ///Ʒͳ + #define THOST_FTDC_TSSM_Product '2' + ///ͳ + #define THOST_FTDC_TSSM_Exchange '3' + + typedef char TThostFtdcTradeSumStatModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcComTypeTypeһϳɽ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcComTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserProductIDTypeһƷʶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUserProductIDType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserProductNameTypeһƷ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUserProductNameType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUserProductMemoTypeһƷ˵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUserProductMemoType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCCancelFlagTypeһ־ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCCancelFlagType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCDateTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCDateType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCInvestorNameTypeһͻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCInvestorNameType[201]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCOpenInvestorNameTypeһͻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCOpenInvestorNameType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCInvestorIDTypeһͻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCInvestorIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCIdentifiedCardNoTypeһ֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCIdentifiedCardNoType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCClientIDTypeһױ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCClientIDType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCBankFlagTypeһбʶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCBankFlagType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCBankAccountTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCBankAccountType[23]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCOpenNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCOpenNameType[401]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCMemoTypeһ˵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCMemoType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCTimeTypeһʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCTimeType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCTradeIDTypeһɽˮ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCTradeIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCExchangeInstIDTypeһԼ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCExchangeInstIDType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCMortgageNameTypeһѺƷ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCMortgageNameType[7]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCReasonTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCReasonType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIsSettlementTypeһǷΪǽԱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcIsSettlementType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCMoneyTypeһʽ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcCSRCMoneyType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCPriceTypeһ۸ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcCSRCPriceType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCOptionsTypeTypeһȨ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCOptionsTypeType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCStrikePriceTypeһִм + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcCSRCStrikePriceType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCTargetProductIDTypeһƷ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCTargetProductIDType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCTargetInstrIDTypeһĺԼ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCTargetInstrIDType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCommModelNameTypeһģ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCommModelNameType[161]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCommModelMemoTypeһģ屸ע + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCommModelMemoType[1025]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExprSetModeTypeһڱʽ + ///////////////////////////////////////////////////////////////////////// + ///й + #define THOST_FTDC_ESM_Relative '1' + /// + #define THOST_FTDC_ESM_Typical '2' + + typedef char TThostFtdcExprSetModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRateInvestorRangeTypeһͶ߷Χ + ///////////////////////////////////////////////////////////////////////// + ///˾׼ + #define THOST_FTDC_RIR_All '1' + ///ģ + #define THOST_FTDC_RIR_Model '2' + ///һͶ + #define THOST_FTDC_RIR_Single '3' + + typedef char TThostFtdcRateInvestorRangeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAgentBrokerIDTypeһ͹˾ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAgentBrokerIDType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDRIdentityIDTypeһĴ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcDRIdentityIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDRIdentityNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDRIdentityNameType[65]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDBLinkIDTypeһDBLinkʶ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDBLinkIDType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSyncDataStatusTypeһϵͳͬ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δͬ + #define THOST_FTDC_SDS_Initialize '0' + ///ͬ + #define THOST_FTDC_SDS_Settlementing '1' + ///ͬ + #define THOST_FTDC_SDS_Settlemented '2' + + typedef char TThostFtdcSyncDataStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeSourceTypeһɽԴ + ///////////////////////////////////////////////////////////////////////// + ///Խͨر + #define THOST_FTDC_TSRC_NORMAL '0' + ///Բѯ + #define THOST_FTDC_TSRC_QUERY '1' + + typedef char TThostFtdcTradeSourceType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFlexStatModeTypeһƷԼͳƷʽ + ///////////////////////////////////////////////////////////////////////// + ///Ʒͳ + #define THOST_FTDC_FSM_Product '1' + ///ͳ + #define THOST_FTDC_FSM_Exchange '2' + ///ͳ + #define THOST_FTDC_FSM_All '3' + + typedef char TThostFtdcFlexStatModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcByInvestorRangeTypeһͶ߷ΧͳƷʽ + ///////////////////////////////////////////////////////////////////////// + ///ͳ + #define THOST_FTDC_BIR_Property '1' + ///ͳ + #define THOST_FTDC_BIR_All '2' + + typedef char TThostFtdcByInvestorRangeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSRiskRateTypeһն + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSRiskRateType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSequenceNo12Typeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcSequenceNo12Type; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPropertyInvestorRangeTypeһͶ߷Χ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_PIR_All '1' + ///Ͷ + #define THOST_FTDC_PIR_Property '2' + ///һͶ + #define THOST_FTDC_PIR_Single '3' + + typedef char TThostFtdcPropertyInvestorRangeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFileStatusTypeһļ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_FIS_NoCreate '0' + /// + #define THOST_FTDC_FIS_Created '1' + ///ʧ + #define THOST_FTDC_FIS_Failed '2' + + typedef char TThostFtdcFileStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFileGenStyleTypeһļɷʽ + ///////////////////////////////////////////////////////////////////////// + ///· + #define THOST_FTDC_FGS_FileTransmit '0' + /// + #define THOST_FTDC_FGS_FileGen '1' + + typedef char TThostFtdcFileGenStyleType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSysOperModeTypeһϵͳ־ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_SoM_Add '1' + ///޸ + #define THOST_FTDC_SoM_Update '2' + ///ɾ + #define THOST_FTDC_SoM_Delete '3' + /// + #define THOST_FTDC_SoM_Copy '4' + /// + #define THOST_FTDC_SoM_AcTive '5' + ///ע + #define THOST_FTDC_SoM_CanCel '6' + /// + #define THOST_FTDC_SoM_ReSet '7' + + typedef char TThostFtdcSysOperModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSysOperTypeTypeһϵͳ־ + ///////////////////////////////////////////////////////////////////////// + ///޸IJԱ + #define THOST_FTDC_SoT_UpdatePassword '0' + ///Աܹ֯ϵ + #define THOST_FTDC_SoT_UserDepartment '1' + ///ɫ + #define THOST_FTDC_SoT_RoleManager '2' + ///ɫ + #define THOST_FTDC_SoT_RoleFunction '3' + /// + #define THOST_FTDC_SoT_BaseParam '4' + ///òԱ + #define THOST_FTDC_SoT_SetUserID '5' + ///ûɫ + #define THOST_FTDC_SoT_SetUserRole '6' + ///ûIP + #define THOST_FTDC_SoT_UserIpRestriction '7' + ///ܹ֯ + #define THOST_FTDC_SoT_DepartmentManager '8' + ///ܹ֯ѯิ + #define THOST_FTDC_SoT_DepartmentCopy '9' + ///ױ + #define THOST_FTDC_SoT_Tradingcode 'A' + ///Ͷ״̬ά + #define THOST_FTDC_SoT_InvestorStatus 'B' + ///ͶȨ޹ + #define THOST_FTDC_SoT_InvestorAuthority 'C' + /// + #define THOST_FTDC_SoT_PropertySet 'D' + ///Ͷ + #define THOST_FTDC_SoT_ReSetInvestorPasswd 'E' + ///Ͷ߸Ϣά + #define THOST_FTDC_SoT_InvestorPersonalityInfo 'F' + + typedef char TThostFtdcSysOperTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCDataQueyTypeTypeһϱݲѯ + ///////////////////////////////////////////////////////////////////////// + ///ѯǰձ͵ + #define THOST_FTDC_CSRCQ_Current '0' + ///ѯʷ͵Ĵ͹˾ + #define THOST_FTDC_CSRCQ_History '1' + + typedef char TThostFtdcCSRCDataQueyTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFreezeStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///Ծ + #define THOST_FTDC_FRS_Normal '1' + /// + #define THOST_FTDC_FRS_Freeze '0' + + typedef char TThostFtdcFreezeStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStandardStatusTypeһ淶״̬ + ///////////////////////////////////////////////////////////////////////// + ///ѹ淶 + #define THOST_FTDC_STST_Standard '0' + ///δ淶 + #define THOST_FTDC_STST_NonStandard '1' + + typedef char TThostFtdcStandardStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCFreezeStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCFreezeStatusType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRightParamTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///߻ + #define THOST_FTDC_RPT_Freeze '1' + ///߻ + #define THOST_FTDC_RPT_FreezeActive '2' + ///Ȩ + #define THOST_FTDC_RPT_OpenLimit '3' + ///Ȩ + #define THOST_FTDC_RPT_RelieveOpenLimit '4' + + typedef char TThostFtdcRightParamTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRightTemplateIDTypeһģ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRightTemplateIDType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRightTemplateNameTypeһģ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcRightTemplateNameType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDataStatusTypeһϴǮ˱״̬ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_AMLDS_Normal '0' + ///ɾ + #define THOST_FTDC_AMLDS_Deleted '1' + + typedef char TThostFtdcDataStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAMLCheckStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_AMLCHS_Init '0' + /// + #define THOST_FTDC_AMLCHS_Checking '1' + ///Ѹ + #define THOST_FTDC_AMLCHS_Checked '2' + ///ܾϱ + #define THOST_FTDC_AMLCHS_RefuseReport '3' + + typedef char TThostFtdcAMLCheckStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAmlDateTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_AMLDT_DrawDay '0' + /// + #define THOST_FTDC_AMLDT_TouchDay '1' + + typedef char TThostFtdcAmlDateTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAmlCheckLevelTypeһ˼ + ///////////////////////////////////////////////////////////////////////// + ///㼶 + #define THOST_FTDC_AMLCL_CheckLevel0 '0' + ///һ + #define THOST_FTDC_AMLCL_CheckLevel1 '1' + /// + #define THOST_FTDC_AMLCL_CheckLevel2 '2' + /// + #define THOST_FTDC_AMLCL_CheckLevel3 '3' + + typedef char TThostFtdcAmlCheckLevelType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAmlCheckFlowTypeһϴǮݳȡ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAmlCheckFlowType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDataTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcDataTypeType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExportFileTypeTypeһļ + ///////////////////////////////////////////////////////////////////////// + ///CSV + #define THOST_FTDC_EFT_CSV '0' + ///Excel + #define THOST_FTDC_EFT_EXCEL '1' + ///DBF + #define THOST_FTDC_EFT_DBF '2' + + typedef char TThostFtdcExportFileTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettleManagerTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///ǰ׼ + #define THOST_FTDC_SMT_Before '1' + /// + #define THOST_FTDC_SMT_Settlement '2' + ///˶ + #define THOST_FTDC_SMT_After '3' + /// + #define THOST_FTDC_SMT_Settlemented '4' + + typedef char TThostFtdcSettleManagerTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettleManagerIDTypeһô + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSettleManagerIDType[33]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettleManagerNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSettleManagerNameType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettleManagerLevelTypeһõȼ + ///////////////////////////////////////////////////////////////////////// + ///Ҫ + #define THOST_FTDC_SML_Must '1' + /// + #define THOST_FTDC_SML_Alarm '2' + ///ʾ + #define THOST_FTDC_SML_Prompt '3' + /// + #define THOST_FTDC_SML_Ignore '4' + + typedef char TThostFtdcSettleManagerLevelType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettleManagerGroupTypeһģ + ///////////////////////////////////////////////////////////////////////// + ///˶ + #define THOST_FTDC_SMG_Exhcange '1' + ///ڲ˶ + #define THOST_FTDC_SMG_ASP '2' + ///ϱݺ˶ + #define THOST_FTDC_SMG_CSRC '3' + + typedef char TThostFtdcSettleManagerGroupType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCheckResultMemoTypeһ˶Խ˵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCheckResultMemoType[1025]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFunctionUrlTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcFunctionUrlType[1025]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAuthInfoTypeһͻ֤Ϣ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAuthInfoType[129]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAuthCodeTypeһͻ֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAuthCodeType[17]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLimitUseTypeTypeһֵʹ + ///////////////////////////////////////////////////////////////////////// + ///ظʹ + #define THOST_FTDC_LUT_Repeatable '1' + ///ظʹ + #define THOST_FTDC_LUT_Unrepeatable '2' + + typedef char TThostFtdcLimitUseTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDataResourceTypeһԴ + ///////////////////////////////////////////////////////////////////////// + ///ϵͳ + #define THOST_FTDC_DAR_Settle '1' + /// + #define THOST_FTDC_DAR_Exchange '2' + /// + #define THOST_FTDC_DAR_CSRC '3' + + typedef char TThostFtdcDataResourceType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMarginTypeTypeһ֤ + ///////////////////////////////////////////////////////////////////////// + ///֤ + #define THOST_FTDC_MGT_ExchMarginRate '0' + ///Ͷ֤߱ + #define THOST_FTDC_MGT_InstrMarginRate '1' + ///Ͷ߽ױ֤ + #define THOST_FTDC_MGT_InstrMarginRateTrade '2' + + typedef char TThostFtdcMarginTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcActiveTypeTypeһЧ + ///////////////////////////////////////////////////////////////////////// + ///Ч + #define THOST_FTDC_ACT_Intraday '1' + ///Ч + #define THOST_FTDC_ACT_Long '2' + + typedef char TThostFtdcActiveTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMarginRateTypeTypeһͻ֤ + ///////////////////////////////////////////////////////////////////////// + ///֤ + #define THOST_FTDC_MRT_Exchange '1' + ///Ͷ֤߱ + #define THOST_FTDC_MRT_Investor '2' + ///Ͷ߽ױ֤ + #define THOST_FTDC_MRT_InvestorTrade '3' + + typedef char TThostFtdcMarginRateTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBackUpStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δɱ + #define THOST_FTDC_BUS_UnBak '0' + /// + #define THOST_FTDC_BUS_BakUp '1' + ///ɱ + #define THOST_FTDC_BUS_BakUped '2' + ///ʧ + #define THOST_FTDC_BUS_BakFail '3' + + typedef char TThostFtdcBackUpStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInitSettlementTypeһʼ״̬ + ///////////////////////////////////////////////////////////////////////// + ///ʼδʼ + #define THOST_FTDC_SIS_UnInitialize '0' + ///ʼ + #define THOST_FTDC_SIS_Initialize '1' + ///ʼ + #define THOST_FTDC_SIS_Initialized '2' + + typedef char TThostFtdcInitSettlementType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReportStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///δɱ + #define THOST_FTDC_SRS_NoCreate '0' + /// + #define THOST_FTDC_SRS_Create '1' + ///ɱ + #define THOST_FTDC_SRS_Created '2' + ///ɱʧ + #define THOST_FTDC_SRS_CreateFail '3' + + typedef char TThostFtdcReportStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSaveStatusTypeһݹ鵵״̬ + ///////////////////////////////////////////////////////////////////////// + ///鵵δ + #define THOST_FTDC_SSS_UnSaveData '0' + ///鵵 + #define THOST_FTDC_SSS_SaveDatad '1' + + typedef char TThostFtdcSaveStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSettArchiveStatusTypeһȷݹ鵵״̬ + ///////////////////////////////////////////////////////////////////////// + ///δ鵵 + #define THOST_FTDC_SAS_UnArchived '0' + ///ݹ鵵 + #define THOST_FTDC_SAS_Archiving '1' + ///ѹ鵵 + #define THOST_FTDC_SAS_Archived '2' + ///鵵ʧ + #define THOST_FTDC_SAS_ArchiveFail '3' + + typedef char TThostFtdcSettArchiveStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCTPTypeTypeһCTPϵͳ + ///////////////////////////////////////////////////////////////////////// + ///δ֪ + #define THOST_FTDC_CTPT_Unkown '0' + /// + #define THOST_FTDC_CTPT_MainCenter '1' + /// + #define THOST_FTDC_CTPT_BackUp '2' + + typedef char TThostFtdcCTPTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcToolIDTypeһߴ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcToolIDType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcToolNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcToolNameType[81]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCloseDealTypeTypeһƽִ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CDT_Normal '0' + ///Ͷƽ + #define THOST_FTDC_CDT_SpecFirst '1' + + typedef char TThostFtdcCloseDealTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMortgageFundUseRangeTypeһѺʽ÷Χ + ///////////////////////////////////////////////////////////////////////// + ///ʹ + #define THOST_FTDC_MFUR_None '0' + ///ڱ֤ + #define THOST_FTDC_MFUR_Margin '1' + ///ѡӯ֤ + #define THOST_FTDC_MFUR_All '2' + + typedef char TThostFtdcMortgageFundUseRangeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCurrencyUnitTypeһֵλ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcCurrencyUnitType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExchangeRateTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcExchangeRateType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSpecProductTypeTypeһƷ + ///////////////////////////////////////////////////////////////////////// + ///֣ױƷ + #define THOST_FTDC_SPT_CzceHedge '1' + ///ѺƷ + #define THOST_FTDC_SPT_IneForeignCurrency '2' + ///߿ƽֲƷ + #define THOST_FTDC_SPT_DceOpenClose '3' + + typedef char TThostFtdcSpecProductTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundMortgageTypeTypeһѺ + ///////////////////////////////////////////////////////////////////////// + ///Ѻ + #define THOST_FTDC_FMT_Mortgage '1' + /// + #define THOST_FTDC_FMT_Redemption '2' + + typedef char TThostFtdcFundMortgageTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAccountSettlementParamIDTypeһͶ˻ + ///////////////////////////////////////////////////////////////////////// + ///֤ + #define THOST_FTDC_ASPI_BaseMargin '1' + ///Ȩ׼ + #define THOST_FTDC_ASPI_LowestInterest '2' + + typedef char TThostFtdcAccountSettlementParamIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCurrencyNameTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCurrencyNameType[31]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCurrencySignTypeһַ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCurrencySignType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundMortDirectionTypeһѺ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_FMD_In '1' + ///ʳ + #define THOST_FTDC_FMD_Out '2' + + typedef char TThostFtdcFundMortDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBusinessClassTypeһ + ///////////////////////////////////////////////////////////////////////// + ///ӯ + #define THOST_FTDC_BT_Profit '0' + /// + #define THOST_FTDC_BT_Loss '1' + /// + #define THOST_FTDC_BT_Other 'Z' + + typedef char TThostFtdcBusinessClassType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSwapSourceTypeTypeһԴ + ///////////////////////////////////////////////////////////////////////// + ///ֹ + #define THOST_FTDC_SST_Manual '0' + ///Զ + #define THOST_FTDC_SST_Automatic '1' + + typedef char TThostFtdcSwapSourceTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCurrExDirectionTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CED_Settlement '0' + ///ۻ + #define THOST_FTDC_CED_Sale '1' + + typedef char TThostFtdcCurrExDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCurrencySwapStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///¼ + #define THOST_FTDC_CSS_Entry '1' + /// + #define THOST_FTDC_CSS_Approve '2' + ///Ѿܾ + #define THOST_FTDC_CSS_Refuse '3' + ///ѳ + #define THOST_FTDC_CSS_Revoke '4' + ///ѷ + #define THOST_FTDC_CSS_Send '5' + ///ɹ + #define THOST_FTDC_CSS_Success '6' + ///ʧ + #define THOST_FTDC_CSS_Failure '7' + + typedef char TThostFtdcCurrencySwapStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCurrExchCertNoTypeһƾ֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCurrExchCertNoType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBatchSerialNoTypeһκ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBatchSerialNoType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcReqFlagTypeһ㷢ͱ־ + ///////////////////////////////////////////////////////////////////////// + ///δ + #define THOST_FTDC_REQF_NoSend '0' + ///ͳɹ + #define THOST_FTDC_REQF_SendSuccess '1' + ///ʧ + #define THOST_FTDC_REQF_SendFailed '2' + ///ȴط + #define THOST_FTDC_REQF_WaitReSend '3' + + typedef char TThostFtdcReqFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcResFlagTypeһ㷵سɹ־ + ///////////////////////////////////////////////////////////////////////// + ///ɹ + #define THOST_FTDC_RESF_Success '0' + ///˻ + #define THOST_FTDC_RESF_InsuffiCient '1' + ///׽δ֪ + #define THOST_FTDC_RESF_UnKnown '8' + + typedef char TThostFtdcResFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPageControlTypeһҳ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPageControlType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcRecordCountTypeһ¼ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcRecordCountType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCurrencySwapMemoTypeһȷϢ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCurrencySwapMemoType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExStatusTypeһ޸״̬ + ///////////////////////////////////////////////////////////////////////// + ///޸ǰ + #define THOST_FTDC_EXS_Before '0' + ///޸ĺ + #define THOST_FTDC_EXS_After '1' + + typedef char TThostFtdcExStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClientRegionTypeһͻ + ///////////////////////////////////////////////////////////////////////// + ///ڿͻ + #define THOST_FTDC_CR_Domestic '1' + ///۰̨ͻ + #define THOST_FTDC_CR_GMT '2' + ///ͻ + #define THOST_FTDC_CR_Foreign '3' + + typedef char TThostFtdcClientRegionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcWorkPlaceTypeһλ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcWorkPlaceType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBusinessPeriodTypeһӪ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBusinessPeriodType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcWebSiteTypeһַ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcWebSiteType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOAIdCardTypeTypeһͳһ֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUOAIdCardTypeType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcClientModeTypeһģʽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcClientModeType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestorFullNameTypeһͶȫ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInvestorFullNameType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOABrokerIDTypeһнID + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUOABrokerIDType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOAZipCodeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUOAZipCodeType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOAEMailTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUOAEMailType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOldCityTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcOldCityType[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCorporateIdentifiedCardNoTypeһ˴֤ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCorporateIdentifiedCardNoType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcHasBoardTypeһǷж» + ///////////////////////////////////////////////////////////////////////// + ///û + #define THOST_FTDC_HB_No '0' + /// + #define THOST_FTDC_HB_Yes '1' + + typedef char TThostFtdcHasBoardType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStartModeTypeһģʽ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_SM_Normal '1' + ///Ӧ + #define THOST_FTDC_SM_Emerge '2' + ///ָ + #define THOST_FTDC_SM_Restore '3' + + typedef char TThostFtdcStartModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTemplateTypeTypeһģ + ///////////////////////////////////////////////////////////////////////// + ///ȫ + #define THOST_FTDC_TPT_Full '1' + /// + #define THOST_FTDC_TPT_Increment '2' + /// + #define THOST_FTDC_TPT_BackUp '3' + + typedef char TThostFtdcTemplateTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLoginModeTypeһ¼ģʽ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_LM_Trade '0' + ///ת + #define THOST_FTDC_LM_Transfer '1' + + typedef char TThostFtdcLoginModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPromptTypeTypeһʾ + ///////////////////////////////////////////////////////////////////////// + ///Լ + #define THOST_FTDC_CPT_Instrument '1' + ///ֶ֤Ч + #define THOST_FTDC_CPT_Margin '2' + + typedef char TThostFtdcPromptTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLedgerManageIDTypeһֻʲ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcLedgerManageIDType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInvestVarietyTypeһͶƷ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInvestVarietyType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBankAccountTypeTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcBankAccountTypeType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLedgerManageBankTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcLedgerManageBankType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCffexDepartmentNameTypeһӪҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCffexDepartmentNameType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCffexDepartmentCodeTypeһӪҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCffexDepartmentCodeType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcHasTrusteeTypeһǷй + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_HT_Yes '1' + ///û + #define THOST_FTDC_HT_No '0' + + typedef char TThostFtdcHasTrusteeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCMemo1Typeһ˵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCMemo1Type[41]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAssetmgrCFullNameTypeһʲҵڻ˾ȫ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAssetmgrCFullNameType[101]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAssetmgrApprovalNOTypeһʲҵĺ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAssetmgrApprovalNOType[51]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAssetmgrMgrNameTypeһʲҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAssetmgrMgrNameType[401]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAmTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_AMT_Bank '1' + ///֤ȯ˾ + #define THOST_FTDC_AMT_Securities '2' + ///˾ + #define THOST_FTDC_AMT_Fund '3' + ///չ˾ + #define THOST_FTDC_AMT_Insurance '4' + ///й˾ + #define THOST_FTDC_AMT_Trust '5' + /// + #define THOST_FTDC_AMT_Other '9' + + typedef char TThostFtdcAmTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCAmTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCAmTypeType[5]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCFundIOTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CFIOT_FundIO '0' + ///ڻ + #define THOST_FTDC_CFIOT_SwapCurrency '1' + + typedef char TThostFtdcCSRCFundIOTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCusAccountTypeTypeһ˻ + ///////////////////////////////////////////////////////////////////////// + ///ڻ˻ + #define THOST_FTDC_CAT_Futures '1' + ///ڻʹҵµʹܽ˻ + #define THOST_FTDC_CAT_AssetmgrFuture '2' + ///ۺʹҵµڻʹй˻ + #define THOST_FTDC_CAT_AssetmgrTrustee '3' + ///ۺʹҵµʽת˻ + #define THOST_FTDC_CAT_AssetmgrTransfer '4' + + typedef char TThostFtdcCusAccountTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCNationalTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCNationalType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCSRCSecAgentIDTypeһID + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCSRCSecAgentIDType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLanguageTypeTypeһ֪ͨ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_LT_Chinese '1' + ///Ӣ + #define THOST_FTDC_LT_English '2' + + typedef char TThostFtdcLanguageTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAmAccountTypeһͶ˻ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcAmAccountType[23]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAssetmgrClientTypeTypeһʲͻ + ///////////////////////////////////////////////////////////////////////// + ///ʹܿͻ + #define THOST_FTDC_AMCT_Person '1' + ///λʹܿͻ + #define THOST_FTDC_AMCT_Organ '2' + ///ⵥλʹܿͻ + #define THOST_FTDC_AMCT_SpecialOrgan '4' + + typedef char TThostFtdcAssetmgrClientTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcAssetmgrTypeTypeһͶ + ///////////////////////////////////////////////////////////////////////// + ///ڻ + #define THOST_FTDC_ASST_Futures '3' + ///ۺ + #define THOST_FTDC_ASST_SpecialOrgan '4' + + typedef char TThostFtdcAssetmgrTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOMTypeһλ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcUOMType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSHFEInstLifePhaseTypeһԼ״̬ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSHFEInstLifePhaseType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSHFEProductClassTypeһƷ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSHFEProductClassType[11]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcPriceDecimalTypeһ۸Сλ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcPriceDecimalType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcInTheMoneyFlagTypeһƽֵȨ־ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcInTheMoneyFlagType[2]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCheckInstrTypeTypeһԼȽ + ///////////////////////////////////////////////////////////////////////// + ///Լ + #define THOST_FTDC_CIT_HasExch '0' + ///Լϵͳ + #define THOST_FTDC_CIT_HasATP '1' + ///ԼȽϲһ + #define THOST_FTDC_CIT_HasDiff '2' + + typedef char TThostFtdcCheckInstrTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDeliveryTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///ֹ + #define THOST_FTDC_DT_HandDeliv '1' + ///ڽ + #define THOST_FTDC_DT_PersonDeliv '2' + + typedef char TThostFtdcDeliveryTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBigMoneyTypeһʽ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcBigMoneyType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcMaxMarginSideAlgorithmTypeһ֤߱㷨 + ///////////////////////////////////////////////////////////////////////// + ///ʹô֤߱㷨 + #define THOST_FTDC_MMSA_NO '0' + ///ʹô֤߱㷨 + #define THOST_FTDC_MMSA_YES '1' + + typedef char TThostFtdcMaxMarginSideAlgorithmType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDAClientTypeTypeһʲͻ + ///////////////////////////////////////////////////////////////////////// + ///Ȼ + #define THOST_FTDC_CACT_Person '0' + /// + #define THOST_FTDC_CACT_Company '1' + /// + #define THOST_FTDC_CACT_Other '2' + + typedef char TThostFtdcDAClientTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCombinInstrIDTypeһԼ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCombinInstrIDType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCombinSettlePriceTypeһȽ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcCombinSettlePriceType[61]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDCEPriorityTypeһȼ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcDCEPriorityType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeGroupIDTypeһɽ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcTradeGroupIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcIsCheckPrepaTypeһǷУ鿪ʽ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcIsCheckPrepaType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcUOAAssetmgrTypeTypeһͶ + ///////////////////////////////////////////////////////////////////////// + ///ڻ + #define THOST_FTDC_UOAAT_Futures '1' + ///ۺ + #define THOST_FTDC_UOAAT_SpecialOrgan '2' + + typedef char TThostFtdcUOAAssetmgrTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDirectionEnTypeһ + ///////////////////////////////////////////////////////////////////////// + ///Buy + #define THOST_FTDC_DEN_Buy '0' + ///Sell + #define THOST_FTDC_DEN_Sell '1' + + typedef char TThostFtdcDirectionEnType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOffsetFlagEnTypeһƽ־ + ///////////////////////////////////////////////////////////////////////// + ///Position Opening + #define THOST_FTDC_OFEN_Open '0' + ///Position Close + #define THOST_FTDC_OFEN_Close '1' + ///Forced Liquidation + #define THOST_FTDC_OFEN_ForceClose '2' + ///Close Today + #define THOST_FTDC_OFEN_CloseToday '3' + ///Close Prev. + #define THOST_FTDC_OFEN_CloseYesterday '4' + ///Forced Reduction + #define THOST_FTDC_OFEN_ForceOff '5' + ///Local Forced Liquidation + #define THOST_FTDC_OFEN_LocalForceClose '6' + + typedef char TThostFtdcOffsetFlagEnType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcHedgeFlagEnTypeһͶױ־ + ///////////////////////////////////////////////////////////////////////// + ///Speculation + #define THOST_FTDC_HFEN_Speculation '1' + ///Arbitrage + #define THOST_FTDC_HFEN_Arbitrage '2' + ///Hedge + #define THOST_FTDC_HFEN_Hedge '3' + + typedef char TThostFtdcHedgeFlagEnType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundIOTypeEnTypeһ + ///////////////////////////////////////////////////////////////////////// + ///Deposit/Withdrawal + #define THOST_FTDC_FIOTEN_FundIO '1' + ///Bank-Futures Transfer + #define THOST_FTDC_FIOTEN_Transfer '2' + ///Bank-Futures FX Exchange + #define THOST_FTDC_FIOTEN_SwapCurrency '3' + + typedef char TThostFtdcFundIOTypeEnType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundTypeEnTypeһʽ + ///////////////////////////////////////////////////////////////////////// + ///Bank Deposit + #define THOST_FTDC_FTEN_Deposite '1' + ///Payment/Fee + #define THOST_FTDC_FTEN_ItemFund '2' + ///Brokerage Adj + #define THOST_FTDC_FTEN_Company '3' + ///Internal Transfer + #define THOST_FTDC_FTEN_InnerTransfer '4' + + typedef char TThostFtdcFundTypeEnType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundDirectionEnTypeһ + ///////////////////////////////////////////////////////////////////////// + ///Deposit + #define THOST_FTDC_FDEN_In '1' + ///Withdrawal + #define THOST_FTDC_FDEN_Out '2' + + typedef char TThostFtdcFundDirectionEnType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFundMortDirectionEnTypeһѺ + ///////////////////////////////////////////////////////////////////////// + ///Pledge + #define THOST_FTDC_FMDEN_In '1' + ///Redemption + #define THOST_FTDC_FMDEN_Out '2' + + typedef char TThostFtdcFundMortDirectionEnType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSwapBusinessTypeTypeһҵ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcSwapBusinessTypeType[3]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOptionsTypeTypeһȨ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CP_CallOptions '1' + /// + #define THOST_FTDC_CP_PutOptions '2' + + typedef char TThostFtdcOptionsTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStrikeModeTypeһִзʽ + ///////////////////////////////////////////////////////////////////////// + ///ŷʽ + #define THOST_FTDC_STM_Continental '0' + ///ʽ + #define THOST_FTDC_STM_American '1' + ///Ľ + #define THOST_FTDC_STM_Bermuda '2' + + typedef char TThostFtdcStrikeModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStrikeTypeTypeһִ + ///////////////////////////////////////////////////////////////////////// + ///Գ + #define THOST_FTDC_STT_Hedge '0' + ///ƥִ + #define THOST_FTDC_STT_Match '1' + + typedef char TThostFtdcStrikeTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcApplyTypeTypeһнȨִ + ///////////////////////////////////////////////////////////////////////// + ///ִ + #define THOST_FTDC_APPT_NotStrikeNum '4' + + typedef char TThostFtdcApplyTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcGiveUpDataSourceTypeһִԴ + ///////////////////////////////////////////////////////////////////////// + ///ϵͳ + #define THOST_FTDC_GUDS_Gen '0' + ///ֹ + #define THOST_FTDC_GUDS_Hand '1' + + typedef char TThostFtdcGiveUpDataSourceType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExecOrderSysIDTypeһִϵͳ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcExecOrderSysIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExecResultTypeһִн + ///////////////////////////////////////////////////////////////////////// + ///ûִ + #define THOST_FTDC_OER_NoExec 'n' + ///Ѿȡ + #define THOST_FTDC_OER_Canceled 'c' + ///ִгɹ + #define THOST_FTDC_OER_OK '0' + ///Ȩֲֲ + #define THOST_FTDC_OER_NoPosition '1' + ///ʽ𲻹 + #define THOST_FTDC_OER_NoDeposit '2' + ///Ա + #define THOST_FTDC_OER_NoParticipant '3' + ///ͻ + #define THOST_FTDC_OER_NoClient '4' + ///Լ + #define THOST_FTDC_OER_NoInstrument '6' + ///ûִȨ + #define THOST_FTDC_OER_NoRight '7' + /// + #define THOST_FTDC_OER_InvalidVolume '8' + ///û㹻ʷɽ + #define THOST_FTDC_OER_NoEnoughHistoryTrade '9' + ///δ֪ + #define THOST_FTDC_OER_Unknown 'a' + + typedef char TThostFtdcExecResultType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStrikeSequenceTypeһִ + ///////////////////////////////////////////////////////////////////////// + typedef int TThostFtdcStrikeSequenceType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStrikeTimeTypeһִʱ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcStrikeTimeType[13]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCombinationTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///ڻ + #define THOST_FTDC_COMBT_Future '0' + ///ֱ۲BUL + #define THOST_FTDC_COMBT_BUL '1' + ///ֱ۲BER + #define THOST_FTDC_COMBT_BER '2' + ///ʽ + #define THOST_FTDC_COMBT_STD '3' + ///ʽ + #define THOST_FTDC_COMBT_STG '4' + /// + #define THOST_FTDC_COMBT_PRT '5' + ///ʱ۲ + #define THOST_FTDC_COMBT_CLD '6' + + typedef char TThostFtdcCombinationTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcOptionRoyaltyPriceTypeTypeһȨȨ۸ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_ORPT_PreSettlementPrice '1' + ///ּ + #define THOST_FTDC_ORPT_OpenPrice '4' + + typedef char TThostFtdcOptionRoyaltyPriceTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBalanceAlgorithmTypeһȨ㷨 + ///////////////////////////////////////////////////////////////////////// + ///Ȩֵӯ + #define THOST_FTDC_BLAG_Default '1' + ///Ȩֵ + #define THOST_FTDC_BLAG_IncludeOptValLost '2' + + typedef char TThostFtdcBalanceAlgorithmType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcActionTypeTypeһִ + ///////////////////////////////////////////////////////////////////////// + ///ִ + #define THOST_FTDC_ACTP_Exec '1' + /// + #define THOST_FTDC_ACTP_Abandon '2' + + typedef char TThostFtdcActionTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcForQuoteStatusTypeһѯ״̬ + ///////////////////////////////////////////////////////////////////////// + ///Ѿύ + #define THOST_FTDC_FQST_Submitted 'a' + ///Ѿ + #define THOST_FTDC_FQST_Accepted 'b' + ///Ѿܾ + #define THOST_FTDC_FQST_Rejected 'c' + + typedef char TThostFtdcForQuoteStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcValueMethodTypeһȡֵʽ + ///////////////////////////////////////////////////////////////////////// + ///ֵ + #define THOST_FTDC_VM_Absolute '0' + /// + #define THOST_FTDC_VM_Ratio '1' + + typedef char TThostFtdcValueMethodType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExecOrderPositionFlagTypeһȨȨǷڻͷı + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_EOPF_Reserve '0' + /// + #define THOST_FTDC_EOPF_UnReserve '1' + + typedef char TThostFtdcExecOrderPositionFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcExecOrderCloseFlagTypeһȨȨɵͷǷԶƽ + ///////////////////////////////////////////////////////////////////////// + ///Զƽ + #define THOST_FTDC_EOCF_AutoClose '0' + ///Զƽ + #define THOST_FTDC_EOCF_NotToClose '1' + + typedef char TThostFtdcExecOrderCloseFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcProductTypeTypeһƷ + ///////////////////////////////////////////////////////////////////////// + ///ڻ + #define THOST_FTDC_PTE_Futures '1' + ///Ȩ + #define THOST_FTDC_PTE_Options '2' + + typedef char TThostFtdcProductTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCZCEUploadFileNameTypeһ֣ļ + ///////////////////////////////////////////////////////////////////////// + ///^\d{8}_zz_\d{4} + #define THOST_FTDC_CUFN_CUFN_O 'O' + ///^\d{8}ɽ + #define THOST_FTDC_CUFN_CUFN_T 'T' + ///^\d{8}ȳֱֲnew + #define THOST_FTDC_CUFN_CUFN_P 'P' + ///^\d{8}ƽ˽ + #define THOST_FTDC_CUFN_CUFN_N 'N' + ///^\d{8}ƽֱ + #define THOST_FTDC_CUFN_CUFN_L 'L' + ///^\d{8}ʽ + #define THOST_FTDC_CUFN_CUFN_F 'F' + ///^\d{8}ϳֱֲ + #define THOST_FTDC_CUFN_CUFN_C 'C' + ///^\d{8}֤ + #define THOST_FTDC_CUFN_CUFN_M 'M' + + typedef char TThostFtdcCZCEUploadFileNameType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDCEUploadFileNameTypeһļ + ///////////////////////////////////////////////////////////////////////// + ///^\d{8}_dl_\d{3} + #define THOST_FTDC_DUFN_DUFN_O 'O' + ///^\d{8}_ɽ + #define THOST_FTDC_DUFN_DUFN_T 'T' + ///^\d{8}_ֱֲ + #define THOST_FTDC_DUFN_DUFN_P 'P' + ///^\d{8}_ʽ + #define THOST_FTDC_DUFN_DUFN_F 'F' + ///^\d{8}_Żϳֲϸ + #define THOST_FTDC_DUFN_DUFN_C 'C' + ///^\d{8}_ֲϸ + #define THOST_FTDC_DUFN_DUFN_D 'D' + ///^\d{8}_֤ + #define THOST_FTDC_DUFN_DUFN_M 'M' + ///^\d{8}_Ȩִб + #define THOST_FTDC_DUFN_DUFN_S 'S' + + typedef char TThostFtdcDCEUploadFileNameType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcSHFEUploadFileNameTypeһļ + ///////////////////////////////////////////////////////////////////////// + ///^\d{4}_\d{8}_\d{8}_DailyFundChg + #define THOST_FTDC_SUFN_SUFN_O 'O' + ///^\d{4}_\d{8}_\d{8}_Trade + #define THOST_FTDC_SUFN_SUFN_T 'T' + ///^\d{4}_\d{8}_\d{8}_SettlementDetail + #define THOST_FTDC_SUFN_SUFN_P 'P' + ///^\d{4}_\d{8}_\d{8}_Capital + #define THOST_FTDC_SUFN_SUFN_F 'F' + + typedef char TThostFtdcSHFEUploadFileNameType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCFFEXUploadFileNameTypeһнļ + ///////////////////////////////////////////////////////////////////////// + ///^\d{4}_SG\d{1}_\d{8}_\d{1}_Trade + #define THOST_FTDC_CFUFN_SUFN_T 'T' + ///^\d{4}_SG\d{1}_\d{8}_\d{1}_SettlementDetail + #define THOST_FTDC_CFUFN_SUFN_P 'P' + ///^\d{4}_SG\d{1}_\d{8}_\d{1}_Capital + #define THOST_FTDC_CFUFN_SUFN_F 'F' + ///^\d{4}_SG\d{1}_\d{8}_\d{1}_OptionExec + #define THOST_FTDC_CFUFN_SUFN_S 'S' + + typedef char TThostFtdcCFFEXUploadFileNameType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcCombDirectionTypeһָ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_CMDR_Comb '0' + /// + #define THOST_FTDC_CMDR_UnComb '1' + + typedef char TThostFtdcCombDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcLockTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// + #define THOST_FTDC_LCKT_Lock '1' + /// + #define THOST_FTDC_LCKT_Unlock '2' + + typedef char TThostFtdcLockTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcBizTypeTypeһҵ + ///////////////////////////////////////////////////////////////////////// + ///ڻ + #define THOST_FTDC_BZTP_Future '1' + ///֤ȯ + #define THOST_FTDC_BZTP_Stock '2' + + typedef char TThostFtdcBizTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcDesignateTypeTypeһָ + ///////////////////////////////////////////////////////////////////////// + ///ָǼ + #define THOST_FTDC_DSTP_Register '1' + ///ָ + #define THOST_FTDC_DSTP_Cancel '2' + + typedef char TThostFtdcDesignateTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFreezeReasonTypeTypeһԭ + ///////////////////////////////////////////////////////////////////////// + ///ʼ +#define THOST_FTDC_FRTP_Init '1' + /// +#define THOST_FTDC_FRTP_Lock '2' + ///ִ +#define THOST_FTDC_FRTP_Exec '3' + + typedef char TThostFtdcFreezeReasonTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcFreezeTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// +#define THOST_FTDC_FZTP_Freeze '1' + ///ⶳ +#define THOST_FTDC_FZTP_Unfreeze '2' + ///ǿִ +#define THOST_FTDC_FZTP_Force '3' + + typedef char TThostFtdcFreezeTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcTradeSystemTypeTypeһϵͳ + ///////////////////////////////////////////////////////////////////////// + ///δ֪ϵͳ +#define THOST_FTDC_TSTP_Unknow '0' + ///ڻϵͳ +#define THOST_FTDC_TSTP_Future '1' + ///ϵͳ +#define THOST_FTDC_TSTP_IShare '2' + + typedef char TThostFtdcTradeSystemTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStockDisposalTypeTypeһ֤ȯ÷ + ///////////////////////////////////////////////////////////////////////// + ///뾭͹˾˻ +#define THOST_FTDC_STPT_ToBroker '1' + ///Ͷ˻ +#define THOST_FTDC_STPT_ToInvestor '2' + + typedef char TThostFtdcStockDisposalTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStockDisposalSysIDTypeһ֤ȯñ + ///////////////////////////////////////////////////////////////////////// + typedef char TThostFtdcStockDisposalSysIDType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TFtdcStockDisposalStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + ///Ѿύ +#define THOST_FTDC_SDPS_Submitted 'a' + ///Ѿ +#define THOST_FTDC_SDPS_Accepted 'b' + ///Ѿܾ +#define THOST_FTDC_SDPS_Rejected 'c' + ///Ѿ +#define THOST_FTDC_SDPS_Cancelled 'd' + + typedef char TThostFtdcStockDisposalStatusType; +} // end of namespace KingstarAPI + +#endif diff --git a/include/Kingstar/IncEx/KSUserApiStructEx.h b/include/Kingstar/IncEx/KSUserApiStructEx.h new file mode 100644 index 0000000..ff907e1 --- /dev/null +++ b/include/Kingstar/IncEx/KSUserApiStructEx.h @@ -0,0 +1,8870 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSUserApiStructEx.h +///@brief ˿ͻ˽ӿʹõҵݽṹ +///////////////////////////////////////////////////////////////////////// + +#if !defined(KINSTARAPI_FTDCSTRUCT_H) +#define KINSTARAPI_FTDCSTRUCT_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "KSUserApiDataTypeEx.h" + +namespace KingstarAPI +{ + + ///Ϣַ + struct CThostFtdcDisseminationField + { + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///к + TThostFtdcSequenceNoType SequenceNo; + }; + + ///û¼ + struct CThostFtdcReqUserLoginField + { + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///նIPַ + TThostFtdcIPAddressType ClientIPAddress; + }; + + ///û¼Ӧ + struct CThostFtdcRspUserLoginField + { + /// + TThostFtdcDateType TradingDay; + ///¼ɹʱ + TThostFtdcTimeType LoginTime; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Դʱ + TThostFtdcTimeType INETime; + }; + + ///ûdz + struct CThostFtdcUserLogoutField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + }; + + ///ǿƽԱ˳ + struct CThostFtdcForceUserLogoutField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + }; + + ///ͻ֤ + struct CThostFtdcReqAuthenticateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤ + TThostFtdcAuthCodeType AuthCode; + }; + + ///ͻ֤Ӧ + struct CThostFtdcRspAuthenticateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + }; + + ///ͻ֤Ϣ + struct CThostFtdcAuthenticationInfoField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤Ϣ + TThostFtdcAuthInfoType AuthInfo; + ///ǷΪ֤ + TThostFtdcBoolType IsResult; + }; + + ///תʱͷ + struct CThostFtdcTransferHeaderField + { + ///汾ţ1.0 + TThostFtdcVersionType Version; + ///״룬 + TThostFtdcTradeCodeType TradeCode; + ///ڣʽyyyymmdd + TThostFtdcTradeDateType TradeDate; + ///ʱ䣬ʽhhmmss + TThostFtdcTradeTimeType TradeTime; + ///ˮţN/A + TThostFtdcTradeSerialType TradeSerial; + ///ڻ˾룬 + TThostFtdcFutureIDType FutureID; + ///д룬ݲѯеõ + TThostFtdcBankIDType BankID; + ///зĴ룬ݲѯеõ + TThostFtdcBankBrchIDType BankBrchID; + ///ԱN/A + TThostFtdcOperNoType OperNo; + ///豸ͣN/A + TThostFtdcDeviceIDType DeviceID; + ///¼N/A + TThostFtdcRecordNumType RecordNum; + ///ỰţN/A + TThostFtdcSessionIDType SessionID; + ///ţN/A + TThostFtdcRequestIDType RequestID; + }; + + ///ʽתڻTradeCode=202001 + struct CThostFtdcTransferBankToFutureReqField + { + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; + }; + + ///ʽתڻӦ + struct CThostFtdcTransferBankToFutureRspField + { + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyCodeType CurrencyCode; + }; + + ///ڻʽתTradeCode=202002 + struct CThostFtdcTransferFutureToBankReqField + { + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; + }; + + ///ڻʽתӦ + struct CThostFtdcTransferFutureToBankRspField + { + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyCodeType CurrencyCode; + }; + + ///ѯʽTradeCode=204002 + struct CThostFtdcTransferQryBankReqField + { + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; + }; + + ///ѯʽӦ + struct CThostFtdcTransferQryBankRspField + { + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + /// + TThostFtdcMoneyType TradeAmt; + ///п + TThostFtdcMoneyType UseAmt; + ///пȡ + TThostFtdcMoneyType FetchAmt; + /// + TThostFtdcCurrencyCodeType CurrencyCode; + }; + + ///ѯнϸTradeCode=204999 + struct CThostFtdcTransferQryDetailReqField + { + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + }; + + ///ѯнϸӦ + struct CThostFtdcTransferQryDetailRspField + { + /// + TThostFtdcDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///ڻˮ + TThostFtdcTradeSerialNoType FutureSerial; + ///ڻ˾ + TThostFtdcFutureIDType FutureID; + ///ʽʺ + TThostFtdcFutureAccountType FutureAccount; + ///ˮ + TThostFtdcTradeSerialNoType BankSerial; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + ///˺ + TThostFtdcBankAccountType BankAccount; + ///֤ + TThostFtdcCertCodeType CertCode; + ///Ҵ + TThostFtdcCurrencyCodeType CurrencyCode; + /// + TThostFtdcMoneyType TxAmount; + ///Ч־ + TThostFtdcTransferValidFlagType Flag; + }; + + ///ӦϢ + struct CThostFtdcRspInfoField + { + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + /// + struct CThostFtdcExchangeField + { + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcExchangeNameType ExchangeName; + /// + TThostFtdcExchangePropertyType ExchangeProperty; + }; + + ///Ʒ + struct CThostFtdcProductField + { + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductNameType ProductName; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceType PriceTick; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///ֲ + TThostFtdcPositionTypeType PositionType; + ///ֲ + TThostFtdcPositionDateTypeType PositionDateType; + ///ƽִ + TThostFtdcCloseDealTypeType CloseDealType; + ///ױ + TThostFtdcCurrencyIDType TradeCurrencyID; + ///Ѻʽ÷Χ + TThostFtdcMortgageFundUseRangeType MortgageFundUseRange; + ///Ʒ + TThostFtdcInstrumentIDType ExchangeProductID; + ///ԼƷ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; + }; + + ///Լ + struct CThostFtdcInstrumentField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentNameType InstrumentName; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + /// + TThostFtdcYearType DeliveryYear; + /// + TThostFtdcMonthType DeliveryMonth; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceType PriceTick; + /// + TThostFtdcDateType CreateDate; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcDateType ExpireDate; + ///ʼ + TThostFtdcDateType StartDelivDate; + /// + TThostFtdcDateType EndDelivDate; + ///Լ״̬ + TThostFtdcInstLifePhaseType InstLifePhase; + ///ǰǷ + TThostFtdcBoolType IsTrading; + ///ֲ + TThostFtdcPositionTypeType PositionType; + ///ֲ + TThostFtdcPositionDateTypeType PositionDateType; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatio; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatio; + ///Ƿʹô֤߱㷨 + TThostFtdcMaxMarginSideAlgorithmType MaxMarginSideAlgorithm; + ///Ʒ + TThostFtdcInstrumentIDType UnderlyingInstrID; + ///ִм + TThostFtdcPriceType StrikePrice; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType; + ///ԼƷ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; + /// + TThostFtdcCombinationTypeType CombinationType; + ///Сµλ + TThostFtdcVolumeType MinBuyVolume; + ///Сµλ + TThostFtdcVolumeType MinSellVolume; + ///Լʶ + TThostFtdcInstrumentCodeType InstrumentCode; + }; + + ///͹˾ + struct CThostFtdcBrokerField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ + TThostFtdcBrokerAbbrType BrokerAbbr; + ///͹˾ + TThostFtdcBrokerNameType BrokerName; + ///ǷԾ + TThostFtdcBoolType IsActive; + }; + + ///Ա + struct CThostFtdcTraderField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallCountType InstallCount; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + ///Ͷ + struct CThostFtdcInvestorField + { + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcDateType OpenDate; + ///ֻ + TThostFtdcMobileType Mobile; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + }; + + ///ױ + struct CThostFtdcTradingCodeField + { + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///ҵ + TThostFtdcBizTypeType BizType; + }; + + ///Ա;͹˾ձ + struct CThostFtdcPartBrokerField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ǷԾ + TThostFtdcBoolType IsActive; + }; + + ///û + struct CThostFtdcSuperUserField + { + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + /// + TThostFtdcPasswordType Password; + ///ǷԾ + TThostFtdcBoolType IsActive; + }; + + ///ûȨ + struct CThostFtdcSuperUserFunctionField + { + ///û + TThostFtdcUserIDType UserID; + ///ܴ + TThostFtdcFunctionCodeType FunctionCode; + }; + + ///Ͷ + struct CThostFtdcInvestorGroupField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ߷ + TThostFtdcInvestorGroupNameType InvestorGroupName; + }; + + ///ʽ˻ + struct CThostFtdcTradingAccountField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ϴѺ + TThostFtdcMoneyType PreMortgage; + ///ϴö + TThostFtdcMoneyType PreCredit; + ///ϴδ + TThostFtdcMoneyType PreDeposit; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///Ϣ + TThostFtdcMoneyType InterestBase; + ///Ϣ + TThostFtdcMoneyType Interest; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + ///ʽ + TThostFtdcMoneyType Available; + ///ȡʽ + TThostFtdcMoneyType WithdrawQuota; + ///׼ + TThostFtdcMoneyType Reserve; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ö + TThostFtdcMoneyType Credit; + ///Ѻ + TThostFtdcMoneyType Mortgage; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///Ͷ߽֤ + TThostFtdcMoneyType DeliveryMargin; + ///֤ + TThostFtdcMoneyType ExchangeDeliveryMargin; + ///ڻ׼ + TThostFtdcMoneyType ReserveBalance; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ϴλ + TThostFtdcMoneyType PreFundMortgageIn; + ///ϴλʳ + TThostFtdcMoneyType PreFundMortgageOut; + /// + TThostFtdcMoneyType FundMortgageIn; + ///ʳ + TThostFtdcMoneyType FundMortgageOut; + ///Ѻ + TThostFtdcMoneyType FundMortgageAvailable; + ///Ѻҽ + TThostFtdcMoneyType MortgageableFund; + ///Ʒռñ֤ + TThostFtdcMoneyType SpecProductMargin; + ///Ʒᱣ֤ + TThostFtdcMoneyType SpecProductFrozenMargin; + ///Ʒ + TThostFtdcMoneyType SpecProductCommission; + ///Ʒ + TThostFtdcMoneyType SpecProductFrozenCommission; + ///Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfit; + ///Ʒƽӯ + TThostFtdcMoneyType SpecProductCloseProfit; + ///ݳֲӯ㷨Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfitByAlg; + ///Ʒ֤ + TThostFtdcMoneyType SpecProductExchangeMargin; + ///ҵ + TThostFtdcBizTypeType BizType; + }; + + ///Ͷֲ߳ + struct CThostFtdcInvestorPositionField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcPositionDateType PositionDate; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ճֲ + TThostFtdcVolumeType Position; + ///ͷ + TThostFtdcVolumeType LongFrozen; + ///ͷ + TThostFtdcVolumeType ShortFrozen; + ///ֶ + TThostFtdcMoneyType LongFrozenAmount; + ///ֶ + TThostFtdcMoneyType ShortFrozenAmount; + /// + TThostFtdcVolumeType OpenVolume; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ֽ + TThostFtdcMoneyType OpenAmount; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ֲֳɱ + TThostFtdcMoneyType PositionCost; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ֳɱ + TThostFtdcMoneyType OpenCost; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///ϳɽγɵijֲ + TThostFtdcVolumeType CombPosition; + ///϶ͷ + TThostFtdcVolumeType CombLongFrozen; + ///Ͽͷ + TThostFtdcVolumeType CombShortFrozen; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///ճֲ + TThostFtdcVolumeType TodayPosition; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ִж + TThostFtdcVolumeType StrikeFrozen; + ///ִж + TThostFtdcMoneyType StrikeFrozenAmount; + ///ִж + TThostFtdcVolumeType AbandonFrozen; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Լ֤ + struct CThostFtdcInstrumentMarginRateField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; + }; + + ///Լ + struct CThostFtdcInstrumentCommissionRateField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ҵ + TThostFtdcBizTypeType BizType; + }; + + /// + struct CThostFtdcDepthMarketDataField + { + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; + ///վ + TThostFtdcPriceType AveragePrice; + ///ҵ + TThostFtdcDateType ActionDay; + }; + + ///ͶߺԼȨ + struct CThostFtdcInstrumentTradingRightField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ȩ + TThostFtdcTradingRightType TradingRight; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ҵ + TThostFtdcBizTypeType BizType; + }; + + ///͹˾û + struct CThostFtdcBrokerUserField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + ///û + TThostFtdcUserTypeType UserType; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///Ƿʹ + TThostFtdcBoolType IsUsingOTP; + }; + + ///͹˾û + struct CThostFtdcBrokerUserPasswordField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; + }; + + ///͹˾ûȨ + struct CThostFtdcBrokerUserFunctionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///͹˾ܴ + TThostFtdcBrokerFunctionCodeType BrokerFunctionCode; + }; + + ///Ա̻ + struct CThostFtdcTraderOfferField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ϯλɽ + TThostFtdcTradeIDType MaxTradeID; + ///ϯλ󱨵 + TThostFtdcReturnCodeType MaxOrderMessageReference; + ///ҵ + TThostFtdcBizTypeType BizType; + }; + + ///Ͷ߽ + struct CThostFtdcSettlementInfoField + { + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType Content; + }; + + ///Լ֤ʵ + struct CThostFtdcInstrumentMarginRateAdjustField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; + }; + + ///֤ + struct CThostFtdcExchangeMarginRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + }; + + ///֤ʵ + struct CThostFtdcExchangeMarginRateAdjustField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///潻Ͷ߶ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///潻Ͷ߶ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///潻Ͷ߿ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///潻Ͷ߿ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ExchLongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ExchLongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ExchShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ExchShortMarginRatioByVolume; + ///潻Ͷ߶ͷ֤ + TThostFtdcRatioType NoLongMarginRatioByMoney; + ///潻Ͷ߶ͷ֤ + TThostFtdcMoneyType NoLongMarginRatioByVolume; + ///潻Ͷ߿ͷ֤ + TThostFtdcRatioType NoShortMarginRatioByMoney; + ///潻Ͷ߿ͷ֤ + TThostFtdcMoneyType NoShortMarginRatioByVolume; + }; + + /// + struct CThostFtdcExchangeRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Դֵλ + TThostFtdcCurrencyUnitType FromCurrencyUnit; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; + /// + TThostFtdcExchangeRateType ExchangeRate; + }; + + /// + struct CThostFtdcSettlementRefField + { + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + }; + + ///ǰʱ + struct CThostFtdcCurrentTimeField + { + ///ǰ + TThostFtdcDateType CurrDate; + ///ǰʱ + TThostFtdcTimeType CurrTime; + ///ǰʱ䣨룩 + TThostFtdcMillisecType CurrMillisec; + ///ҵ + TThostFtdcDateType ActionDay; + }; + + ///ͨѶ׶ + struct CThostFtdcCommPhaseField + { + /// + TThostFtdcDateType TradingDay; + ///ͨѶʱα + TThostFtdcCommPhaseNoType CommPhaseNo; + ///ϵͳ + TThostFtdcSystemIDType SystemID; + }; + + ///¼Ϣ + struct CThostFtdcLoginInfoField + { + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + /// + TThostFtdcPasswordType Password; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///Դʱ + TThostFtdcTimeType INETime; + ///ѯʱǷҪ + TThostFtdcBoolType IsQryControl; + }; + + ///¼Ϣ + struct CThostFtdcLogoutAllField + { + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + }; + + ///ǰ״̬ + struct CThostFtdcFrontStatusField + { + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + ///ǷԾ + TThostFtdcBoolType IsActive; + }; + + ///û + struct CThostFtdcUserPasswordUpdateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; + }; + + ///뱨 + struct CThostFtdcInputOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///־ + TThostFtdcBoolType IsSwapOrder; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + /// + struct CThostFtdcOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ + TThostFtdcVolumeType ZCETotalTradedVolume; + ///־ + TThostFtdcBoolType IsSwapOrder; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + /// + struct CThostFtdcExchangeOrderField + { + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ʧ + struct CThostFtdcExchangeOrderInsertErrorField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///뱨 + struct CThostFtdcInputOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + /// + struct CThostFtdcOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + /// + struct CThostFtdcExchangeOrderActionField + { + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ʧ + struct CThostFtdcExchangeOrderActionErrorField + { + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + ///ɽ + struct CThostFtdcExchangeTradeField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ɽԴ + TThostFtdcTradeSourceType TradeSource; + }; + + ///ɽ + struct CThostFtdcTradeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ɽԴ + TThostFtdcTradeSourceType TradeSource; + }; + + ///ûỰ + struct CThostFtdcUserSessionField + { + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; + }; + + ///ѯ󱨵 + struct CThostFtdcQueryMaxOrderVolumeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ͷ߽ȷϢ + struct CThostFtdcSettlementInfoConfirmField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ȷ + TThostFtdcDateType ConfirmDate; + ///ȷʱ + TThostFtdcTimeType ConfirmTime; + }; + + ///ͬ + struct CThostFtdcSyncDepositField + { + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcMoneyType Deposit; + ///Ƿǿƽ + TThostFtdcBoolType IsForce; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///Ѻͬ + struct CThostFtdcSyncFundMortgageField + { + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Ѻ + TThostFtdcMoneyType MortgageAmount; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; + }; + + ///͹˾ͬ + struct CThostFtdcBrokerSyncField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + ///ͬеͶ + struct CThostFtdcSyncingInvestorField + { + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcDateType OpenDate; + ///ֻ + TThostFtdcMobileType Mobile; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + }; + + ///ͬеĽ״ + struct CThostFtdcSyncingTradingCodeField + { + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ͬеͶ߷ + struct CThostFtdcSyncingInvestorGroupField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ߷ + TThostFtdcInvestorGroupNameType InvestorGroupName; + }; + + ///ͬеĽ˺ + struct CThostFtdcSyncingTradingAccountField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ϴѺ + TThostFtdcMoneyType PreMortgage; + ///ϴö + TThostFtdcMoneyType PreCredit; + ///ϴδ + TThostFtdcMoneyType PreDeposit; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///Ϣ + TThostFtdcMoneyType InterestBase; + ///Ϣ + TThostFtdcMoneyType Interest; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + ///ʽ + TThostFtdcMoneyType Available; + ///ȡʽ + TThostFtdcMoneyType WithdrawQuota; + ///׼ + TThostFtdcMoneyType Reserve; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ö + TThostFtdcMoneyType Credit; + ///Ѻ + TThostFtdcMoneyType Mortgage; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///Ͷ߽֤ + TThostFtdcMoneyType DeliveryMargin; + ///֤ + TThostFtdcMoneyType ExchangeDeliveryMargin; + ///ڻ׼ + TThostFtdcMoneyType ReserveBalance; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ϴλ + TThostFtdcMoneyType PreFundMortgageIn; + ///ϴλʳ + TThostFtdcMoneyType PreFundMortgageOut; + /// + TThostFtdcMoneyType FundMortgageIn; + ///ʳ + TThostFtdcMoneyType FundMortgageOut; + ///Ѻ + TThostFtdcMoneyType FundMortgageAvailable; + ///Ѻҽ + TThostFtdcMoneyType MortgageableFund; + ///Ʒռñ֤ + TThostFtdcMoneyType SpecProductMargin; + ///Ʒᱣ֤ + TThostFtdcMoneyType SpecProductFrozenMargin; + ///Ʒ + TThostFtdcMoneyType SpecProductCommission; + ///Ʒ + TThostFtdcMoneyType SpecProductFrozenCommission; + ///Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfit; + ///Ʒƽӯ + TThostFtdcMoneyType SpecProductCloseProfit; + ///ݳֲӯ㷨Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfitByAlg; + ///Ʒ֤ + TThostFtdcMoneyType SpecProductExchangeMargin; + }; + + ///ͬеͶֲ߳ + struct CThostFtdcSyncingInvestorPositionField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcPositionDateType PositionDate; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ճֲ + TThostFtdcVolumeType Position; + ///ͷ + TThostFtdcVolumeType LongFrozen; + ///ͷ + TThostFtdcVolumeType ShortFrozen; + ///ֶ + TThostFtdcMoneyType LongFrozenAmount; + ///ֶ + TThostFtdcMoneyType ShortFrozenAmount; + /// + TThostFtdcVolumeType OpenVolume; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ֽ + TThostFtdcMoneyType OpenAmount; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ֲֳɱ + TThostFtdcMoneyType PositionCost; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ֳɱ + TThostFtdcMoneyType OpenCost; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///ϳɽγɵijֲ + TThostFtdcVolumeType CombPosition; + ///϶ͷ + TThostFtdcVolumeType CombLongFrozen; + ///Ͽͷ + TThostFtdcVolumeType CombShortFrozen; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///ճֲ + TThostFtdcVolumeType TodayPosition; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ִж + TThostFtdcVolumeType StrikeFrozen; + ///ִж + TThostFtdcMoneyType StrikeFrozenAmount; + ///ִж + TThostFtdcVolumeType AbandonFrozen; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ͬеĺԼ֤ + struct CThostFtdcSyncingInstrumentMarginRateField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; + }; + + ///ͬеĺԼ + struct CThostFtdcSyncingInstrumentCommissionRateField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ͬеĺԼȨ + struct CThostFtdcSyncingInstrumentTradingRightField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ȩ + TThostFtdcTradingRightType TradingRight; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯ + struct CThostFtdcQryOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + }; + + ///ѯɽ + struct CThostFtdcQryTradeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + ///ʼʱ + TThostFtdcTimeType TradeTimeStart; + ///ʱ + TThostFtdcTimeType TradeTimeEnd; + }; + + ///ѯͶֲ߳ + struct CThostFtdcQryInvestorPositionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯʽ˻ + struct CThostFtdcQryTradingAccountField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ҵ + TThostFtdcBizTypeType BizType; + }; + + ///ѯͶ + struct CThostFtdcQryInvestorField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///ѯױ + struct CThostFtdcQryTradingCodeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; + }; + + ///ѯͶ + struct CThostFtdcQryInvestorGroupField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + ///ѯԼ֤ + struct CThostFtdcQryInstrumentMarginRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + }; + + ///ѯ + struct CThostFtdcQryInstrumentCommissionRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯԼȨ + struct CThostFtdcQryInstrumentTradingRightField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯ͹˾ + struct CThostFtdcQryBrokerField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + ///ѯԱ + struct CThostFtdcQryTraderField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ѯûȨ + struct CThostFtdcQrySuperUserFunctionField + { + ///û + TThostFtdcUserIDType UserID; + }; + + ///ѯûỰ + struct CThostFtdcQryUserSessionField + { + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + }; + + ///ѯ͹˾Ա + struct CThostFtdcQryPartBrokerField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + }; + + ///ѯǰ״̬ + struct CThostFtdcQryFrontStatusField + { + ///ǰñ + TThostFtdcFrontIDType FrontID; + }; + + ///ѯ + struct CThostFtdcQryExchangeOrderField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ѯ + struct CThostFtdcQryOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯ + struct CThostFtdcQryExchangeOrderActionField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ѯû + struct CThostFtdcQrySuperUserField + { + ///û + TThostFtdcUserIDType UserID; + }; + + ///ѯ + struct CThostFtdcQryExchangeField + { + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯƷ + struct CThostFtdcQryProductField + { + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯԼ + struct CThostFtdcQryInstrumentField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + }; + + ///ѯ + struct CThostFtdcQryDepthMarketDataField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯ͹˾û + struct CThostFtdcQryBrokerUserField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + }; + + ///ѯ͹˾ûȨ + struct CThostFtdcQryBrokerUserFunctionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + }; + + ///ѯԱ̻ + struct CThostFtdcQryTraderOfferField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ѯˮ + struct CThostFtdcQrySyncDepositField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + }; + + ///ѯͶ߽ + struct CThostFtdcQrySettlementInfoField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; + }; + + ///ѯ֤ + struct CThostFtdcQryExchangeMarginRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + }; + + ///ѯ֤ + struct CThostFtdcQryExchangeMarginRateAdjustField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + }; + + ///ѯ + struct CThostFtdcQryExchangeRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; + }; + + ///ѯѺˮ + struct CThostFtdcQrySyncFundMortgageField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; + }; + + ///ѯ + struct CThostFtdcQryHisOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + }; + + ///ǰȨԼС֤ + struct CThostFtdcOptionInstrMiniMarginField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///λ֣ȨԼС֤ + TThostFtdcMoneyType MinMargin; + ///ȡֵʽ + TThostFtdcValueMethodType ValueMethod; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ǰȨԼ֤ϵ + struct CThostFtdcOptionInstrMarginAdjustField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷͷ֤ϵ + TThostFtdcRatioType SShortMarginRatioByMoney; + ///Ͷͷ֤ϵ + TThostFtdcMoneyType SShortMarginRatioByVolume; + ///ֵͷ֤ϵ + TThostFtdcRatioType HShortMarginRatioByMoney; + ///ֵͷ֤ϵ + TThostFtdcMoneyType HShortMarginRatioByVolume; + ///ͷ֤ϵ + TThostFtdcRatioType AShortMarginRatioByMoney; + ///ͷ֤ϵ + TThostFtdcMoneyType AShortMarginRatioByVolume; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ǰȨԼѵϸ + struct CThostFtdcOptionInstrCommRateField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///ִ + TThostFtdcRatioType StrikeRatioByMoney; + ///ִ + TThostFtdcRatioType StrikeRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ȩ׳ɱ + struct CThostFtdcOptionInstrTradeCostField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType FixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType MiniMargin; + ///ȨԼȨ + TThostFtdcMoneyType Royalty; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType ExchFixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType ExchMiniMargin; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ȩ׳ɱѯ + struct CThostFtdcQryOptionInstrTradeCostField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ + TThostFtdcPriceType InputPrice; + ///ļ۸,0 + TThostFtdcPriceType UnderlyingPrice; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ȩʲѯ + struct CThostFtdcQryOptionInstrCommRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ָָֻ + struct CThostFtdcIndexPriceField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ָֻ̼ + TThostFtdcPriceType ClosePrice; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ִ + struct CThostFtdcInputExecOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ִ + struct CThostFtdcInputExecOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + ///ִ + struct CThostFtdcExecOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerExecOrderSeq; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ִ + struct CThostFtdcExecOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ִѯ + struct CThostFtdcQryExecOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + }; + + ///ִϢ + struct CThostFtdcExchangeExecOrderField + { + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ִѯ + struct CThostFtdcQryExchangeExecOrderField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ִѯ + struct CThostFtdcQryExecOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ִ + struct CThostFtdcExchangeExecOrderActionField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ִѯ + struct CThostFtdcQryExchangeExecOrderActionField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ִ + struct CThostFtdcErrExecOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ѯִ + struct CThostFtdcQryErrExecOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///ִ + struct CThostFtdcErrExecOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ѯִ + struct CThostFtdcQryErrExecOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///ͶȨԼȨ + struct CThostFtdcOptionInstrTradingRightField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDirectionType Direction; + ///Ȩ + TThostFtdcTradingRightType TradingRight; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + }; + + ///ѯȨԼȨ + struct CThostFtdcQryOptionInstrTradingRightField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯ + struct CThostFtdcInputForQuoteField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯ + struct CThostFtdcForQuoteField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ѯ۱ + TThostFtdcSequenceNoType BrokerForQutoSeq; + }; + + ///ѯ۲ѯ + struct CThostFtdcQryForQuoteField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + }; + + ///ѯϢ + struct CThostFtdcExchangeForQuoteField + { + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; + }; + + ///ѯ۲ѯ + struct CThostFtdcQryExchangeForQuoteField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ı + struct CThostFtdcInputQuoteField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///뱨۲ + struct CThostFtdcInputQuoteActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + /// + struct CThostFtdcQuoteField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾۱ + TThostFtdcSequenceNoType BrokerQuoteSeq; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///۲ + struct CThostFtdcQuoteActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///۲ѯ + struct CThostFtdcQryQuoteField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + }; + + ///Ϣ + struct CThostFtdcExchangeQuoteField + { + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///۲ѯ + struct CThostFtdcQryExchangeQuoteField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///۲ѯ + struct CThostFtdcQryQuoteActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///۲ + struct CThostFtdcExchangeQuoteActionField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + }; + + ///۲ѯ + struct CThostFtdcQryExchangeQuoteActionField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ȨԼdeltaֵ + struct CThostFtdcOptionInstrDeltaField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Deltaֵ + TThostFtdcRatioType Delta; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///̵ѯ + struct CThostFtdcForQuoteRspField + { + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///ѯʱ + TThostFtdcTimeType ForQuoteTime; + ///ҵ + TThostFtdcDateType ActionDay; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ǰȨԼִƫֵϸ + struct CThostFtdcStrikeOffsetField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִƫֵ + TThostFtdcMoneyType Offset; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ȩִƫֵѯ + struct CThostFtdcQryStrikeOffsetField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + ///¼ + struct CThostFtdcInputLockField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType LockRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcLockTypeType LockType; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + /// + struct CThostFtdcLockField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType LockRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcLockTypeType LockType; + /// + TThostFtdcOrderLocalIDType LockLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType LockSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderActionStatusType LockStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerLockSeq; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ѯ + struct CThostFtdcQryLockField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType LockSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + }; + + ///֤ȯλ + struct CThostFtdcLockPositionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcVolumeType FrozenVolume; + }; + + ///ѯ֤ȯλ + struct CThostFtdcQryLockPositionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ǰETFȨԼѵϸ + struct CThostFtdcETFOptionInstrCommRateField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///ִ + TThostFtdcRatioType StrikeRatioByMoney; + ///ִ + TThostFtdcRatioType StrikeRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲַ + TThostFtdcPosiDirectionType PosiDirection; + }; + + ///ETFȨʲѯ + struct CThostFtdcQryETFOptionInstrCommRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ijֲֶ + struct CThostFtdcPosiFreezeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcVolumeType Volume; + ///ԭ + TThostFtdcFreezeReasonTypeType FreezeReasonType; + /// + TThostFtdcFreezeTypeType FreezeType; + }; + + ///ѯ + struct CThostFtdcQryExchangeLockField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + /// + struct CThostFtdcExchangeLockField + { + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcLockTypeType LockType; + /// + TThostFtdcOrderLocalIDType LockLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType LockSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderActionStatusType LockStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + /// + struct CThostFtdcExchangeExecOrderActionErrorField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + /// + struct CThostFtdcInputBatchOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///û + TThostFtdcUserIDType UserID; + }; + + /// + struct CThostFtdcBatchOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + }; + + /// + struct CThostFtdcExchangeBatchOrderActionField + { + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + }; + + ///ѯ + struct CThostFtdcQryBatchOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ͷֲ߳ + struct CThostFtdcLimitPosiField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType TotalVolume; + ///ͷ + TThostFtdcVolumeType LongVolume; + ///նͷ + TThostFtdcVolumeType OpenVolume; + ///ͷֲֽ + TThostFtdcMoneyType LongAmount; + /// + TThostFtdcVolumeType TotalVolumeFrozen; + ///ͷ + TThostFtdcVolumeType LongVolumeFrozen; + ///նͷ + TThostFtdcVolumeType OpenVolumeFrozen; + ///ͷֲֽ + TThostFtdcMoneyType LongAmountFrozen; + }; + + ///ѯͶֲ߳ + struct CThostFtdcQryLimitPosiField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///͹˾ֲ + struct CThostFtdcBrokerLimitPosiField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcLargeVolumeType TotalVolume; + ///ͷ + TThostFtdcLargeVolumeType LongVolume; + /// + TThostFtdcLargeVolumeType TotalVolumeFrozen; + ///ͷ + TThostFtdcLargeVolumeType LongVolumeFrozen; + }; + + ///ѯ͹˾ֲ + struct CThostFtdcQryBrokerLimitPosiField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ͷ֤ȯֲ + struct CThostFtdcLimitPosiSField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType TotalVolume; + ///տ + TThostFtdcVolumeType OpenVolume; + /// + TThostFtdcVolumeType TotalVolumeFrozen; + ///տ + TThostFtdcVolumeType OpenVolumeFrozen; + }; + + ///ѯͶ֤ȯֲ + struct CThostFtdcQryLimitPosiSField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ͷֲ߳Ʋ + struct CThostFtdcLimitPosiParamField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType TotalVolume; + ///ͷ + TThostFtdcVolumeType LongVolume; + ///նͷ + TThostFtdcVolumeType OpenVolume; + ///ͷֲֽ + TThostFtdcMoneyType LongAmount; + }; + + ///͹˾ֲƲ + struct CThostFtdcBrokerLimitPosiParamField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcLargeVolumeType TotalVolume; + ///ͷ + TThostFtdcLargeVolumeType LongVolume; + }; + + ///Ͷ֤ȯֲƲ + struct CThostFtdcLimitPosiParamSField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcVolumeType TotalVolume; + ///տ + TThostFtdcVolumeType OpenVolume; + }; + + ///֤ȯò + struct CThostFtdcInputStockDisposalActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯò + TThostFtdcOrderActionRefType StockDisposalActionRef; + ///֤ȯ + TThostFtdcOrderRefType StockDisposalRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + ///֤ȯò + struct CThostFtdcStockDisposalActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯò + TThostFtdcOrderActionRefType StockDisposalActionRef; + ///֤ȯ + TThostFtdcOrderRefType StockDisposalRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///֤ȯòѯ + struct CThostFtdcQryStockDisposalActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///֤ȯò + struct CThostFtdcExchangeStockDisposalActionField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///֤ȯò + struct CThostFtdcQryExchangeStockDisposalActionField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ѯ֤ȯò + struct CThostFtdcQryErrStockDisposalActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///֤ȯò + struct CThostFtdcExchangeStockDisposalActionErrorField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯñ + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + ///֤ȯò + struct CThostFtdcErrStockDisposalActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯò + TThostFtdcOrderActionRefType StockDisposalActionRef; + ///֤ȯ + TThostFtdcOrderRefType StockDisposalRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ϺԼȫϵ + struct CThostFtdcCombInstrumentGuardField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ȫϵ + TThostFtdcRatioType GuarantRatio; + }; + + ///ϺԼȫϵѯ + struct CThostFtdcQryCombInstrumentGuardField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + /// + struct CThostFtdcInputCombActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + /// + struct CThostFtdcCombActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϱ + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///״̬ + TThostFtdcOrderActionStatusType ActionStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + }; + + ///ϲѯ + struct CThostFtdcQryCombActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ϣ + struct CThostFtdcExchangeCombActionField + { + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϱ + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///״̬ + TThostFtdcOrderActionStatusType ActionStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcSequenceNoType SequenceNo; + }; + + ///ϲѯ + struct CThostFtdcQryExchangeCombActionField + { + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///Ʒۻ + struct CThostFtdcProductExchRateField + { + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///۱ + TThostFtdcCurrencyIDType QuoteCurrencyID; + /// + TThostFtdcExchangeRateType ExchangeRate; + }; + + ///Ʒۻʲѯ + struct CThostFtdcQryProductExchRateField + { + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + }; + + ///ָ + struct CThostFtdcInputDesignateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ָǼ + TThostFtdcOrderRefType DesignateRef; + ///û + TThostFtdcUserIDType UserID; + ///ָ + TThostFtdcDesignateTypeType DesignateType; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ָ + struct CThostFtdcDesignateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ָǼ + TThostFtdcOrderRefType DesignateRef; + ///û + TThostFtdcUserIDType UserID; + ///ָ + TThostFtdcDesignateTypeType DesignateType; + ///ָ + TThostFtdcOrderLocalIDType DesignateLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ָ״̬ + TThostFtdcOrderActionStatusType DesignateStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ָ + struct CThostFtdcQryDesignateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ָϢ + struct CThostFtdcExchangeDesignateField + { + ///ָ + TThostFtdcDesignateTypeType DesignateType; + ///ָ + TThostFtdcOrderLocalIDType DesignateLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ָ״̬ + TThostFtdcOrderActionStatusType DesignateStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///֤ȯ + struct CThostFtdcInputStockDisposalField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯõǼ + TThostFtdcOrderRefType StockDisposalRef; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcVolumeType Volume; + ///֤ȯ÷ + TThostFtdcStockDisposalTypeType StockDisposalType; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///֤ȯ + struct CThostFtdcStockDisposalField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤ȯõǼ + TThostFtdcOrderRefType StockDisposalRef; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcVolumeType Volume; + ///֤ȯ÷ + TThostFtdcStockDisposalTypeType StockDisposalType; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯ״̬ + TThostFtdcStockDisposalStatusType StockDisposalStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + }; + + ///֤ȯ + struct CThostFtdcQryStockDisposalField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///֤ȯϢ + struct CThostFtdcExchangeStockDisposalField + { + /// + TThostFtdcVolumeType Volume; + ///֤ȯ÷ + TThostFtdcStockDisposalTypeType StockDisposalType; + ///֤ȯñ + TThostFtdcOrderLocalIDType StockDisposalLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ȯ״̬ + TThostFtdcStockDisposalStatusType StockDisposalStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + ///֤ȯò + TThostFtdcStockDisposalSysIDType StockDisposalSysID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + }; + + ///ǰѵϸ + struct CThostFtdcInstrumentOrderCommRateField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcRatioType OrderCommByVolume; + /// + TThostFtdcRatioType OrderActionCommByVolume; + }; + + ///ʲѯ + struct CThostFtdcQryInstrumentOrderCommRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + ///г + struct CThostFtdcMarketDataField + { + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; + }; + + /// + struct CThostFtdcMarketDataBaseField + { + /// + TThostFtdcDateType TradingDay; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + ///ʵ + TThostFtdcRatioType PreDelta; + }; + + ///龲̬ + struct CThostFtdcMarketDataStaticField + { + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcPriceType ClosePrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ʵ + TThostFtdcRatioType CurrDelta; + }; + + ///³ɽ + struct CThostFtdcMarketDataLastMatchField + { + ///¼ + TThostFtdcPriceType LastPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + }; + + ///ż + struct CThostFtdcMarketDataBestPriceField + { + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; + }; + + /// + struct CThostFtdcMarketDataBid23Field + { + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; + }; + + /// + struct CThostFtdcMarketDataAsk23Field + { + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; + }; + + ///ġ + struct CThostFtdcMarketDataBid45Field + { + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; + }; + + ///ġ + struct CThostFtdcMarketDataAsk45Field + { + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; + }; + + ///ʱ + struct CThostFtdcMarketDataUpdateTimeField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///齻 + struct CThostFtdcMarketDataExchangeField + { + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ָĺԼ + struct CThostFtdcSpecificInstrumentField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + ///Լ״̬ + struct CThostFtdcInstrumentStatusField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcSettlementGroupIDType SettlementGroupID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Լ״̬ + TThostFtdcInstrumentStatusType InstrumentStatus; + ///׽׶α + TThostFtdcTradingSegmentSNType TradingSegmentSN; + ///뱾״̬ʱ + TThostFtdcTimeType EnterTime; + ///뱾״̬ԭ + TThostFtdcInstStatusEnterReasonType EnterReason; + }; + + ///ѯԼ״̬ + struct CThostFtdcQryInstrumentStatusField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + }; + + ///Ͷ˻ + struct CThostFtdcInvestorAccountField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///ӯ㷨 + struct CThostFtdcPositionProfitAlgorithmField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///ע + TThostFtdcMemoType Memo; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///Աʽۿ + struct CThostFtdcDiscountField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʽۿ۱ + TThostFtdcRatioType Discount; + }; + + ///ѯת + struct CThostFtdcQryTransferBankField + { + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + }; + + ///ת + struct CThostFtdcTransferBankField + { + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; + ///ǷԾ + TThostFtdcBoolType IsActive; + }; + + ///ѯͶֲ߳ϸ + struct CThostFtdcQryInvestorPositionDetailField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Ͷֲ߳ϸ + struct CThostFtdcInvestorPositionDetailField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcDateType OpenDate; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcVolumeType Volume; + ///ּ + TThostFtdcPriceType OpenPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///նгֲӯ + TThostFtdcMoneyType PositionProfitByDate; + ///ʶԳֲӯ + TThostFtdcMoneyType PositionProfitByTrade; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + /// + TThostFtdcPriceType LastSettlementPrice; + /// + TThostFtdcPriceType SettlementPrice; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + }; + + ///ʽ˻ + struct CThostFtdcTradingAccountPasswordField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///鱨̻ + struct CThostFtdcMDTraderOfferField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ϯλɽ + TThostFtdcTradeIDType MaxTradeID; + ///ϯλ󱨵 + TThostFtdcReturnCodeType MaxOrderMessageReference; + ///ҵ + TThostFtdcBizTypeType BizType; + }; + + ///ѯ鱨̻ + struct CThostFtdcQryMDTraderOfferField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + }; + + ///ѯͻ֪ͨ + struct CThostFtdcQryNoticeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + ///ͻ֪ͨ + struct CThostFtdcNoticeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ϣ + TThostFtdcContentType Content; + ///͹˾֪ͨк + TThostFtdcSequenceLabelType SequenceLabel; + }; + + ///ûȨ + struct CThostFtdcUserRightField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ͻȨ + TThostFtdcUserRightTypeType UserRightType; + ///Ƿֹ + TThostFtdcBoolType IsForbidden; + }; + + ///ѯϢȷ + struct CThostFtdcQrySettlementInfoConfirmField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///װؽϢ + struct CThostFtdcLoadSettlementInfoField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + ///͹˾ʽ㷨 + struct CThostFtdcBrokerWithdrawAlgorithmField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ㷨 + TThostFtdcAlgorithmType WithdrawAlgorithm; + ///ʽʹ + TThostFtdcRatioType UsingRatio; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType IncludeCloseProfit; + ///޲޳ɽͻǷܿ + TThostFtdcAllWithoutTradeType AllWithoutTrade; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///Ƿû¼ + TThostFtdcBoolType IsBrokerUserEvent; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; + ///Ȩ㷨 + TThostFtdcBalanceAlgorithmType BalanceAlgorithm; + }; + + ///ʽ˻ + struct CThostFtdcTradingAccountPasswordUpdateV1Field + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; + }; + + ///ʽ˻ + struct CThostFtdcTradingAccountPasswordUpdateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///ѯϺԼ + struct CThostFtdcQryCombinationLegField + { + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; + }; + + ///ѯϺԼ + struct CThostFtdcQrySyncStatusField + { + /// + TThostFtdcDateType TradingDay; + }; + + ///Ͻ׺Լĵ + struct CThostFtdcCombinationLegField + { + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + /// + TThostFtdcImplyLevelType ImplyLevel; + }; + + ///ͬ״̬ + struct CThostFtdcSyncStatusField + { + /// + TThostFtdcDateType TradingDay; + ///ͬ״̬ + TThostFtdcDataSyncStatusType DataSyncStatus; + }; + + ///ѯϵ + struct CThostFtdcQryLinkManField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///ϵ + struct CThostFtdcLinkManField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵ + TThostFtdcPersonTypeType PersonType; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + /// + TThostFtdcPartyNameType PersonName; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcZipCodeType ZipCode; + ///ȼ + TThostFtdcPriorityType Priority; + /// + TThostFtdcUOAZipCodeType UOAZipCode; + ///ȫ + TThostFtdcInvestorFullNameType PersonFullName; + }; + + ///ѯ͹˾û¼ + struct CThostFtdcQryBrokerUserEventField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; + }; + + ///ѯ͹˾û¼ + struct CThostFtdcBrokerUserEventField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; + ///û¼ + TThostFtdcSequenceNoType EventSequenceNo; + ///¼ + TThostFtdcDateType EventDate; + ///¼ʱ + TThostFtdcTimeType EventTime; + ///û¼Ϣ + TThostFtdcUserEventInfoType UserEventInfo; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯǩԼ + struct CThostFtdcQryContractBankField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + }; + + ///ѯǩԼӦ + struct CThostFtdcContractBankField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; + }; + + ///Ͷϳֲϸ + struct CThostFtdcInvestorPositionCombineDetailField + { + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///ϱ + TThostFtdcTradeIDType TradeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + ///ֲ + TThostFtdcVolumeType TotalAmt; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ɽ + TThostFtdcTradeGroupIDType TradeGroupID; + }; + + ///Ԥ + struct CThostFtdcParkedOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ԥ񱨵 + TThostFtdcParkedOrderIDType ParkedOrderID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ״̬ + TThostFtdcParkedOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; + }; + + ///Ԥ񵥲 + struct CThostFtdcParkedOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ԥ񳷵 + TThostFtdcParkedOrderActionIDType ParkedOrderActionID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ񳷵״̬ + TThostFtdcParkedOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ѯԤ + struct CThostFtdcQryParkedOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯԤ񳷵 + struct CThostFtdcQryParkedOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ɾԤ + struct CThostFtdcRemoveParkedOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񱨵 + TThostFtdcParkedOrderIDType ParkedOrderID; + }; + + ///ɾԤ񳷵 + struct CThostFtdcRemoveParkedOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񳷵 + TThostFtdcParkedOrderActionIDType ParkedOrderActionID; + }; + + ///͹˾ʽ㷨 + struct CThostFtdcInvestorWithdrawAlgorithmField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʽ + TThostFtdcRatioType UsingRatio; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; + }; + + ///ѯϳֲϸ + struct CThostFtdcQryInvestorPositionCombineDetailField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + }; + + ///ɽ + struct CThostFtdcMarketDataAveragePriceField + { + ///վ + TThostFtdcPriceType AveragePrice; + }; + + ///УͶ + struct CThostFtdcVerifyInvestorPasswordField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcPasswordType Password; + }; + + ///ûIP + struct CThostFtdcUserIPField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///IPַ + TThostFtdcIPAddressType IPMask; + ///Macַ + TThostFtdcMacAddressType MacAddress; + }; + + ///û¼֪ͨϢ + struct CThostFtdcTradingNoticeInfoField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʱ + TThostFtdcTimeType SendTime; + ///Ϣ + TThostFtdcContentType FieldContent; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///к + TThostFtdcSequenceNoType SequenceNo; + }; + + ///û¼֪ͨ + struct CThostFtdcTradingNoticeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///û + TThostFtdcUserIDType UserID; + ///ʱ + TThostFtdcTimeType SendTime; + ///к + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType FieldContent; + }; + + ///ѯ¼֪ͨ + struct CThostFtdcQryTradingNoticeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///ѯ󱨵 + struct CThostFtdcQryErrOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///󱨵 + struct CThostFtdcErrOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯ󱨵 + struct CThostFtdcErrorConditionalOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ + TThostFtdcVolumeType ZCETotalTradedVolume; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + }; + + ///ѯ󱨵 + struct CThostFtdcQryErrOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///󱨵 + struct CThostFtdcErrOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ӫҵ + TThostFtdcBranchIDType BranchID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ѯ״̬ + struct CThostFtdcQryExchangeSequenceField + { + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///״̬ + struct CThostFtdcExchangeSequenceField + { + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Լ״̬ + TThostFtdcInstrumentStatusType MarketStatus; + }; + + ///ݼ۸ѯ󱨵 + struct CThostFtdcQueryMaxOrderVolumeWithPriceField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯ͹˾ײ + struct CThostFtdcQryBrokerTradingParamsField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///͹˾ײ + struct CThostFtdcBrokerTradingParamsField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤۸ + TThostFtdcMarginPriceTypeType MarginPriceType; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ȨȨ۸ + TThostFtdcOptionRoyaltyPriceTypeType OptionRoyaltyPriceType; + }; + + ///ѯ͹˾㷨 + struct CThostFtdcQryBrokerTradingAlgosField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + ///͹˾㷨 + struct CThostFtdcBrokerTradingAlgosField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ֲִ㷨 + TThostFtdcHandlePositionAlgoIDType HandlePositionAlgoID; + ///Ѱұ֤㷨 + TThostFtdcFindMarginRateAlgoIDType FindMarginRateAlgoID; + ///ʽ㷨 + TThostFtdcHandleTradingAccountAlgoIDType HandleTradingAccountAlgoID; + }; + + ///ѯ͹˾ʽ + struct CThostFtdcQueryBrokerDepositField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///͹˾ʽ + struct CThostFtdcBrokerDepositField + { + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ʽ + TThostFtdcMoneyType Available; + ///׼ + TThostFtdcMoneyType Reserve; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + }; + + ///ѯ֤ϵͳ͹˾Կ + struct CThostFtdcQryCFMMCBrokerKeyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + }; + + ///֤ϵͳ͹˾Կ + struct CThostFtdcCFMMCBrokerKeyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Կ + TThostFtdcDateType CreateDate; + ///Կʱ + TThostFtdcTimeType CreateTime; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬Կ + TThostFtdcCFMMCKeyType CurrentKey; + ///̬Կ + TThostFtdcCFMMCKeyKindType KeyKind; + }; + + ///֤ϵͳ͹˾ʽ˻Կ + struct CThostFtdcCFMMCTradingAccountKeyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬Կ + TThostFtdcCFMMCKeyType CurrentKey; + }; + + ///ѯ֤ϵͳ͹˾ʽ˻Կ + struct CThostFtdcQryCFMMCTradingAccountKeyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///û̬Ʋ + struct CThostFtdcBrokerUserOTPParamField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ṩ + TThostFtdcOTPVendorsIDType OTPVendorsID; + ///̬к + TThostFtdcSerialNumberType SerialNumber; + ///Կ + TThostFtdcAuthKeyType AuthKey; + ///Ưֵ + TThostFtdcLastDriftType LastDrift; + ///ɹֵ + TThostFtdcLastSuccessType LastSuccess; + ///̬ + TThostFtdcOTPTypeType OTPType; + }; + + ///ֹͬû̬ + struct CThostFtdcManualSyncBrokerUserOTPField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ + TThostFtdcOTPTypeType OTPType; + ///һ̬ + TThostFtdcPasswordType FirstOTP; + ///ڶ̬ + TThostFtdcPasswordType SecondOTP; + }; + + ///Ͷģ + struct CThostFtdcCommRateModelField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///ģ + TThostFtdcCommModelNameType CommModelName; + }; + + ///ѯͶģ + struct CThostFtdcQryCommRateModelField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; + }; + + ///Ͷ֤߱ģ + struct CThostFtdcMarginModelField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + ///ģ + TThostFtdcCommModelNameType MarginModelName; + }; + + ///ѯͶ֤߱ģ + struct CThostFtdcQryMarginModelField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + }; + + ///ֵ۵Ϣ + struct CThostFtdcEWarrantOffsetField + { + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType Volume; + }; + + ///ѯֵ۵Ϣ + struct CThostFtdcQryEWarrantOffsetField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + ///ѯͶƷ/Ʒֱ֤ + struct CThostFtdcQryInvestorProductGroupMarginField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + }; + + ///ͶƷ/Ʒֱ֤ + struct CThostFtdcInvestorProductGroupMarginField + { + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType LongFrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType ShortFrozenMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ͷ֤ + TThostFtdcMoneyType LongUseMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortUseMargin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///ͷ֤ + TThostFtdcMoneyType LongExchMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortExchMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + /// + TThostFtdcMoneyType FrozenCommission; + /// + TThostFtdcMoneyType Commission; + ///ʽ + TThostFtdcMoneyType FrozenCash; + ///ʽ + TThostFtdcMoneyType CashIn; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///۵ܽ + TThostFtdcMoneyType OffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortOffsetAmount; + ///۵ܽ + TThostFtdcMoneyType ExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortExchOffsetAmount; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + }; + + ///ѯû + struct CThostFtdcQueryCFMMCTradingAccountTokenField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///û + struct CThostFtdcCFMMCTradingAccountTokenField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬ + TThostFtdcCFMMCTokenType Token; + }; + + ///ѯƷ + struct CThostFtdcQryProductGroupField + { + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ͶƷ/Ʒֱ֤Ʒ + struct CThostFtdcProductGroupField + { + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductGroupID; + }; + + ///תʿ + struct CThostFtdcReqOpenAccountField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + }; + + ///ת + struct CThostFtdcReqCancelAccountField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + }; + + ///˻ + struct CThostFtdcReqChangeAccountField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; + }; + + ///ת + struct CThostFtdcReqTransferField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + }; + + ///зʽתڻӦ + struct CThostFtdcRspTransferField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + /// + struct CThostFtdcReqRepealField + { + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + }; + + ///Ӧ + struct CThostFtdcRspRepealField + { + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ѯ˻Ϣ + struct CThostFtdcReqQueryAccountField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + }; + + ///ѯ˻ϢӦ + struct CThostFtdcRspQueryAccountField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; + }; + + ///ǩǩ + struct CThostFtdcFutureSignIOField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + }; + + ///ǩӦ + struct CThostFtdcRspFutureSignInField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; + }; + + ///ǩ + struct CThostFtdcReqFutureSignOutField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + }; + + ///ǩӦ + struct CThostFtdcRspFutureSignOutField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ѯָˮŵĽ׽ + struct CThostFtdcReqQueryTradeResultBySerialField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ˮ + TThostFtdcSerialType Reference; + ///ˮŷߵĻ + TThostFtdcInstitutionTypeType RefrenceIssureType; + ///ˮŷ߻ + TThostFtdcOrganCodeType RefrenceIssure; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ժҪ + TThostFtdcDigestType Digest; + }; + + ///ѯָˮŵĽ׽Ӧ + struct CThostFtdcRspQueryTradeResultBySerialField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///ˮ + TThostFtdcSerialType Reference; + ///ˮŷߵĻ + TThostFtdcInstitutionTypeType RefrenceIssureType; + ///ˮŷ߻ + TThostFtdcOrganCodeType RefrenceIssure; + ///ԭʼش + TThostFtdcReturnCodeType OriginReturnCode; + ///ԭʼ + TThostFtdcDescrInfoForReturnCodeType OriginDescrInfoForReturnCode; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ժҪ + TThostFtdcDigestType Digest; + }; + + ///ļ + struct CThostFtdcReqDayEndFileReadyField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ļҵ + TThostFtdcFileBusinessCodeType FileBusinessCode; + ///ժҪ + TThostFtdcDigestType Digest; + }; + + ///ؽ + struct CThostFtdcReturnResultField + { + ///ش + TThostFtdcReturnCodeType ReturnCode; + /// + TThostFtdcDescrInfoForReturnCodeType DescrInfoForReturnCode; + }; + + ///֤ڻʽ + struct CThostFtdcVerifyFuturePasswordField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///װ + TThostFtdcInstallIDType InstallID; + ///ID + TThostFtdcTIDType TID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///֤ͻϢ + struct CThostFtdcVerifyCustInfoField + { + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + }; + + ///֤ڻʽͿͻϢ + struct CThostFtdcVerifyFuturePasswordAndCustInfoField + { + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///֤ڻʽͿͻϢ + struct CThostFtdcDepositResultInformField + { + ///ˮţˮΪڱ̷صˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcRequestIDType RequestID; + ///ش + TThostFtdcReturnCodeType ReturnCode; + /// + TThostFtdcDescrInfoForReturnCodeType DescrInfoForReturnCode; + }; + + ///׺ڱ̷Կͬ + struct CThostFtdcReqSyncKeyField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + }; + + ///׺ڱ̷ԿͬӦ + struct CThostFtdcRspSyncKeyField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ѯ˻Ϣ֪ͨ + struct CThostFtdcNotifyQueryAccountField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ת˽ˮ + struct CThostFtdcTransferSerialField + { + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateSerial; + ///׷ + TThostFtdcTradeDateType TradeDate; + /// + TThostFtdcDateType TradingDay; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///Ự + TThostFtdcSessionIDType SessionID; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///ڻ˾ʺ + TThostFtdcFutureAccTypeType FutureAccType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///׽ + TThostFtdcTradeAmountType TradeAmount; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///Ч־ + TThostFtdcAvailabilityFlagType AvailabilityFlag; + ///Ա + TThostFtdcOperatorCodeType OperatorCode; + ///ʺ + TThostFtdcBankAccountType BankNewAccount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ѯתˮ + struct CThostFtdcQryTransferSerialField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///ǩ֪ͨ + struct CThostFtdcNotifyFutureSignInField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; + }; + + ///ǩ֪ͨ + struct CThostFtdcNotifyFutureSignOutField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///׺ڱ̷Կ֪ͬͨ + struct CThostFtdcNotifySyncKeyField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ѯǩԼϵ + struct CThostFtdcQryAccountregisterField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///ͻϢ + struct CThostFtdcAccountregisterField + { + /// + TThostFtdcTradeDateType TradeDay; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///ڻ˾֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcOpenOrDestroyType OpenOrDestroy; + ///ǩԼ + TThostFtdcTradeDateType RegDate; + ///Լ + TThostFtdcTradeDateType OutDate; + ///ID + TThostFtdcTIDType TID; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + }; + + ///ڿϢ + struct CThostFtdcOpenAccountField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///Ϣ + struct CThostFtdcCancelAccountField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ڱ˺Ϣ + struct CThostFtdcChangeAccountField + { + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + }; + + ///ԱȨ + struct CThostFtdcSecAgentACIDMapField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcCurrencyIDType CurrencyID; + ///нʽʺ + TThostFtdcAccountIDType BrokerSecAgentID; + }; + + ///ԱȨ޲ѯ + struct CThostFtdcQrySecAgentACIDMapField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///ֱĽȨ + struct CThostFtdcUserRightsAssignField + { + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; + }; + + ///ù˾ǷڱʾĽȨ + struct CThostFtdcBrokerUserRightAssignField + { + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; + ///ܷ + TThostFtdcBoolType Tradeable; + }; + + ///ֱת + struct CThostFtdcDRTransferField + { + ///ԭĴ + TThostFtdcDRIdentityIDType OrigDRIdentityID; + ///Ŀ꽻Ĵ + TThostFtdcDRIdentityIDType DestDRIdentityID; + ///ԭӦõԪ + TThostFtdcBrokerIDType OrigBrokerID; + ///ĿõԪ + TThostFtdcBrokerIDType DestBrokerID; + }; + + ///FensûϢ + struct CThostFtdcFensUserInfoField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ģʽ + TThostFtdcLoginModeType LoginMode; + }; + + ///ǰ + struct CThostFtdcCurrTransferIdentityField + { + ///Ĵ + TThostFtdcDRIdentityIDType IdentityID; + }; + + ///ֹ¼û + struct CThostFtdcLoginForbiddenUserField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + }; + + ///ѯֹ¼û + struct CThostFtdcQryLoginForbiddenUserField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + }; + + ///UDP鲥Ϣ + struct CThostFtdcMulticastGroupInfoField + { + ///鲥IPַ + TThostFtdcIPAddressType GroupIP; + ///鲥IP˿ + TThostFtdcIPPortType GroupPort; + ///Դַ + TThostFtdcIPAddressType SourceIP; + }; + + ///ʽ˻׼ + struct CThostFtdcTradingAccountReserveField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///׼ + TThostFtdcMoneyType Reserve; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///DBF¼ + struct CThostFtdcDBFRecordField + { + ///DBF + TThostFtdcDBFComdTypeType DBFComdType; + ///DBFʱ + TThostFtdcDBFComTimeType DBFComTime; + ///DBFԭʼˮ + TThostFtdcDBFComNoType DBFOComNo; + ///DBFˮ + TThostFtdcDBFComNoType DBFComNo; + ///DBFֶ + TThostFtdcDBFFdNameType DBFFdName1; + ///DBFֶ + TThostFtdcDBFFdContentType DBFFdContent1; + ///DBFֶ + TThostFtdcDBFFdNameType DBFFdName2; + ///DBFֶ + TThostFtdcDBFFdContentType DBFFdContent2; + ///DBFֶ + TThostFtdcDBFFdNameType DBFFdName3; + ///DBFֶ + TThostFtdcDBFFdContentType DBFFdContent3; + ///DBFֶ + TThostFtdcDBFFdNameType DBFFdName4; + ///DBFֶ + TThostFtdcDBFFdContentType DBFFdContent4; + }; +} // end of namespace KingstarAPI + +#endif diff --git a/include/Kingstar/IncEx/KSVocApi.h b/include/Kingstar/IncEx/KSVocApi.h new file mode 100644 index 0000000..dbb5e01 --- /dev/null +++ b/include/Kingstar/IncEx/KSVocApi.h @@ -0,0 +1,153 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSVocApi.h +///@brief ˿ͻ˿ͻƽӿ +///////////////////////////////////////////////////////////////////////// + +#ifndef __KSVOCAPI_H_INCLUDED_ +#define __KSVOCAPI_H_INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "KSUserApiStructEx.h" +#include "KSVocApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) && !defined(KSTRADEAPI_STATIC_LIB) +#ifdef LIB_TRADER_API_EXPORT +#define TRADER_VOCAPI_EXPORT __declspec(dllexport) +#else +#define TRADER_VOCAPI_EXPORT __declspec(dllimport) +#endif +#else +#ifdef WIN32 +#define TRADER_VOCAPI_EXPORT +#else +#define TRADER_VOCAPI_EXPORT __attribute__((visibility("default"))) +#endif + +#endif + +namespace KingstarAPI +{ + + class CKSVocSpi + { + public: + ///ѯǰijֲϸӦ + virtual void OnRspQryInvestorOpenPosition(CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯǰϳֲϸӦ + virtual void OnRspQryInvestorOpenCombinePosition(CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspBulkCancelOrder(CThostFtdcBulkCancelOrderField *pBulkCancelOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ƽֲԲѯӦ + virtual void OnRspQryCloseStrategy(CKSCloseStrategyResultField *pCloseStrategy, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ϲԲѯӦ + virtual void OnRspQryCombStrategy(CKSCombStrategyResultField *pCombStrategy, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ȨϲԲѯӦ + virtual void OnRspQryOptionCombStrategy(CKSOptionCombStrategyResultField *pOptionCombStrategy, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + + ///ѯͻתϢӦ + virtual void OnRspQryTransferInfo(CKSTransferInfoResultField *pResultField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֪ͨӦ + virtual void OnRspQryKSTradingNotice(CKSTradingNoticeField *pTradingNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///û˲ƷԴѯӦ + virtual void OnRspQryUserProductUrl(CKSUserProductUrlField *pUserProductUrl, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ϲֵѯӦ + virtual void OnRspQryMaxCombActionVolume(CKSMaxCombActionVolumeField *pMaxCombActionVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnKSTradingNotice(CKSTradingNoticeField *pTradingNoticeInfo) {}; + + ///ѯȨԼӦ + virtual void OnRspQryKSOptionInstrCommRate(CKSOptionInstrCommRateField *pOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼ֤Ӧ + virtual void OnRspQryKSInstrumentMarginRate(CKSInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ͻÿճӦ + virtual void OnRspFundOutCreditApply(CKSInputFundOutCreditApplyField *pFundOutCreditApply, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ͻÿճȲѯӦ + virtual void OnRspQryFundOutCredit(CKSRspQryFundOutCreditField *pRspQryFundOutCredit, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ͻÿճѯӦ + virtual void OnRspQryFundOutCreditApply(CKSRspQryFundOutCreditApplyField *pRspQryFundOutCreditApply, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ԤԼȡӦ + virtual void OnRspLargeFundOutApply(CKSLargeFundOutApplyField *pLargeFundOutApply, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ԤԼѯӦ + virtual void OnRspQryLargeFundOutApply(CKSRspLargeFundOutApplyField *pRspLargeFundOutApply, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + }; + + class TRADER_VOCAPI_EXPORT CKSVocApi + { + public: + ///ѯǰijֲϸ + virtual int ReqQueryInvestorOpenPosition(CThostFtdcQryInvestorPositionDetailField *pQryInvestorOpenPosition, int nRequestID) = 0; + + ///ѯǰϳֲϸ + virtual int ReqQueryInvestorOpenCombinePosition(CThostFtdcQryInvestorPositionCombineDetailField *pQryInvestorOpenCombinePosition, int nRequestID) = 0; + + /// + virtual int ReqBulkCancelOrder (CThostFtdcBulkCancelOrderField *pBulkCancelOrder, int nRequestID) = 0; + + ///ƽֲԲѯ + virtual int ReqQryCloseStrategy(CKSCloseStrategy *pCloseStrategy, int nRequestID) = 0; + + ///ϲԲѯ + virtual int ReqQryCombStrategy(CKSCombStrategy *pCombStrategy, int nRequestID) = 0; + + ///ȨϲԲѯ + virtual int ReqQryOptionCombStrategy(CKSOptionCombStrategy *pOptionCombStrategy, int nRequestID) = 0; + + ///ѯͻתϢ + virtual int ReqQryTransferInfo(CKSTransferInfo *pTransferInfo, int nRequestID) = 0; + + ///ѯ֪ͨ + virtual int ReqQryKSTradingNotice(CKSQryTradingNoticeField *pQryTradingNotice, int nRequestID) = 0; + + ///û˲ƷԴѯ + virtual int ReqQryUserProductUrl (CKSQryUserProductUrlField *pQryUserProductUrl, int nRequestID) = 0; + + ///ϲֵѯ + virtual int ReqQryMaxCombActionVolume(CKSQryMaxCombActionVolumeField *pQryMaxCombActionVolume, int nRequestID) = 0; + + ///ѯȨԼ + virtual int ReqQryKSOptionInstrCommRate(CKSQryOptionInstrCommRateField *pQryOptionInstrCommRate, int nRequestID) = 0; + + ///ѯԼ֤ + virtual int ReqQryKSInstrumentMarginRate(CKSQryInstrumentMarginRateField *pQryInstrumentMarginRate, int nRequestID) = 0; + + ///ͻÿճ + virtual int ReqFundOutCreditApply(CKSInputFundOutCreditApplyField *pFundOutCreditApply, int nRequestID) = 0; + + ///ͻÿճȲѯ + virtual int ReqQryFundOutCredit(CKSQryFundOutCreditField *pQryFundOutCredit, int nRequestID) = 0; + + ///ͻÿճѯ + virtual int ReqQryFundOutCreditApply(CKSQryFundOutCreditApplyField *pQryFundOutCreditApply, int nRequestID) = 0; + + ///ԤԼȡ + virtual int ReqLargeFundOutApply(CKSLargeFundOutApplyField *pLargeFundOutApply, int nRequestID) = 0; + + ///ԤԼѯ + virtual int ReqQryLargeFundOutApply(CKSQryLargeFundOutApplyField *pQryLargeFundOutApply, int nRequestID) = 0; + + protected: + ~CKSVocApi(){}; + }; + +} // end of namespace KingstarAPI +#endif \ No newline at end of file diff --git a/include/Kingstar/IncEx/KSVocApiDataType.h b/include/Kingstar/IncEx/KSVocApiDataType.h new file mode 100644 index 0000000..fb7f0fd --- /dev/null +++ b/include/Kingstar/IncEx/KSVocApiDataType.h @@ -0,0 +1,363 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSVocApiDataType.h +///@brief ˿ͻ˽ӿʹõҵ +///////////////////////////////////////////////////////////////////////// + +#ifndef __KSVOCAPIDATATYPE_H_INCLUDED_ +#define __KSVOCAPIDATATYPE_H_INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +namespace KingstarAPI +{ + //չAPI + enum KS_EXTAPI_TYPE + { + KS_COS_API = 0, + KS_OPT_API, + KS_VOC_API, + KS_VOC_MDAPI, + KS_PRD_API + }; + + ///////////////////////////////////////////////////////////////////////// + ///TKSConditionalTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + ///ڵ +#define KSCOS_GreaterEqualTermPrice '0' + ///Сڵ +#define KSCOS_LesserThanTermPrice '1' + + typedef char TKSConditionalTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSConditionalOrderTypeһ + ///////////////////////////////////////////////////////////////////////// + ///鴥 +#define KSCOS_TRIGGERTYPE_QUOTATION '0' + ///̴ +#define KSCOS_TRIGGERTYPE_OPEN '1' + ///ʱ䴥 +#define KSCOS_TRIGGERTYPE_TIME '2' + ///ʱ䴥 +#define KSCOS_TRIGGERTYPE_QUOTAIONANDTIME '5' + + typedef char TKSConditionalOrderType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSConditionalOrderStateAlterTypeһͣ򼤻־ + ///////////////////////////////////////////////////////////////////////// + ///ͣ +#define KSCOS_State_PAUSE '0' + /// +#define KSCOS_State_ACTIVE '1' + + typedef char TKSConditionalOrderStateAlterType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSConditionalOrderSelectResultTypeһѡ + ///////////////////////////////////////////////////////////////////////// + // +#define KSCOS_Select_AGAIN '0' + // +#define KSCOS_Select_SKIP '1' + // ֹ +#define KSCOS_Select_ABORT '2' + + typedef char TKSConditionalOrderSelectResultType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSOrderPriceTypeTypeһ۸ + ///////////////////////////////////////////////////////////////////////// + // ¼ +#define KSCOS_OrderPrice_LastPrice '0' + // +#define KSCOS_OrderPrice_BidPrice '1' + // +#define KSCOS_OrderPrice_AskPrice '2' + + typedef char TKSOrderPriceTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSCloseModeTypeһƽּ۸ + ///////////////////////////////////////////////////////////////////////// + // м +#define KSPL_Close_MarketPrice '0' + // Ӽ +#define KSPL_Close_SalePrice '1' + //Ӽ¼ +#define KSPL_Close_LastPrice '2' + + typedef char TKSCloseModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSOffsetValueTypeһֹֹӯ۵ķʽ + ///////////////////////////////////////////////////////////////////////// + // ֵָ +#define KSPL_OffsetValue_TermPrice '0' + // ֳɽ۵ƫֵ +#define KSPL_OffsetValue_TradePrice '1' + + typedef char TKSOffsetValueType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSSpringTypeTypeһ۸ + ///////////////////////////////////////////////////////////////////////// + ///¼ +#define KSPL_SPRING_LastPrice '0' + /// +#define KSPL_SPRING_SalePrice '1' + + typedef char TKSSpringTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSConditionalOrderStatusTypeһ״̬ + ///////////////////////////////////////////////////////////////////////// + // ͣ +#define KSCOS_OrderStatus_PAUSENOTOUCHED '0' + // δ +#define KSCOS_OrderStatus_ACTIVENOTOUCHED '1' + //ɾ +#define KSCOS_OrderStatus_Deleted '2' + //Ѵδ +#define KSCOS_OrderStatus_TOUCHEDNOSEND '3' + // ͳʱ +#define KSCOS_OrderStatus_SENDTIMEOUT '4' + //ͳɹ +#define KSCOS_OrderStatus_SENDSUCCESS '5' + // ȴѡ +#define KSCOS_OrderStatus_WAITSELECT '6' + // ѡ +#define KSCOS_OrderStatus_SELECTSKIP '7' + // ѡֹ +#define KSCOS_OrderStatus_SELECTABORT '8' + + typedef char TKSConditionalOrderStatusType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSConditionalOrderIDTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef int TKSConditionalOrderIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSProfitAndLossOrderIDTypeһֹֹӯ + ///////////////////////////////////////////////////////////////////////// + typedef int TKSProfitAndLossOrderIDType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSConditionalOrderSelectTypeTypeһѡʽ + ///////////////////////////////////////////////////////////////////////// + // ȷϡȡ +#define KSCOS_Select_ConfirmORCancel '1' + // ԡֹ +#define KS_Select_AgainOrSkipOrAbort '2' + + typedef char TKSConditionalOrderSelectTypeType; + + + ///////////////////////////////////////////////////////////////////////// + const int MAX_ORDER_COUNT = 20; + + ///////////////////////////////////////////////////////////////////////// + ///TKSCloseStrategyTypeһƽֲ + ///////////////////////////////////////////////////////////////////////// + ///ȿƽͨ +#define KSVOC_OpenFCloseF_OrdiComb '1' + ///ͨϣȿƽ +#define KSVOC_OrdiComb_OpenFCloseF '2' + ///ڵ(ڵijֲƽƽ) +#define KSVOC_TodayF_TIME '3' + + typedef char TKSCloseStrategyType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSStrategyIDTypeһԴ + ///////////////////////////////////////////////////////////////////////// + typedef char TKSStrategyIDType[4]; + + ///////////////////////////////////////////////////////////////////////// + ///TKSCombTypeTypeһ + ///////////////////////////////////////////////////////////////////////// + /// +#define KSVOC_CombType_Arbitrage '0' + /// +#define KSVOC_CombType_Swap '1' + + typedef char TKSCombTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSStrikePriceTypeһִм + ///////////////////////////////////////////////////////////////////////// + // ִм۹ȵͶȸ +#define KSVOC_StrikePrice_Low 'L' + // ִм۹ȸ߶ȵ +#define KSVOC_StrikePrice_High 'H' + // ִм۹ͬ +#define KSVOC_StrikePrice_Minus 'E' + // У۸ϵ +#define KSVOC_StrikePrice_Plus 'N' + + typedef char TKSStrikePriceType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSCalcFlagTypeһ + ///////////////////////////////////////////////////////////////////////// + // +#define KSVOC_CalcFlag_Plus '1' + // +#define KSVOC_CalcFlag_Minus '2' + + typedef char TKSCalcFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TThostFtdcVolRatioTypeһ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcVolRatioType; + + ///////////////////////////////////////////////////////////////////////// + ///TThostFtdcMoneyRatioTypeһʽ + ///////////////////////////////////////////////////////////////////////// + typedef double TThostFtdcMoneyRatioType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSInfoTypeTypeһϢ + ///////////////////////////////////////////////////////////////////////// + // ͨ +#define KSVOC_InfoType_Common '1' + // +#define KSVOC_InfoType_Warn '2' + // Σ +#define KSVOC_InfoType_Risk '3' + // +#define KSVOC_InfoType_Roll '4' + // ǿȷ +#define KSVOC_InfoType_Force '5' + + typedef char TKSInfoTypeType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSConfirmFlagTypeһȷϱ־ + ///////////////////////////////////////////////////////////////////////// + // δȷ +#define KSVOC_ConfirmFlag_UnConfirm '0' + // ȷ +#define KSVOC_ConfirmFlag_Confirmed '1' + + typedef char TKSConfirmFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSProductVersionTypeһ汾 + ///////////////////////////////////////////////////////////////////////// + typedef char TKSProductVersionType[21]; + + ///////////////////////////////////////////////////////////////////////// + ///TKSProtectFlagTypeһԱ־ + ///////////////////////////////////////////////////////////////////////// + // +#define KSVOC_PF_True 'T' + // DZ +#define KSVOC_PF_Flase 'F' + + typedef char TKSProtectFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSControlRangeTypeһƷΧ + ///////////////////////////////////////////////////////////////////////// + // Ʒ +#define KSVOC_CR_Product '0' + // +#define KSVOC_CR_ALL '1' + + typedef char TKSControlRangeType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSTradeLevelTypeһ׼ + ///////////////////////////////////////////////////////////////////////// + // һ +#define KSVOC_TL_Level1 '1' + // +#define KSVOC_TL_Level2 '2' + // +#define KSVOC_TL_Level3 '3' + + typedef char TKSTradeLevelType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSSOPosiDirectionTypeһɳֲַ + ///////////////////////////////////////////////////////////////////////// + // Ȩ +#define KSVOC_SOPD_Buy '1' + // +#define KSVOC_SOPD_Sell '2' + + typedef char TKSSOPosiDirectionType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSSODelivModeTypeһɽղѯ + ///////////////////////////////////////////////////////////////////////// + // Ȩľ +#define KSVOC_SODM_Product '1' + // Ȩֽ㽻ϸ +#define KSVOC_SODM_Cash '2' + // ȨΥԼÿȯ +#define KSVOC_SODM_Dispos '3' + + typedef char TKSSODelivModeType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSCombActionTypeһǿ + ///////////////////////////////////////////////////////////////////////// + ///ǿ +#define KSVOC_CAT_False '0' + ///ǿ +#define KSVOC_CAT_True '1' + + typedef char TKSCombActionType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSCombStrategyIDTypeһϲԴ + ///////////////////////////////////////////////////////////////////////// + typedef char TKSCombStrategyIDType[9]; + + ///////////////////////////////////////////////////////////////////////// + ///TKSProfitAndLossFlagTypeһֹֹӯ־ + ///////////////////////////////////////////////////////////////////////// + // ֹֹӯ +#define KSCOS_PLF_NotProfitNotLoss '0' + // ֹ +#define KSCOS_PLF_Loss '1' + // ֹӯ +#define KSCOS_PLF_Profit '2' + // ֹֹӯ +#define KSCOS_PLF_ProfitAndLoss '3' + + typedef char TKSProfitAndLossFlagType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSFOCreditApplyTypeһճȲ + ///////////////////////////////////////////////////////////////////////// + /// +#define KSVOC_FOCAT_Confirm '0' + ///ȡ +#define KSVOC_FOCAT_NoConfirm '1' + + typedef char TKSFOCreditApplyType; + + ///////////////////////////////////////////////////////////////////////// + ///TKSFOCreditStatusTypeһճȴ״̬ + ///////////////////////////////////////////////////////////////////////// + /// +#define KSVOC_FOCST_SENDING '0' + ///ͨ +#define KSVOC_FOCST_ACCEPTED '1' + ///ѷ +#define KSVOC_FOCST_REJECT '2' + + typedef char TKSFOCreditStatusType; + +} // end of namespace KingstarAPI +#endif \ No newline at end of file diff --git a/include/Kingstar/IncEx/KSVocApiStruct.h b/include/Kingstar/IncEx/KSVocApiStruct.h new file mode 100644 index 0000000..b309ae9 --- /dev/null +++ b/include/Kingstar/IncEx/KSVocApiStruct.h @@ -0,0 +1,1922 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSVocApiStruct.h +///@brief ˿ͻ˽ӿʹõҵݽṹ +///////////////////////////////////////////////////////////////////////// + +#ifndef __KSVOCAPISTRUCT_H_INCLUDED_ +#define __KSVOCAPISTRUCT_H_INCLUDED_ + +#include "KSUserApiDataTypeEx.h" +#include "KSVocApiDataType.h" +#include "KSUserApiStructEx.h" + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +namespace KingstarAPI +{ + + ///ʼ¼ + struct CKSConditionalOrderInitInsert + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType CombHedgeFlag; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///۸ + TThostFtdcPriceType LimitPrice; + ///۸ + TKSOrderPriceTypeType OrderPriceType; + /// + TKSConditionalTypeType ConditionalType; + /// + TThostFtdcPriceType ConditionalPrice; + /// + TKSConditionalOrderIDType ConditionalOrderID; + /// + TThostFtdcVolumeType TriggeredTimes; + /// + TKSConditionalOrderType OrderType; + ///Чʱ + TThostFtdcTimeType ActiveTime; + ///ʧЧʱ + TThostFtdcTimeType InActiveTime; + ///Ҵ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///޸ + struct CKSConditionalOrderModify + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType CombHedgeFlag; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///۸ + TThostFtdcPriceType LimitPrice; + ///۸ + TKSOrderPriceTypeType OrderPriceType; + /// + TKSConditionalTypeType ConditionalType; + /// + TThostFtdcPriceType ConditionalPrice; + /// + TKSConditionalOrderIDType ConditionalOrderID; + /// + TThostFtdcVolumeType TriggeredTimes; + /// + TKSConditionalOrderType OrderType; + ///Чʱ + TThostFtdcTimeType ActiveTime; + ///ʧЧʱ + TThostFtdcTimeType InActiveTime; + ///Ҵ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///ѯ + struct CKSConditionalOrderQuery + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TKSConditionalOrderIDType ConditionalOrderID; + }; + + ///ɾ + struct CKSConditionalOrderRemove + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TKSConditionalOrderIDType ConditionalOrderID; + }; + + ///ͣ򼤻 + struct CKSConditionalOrderStateAlter + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TKSConditionalOrderIDType ConditionalOrderID; + ///ͣ򼤻־ + TKSConditionalOrderStateAlterType ConditionalOrderStateAlter; + }; + + ///ѡ + struct CKSConditionalOrderSelect + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TKSConditionalOrderIDType ConditionalOrderID; + ///ѡ + TKSConditionalOrderSelectResultType SelectResult; + }; + + + ///Ϣ + struct CKSConditionalOrderRspResultField + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TKSConditionalOrderIDType ConditionalOrderID; + }; + + ///Ӧ + struct CKSConditionalOrderOperResultField + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TKSConditionalOrderIDType ConditionalOrderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + ///ƽ־ + TThostFtdcOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType CombHedgeFlag; + /// + TThostFtdcDirectionType Direction; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + /// + TThostFtdcTradeDateType TradingDay; + ///û + TThostFtdcUserIDType UserID; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ͻ + TThostFtdcClientIDType ClientID; + ///״̬ + TKSConditionalOrderStatusType ConditionalOrderStatus; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcVolumeType TriggeredTimes; + /// + TKSConditionalOrderType OrderType; + ///ע + TThostFtdcMemoType Memo; + ///Чʱ + TThostFtdcTimeType ActiveTime; + ///ʧЧʱ + TThostFtdcTimeType InActiveTime; + /// + TKSConditionalTypeType ConditionalType; + /// + TThostFtdcPriceType ConditionalPrice; + }; + + ///¼ֹֹӯ + struct CKSProfitAndLossOrderInsert + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ֹ + TThostFtdcPriceType StopLossPrice; + ///ֹӯ + TThostFtdcPriceType TakeProfitPrice; + ///ƽַʽ + TKSCloseModeType CloseMode; + //ƽַӼλƽַʽ=12ʱЧ + TThostFtdcPriceType FiguresPrice; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ӯ۵ķʽ + TKSOffsetValueType OffsetValue; + ///۸ + TKSSpringTypeType SpringType; + ///ֹ + TThostFtdcPriceType FloatLimitPrice; + ///ֹ𵥴 + TThostFtdcVolumeType TriggeredTimes; + ///Ҵ + TThostFtdcCurrencyIDType CurrencyID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ֹֹӯ־ + TKSProfitAndLossFlagType ProfitAndLossFlag; + }; + + ///ɾֹֹӯ + struct CKSProfitAndLossOrderRemove + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֹֹӯ + TKSProfitAndLossOrderIDType ProfitAndLossOrderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + }; + + ///ѯֹֹӯ + struct CKSProfitAndLossOrderQuery + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֹֹӯ + TKSProfitAndLossOrderIDType ProfitAndLossOrderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + }; + + ///޸ֹֹӯ + struct CKSProfitAndLossOrderModify + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֹֹӯ + TKSProfitAndLossOrderIDType ProfitAndLossOrderID; + ///ֹ + TThostFtdcPriceType StopLossPrice; + ///ֹӯ + TThostFtdcPriceType TakeProfitPrice; + ///ƽַʽ + TKSCloseModeType CloseMode; + //ƽַλƽַʽ=12ʱЧ + TThostFtdcPriceType FiguresPrice; + ///ӯ۵ķʽ + TKSOffsetValueType OffsetValue; + ///۸ + TKSSpringTypeType SpringType; + ///ֹ + TThostFtdcPriceType FloatLimitPrice; + /// + TThostFtdcVolumeType TriggeredTimes; + ///ֹֹӯ־ + TKSProfitAndLossFlagType ProfitAndLossFlag; + }; + + ///ֹֹӯɾ + struct CKSProfitAndLossOrderRemoveField + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֹֹӯ + TKSProfitAndLossOrderIDType ProfitAndLossOrderID; + }; + + ///ֹֹӯ + struct CKSProfitAndLossOrderOperResultField + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֹֹӯ + TKSProfitAndLossOrderIDType ProfitAndLossOrderID; + ///Ա + TThostFtdcUserIDType UserID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ֹ + TThostFtdcPriceType StopLossPrice; + ///ֹӯ + TThostFtdcPriceType TakeProfitPrice; + ///ƽַʽ + TKSCloseModeType CloseMode; + ///ƽַӼλƽַʽ=12ʱЧ + TThostFtdcPriceType Figures; + ///鴥ʱ¼ + TThostFtdcPriceType LastPrice; + ///ֹֹӯʱ + TThostFtdcTimeType ProfitAndLossOrderFormTime; + ///ʱ + TThostFtdcTimeType ConditionalOrderFormTime; + ///ίеʱ + TThostFtdcTimeType OrderFormTime; + ///ֹֹӯ״̬ + TKSConditionalOrderStatusType ProfitAndLossOrderStatus; + /// + TKSConditionalOrderIDType ConditionalOrderID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ƽ־ + TThostFtdcOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType CombHedgeFlag; + /// + TThostFtdcDirectionType Direction; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///ӯ۵ķʽ + TKSOffsetValueType OffsetValue; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///۸ + TKSSpringTypeType SpringType; + ///ֹ + TThostFtdcPriceType FloatLimitPrice; + ///ֳɽ۸ + TThostFtdcPriceType OpenTradePrice; + ///ֹֹӯ־ + TKSProfitAndLossFlagType ProfitAndLossFlag; + }; + + // ѡϢ + struct CKSCOSAskSelectField + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcUserIDType UserID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TKSConditionalOrderIDType ConditionalOrderID; + ///ע + TThostFtdcMemoType Memo; + ///ѡʽ + TKSConditionalOrderSelectTypeType SelectType; + }; + + // ״̬Ϣ + struct CKSCOSStatusField + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcUserIDType UserID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TKSConditionalOrderIDType ConditionalOrderID; + ///״̬ + TKSConditionalOrderStatusType ConditionalOrderStatus; + ///ע + TThostFtdcMemoType Memo; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + ///ƽ־ + TThostFtdcOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType CombHedgeFlag; + /// + TThostFtdcDirectionType Direction; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + /// + TThostFtdcTradeDateType TradingDay; + ///û + TThostFtdcUserIDType CancelUserID; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ɽ۸ + TThostFtdcPriceType TradePrice; + ///Ҵ + TThostFtdcCurrencyIDType CurrencyID; + }; + + // ֹֹӯ״̬Ϣ + struct CKSPLStatusField + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcUserIDType UserID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ֹֹӯ + TKSProfitAndLossOrderIDType ProfitAndLossOrderID; + ///ֹ + TKSConditionalOrderIDType StopLossOrderID; + ///ֹӯ + TKSConditionalOrderIDType TakeProfitOrderID; + ///ӯ״̬ + TKSConditionalOrderStatusType ProfitAndLossOrderStatus; + ///ֹ + TThostFtdcPriceType StopLossPrice; + ///ֹӯ + TThostFtdcPriceType TakeProfitPrice; + ///ӯ۵ķʽ + TKSOffsetValueType OffsetValue; + ///ֳɽ۸ + TThostFtdcPriceType OpenTradePrice; + ///ע + TThostFtdcMemoType Memo; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + ///ƽ־ + TThostFtdcOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType CombHedgeFlag; + /// + TThostFtdcDirectionType Direction; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + /// + TThostFtdcTradeDateType TradingDay; + ///û + TThostFtdcUserIDType CancelUserID; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ɽ۸ + TThostFtdcPriceType TradePrice; + ///Ҵ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///ѯָֻ + struct CKSQryIndexPriceField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + ///ѯָֻ + struct CKSIndexPriceField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ָֻ̼ + TThostFtdcPriceType ClosePrice; + ///ȫϵ + TThostFtdcRatioType GuarantRatio; + }; + + ///ѯȨԼϵ + struct CKSQryOptionInstrGuardField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + }; + + ///ѯȨԼϵ + struct CKSOptionInstrGuardField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͱϵ + TThostFtdcVolumeType MiniNumerator; + ///ͱϵĸ + TThostFtdcVolumeType MiniDenominator ; + ///ȨԼС֤ + TThostFtdcMoneyType MiniMargin; + }; + + ///ѯ + struct CKSQryExecOrderVolumeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///־ + TThostFtdcDirectionType Direction; + }; + + ///ѯ + struct CKSExecOrderVolumeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcVolumeType ExecVolume; + /// + TThostFtdcVolumeType ActionVolume; + ///ִ + TThostFtdcVolumeType ExecedVolume; + /// + TThostFtdcVolumeType ActionedVolume; + ///־ + TThostFtdcDirectionType Direction; + }; + + ///ȨָϢ + struct CKSQryStockOptionAssignmentField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + }; + + ///ȨָϢ + struct CKSStockOptionAssignmentField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentNameType InstrumentName; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ȨָɺԼ + TThostFtdcVolumeType AssInsVo; + ///Ȩ֤ȯ + TThostFtdcVolumeType AssProVol; + ///ȨָӦ + TThostFtdcMoneyType FeePay; + ///ȨC/P־ + TThostFtdcOptionsTypeType OptionsType; + ///Ȩ + TThostFtdcDateType DeliveryDay; + ///ɺԼʶ + TThostFtdcInstrumentIDType StockID; + }; + + ///Key + struct CThostOrderKeyField + { + /// + TThostFtdcOrderRefType OrderRef; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + }; + + /// + struct CThostFtdcBulkCancelOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcOrderTypeType OrderType; + /// + TThostFtdcVolumeType nCount; + /// + CThostOrderKeyField OrderKey[MAX_ORDER_COUNT]; + }; + + ///ƽֲ + struct CKSCloseStrategy + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///ƽֲӦ + struct CKSCloseStrategyResultField + { + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcExchangeNameType ExchangeName; + ///ƽֲ + TKSCloseStrategyType CloseStrategy; + }; + + ///ϲ + struct CKSCombStrategy + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///(1:ڻ;2:Ȩ;:ȫ) + TThostFtdcProductClassType ProductClass; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Դ(SP/SPD) + TKSStrategyIDType StrategyID; + /// + TKSCombTypeType CombType; + }; + + ///ϲӦ + struct CKSCombStrategyResultField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///Դ + TKSStrategyIDType StrategyID; + /// + TKSCombTypeType CombType; + /// + TThostFtdcDirectionType CombDirection; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + /// + TThostFtdcVolumeType Volume; + ///һ + TThostFtdcDirectionType Direction1; + ///ƽ־һ + TThostFtdcOffsetFlagType OffsetFlag1; + ///һ + TThostFtdcVolRatioType VolRatio1; + ///һ + TKSCalcFlagType CalcFlag1; + ///֤һ + TThostFtdcMoneyRatioType MarginRatio1; + /// + TThostFtdcDirectionType Direction2; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag2; + /// + TThostFtdcVolRatioType VolRatio2; + ///Ŷ + TKSCalcFlagType CalcFlag2; + ///֤ + TThostFtdcMoneyRatioType MarginRatio2; + /// + TThostFtdcDirectionType Direction3; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag3; + /// + TThostFtdcVolRatioType VolRatio3; + /// + TKSCalcFlagType CalcFlag3; + ///֤ + TThostFtdcMoneyRatioType MarginRatio3; + /// + TThostFtdcDirectionType Direction4; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag4; + /// + TThostFtdcVolRatioType VolRatio4; + /// + TKSCalcFlagType CalcFlag4; + ///֤ + TThostFtdcMoneyRatioType MarginRatio4; + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + }; + + ///Ȩϲ + struct CKSOptionCombStrategy + { + ///Ӫҵ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Դ + TKSStrategyIDType StrategyID; + /// + TThostFtdcDirectionType CombDirection; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + }; + + ///ȨϲӦ + struct CKSOptionCombStrategyResultField + { + /// + TThostFtdcExchangeIDType ExchangeID; + ///Դ + TKSStrategyIDType StrategyID; + /// + TThostFtdcDirectionType CombDirection; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + /// + TThostFtdcVolumeType Volume; + ///һ + TThostFtdcDirectionType Direction1; + ///Ȩһ + TThostFtdcOptionsTypeType OptionsType1; + ///ִмһ + TKSStrikePriceType StrikeType1; + ///ƽ־һ + TThostFtdcOffsetFlagType OffsetFlag1; + ///һ + TThostFtdcVolRatioType VolRatio1; + ///֤һ + TThostFtdcMoneyRatioType MarginRatio1; + ///һ + TKSCalcFlagType CalcFlag1; + /// + TThostFtdcDirectionType Direction2; + ///ȨͶ + TThostFtdcOptionsTypeType OptionsType2; + ///ִмͶ + TKSStrikePriceType StrikeType2; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag2; + /// + TThostFtdcVolRatioType VolRatio2; + ///֤ + TThostFtdcMoneyRatioType MarginRatio2; + ///Ŷ + TKSCalcFlagType CalcFlag2; + /// + TThostFtdcDirectionType Direction3; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType3; + ///ִм + TKSStrikePriceType StrikeType3; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag3; + /// + TThostFtdcVolRatioType VolRatio3; + ///֤ + TThostFtdcMoneyRatioType MarginRatio3; + /// + TKSCalcFlagType CalcFlag3; + /// + TThostFtdcDirectionType Direction4; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType4; + ///ִм + TKSStrikePriceType StrikeType4; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag4; + /// + TThostFtdcVolRatioType VolRatio4; + ///֤ + TThostFtdcMoneyRatioType MarginRatio4; + /// + TKSCalcFlagType CalcFlag4; + }; + + ///ѯͻתϢ + struct CKSTransferInfo + { + ///д + TThostFtdcBankIDType BankID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///ѯͻתϢӦ + struct CKSTransferInfoResultField + { + ///ʼʱ + TThostFtdcTimeType DepositBegin; + ///ʱ + TThostFtdcTimeType DepositEnd; + ///ʼʱ + TThostFtdcTimeType WithdrawBegin; + ///ʱ + TThostFtdcTimeType WithdrawEnd; + /// + TThostFtdcLargeVolumeType WithdrawVolume; + ///޶ + TThostFtdcMoneyType WithdrawLimit; + ///𵥱޶ + TThostFtdcMoneyType WithdrawLimitByTrade; + ///ʽ + TThostFtdcMoneyType Available; + ///ѳ + TThostFtdcLargeVolumeType WithdrawedVolume; + ///ѳ + TThostFtdcMoneyType WithdrawedAmount; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + }; + + ///ѯKingstar¼֪ͨ + struct CKSQryTradingNoticeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ϣ + TKSInfoTypeType InfoType; + ///ȷϱ־ + TKSConfirmFlagType ConfirmFlag; + ///ʼʱ + TThostFtdcTimeType TimeStart; + ///ʱ + TThostFtdcTimeType TimeEnd; + }; + + ///û¼֪ͨ + struct CKSTradingNoticeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ϣ + TKSInfoTypeType InfoType; + ///ϢժҪ + TThostFtdcDigestType InfoDigest; + ///Ϣ + TThostFtdcContentType FieldContent; + /// + TThostFtdcTimeType SendDate; + ///ʱ + TThostFtdcTimeType SendTime; + ///к + TThostFtdcSequenceNoType SequenceNo; + ///ȷϱ־ + TKSConfirmFlagType ConfirmFlag; + }; + + ///û˲ƷԴѯ + struct CKSQryUserProductUrlField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + }; + + ///û˲ƷԴ + struct CKSUserProductUrlField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///û˲Ʒ°汾 + TKSProductVersionType LastProductVersion; + ///û˲ƷͰ汾 + TKSProductVersionType MinUseProductVersion; + ///û˲ƷͰ汾 + TKSProductVersionType MinUpdateVersion; + ///û˲Ʒ°汾װС + TThostFtdcLargeVolumeType InstallPackSize; + ///û˲Ʒ°汾 + TThostFtdcTradeDateType PublishDate; + ///û˲Ʒ°汾˵ + TThostFtdcUserProductMemoType ProductMemo; + ///û˲ƷԴUrlַ + TThostFtdcFunctionUrlType Url; + }; + + ///ѯͻ׼ + struct CKSQryInvestorTradeLevelField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + }; + + ///ͻ׼ + struct CKSInvestorTradeLevelField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///׼ + TKSTradeLevelType TradeLevel; + }; + + ///ѯ޹ + struct CKSQryPurchaseLimitAmtField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///޹ + struct CKSPurchaseLimitAmtField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///޹ + TThostFtdcMoneyType PurLimitAmt; + }; + + ///ѯ޲ֶ + struct CKSQryPositionLimitVolField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ա־ + TKSProtectFlagType ProtectFlag; + ///ȨC/P־ + TThostFtdcOptionsTypeType OptionsType; + ///ƷΧ + TKSControlRangeType ControlRange; + }; + + ///ѯ޲ֶ + struct CKSPositionLimitVolField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ա־ + TKSProtectFlagType ProtectFlag; + ///ȨC/P־ + TThostFtdcOptionsTypeType OptionsType; + ///ƷΧ + TKSControlRangeType ControlRange; + ///޲ֶ + TThostFtdcVolumeType PosiLimitVol; + }; + + ///ѯʷ + struct CKSQryHistoryOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ʒִ + TThostFtdcInstrumentIDType ProductID; + ///ʼ + TThostFtdcDateType OrderDataStart; + /// + TThostFtdcDateType OrderDataEnd; + }; + + ///ѯʷɽ + struct CKSQryHistoryTradeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ʒִ + TThostFtdcInstrumentIDType ProductID; + ///ʼ + TThostFtdcDateType TradeDataStart; + /// + TThostFtdcDateType TradeDataEnd; + }; + + ///ʷ + struct CKSHistoryOrderField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///걨ʱ + TThostFtdcTimeType InsertTime; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ɽ۸ + TThostFtdcPriceType TradePrice; + ///ɽ + TThostFtdcMoneyType TradeAmount; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ⶳ + TThostFtdcMoneyType FrozenAmount; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcExchangeIDType ExchangeID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + /// + TThostFtdcRequestIDType RequestID; + /// + TThostFtdcOrderRefType OrderRef; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ίм۸ + TThostFtdcPriceType OrderPrice; + ///ίԴ + TThostFtdcOrderSourceType OrderSource; + ///ί + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType OrderTime; + ///ί + TThostFtdcVolumeType VolumeTotalOriginal; + ///ί״̬ + TThostFtdcOrderStatusType OrderStatus; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductNameType ProductName; + ///Ʒ + TThostFtdcProductClassType ProductClass; + ///Ͷƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///ҵ + TThostFtdcFunctionNameType FunctionName; + }; + + ///ʷɽ + struct CKSHistoryTradeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductNameType ProductName; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ɽ + TThostFtdcMoneyType TradeAmount; + ///ɽ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///Ͷƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcMoneyType Commission; + ///ע + TThostFtdcMemoType Memo; + ///ʱ + TThostFtdcTimeType TraderOfferTime; + ///ɽ۸ + TThostFtdcPriceType TradePrice; + ///Ȩױ + TThostFtdcClientIDType ClientID; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType; + ///ұ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///Ȩ + TThostFtdcVolumeType RoyaltyVolume; + /// + TThostFtdcVolumeType ObligationVolume; + ///Ȩֽ + TThostFtdcMoneyType RoyaltyAmount; + ///ֽ + TThostFtdcMoneyType ObligationAmount; + ///ɽ + TThostFtdcTradeIDType TradeID; + ///ҵ + TThostFtdcFunctionNameType FunctionName; + }; + + ///ϲֵѯ + struct CKSQryMaxCombActionVolumeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + //ϲֱ + TThostFtdcCombDirectionType CombDirection; + }; + + ///ϲֵ + struct CKSMaxCombActionVolumeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcVolumeType MaxCombVolume; + ///ɲ + TThostFtdcVolumeType MaxActionVolume; + }; + + ///ѯȨָϸ + struct CKSQryHistoryAssignmentField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ + TThostFtdcHedgeFlagType HedgeFlag; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType; + /// + TThostFtdcDateType DeliveryMonth; + ///ֲַ + TKSSOPosiDirectionType PosiDirection; + }; + + ///ѯȨϸ + struct CKSQrySODelivDetailField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcDateType DeliveryMonth; + ///ɽղѯ + TKSSODelivModeType DelivMode; + }; + + ///ԶȨִв + struct CKSAutoExecOrderActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ԶȨֵ(0-ԶȨ,0-ֵԶȨ(2020%)) + TThostFtdcVolumeType RangeVol; + }; + + ///Ȩָϸ + struct CKSHistoryAssignmentField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcTradeDateType TradingDay; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///֤ȯ + TThostFtdcInstrumentIDType StockInstr; + ///Ͷ + TThostFtdcHedgeFlagType HedgeFlag; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType; + ///ֲַ + TKSSOPosiDirectionType PosiDirection; + ///ִм + TThostFtdcPriceType StrikePrice; + ///Ȩָ + TThostFtdcVolumeType ExecVol; + ///֤ȯӦո + TThostFtdcVolumeType IOVol; + ///Ӧո + TThostFtdcMoneyType IOAmt; + ///Ȩ + TThostFtdcDateType DelivDate; + }; + + ///Ȩϸ + struct CKSSODelivDetailField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///֤ȯ + TThostFtdcInstrumentIDType StockInstr; + ///Ӧ/Ӧ/ȯ֤ȯ + TThostFtdcVolumeType IOVol; + ///ʵո + TThostFtdcVolumeType IOVolInFact; + /// + TThostFtdcPriceType SettlementPrice; + ///ȯֵ/ + TThostFtdcMoneyType SettlementAmt; + ///Ȩ + TThostFtdcDateType DelivDate; + ///ҵ + TThostFtdcFunctionNameType FunctionName; + }; + + ///ҵ + struct CKSSubPrimeDataBusinessField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + }; + + ///ҵ + struct CKSPrimeDataBusinessField + { + ///洢 + TThostFtdcProcessNameType ProcessName; + ///ܷʽ + TThostFtdcFBTEncryModeType EncryMode; + ///Կ + TThostFtdcPasswordKeyType PasswordKey; + ///ݹ鵵״̬ + TThostFtdcSaveStatusType SaveStatus; + }; + + ///ָĺԼ + struct CKSSpecificInstrumentField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ѯԼ֤ + struct CKSQryInstrumentMarginRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///Լ֤ + struct CKSInstrumentMarginRateField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ĸϲ + struct CKSInputCombActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Դ + TKSCombStrategyIDType StrategyID; + ///Լ1 + TThostFtdcInstrumentIDType InstrumentID1; + ///Լ2 + TThostFtdcInstrumentIDType InstrumentID2; + ///Լ3 + TThostFtdcInstrumentIDType InstrumentID3; + ///Լ4 + TThostFtdcInstrumentIDType InstrumentID4; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + ///1 + TThostFtdcDirectionType Direction1; + ///2 + TThostFtdcDirectionType Direction2; + ///3 + TThostFtdcDirectionType Direction3; + ///4 + TThostFtdcDirectionType Direction4; + ///ǿ + TKSCombActionType CombActionFlag; + /// + TThostFtdcVolumeType Volume; + ///ϲֱ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + }; + + ///ϲ + struct CKSCombActionField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Դ + TKSCombStrategyIDType StrategyID; + ///Լ1 + TThostFtdcInstrumentIDType InstrumentID1; + ///Լ2 + TThostFtdcInstrumentIDType InstrumentID2; + ///Լ3 + TThostFtdcInstrumentIDType InstrumentID3; + ///Լ4 + TThostFtdcInstrumentIDType InstrumentID4; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + ///1 + TThostFtdcDirectionType Direction1; + ///2 + TThostFtdcDirectionType Direction2; + ///3 + TThostFtdcDirectionType Direction3; + ///4 + TThostFtdcDirectionType Direction4; + ///ǿ + TKSCombActionType CombActionFlag; + /// + TThostFtdcVolumeType Volume; + ///ϲֱ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϱ + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///״̬ + TThostFtdcOrderActionStatusType ActionStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + }; + + ///ѯϳֲϸ + struct CKSQryInvestorPositionCombineDetailField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + }; + + ///ϳֲϸ + struct CKSInvestorPositionCombineDetailField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ױ + TThostFtdcClientIDType ClientID; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///Դ + TKSCombStrategyIDType StrategyID; + ///Լ1 + TThostFtdcInstrumentIDType InstrumentID1; + ///Լ2 + TThostFtdcInstrumentIDType InstrumentID2; + ///Լ3 + TThostFtdcInstrumentIDType InstrumentID3; + ///Լ4 + TThostFtdcInstrumentIDType InstrumentID4; + ///ռñ֤ + TThostFtdcMoneyType Margin; + ///Զ + TThostFtdcVolumeType CombActionVolume; + ///Ͷ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcVolumeType TotalAmt; + ///1 + TThostFtdcDirectionType Direction1; + ///2 + TThostFtdcDirectionType Direction2; + ///3 + TThostFtdcDirectionType Direction3; + ///4 + TThostFtdcDirectionType Direction4; + /// + TThostFtdcDirectionType CombDirection; + }; + + ///ɿϿɲѯ + struct CKSQryCombActionVolumeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Դ + TKSCombStrategyIDType StrategyID; + ///Լ1 + TThostFtdcInstrumentIDType InstrumentID1; + ///Լ2 + TThostFtdcInstrumentIDType InstrumentID2; + ///Լ3 + TThostFtdcInstrumentIDType InstrumentID3; + ///Լ4 + TThostFtdcInstrumentIDType InstrumentID4; + ///Ͷ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϲֱ + TThostFtdcCombDirectionType CombDirection; + ///1 + TThostFtdcDirectionType Direction1; + ///2 + TThostFtdcDirectionType Direction2; + ///3 + TThostFtdcDirectionType Direction3; + ///4 + TThostFtdcDirectionType Direction4; + ///ǿ + TKSCombActionType CombActionFlag; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + }; + + ///ɿϿɲ + struct CKSCombActionVolumeField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcVolumeType MaxCombVolume; + ///ɲ + TThostFtdcVolumeType MaxActionVolume; + }; + + ///ͻÿճ + struct CKSInputFundOutCreditApplyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ճ + TThostFtdcMoneyType FundOutCredit; + ///ճȲ + TKSFOCreditApplyType CreditApplyFlag; + ///ˮ + TThostFtdcTradeSerialNoType CreditSerial; + }; + + ///ͻÿճȲѯ + struct CKSQryFundOutCreditField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + }; + + ///ͻÿճȲѯ + struct CKSRspQryFundOutCreditField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ճ + TThostFtdcMoneyType FundOutCredit; + ///ѳ + TThostFtdcMoneyType FundOutedCredit; + /// + TThostFtdcDateType UpdateDate; + /// + TThostFtdcDateType SetDate; + ///ʱ + TThostFtdcTimeType SetTime; + }; + + ///ͻÿճѯ + struct CKSQryFundOutCreditApplyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ѯʼ + TThostFtdcDateType QryCreditStart; + ///ѯ + TThostFtdcDateType QryCreditEnd; + ///ճȴ״̬ + TKSFOCreditStatusType DealStatus; + }; + + ///ͻÿճѯ + struct CKSRspQryFundOutCreditApplyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ˮ + TThostFtdcTradeSerialNoType CreditSerial; + /// + TThostFtdcMoneyType FundOutCredit; + ///ճȴ״̬ + TKSFOCreditStatusType DealStatus; + /// + TThostFtdcDateType ApplyDate; + ///ʱ + TThostFtdcTimeType ApplyTime; + /// + TThostFtdcDateType ConfirmDate; + ///ʱ + TThostFtdcTimeType ConfirmTime; + }; + + ///ԤԼȡ + struct CKSLargeFundOutApplyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ԤԼ + TThostFtdcDateType ApplyDate; + /// + TKSFOCreditApplyType ApplyFlag; + ///ˮ + TThostFtdcTradeSerialNoType ApplySerial; + ///ԤԼ + TThostFtdcMoneyType FundOutCredit; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///д + TThostFtdcBankIDType BankID; + }; + + ///ԤԼѯ + struct CKSQryLargeFundOutApplyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ԤԼ + TThostFtdcDateType ApplyDate; + ///ԤԼ + TThostFtdcDateType FundOutDate; + ///״̬ + TKSFOCreditStatusType ApplyFlag; + ///д + TThostFtdcBankIDType BankID; + }; + + ///ԤԼѯ + struct CKSRspLargeFundOutApplyField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ˮ + TThostFtdcTradeSerialNoType ApplySerial; + ///״̬ + TKSFOCreditStatusType ApplyFlag; + ///д + TThostFtdcBankIDType BankID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ԤԼ + TThostFtdcMoneyType FundOutCredit; + ///ԤԼ + TThostFtdcDateType ApplyDate; + ///ԤԼ + TThostFtdcDateType FundOutDate; + /// + TThostFtdcDateType SetDate; + ///ʱ + TThostFtdcTimeType SetTime; + }; + + ///Ȩʲѯ + struct CKSQryOptionInstrCommRateField + { + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + }; + + ///ǰȨԼѵϸ + struct CKSOptionInstrCommRateField + { + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///򿪲 + TThostFtdcRatioType BuyOpenRatioByMoney; + ///򿪲 + TThostFtdcRatioType BuyOpenRatioByVolume; + ///ƽ + TThostFtdcRatioType BuyCloseRatioByMoney; + ///ƽ + TThostFtdcRatioType BuyCloseRatioByVolume; + ///Ȩ + TThostFtdcRatioType StrikeRatioByMoney; + ///Ȩ + TThostFtdcRatioType StrikeRatioByVolume; + /// + TThostFtdcRatioType SellOpenRatioByMoney; + /// + TThostFtdcRatioType SellOpenRatioByVolume; + ///ƽ + TThostFtdcRatioType SellCloseRatioByMoney; + ///ƽ + TThostFtdcRatioType SellCloseRatioByVolume; + ///ҿ + TThostFtdcRatioType CoveredOpenRatioByMoney; + ///ҿ + TThostFtdcRatioType CoveredOpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CoveredCloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CoveredCloseRatioByVolume; + /// + TThostFtdcExchangeIDType ExchangeID; + }; +} // end of namespace KingstarAPI +#endif \ No newline at end of file diff --git a/include/Kingstar/IncEx/KSVocMdApi.h b/include/Kingstar/IncEx/KSVocMdApi.h new file mode 100644 index 0000000..510c564 --- /dev/null +++ b/include/Kingstar/IncEx/KSVocMdApi.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSVocMDApi.h +///@brief ˿ͻ˿ͻӿ +///////////////////////////////////////////////////////////////////////// + +#ifndef __KSVOCMDAPI_H_INCLUDED_ +#define __KSVOCMDAPI_H_INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "KSUserApiStructEx.h" +#include "KSVocApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) && !defined(KSMDAPI_STATIC_LIB) +#ifdef LIB_MD_API_EXPORT +#define TRADER_VOCMDAPI_EXPORT __declspec(dllexport) +#else +#define TRADER_VOCMDAPI_EXPORT __declspec(dllimport) +#endif +#else +#ifdef WIN32 +#define TRADER_VOCMDAPI_EXPORT +#else +#define TRADER_VOCMDAPI_EXPORT __attribute__((visibility("default"))) +#endif + +#endif + +namespace KingstarAPI +{ + + class CKSVocMdSpi + { + public: + ///Ӧ + virtual void OnRspSubKSMarketData(CKSSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡӦ + virtual void OnRspUnSubKSMarketData(CKSSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + }; + + class TRADER_VOCMDAPI_EXPORT CKSVocMdApi + { + public: + ///顣 + ///@param ppInstrumentID Լ + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeKSMarketData(CKSSpecificInstrumentField *ppInstrumentID[], int nCount) = 0; + + ///˶顣 + ///@param ppInstrumentID Լ + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeKSMarketData(CKSSpecificInstrumentField *ppInstrumentID[], int nCount) = 0; + + protected: + ~CKSVocMdApi(){}; + }; + +} // end of namespace KingstarAPI +#endif \ No newline at end of file diff --git a/include/Kingstar/inc/KSMarketDataAPI.h b/include/Kingstar/inc/KSMarketDataAPI.h new file mode 100644 index 0000000..58297d8 --- /dev/null +++ b/include/Kingstar/inc/KSMarketDataAPI.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSMarketDataAPI.h +///@brief ˿ͻ˽ӿʹõҵͨѶӿ +///@history +///20140801 Kingstar IRDG ļ +///////////////////////////////////////////////////////////////////////// + +#ifndef __KSFMDUSER_API_H__ +#define __KSFMDUSER_API_H__ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifdef WIN32 +#ifdef KSFMDUSERAPI_EXPORTS +#define KSFMDUSERAPI __declspec(dllexport) +#else +#define KSFMDUSERAPI __declspec(dllimport) +#endif +#else +#ifdef KSFMDUSERAPI_EXPORTS +#define KSFMDUSERAPI __attribute__ ((visibility ("default"))) +#else +#define KSFMDUSERAPI +#endif +#endif + +#include "../IncEx/KSMdApiEx.h" +#include "../IncEx/KSVocMdApi.h" + +#endif \ No newline at end of file diff --git a/include/Kingstar/inc/KSTradeAPI.h b/include/Kingstar/inc/KSTradeAPI.h new file mode 100644 index 0000000..4b14c60 --- /dev/null +++ b/include/Kingstar/inc/KSTradeAPI.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////// +///@system һϵͳ +///@company SunGard China +///@file KSTradeAPI.h +///@brief ˿ͻ˽ӿʹõҵͨѶӿ +///@history +///20140801 Kingstar IRDG ļ +///////////////////////////////////////////////////////////////////////// + +#ifndef __KSFTRADER_API_H__ +#define __KSFTRADER_API_H__ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifdef WIN32 +#ifdef KSFTRADERAPI_EXPORTS +#define KSFTRADERAPI __declspec(dllexport) +#else +#define KSFTRADERAPI __declspec(dllimport) +#endif +#else +#ifdef KSFTRADERAPI_EXPORTS +#define KSFTRADERAPI __attribute__ ((visibility ("default"))) +#else +#define KSFTRADERAPI +#endif +#endif + +#include "../IncEx/KSTraderApiEx.h" +#include "../IncEx/KSCosApi.h" +#include "../IncEx/KSOptionApi.h" +#include "../IncEx/KSVocApi.h" + +#endif \ No newline at end of file diff --git a/include/Kingstar/version.txt b/include/Kingstar/version.txt new file mode 100644 index 0000000..e2abbe4 --- /dev/null +++ b/include/Kingstar/version.txt @@ -0,0 +1 @@ +20150813 \ No newline at end of file diff --git a/include/Kingstar/win32/KSInterB2C.lkc b/include/Kingstar/win32/KSInterB2C.lkc new file mode 100644 index 0000000..bd9f49d Binary files /dev/null and b/include/Kingstar/win32/KSInterB2C.lkc differ diff --git a/include/Kingstar/win32/KSMarketDataAPI.dll b/include/Kingstar/win32/KSMarketDataAPI.dll new file mode 100644 index 0000000..df9eab9 Binary files /dev/null and b/include/Kingstar/win32/KSMarketDataAPI.dll differ diff --git a/include/Kingstar/win32/KSMarketDataAPI.lib b/include/Kingstar/win32/KSMarketDataAPI.lib new file mode 100644 index 0000000..46006df Binary files /dev/null and b/include/Kingstar/win32/KSMarketDataAPI.lib differ diff --git a/include/Kingstar/win32/KSTradeAPI.dll b/include/Kingstar/win32/KSTradeAPI.dll new file mode 100644 index 0000000..12a1fc6 Binary files /dev/null and b/include/Kingstar/win32/KSTradeAPI.dll differ diff --git a/include/Kingstar/win32/KSTradeAPI.lib b/include/Kingstar/win32/KSTradeAPI.lib new file mode 100644 index 0000000..86508ee Binary files /dev/null and b/include/Kingstar/win32/KSTradeAPI.lib differ diff --git a/include/Kingstar/win32/SSPXEncode.dll b/include/Kingstar/win32/SSPXEncode.dll new file mode 100644 index 0000000..1e2cb6a Binary files /dev/null and b/include/Kingstar/win32/SSPXEncode.dll differ diff --git a/include/Kingstar/win32/ksPortalAPI.dll b/include/Kingstar/win32/ksPortalAPI.dll new file mode 100644 index 0000000..0fec8a7 Binary files /dev/null and b/include/Kingstar/win32/ksPortalAPI.dll differ diff --git a/include/Kingstar/win32/lkcdll.dll b/include/Kingstar/win32/lkcdll.dll new file mode 100644 index 0000000..d860ef3 Binary files /dev/null and b/include/Kingstar/win32/lkcdll.dll differ diff --git a/include/QueueEnum.h b/include/QueueEnum.h index e5d3cda..69744d4 100644 --- a/include/QueueEnum.h +++ b/include/QueueEnum.h @@ -1,86 +1,87 @@ -#ifndef _QUEUE_ENUM_H_ +#ifndef _QUEUE_ENUM_H_ #define _QUEUE_ENUM_H_ -/// +/// 基本请求 enum RequestType :char { - GetApiType = 0, - GetApiVersion, - GetApiName, + RequestType_GetApiTypes = 0, + RequestType_GetApiVersion, + RequestType_GetApiName, - Create, // - Release, // - Register, // עնлص - Config, // ò + RequestType_Create, // 创建 + RequestType_Release, // 销毁 + RequestType_Register, // 注册接收队列回调 + RequestType_Config, // 配置参数 - Connect, // ʼ/ - Disconnect, // ֹͣ/Ͽ + RequestType_Connect, // 开始/连接 + RequestType_Disconnect, // 停止/断开 - Clear, // - Process, // + RequestType_Clear, // 清理 + RequestType_Process, // 处理 - Subscribe, // - Unsubscribe, // ȡ + RequestType_Subscribe, // 订阅 + RequestType_Unsubscribe, // 取消订阅 - SubscribeQuote, // ѯ - UnsubscribeQuote, // ȡѯ + RequestType_SubscribeQuote, // 订阅询价 + RequestType_UnsubscribeQuote, // 取消订阅询价 - ReqOrderInsert, - ReqQuoteInsert, - ReqOrderAction, - ReqQuoteAction, + RequestType_ReqOrderInsert, + RequestType_ReqQuoteInsert, + RequestType_ReqOrderAction, + RequestType_ReqQuoteAction, }; -///ѯ +///查询 enum QueryType :char { - ReqQryInstrument = 32, - ReqQryTradingAccount, - ReqQryInvestorPosition, + QueryType_ReqQryInstrument = 32, + QueryType_ReqQryTradingAccount, + QueryType_ReqQryInvestorPosition, - ReqQryOrder, - ReqQryTrade, - ReqQryQuote, + QueryType_ReqQryOrder, + QueryType_ReqQryTrade, + QueryType_ReqQryQuote, - ReqQryInstrumentCommissionRate, - ReqQryInstrumentMarginRate, - ReqQrySettlementInfo, - ReqQryInvestor, + QueryType_ReqQryInstrumentCommissionRate, + QueryType_ReqQryInstrumentMarginRate, + QueryType_ReqQrySettlementInfo, + QueryType_ReqQryInvestor, - ReqQryHistoricalTicks, - ReqQryHistoricalBars, + QueryType_ReqQryHistoricalTicks, + QueryType_ReqQryHistoricalBars, }; -///Ӧ -enum ResponeType :char +///响应 +enum ResponseType :char { - OnConnectionStatus = 64, - OnRtnError, - OnLog, + ResponseType_OnConnectionStatus = 64, + ResponseType_OnRtnError, + ResponseType_OnLog, - OnRtnDepthMarketData, - OnRspQryInstrument, - OnRspQryTradingAccount, - OnRspQryInvestorPosition, - OnRspQrySettlementInfo, + ResponseType_OnRtnDepthMarketData, + ResponseType_OnRspQryInstrument, + ResponseType_OnRspQryTradingAccount, + ResponseType_OnRspQryInvestorPosition, + ResponseType_OnRspQrySettlementInfo, - OnRspQryOrder, - OnRspQryTrade, - OnRspQryQuote, + ResponseType_OnRspQryOrder, + ResponseType_OnRspQryTrade, + ResponseType_OnRspQryQuote, - OnRtnOrder, - OnRtnTrade, - OnRtnQuote, + ResponseType_OnRtnOrder, + ResponseType_OnRtnTrade, + ResponseType_OnRtnQuote, - OnRtnQuoteRequest, + ResponseType_OnRtnQuoteRequest, - OnRspQryHistoricalTicks, - OnRspQryHistoricalBars, - OnRspQryInvestor, + ResponseType_OnRspQryHistoricalTicks, + ResponseType_OnRspQryHistoricalBars, + ResponseType_OnRspQryInvestor, + ResponseType_OnRtnInstrumentStatus, - OnFilterSubscribe, + ResponseType_OnFilterSubscribe, }; -// >=100ʾAPIԶ +// >=100表示API自定义 #endif diff --git a/include/QueueHeader.h b/include/QueueHeader.h deleted file mode 100644 index 0730eb8..0000000 --- a/include/QueueHeader.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _QUEUE_HEADER_H_ -#define _QUEUE_HEADER_H_ - -#include "../include/CrossPlatform.h" - -#ifdef __cplusplus -extern "C" { -#endif - - typedef void* (__stdcall *fnOnRespone) (char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1,int size1, void* ptr2,int size2, void* ptr3,int size3); - - //DLL_PUBLIC void* __stdcall XRespone(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); -#ifdef __cplusplus -} -#endif - -#endif//end of _QUEUE_HEADER_H_ diff --git a/include/QueueStruct.h b/include/QueueStruct.h deleted file mode 100644 index e1d1632..0000000 --- a/include/QueueStruct.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _QUEUE_STRUCT_H_ -#define _QUEUE_STRUCT_H_ - - -struct ResponeItem -{ - char type; // (RequestType) - - void* pApi1; // 执行者,不能delete - void* pApi2; // 源头,不能delete - - double double1; - double double2; - - void* ptr1; // 需要delete - int size1; - void* ptr2; // 需要delete - int size2; - void* ptr3; // 需要delete - int size3; - - bool bNeedDelete; -}; - - -#endif//end of _QUEUE_HEADER_H_ diff --git a/include/Sgit/SgitFtdcMdApi.h b/include/Sgit/SgitFtdcMdApi.h new file mode 100644 index 0000000..5777e4e --- /dev/null +++ b/include/Sgit/SgitFtdcMdApi.h @@ -0,0 +1,167 @@ +///////////////////////////////////////////////////////////////////////// +///@system +///@company +///@file ThostFtdcMdApi.h +///@brief ˿ͻ˽ӿ +///@history +///20060106 +///////////////////////////////////////////////////////////////////////// + +#if !defined(THOST_FTDCMDAPI_H) +#define THOST_FTDCMDAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SgitFtdcUserApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_FS_MD_API_EXPORT +#define FS_MD_API_EXPORT __declspec(dllexport) +#else +#define FS_MD_API_EXPORT __declspec(dllimport) +#endif +#else +#define FS_MD_API_EXPORT +#endif +namespace fstech{ +class CThostFtdcMdSpi +{ +public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡӦ + virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ȡѯӦ + virtual void OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) {}; + + ///ѯ֪ͨ + virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {}; + + ///ӽ + virtual void OnRtnDeferDeliveryQuot(CThostDeferDeliveryQuot* pQuot){}; + +}; + +class FS_MD_API_EXPORT CThostFtdcMdApi +{ +public: + ///MdApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + ///modify for udp marketdata + static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp=false, const bool bIsMulticast=false); + + ///ȡAPIİ汾Ϣ + ///@retrun ȡİ汾 + static const char *GetApiVersion(); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcMdSpi *pSpi) = 0; + + ///顣 + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeMarketData(char *ppInstrumentID[], int nCount) = 0; + + ///˶顣 + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeMarketData(char *ppInstrumentID[], int nCount) = 0; + + ///ѯۡ + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int SubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0; + + ///˶ѯۡ + ///@param ppInstrumentID ԼID + ///@param nCount Ҫ/˶ĺԼ + ///@remark + virtual int UnSubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0; + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; +protected: + ~CThostFtdcMdApi(){}; +}; + +} +#endif diff --git a/include/Sgit/SgitFtdcTraderApi.h b/include/Sgit/SgitFtdcTraderApi.h new file mode 100644 index 0000000..2e1ede3 --- /dev/null +++ b/include/Sgit/SgitFtdcTraderApi.h @@ -0,0 +1,645 @@ +///////////////////////////////////////////////////////////////////////// +///@system +///@company +///@file SgitFtdcTraderApi.h +///@brief ˿ͻ˽ӿ +///@history +///20150810 +///////////////////////////////////////////////////////////////////////// + +#if !defined(SGIT_FTDCTRADERAPI_H) +#define SGIT_FTDCTRADERAPI_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SgitFtdcUserApiStruct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_FS_TRADER_API_EXPORT +#define FS_TRADER_API_EXPORT __declspec(dllexport) +#else +#define FS_TRADER_API_EXPORT __declspec(dllimport) +#endif +#else +#define FS_TRADER_API_EXPORT +#endif +namespace fstech{ +// +class CThostFtdcTraderSpi +{ +public: + ///ͻ뽻׺̨ͨʱδ¼ǰ÷á + virtual void OnFrontConnected(){}; + + ///ͻ뽻׺̨ͨӶϿʱ÷áAPIԶӣͻ˿ɲ + ///@param nReason ԭ + /// 0x1001 ʧ + /// 0x1002 дʧ + /// 0x2001 ʱ + /// 0x2002 ʧ + /// 0x2003 յ + virtual void OnFrontDisconnected(int nReason){}; + + ///ʱ档ʱδյʱ÷á + ///@param nTimeLapse ϴνձĵʱ + virtual void OnHeartBeatWarning(int nTimeLapse){}; + + ///ͻ֤Ӧ + virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + + ///¼Ӧ + virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///dzӦ + virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ûӦ + virtual void OnRspUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ʽ˻Ӧ + virtual void OnRspTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ԥ¼Ӧ + virtual void OnRspParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ԥ񳷵¼Ӧ + virtual void OnRspParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ󱨵Ӧ + virtual void OnRspQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ͷ߽ȷӦ + virtual void OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ɾԤӦ + virtual void OnRspRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ɾԤ񳷵Ӧ + virtual void OnRspRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ִ¼Ӧ + virtual void OnRspExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ִӦ + virtual void OnRspExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ¼Ӧ + virtual void OnRspForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///۲Ӧ + virtual void OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspBatchOrderAction(CThostFtdcInputBatchOrderActionField *pInputBatchOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///¼Ӧ + virtual void OnRspCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryOrder(CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯɽӦ + virtual void OnRspQryTrade(CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳Ӧ + virtual void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯʽ˻Ӧ + virtual void OnRspQryTradingAccount(CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶӦ + virtual void OnRspQryInvestor(CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯױӦ + virtual void OnRspQryTradingCode(CThostFtdcTradingCodeField *pTradingCode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼ֤Ӧ + virtual void OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchange(CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷӦ + virtual void OnRspQryProduct(CThostFtdcProductField *pProduct, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԼӦ + virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶ߽Ӧ + virtual void OnRspQrySettlementInfo(CThostFtdcSettlementInfoField *pSettlementInfo, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯתӦ + virtual void OnRspQryTransferBank(CThostFtdcTransferBankField *pTransferBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionDetail(CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͻ֪ͨӦ + virtual void OnRspQryNotice(CThostFtdcNoticeField *pNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯϢȷӦ + virtual void OnRspQrySettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶֲ߳ϸӦ + virtual void OnRspQryInvestorPositionCombineDetail(CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤ϵͳ͹˾ʽ˻ԿӦ + virtual void OnRspQryCFMMCTradingAccountKey(CThostFtdcCFMMCTradingAccountKeyField *pCFMMCTradingAccountKey, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯֵ۵ϢӦ + virtual void OnRspQryEWarrantOffset(CThostFtdcEWarrantOffsetField *pEWarrantOffset, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯͶƷ/Ʒֱ֤Ӧ + virtual void OnRspQryInvestorProductGroupMargin(CThostFtdcInvestorProductGroupMarginField *pInvestorProductGroupMargin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤Ӧ + virtual void OnRspQryExchangeMarginRate(CThostFtdcExchangeMarginRateField *pExchangeMarginRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֤Ӧ + virtual void OnRspQryExchangeMarginRateAdjust(CThostFtdcExchangeMarginRateAdjustField *pExchangeMarginRateAdjust, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryExchangeRate(CThostFtdcExchangeRateField *pExchangeRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԱȨӦ + virtual void OnRspQrySecAgentACIDMap(CThostFtdcSecAgentACIDMapField *pSecAgentACIDMap, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷۻ + virtual void OnRspQryProductExchRate(CThostFtdcProductExchRateField *pProductExchRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯƷ + virtual void OnRspQryProductGroup(CThostFtdcProductGroupField *pProductGroup, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨ׳ɱӦ + virtual void OnRspQryOptionInstrTradeCost(CThostFtdcOptionInstrTradeCostField *pOptionInstrTradeCost, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯȨԼӦ + virtual void OnRspQryOptionInstrCommRate(CThostFtdcOptionInstrCommRateField *pOptionInstrCommRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯִӦ + virtual void OnRspQryExecOrder(CThostFtdcExecOrderField *pExecOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯѯӦ + virtual void OnRspQryForQuote(CThostFtdcForQuoteField *pForQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯϺԼȫϵӦ + virtual void OnRspQryCombInstrumentGuard(CThostFtdcCombInstrumentGuardField *pCombInstrumentGuard, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯӦ + virtual void OnRspQryCombAction(CThostFtdcCombActionField *pCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯתˮӦ + virtual void OnRspQryTransferSerial(CThostFtdcTransferSerialField *pTransferSerial, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯǩԼϵӦ + virtual void OnRspQryAccountregister(CThostFtdcAccountregisterField *pAccountregister, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///Ӧ + virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///֪ͨ + virtual void OnRtnOrder(CThostFtdcOrderField *pOrder) {}; + + ///ɽ֪ͨ + virtual void OnRtnTrade(CThostFtdcTradeField *pTrade) {}; + + ///¼ر + virtual void OnErrRtnOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ر + virtual void OnErrRtnOrderAction(CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///Լ״̬֪ͨ + virtual void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) {}; + + ///֪ͨ + virtual void OnRtnTradingNotice(CThostFtdcTradingNoticeInfoField *pTradingNoticeInfo) {}; + + ///ʾУ + virtual void OnRtnErrorConditionalOrder(CThostFtdcErrorConditionalOrderField *pErrorConditionalOrder) {}; + + ///ִ֪ͨ + virtual void OnRtnExecOrder(CThostFtdcExecOrderField *pExecOrder) {}; + + ///ִ¼ر + virtual void OnErrRtnExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ִر + virtual void OnErrRtnExecOrderAction(CThostFtdcExecOrderActionField *pExecOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯ¼ر + virtual void OnErrRtnForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, CThostFtdcRspInfoField *pRspInfo) {}; + + ///֪ͨ + virtual void OnRtnQuote(CThostFtdcQuoteField *pQuote) {}; + + ///¼ر + virtual void OnErrRtnQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, CThostFtdcRspInfoField *pRspInfo) {}; + + ///۲ر + virtual void OnErrRtnQuoteAction(CThostFtdcQuoteActionField *pQuoteAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯ֪ͨ + virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {}; + + ///֤û + virtual void OnRtnCFMMCTradingAccountToken(CThostFtdcCFMMCTradingAccountTokenField *pCFMMCTradingAccountToken) {}; + + ///ر + virtual void OnErrRtnBatchOrderAction(CThostFtdcBatchOrderActionField *pBatchOrderAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///֪ͨ + virtual void OnRtnCombAction(CThostFtdcCombActionField *pCombAction) {}; + + ///¼ر + virtual void OnErrRtnCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ѯǩԼӦ + virtual void OnRspQryContractBank(CThostFtdcContractBankField *pContractBank, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԤӦ + virtual void OnRspQryParkedOrder(CThostFtdcParkedOrderField *pParkedOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯԤ񳷵Ӧ + virtual void OnRspQryParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ֪ͨӦ + virtual void OnRspQryTradingNotice(CThostFtdcTradingNoticeField *pTradingNotice, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ͹˾ײӦ + virtual void OnRspQryBrokerTradingParams(CThostFtdcBrokerTradingParamsField *pBrokerTradingParams, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯ͹˾㷨Ӧ + virtual void OnRspQryBrokerTradingAlgos(CThostFtdcBrokerTradingAlgosField *pBrokerTradingAlgos, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ѯû + virtual void OnRspQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///зʽתڻ֪ͨ + virtual void OnRtnFromBankToFutureByBank(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///зڻʽת֪ͨ + virtual void OnRtnFromFutureToBankByBank(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///зתڻ֪ͨ + virtual void OnRtnRepealFromBankToFutureByBank(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///зڻת֪ͨ + virtual void OnRtnRepealFromFutureToBankByBank(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻʽתڻ֪ͨ + virtual void OnRtnFromBankToFutureByFuture(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///ڻڻʽת֪ͨ + virtual void OnRtnFromFutureToBankByFuture(CThostFtdcRspTransferField *pRspTransfer) {}; + + ///ϵͳʱڻֹתڻдϺ̷ص֪ͨ + virtual void OnRtnRepealFromBankToFutureByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ϵͳʱڻֹڻתдϺ̷ص֪ͨ + virtual void OnRtnRepealFromFutureToBankByFutureManual(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻѯ֪ͨ + virtual void OnRtnQueryBankBalanceByFuture(CThostFtdcNotifyQueryAccountField *pNotifyQueryAccount) {}; + + ///ڻʽתڻر + virtual void OnErrRtnBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻڻʽתдر + virtual void OnErrRtnFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ϵͳʱڻֹתڻر + virtual void OnErrRtnRepealBankToFutureByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ϵͳʱڻֹڻתдر + virtual void OnErrRtnRepealFutureToBankByFutureManual(CThostFtdcReqRepealField *pReqRepeal, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻѯر + virtual void OnErrRtnQueryBankBalanceByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo) {}; + + ///ڻתڻдϺ̷ص֪ͨ + virtual void OnRtnRepealFromBankToFutureByFuture(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻڻתдϺ̷ص֪ͨ + virtual void OnRtnRepealFromFutureToBankByFuture(CThostFtdcRspRepealField *pRspRepeal) {}; + + ///ڻʽתڻӦ + virtual void OnRspFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ڻڻʽתӦ + virtual void OnRspFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///ڻѯӦ + virtual void OnRspQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}; + + ///зڿ֪ͨ + virtual void OnRtnOpenAccountByBank(CThostFtdcOpenAccountField *pOpenAccount) {}; + + ///з֪ͨ + virtual void OnRtnCancelAccountByBank(CThostFtdcCancelAccountField *pCancelAccount) {}; + + ///з˺֪ͨ + virtual void OnRtnChangeAccountByBank(CThostFtdcChangeAccountField *pChangeAccount) {}; + + /// յԼλѯӦʱصú + virtual void onRspMBLQuot(CThostMBLQuotData *pMBLQuotData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast){}; + +}; + +class FS_TRADER_API_EXPORT CThostFtdcTraderApi +{ +public: + ///TraderApi + ///@param pszFlowPath ϢļĿ¼ĬΪǰĿ¼ + ///@return UserApi + static CThostFtdcTraderApi *CreateFtdcTraderApi(const char *pszFlowPath = ""); + + ///ȡAPIİ汾Ϣ + ///@retrun ȡİ汾 + static const char *GetApiVersion(); + + ///ɾӿڶ + ///@remark ʹñӿڶʱ,øúɾӿڶ + virtual void Release() = 0; + + ///ʼ + ///@remark ʼл,ֻеú,ӿڲſʼ + virtual void Init() = 0; + + ///ȴӿ߳̽ + ///@return ߳˳ + virtual int Join() = 0; + + ///ȡǰ + ///@retrun ȡĽ + ///@remark ֻе¼ɹ,ܵõȷĽ + virtual const char *GetTradingDay() = 0; + + ///עǰûַ + ///@param pszFrontAddressǰûַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:17001 + ///@remark tcpЭ飬127.0.0.1ַ17001˿ںš + virtual void RegisterFront(char *pszFrontAddress) = 0; + + ///עַַ + ///@param pszNsAddressַַ + ///@remark ַĸʽΪprotocol://ipaddress:port磺tcp://127.0.0.1:12001 + ///@remark tcpЭ飬127.0.0.1ַ12001˿ںš + ///@remark RegisterNameServerRegisterFront + virtual void RegisterNameServer(char *pszNsAddress) = 0; + + ///עַûϢ + ///@param pFensUserInfoûϢ + virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0; + + ///עصӿ + ///@param pSpi Իصӿʵ + virtual void RegisterSpi(CThostFtdcTraderSpi *pSpi) = 0; + + ///˽ + ///@param nResumeType ˽شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼˽ + ///@remark ÷ҪInitǰá򲻻յ˽ݡ + virtual void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///Ĺ + ///@param nResumeType شʽ + /// THOST_TERT_RESTART:ӱտʼش + /// THOST_TERT_RESUME:ϴյ + /// THOST_TERT_QUICK:ֻ͵¼󹫹 + ///@remark ÷ҪInitǰá򲻻յݡ + virtual void SubscribePublicTopic(THOST_TE_RESUME_TYPE nResumeType) = 0; + + ///ͻ֤ + virtual int ReqAuthenticate(CThostFtdcReqAuthenticateField *pReqAuthenticateField, int nRequestID) = 0; + + ///û¼ + virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0; + + + ///dz + virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0; + + ///û + virtual int ReqUserPasswordUpdate(CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate, int nRequestID) = 0; + + ///ʽ˻ + virtual int ReqTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate, int nRequestID) = 0; + + ///¼ + virtual int ReqOrderInsert(CThostFtdcInputOrderField *pInputOrder, int nRequestID) = 0; + + ///Ԥ¼ + virtual int ReqParkedOrderInsert(CThostFtdcParkedOrderField *pParkedOrder, int nRequestID) = 0; + + ///Ԥ񳷵¼ + virtual int ReqParkedOrderAction(CThostFtdcParkedOrderActionField *pParkedOrderAction, int nRequestID) = 0; + + /// + virtual int ReqOrderAction(CThostFtdcInputOrderActionField *pInputOrderAction, int nRequestID) = 0; + + ///ѯ󱨵 + virtual int ReqQueryMaxOrderVolume(CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume, int nRequestID) = 0; + + ///Ͷ߽ȷ + virtual int ReqSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, int nRequestID) = 0; + + ///ɾԤ + virtual int ReqRemoveParkedOrder(CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder, int nRequestID) = 0; + + ///ɾԤ񳷵 + virtual int ReqRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction, int nRequestID) = 0; + + ///ִ¼ + virtual int ReqExecOrderInsert(CThostFtdcInputExecOrderField *pInputExecOrder, int nRequestID) = 0; + + ///ִ + virtual int ReqExecOrderAction(CThostFtdcInputExecOrderActionField *pInputExecOrderAction, int nRequestID) = 0; + + ///ѯ¼ + virtual int ReqForQuoteInsert(CThostFtdcInputForQuoteField *pInputForQuote, int nRequestID) = 0; + + ///¼ + virtual int ReqQuoteInsert(CThostFtdcInputQuoteField *pInputQuote, int nRequestID) = 0; + + ///۲ + virtual int ReqQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, int nRequestID) = 0; + + /// + virtual int ReqBatchOrderAction(CThostFtdcInputBatchOrderActionField *pInputBatchOrderAction, int nRequestID) = 0; + + ///¼ + virtual int ReqCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryOrder(CThostFtdcQryOrderField *pQryOrder, int nRequestID) = 0; + + ///ѯɽ + virtual int ReqQryTrade(CThostFtdcQryTradeField *pQryTrade, int nRequestID) = 0; + + ///ѯͶֲ߳ + virtual int ReqQryInvestorPosition(CThostFtdcQryInvestorPositionField *pQryInvestorPosition, int nRequestID) = 0; + + ///ѯʽ˻ + virtual int ReqQryTradingAccount(CThostFtdcQryTradingAccountField *pQryTradingAccount, int nRequestID) = 0; + + ///ѯͶ + virtual int ReqQryInvestor(CThostFtdcQryInvestorField *pQryInvestor, int nRequestID) = 0; + + ///ѯױ + virtual int ReqQryTradingCode(CThostFtdcQryTradingCodeField *pQryTradingCode, int nRequestID) = 0; + + ///ѯԼ֤ + virtual int ReqQryInstrumentMarginRate(CThostFtdcQryInstrumentMarginRateField *pQryInstrumentMarginRate, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrumentCommissionRate(CThostFtdcQryInstrumentCommissionRateField *pQryInstrumentCommissionRate, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchange(CThostFtdcQryExchangeField *pQryExchange, int nRequestID) = 0; + + ///ѯƷ + virtual int ReqQryProduct(CThostFtdcQryProductField *pQryProduct, int nRequestID) = 0; + + ///ѯԼ + virtual int ReqQryInstrument(CThostFtdcQryInstrumentField *pQryInstrument, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryDepthMarketData(CThostFtdcQryDepthMarketDataField *pQryDepthMarketData, int nRequestID) = 0; + + ///ѯͶ߽ + virtual int ReqQrySettlementInfo(CThostFtdcQrySettlementInfoField *pQrySettlementInfo, int nRequestID) = 0; + + ///ѯת + virtual int ReqQryTransferBank(CThostFtdcQryTransferBankField *pQryTransferBank, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionDetail(CThostFtdcQryInvestorPositionDetailField *pQryInvestorPositionDetail, int nRequestID) = 0; + + ///ѯͻ֪ͨ + virtual int ReqQryNotice(CThostFtdcQryNoticeField *pQryNotice, int nRequestID) = 0; + + ///ѯϢȷ + virtual int ReqQrySettlementInfoConfirm(CThostFtdcQrySettlementInfoConfirmField *pQrySettlementInfoConfirm, int nRequestID) = 0; + + ///ѯͶֲ߳ϸ + virtual int ReqQryInvestorPositionCombineDetail(CThostFtdcQryInvestorPositionCombineDetailField *pQryInvestorPositionCombineDetail, int nRequestID) = 0; + + ///ѯ֤ϵͳ͹˾ʽ˻Կ + virtual int ReqQryCFMMCTradingAccountKey(CThostFtdcQryCFMMCTradingAccountKeyField *pQryCFMMCTradingAccountKey, int nRequestID) = 0; + + ///ѯֵ۵Ϣ + virtual int ReqQryEWarrantOffset(CThostFtdcQryEWarrantOffsetField *pQryEWarrantOffset, int nRequestID) = 0; + + ///ѯͶƷ/Ʒֱ֤ + virtual int ReqQryInvestorProductGroupMargin(CThostFtdcQryInvestorProductGroupMarginField *pQryInvestorProductGroupMargin, int nRequestID) = 0; + + ///ѯ֤ + virtual int ReqQryExchangeMarginRate(CThostFtdcQryExchangeMarginRateField *pQryExchangeMarginRate, int nRequestID) = 0; + + ///ѯ֤ + virtual int ReqQryExchangeMarginRateAdjust(CThostFtdcQryExchangeMarginRateAdjustField *pQryExchangeMarginRateAdjust, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryExchangeRate(CThostFtdcQryExchangeRateField *pQryExchangeRate, int nRequestID) = 0; + + ///ѯԱȨ + virtual int ReqQrySecAgentACIDMap(CThostFtdcQrySecAgentACIDMapField *pQrySecAgentACIDMap, int nRequestID) = 0; + + ///ѯƷۻ + virtual int ReqQryProductExchRate(CThostFtdcQryProductExchRateField *pQryProductExchRate, int nRequestID) = 0; + + ///ѯƷ + virtual int ReqQryProductGroup(CThostFtdcQryProductGroupField *pQryProductGroup, int nRequestID) = 0; + + ///ѯȨ׳ɱ + virtual int ReqQryOptionInstrTradeCost(CThostFtdcQryOptionInstrTradeCostField *pQryOptionInstrTradeCost, int nRequestID) = 0; + + ///ѯȨԼ + virtual int ReqQryOptionInstrCommRate(CThostFtdcQryOptionInstrCommRateField *pQryOptionInstrCommRate, int nRequestID) = 0; + + ///ѯִ + virtual int ReqQryExecOrder(CThostFtdcQryExecOrderField *pQryExecOrder, int nRequestID) = 0; + + ///ѯѯ + virtual int ReqQryForQuote(CThostFtdcQryForQuoteField *pQryForQuote, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryQuote(CThostFtdcQryQuoteField *pQryQuote, int nRequestID) = 0; + + ///ѯϺԼȫϵ + virtual int ReqQryCombInstrumentGuard(CThostFtdcQryCombInstrumentGuardField *pQryCombInstrumentGuard, int nRequestID) = 0; + + ///ѯ + virtual int ReqQryCombAction(CThostFtdcQryCombActionField *pQryCombAction, int nRequestID) = 0; + + ///ѯתˮ + virtual int ReqQryTransferSerial(CThostFtdcQryTransferSerialField *pQryTransferSerial, int nRequestID) = 0; + + ///ѯǩԼϵ + virtual int ReqQryAccountregister(CThostFtdcQryAccountregisterField *pQryAccountregister, int nRequestID) = 0; + + ///ѯǩԼ + virtual int ReqQryContractBank(CThostFtdcQryContractBankField *pQryContractBank, int nRequestID) = 0; + + ///ѯԤ + virtual int ReqQryParkedOrder(CThostFtdcQryParkedOrderField *pQryParkedOrder, int nRequestID) = 0; + + ///ѯԤ񳷵 + virtual int ReqQryParkedOrderAction(CThostFtdcQryParkedOrderActionField *pQryParkedOrderAction, int nRequestID) = 0; + + ///ѯ֪ͨ + virtual int ReqQryTradingNotice(CThostFtdcQryTradingNoticeField *pQryTradingNotice, int nRequestID) = 0; + + ///ѯ͹˾ײ + virtual int ReqQryBrokerTradingParams(CThostFtdcQryBrokerTradingParamsField *pQryBrokerTradingParams, int nRequestID) = 0; + + ///ѯ͹˾㷨 + virtual int ReqQryBrokerTradingAlgos(CThostFtdcQryBrokerTradingAlgosField *pQryBrokerTradingAlgos, int nRequestID) = 0; + + ///ѯû + virtual int ReqQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField *pQueryCFMMCTradingAccountToken, int nRequestID) = 0; + + ///ڻʽתڻ + virtual int ReqFromBankToFutureByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID) = 0; + + ///ڻڻʽת + virtual int ReqFromFutureToBankByFuture(CThostFtdcReqTransferField *pReqTransfer, int nRequestID) = 0; + + ///ڻѯ + virtual int ReqQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField *pReqQueryAccount, int nRequestID) = 0; + + /// ͺԼλѯ + virtual int ReqMBLQuot(CThostMBLQuotReq *pMBLQuotReq, int nRequest) = 0; + + virtual int InitLog(TThostFtdcBoolType bLog=1) = 0; + virtual int IsReviveNtyCapital(TThostFtdcBoolType bRecive=1) = 0; +protected: + ~CThostFtdcTraderApi(){}; +}; +// +}; +#endif diff --git a/include/Sgit/SgitFtdcUserApiDataType.h b/include/Sgit/SgitFtdcUserApiDataType.h new file mode 100644 index 0000000..3a533cd --- /dev/null +++ b/include/Sgit/SgitFtdcUserApiDataType.h @@ -0,0 +1,6315 @@ +///////////////////////////////////////////////////////////////////////// +///@system +///@company +///@file SgitFtdcUserApiDataType.h +///@brief ˿ͻ˽ӿʹõҵ +///@history +///20150810 +///////////////////////////////////////////////////////////////////////// + +#ifndef SGIT_FTDCDATATYPE_H +#define SGIT_FTDCDATATYPE_H +// +namespace fstech{ +// +enum THOST_TE_RESUME_TYPE +{ + THOST_TERT_RESTART = 0, + THOST_TERT_RESUME, + THOST_TERT_QUICK +}; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTraderIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDTypeһͶߴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerIDTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerAbbrTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerNameTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeInstIDTypeһԼڽĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderRefTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderRefType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParticipantIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParticipantIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserIDTypeһû +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserIDType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPasswordType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDTypeһױ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarketIDTypeһг +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMarketIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductNameTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeAbbrTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExchangeFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMacAddressTypeһMacַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMacAddressType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSystemIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangePropertyTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EXP_Normal '0' +///ݳɽɱ +#define THOST_FTDC_EXP_GenOrderByTrade '1' + +typedef char TThostFtdcExchangePropertyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLongTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLongTimeType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentNameTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementGroupIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettlementGroupIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSysIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeIDTypeһɽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeIDType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandTypeTypeһDB +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommandTypeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPAddressTypeһIPַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIPAddressType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPPortTypeһIP˿ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcIPPortType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductInfoTypeһƷϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProtocolInfoTypeһЭϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProtocolInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessUnitTypeһҵԪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessUnitType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepositSeqNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDepositSeqNoType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdentifiedCardNoTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIdentifiedCardNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdCardTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֯ +#define THOST_FTDC_ICT_EID '0' +///й֤ +#define THOST_FTDC_ICT_IDCard '1' +///֤ +#define THOST_FTDC_ICT_OfficerIDCard '2' +///֤ +#define THOST_FTDC_ICT_PoliceIDCard '3' +///ʿ֤ +#define THOST_FTDC_ICT_SoldierIDCard '4' +///ڲ +#define THOST_FTDC_ICT_HouseholdRegister '5' +/// +#define THOST_FTDC_ICT_Passport '6' +///̨֤ +#define THOST_FTDC_ICT_TaiwanCompatriotIDCard '7' +///֤ +#define THOST_FTDC_ICT_HomeComingCard '8' +///Ӫҵִպ +#define THOST_FTDC_ICT_LicenseNo '9' +///˰ǼǺ/˰ID +#define THOST_FTDC_ICT_TaxNo 'A' +///۰ľڵ֤ͨ +#define THOST_FTDC_ICT_HMMainlandTravelPermit 'B' +///̨½֤ͨ +#define THOST_FTDC_ICT_TwMainlandTravelPermit 'C' +/// +#define THOST_FTDC_ICT_DrivingLicense 'D' +///籣ID +#define THOST_FTDC_ICT_SocialID 'F' +///֤ +#define THOST_FTDC_ICT_LocalID 'G' +///ҵǼ֤ +#define THOST_FTDC_ICT_BusinessRegistration 'H' +///۰Ծ֤ +#define THOST_FTDC_ICT_HKMCIDCard 'I' +///п֤ +#define THOST_FTDC_ICT_AccountsPermits 'J' +///֤ +#define THOST_FTDC_ICT_OtherCard 'x' + +typedef char TThostFtdcIdCardTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderLocalIDTypeһر +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrderLocalIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserNameTypeһû +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPartyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPartyNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorMsgTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcErrorMsgType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldNameTypeһֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFieldNameType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldContentTypeһֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFieldContentType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemNameTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSystemNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContentTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcContentType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IR_All '1' +///Ͷ +#define THOST_FTDC_IR_Group '2' +///һͶ +#define THOST_FTDC_IR_Single '3' + +typedef char TThostFtdcInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepartmentRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_DR_All '1' +///ܹ֯ +#define THOST_FTDC_DR_Group '2' +///һͶ +#define THOST_FTDC_DR_Single '3' + +typedef char TThostFtdcDepartmentRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataSyncStatusTypeһͬ״̬ +///////////////////////////////////////////////////////////////////////// +///δͬ +#define THOST_FTDC_DS_Asynchronous '1' +///ͬ +#define THOST_FTDC_DS_Synchronizing '2' +///ͬ +#define THOST_FTDC_DS_Synchronized '3' + +typedef char TThostFtdcDataSyncStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerDataSyncStatusTypeһ͹˾ͬ״̬ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_BDS_Synchronized '1' +///ͬ +#define THOST_FTDC_BDS_Synchronizing '2' + +typedef char TThostFtdcBrokerDataSyncStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeConnectStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_ECS_NoConnection '1' +///ѾԼѯ +#define THOST_FTDC_ECS_QryInstrumentSent '2' +///ѾȡϢ +#define THOST_FTDC_ECS_GotInformation '9' + +typedef char TThostFtdcExchangeConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderConnectStatusTypeһԱ״̬ +///////////////////////////////////////////////////////////////////////// +///ûκ +#define THOST_FTDC_TCS_NotConnected '1' +///Ѿ +#define THOST_FTDC_TCS_Connected '2' +///ѾԼѯ +#define THOST_FTDC_TCS_QryInstrumentSent '3' +///˽ +#define THOST_FTDC_TCS_SubPrivateFlow '4' + +typedef char TThostFtdcTraderConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionCodeTypeһܴ +///////////////////////////////////////////////////////////////////////// +///첽 +#define THOST_FTDC_FC_DataAsync '1' +///ǿûdz +#define THOST_FTDC_FC_ForceUserLogout '2' +///û +#define THOST_FTDC_FC_UserPasswordUpdate '3' +///͹˾ +#define THOST_FTDC_FC_BrokerPasswordUpdate '4' +///Ͷ߿ +#define THOST_FTDC_FC_InvestorPasswordUpdate '5' +/// +#define THOST_FTDC_FC_OrderInsert '6' +/// +#define THOST_FTDC_FC_OrderAction '7' +///ͬϵͳ +#define THOST_FTDC_FC_SyncSystemData '8' +///ͬ͹˾ +#define THOST_FTDC_FC_SyncBrokerData '9' +///ͬ͹˾ +#define THOST_FTDC_FC_BachSyncBrokerData 'A' +///ѯ +#define THOST_FTDC_FC_SuperQuery 'B' +///Ԥ񱨵 +#define THOST_FTDC_FC_ParkedOrderInsert 'C' +///Ԥ񱨵 +#define THOST_FTDC_FC_ParkedOrderAction 'D' +///̬ͬ +#define THOST_FTDC_FC_SyncOTP 'E' +///ɾδ֪ +#define THOST_FTDC_FC_DeleteOrder 'F' + +typedef char TThostFtdcFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerFunctionCodeTypeһ͹˾ܴ +///////////////////////////////////////////////////////////////////////// +///ǿûdz +#define THOST_FTDC_BFC_ForceUserLogout '1' +///û +#define THOST_FTDC_BFC_UserPasswordUpdate '2' +///ͬ͹˾ +#define THOST_FTDC_BFC_SyncBrokerData '3' +///ͬ͹˾ +#define THOST_FTDC_BFC_BachSyncBrokerData '4' +/// +#define THOST_FTDC_BFC_OrderInsert '5' +/// +#define THOST_FTDC_BFC_OrderAction '6' +///ȫѯ +#define THOST_FTDC_BFC_AllQuery '7' +///ϵͳܣ/dz/޸ +#define THOST_FTDC_BFC_log 'a' +///ѯѯݣԼȳ +#define THOST_FTDC_BFC_BaseQry 'b' +///ײѯɽί +#define THOST_FTDC_BFC_TradeQry 'c' +///׹ܣ +#define THOST_FTDC_BFC_Trade 'd' +///ת +#define THOST_FTDC_BFC_Virement 'e' +///ռ +#define THOST_FTDC_BFC_Risk 'f' +///ѯ/ѯỰ˵ +#define THOST_FTDC_BFC_Session 'g' +///֪ͨ +#define THOST_FTDC_BFC_RiskNoticeCtl 'h' +///֪ͨ +#define THOST_FTDC_BFC_RiskNotice 'i' +///쿴͹˾ʽȨ +#define THOST_FTDC_BFC_BrokerDeposit 'j' +///ʽѯ +#define THOST_FTDC_BFC_QueryFund 'k' +///ѯ +#define THOST_FTDC_BFC_QueryOrder 'l' +///ɽѯ +#define THOST_FTDC_BFC_QueryTrade 'm' +///ֲֲѯ +#define THOST_FTDC_BFC_QueryPosition 'n' +///ѯ +#define THOST_FTDC_BFC_QueryMarketData 'o' +///û¼ѯ +#define THOST_FTDC_BFC_QueryUserEvent 'p' +///֪ͨѯ +#define THOST_FTDC_BFC_QueryRiskNotify 'q' +///ѯ +#define THOST_FTDC_BFC_QueryFundChange 'r' +///ͶϢѯ +#define THOST_FTDC_BFC_QueryInvestor 's' +///ױѯ +#define THOST_FTDC_BFC_QueryTradingCode 't' +///ǿƽ +#define THOST_FTDC_BFC_ForceClose 'u' +///ѹ +#define THOST_FTDC_BFC_PressTest 'v' +///Ȩ淴 +#define THOST_FTDC_BFC_RemainCalc 'w' +///ֱֲָ֤ +#define THOST_FTDC_BFC_NetPositionInd 'x' +///Ԥ +#define THOST_FTDC_BFC_RiskPredict 'y' +///ݵ +#define THOST_FTDC_BFC_DataExport 'z' +///ָ +#define THOST_FTDC_BFC_RiskTargetSetup 'A' +///Ԥ +#define THOST_FTDC_BFC_MarketDataWarn 'B' +///ҵ֪ͨѯ +#define THOST_FTDC_BFC_QryBizNotice 'C' +///ҵ֪ͨģ +#define THOST_FTDC_BFC_CfgBizNotice 'D' +///̬ͬ +#define THOST_FTDC_BFC_SyncOTP 'E' +///ҵ֪ͨ +#define THOST_FTDC_BFC_SendBizNotice 'F' +///ռ׼ +#define THOST_FTDC_BFC_CfgRiskLevelStd 'G' +///նӦ +#define THOST_FTDC_BFC_TbCommand 'H' +///ɾδ֪ +#define THOST_FTDC_BFC_DeleteOrder 'J' +///Ԥ񱨵 +#define THOST_FTDC_BFC_ParkedOrderInsert 'K' +///Ԥ񱨵 +#define THOST_FTDC_BFC_ParkedOrderAction 'L' + +typedef char TThostFtdcBrokerFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_OAS_Submitted 'a' +///Ѿ +#define THOST_FTDC_OAS_Accepted 'b' +///Ѿܾ +#define THOST_FTDC_OAS_Rejected 'c' + +typedef char TThostFtdcOrderActionStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ȫɽ +#define THOST_FTDC_OST_AllTraded '0' +///ֳɽڶ +#define THOST_FTDC_OST_PartTradedQueueing '1' +///ֳɽڶ +#define THOST_FTDC_OST_PartTradedNotQueueing '2' +///δɽڶ +#define THOST_FTDC_OST_NoTradeQueueing '3' +///δɽڶ +#define THOST_FTDC_OST_NoTradeNotQueueing '4' +/// +#define THOST_FTDC_OST_Canceled '5' +///δ֪ +#define THOST_FTDC_OST_Unknown 'a' +///δ +#define THOST_FTDC_OST_NotTouched 'b' +///Ѵ +#define THOST_FTDC_OST_Touched 'c' + +typedef char TThostFtdcOrderStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSubmitStatusTypeһύ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_OSS_InsertSubmitted '0' +///Ѿύ +#define THOST_FTDC_OSS_CancelSubmitted '1' +///޸Ѿύ +#define THOST_FTDC_OSS_ModifySubmitted '2' +///Ѿ +#define THOST_FTDC_OSS_Accepted '3' +///Ѿܾ +#define THOST_FTDC_OSS_InsertRejected '4' +///Ѿܾ +#define THOST_FTDC_OSS_CancelRejected '5' +///ĵѾܾ +#define THOST_FTDC_OSS_ModifyRejected '6' + +typedef char TThostFtdcOrderSubmitStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ճֲ +#define THOST_FTDC_PSD_Today '1' +///ʷֲ +#define THOST_FTDC_PSD_History '2' + +typedef char TThostFtdcPositionDateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateTypeTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ʹʷֲ +#define THOST_FTDC_PDT_UseHistory '1' +///ʹʷֲ +#define THOST_FTDC_PDT_NoUseHistory '2' + +typedef char TThostFtdcPositionDateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRoleTypeһ׽ɫ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ER_Broker '1' +///Ӫ +#define THOST_FTDC_ER_Host '2' +/// +#define THOST_FTDC_ER_Maker '3' + +typedef char TThostFtdcTradingRoleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductClassTypeһƷ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_PC_Futures '1' +///ڻȨ +#define THOST_FTDC_PC_Options '2' +/// +#define THOST_FTDC_PC_Combination '3' +/// +#define THOST_FTDC_PC_Spot '4' +///ת +#define THOST_FTDC_PC_EFP '5' +///ֻȨ +#define THOST_FTDC_PC_SpotOption '6' +//ֻ +#define THOST_FTDC_PC_Defer '7' +typedef char TThostFtdcProductClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstLifePhaseTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_IP_NotStart '0' +/// +#define THOST_FTDC_IP_Started '1' +///ͣ +#define THOST_FTDC_IP_Pause '2' +/// +#define THOST_FTDC_IP_Expired '3' + +typedef char TThostFtdcInstLifePhaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_D_Buy '0' +/// +#define THOST_FTDC_D_Sell '1' + +typedef char TThostFtdcDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionTypeTypeһֲ +///////////////////////////////////////////////////////////////////////// +///ֲ +#define THOST_FTDC_PT_Net '1' +///ۺϳֲ +#define THOST_FTDC_PT_Gross '2' + +typedef char TThostFtdcPositionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPosiDirectionTypeһֲֶշ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PD_Net '1' +///ͷ +#define THOST_FTDC_PD_Long '2' +///ͷ +#define THOST_FTDC_PD_Short '3' + +typedef char TThostFtdcPosiDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysSettlementStatusTypeһϵͳ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_SS_NonActive '1' +/// +#define THOST_FTDC_SS_Startup '2' +/// +#define THOST_FTDC_SS_Operating '3' +/// +#define THOST_FTDC_SS_Settlement '4' +/// +#define THOST_FTDC_SS_SettlementFinished '5' + +typedef char TThostFtdcSysSettlementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRatioAttrTypeһ +///////////////////////////////////////////////////////////////////////// +///׷ +#define THOST_FTDC_RA_Trade '0' +/// +#define THOST_FTDC_RA_Settlement '1' + +typedef char TThostFtdcRatioAttrType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_HF_Speculation '1' +/// +#define THOST_FTDC_HF_Arbitrage '2' +///ױ +#define THOST_FTDC_HF_Hedge '3' +//ӽ걨 +#define THOST_FTDC_HF_DEFER '4' +//걨 +#define THOST_FTDC_HF_MID '5' + +typedef char TThostFtdcHedgeFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_BHF_Speculation '1' +/// +#define THOST_FTDC_BHF_Arbitrage '2' +///ױ +#define THOST_FTDC_BHF_Hedge '3' + +typedef char TThostFtdcBillHedgeFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDTypeTypeһױ +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_CIDT_Speculation '1' +/// +#define THOST_FTDC_CIDT_Arbitrage '2' +///ױ +#define THOST_FTDC_CIDT_Hedge '3' + +typedef char TThostFtdcClientIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderPriceTypeTypeһ۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OPT_AnyPrice '1' +///޼ +#define THOST_FTDC_OPT_LimitPrice '2' +///ż +#define THOST_FTDC_OPT_BestPrice '3' +///¼ +#define THOST_FTDC_OPT_LastPrice '4' +///¼۸ϸ1ticks +#define THOST_FTDC_OPT_LastPricePlusOneTicks '5' +///¼۸ϸ2ticks +#define THOST_FTDC_OPT_LastPricePlusTwoTicks '6' +///¼۸ϸ3ticks +#define THOST_FTDC_OPT_LastPricePlusThreeTicks '7' +///һ +#define THOST_FTDC_OPT_AskPrice1 '8' +///һ۸ϸ1ticks +#define THOST_FTDC_OPT_AskPrice1PlusOneTicks '9' +///һ۸ϸ2ticks +#define THOST_FTDC_OPT_AskPrice1PlusTwoTicks 'A' +///һ۸ϸ3ticks +#define THOST_FTDC_OPT_AskPrice1PlusThreeTicks 'B' +///һ +#define THOST_FTDC_OPT_BidPrice1 'C' +///һ۸ϸ1ticks +#define THOST_FTDC_OPT_BidPrice1PlusOneTicks 'D' +///һ۸ϸ2ticks +#define THOST_FTDC_OPT_BidPrice1PlusTwoTicks 'E' +///һ۸ϸ3ticks +#define THOST_FTDC_OPT_BidPrice1PlusThreeTicks 'F' +///嵵 +#define THOST_FTDC_OPT_FiveLevelPrice 'G' + +typedef char TThostFtdcOrderPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetFlagTypeһƽ־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OF_Open '0' +///ƽ +#define THOST_FTDC_OF_Close '1' +///ǿƽ +#define THOST_FTDC_OF_ForceClose '2' +///ƽ +#define THOST_FTDC_OF_CloseToday '3' +///ƽ +#define THOST_FTDC_OF_CloseYesterday '4' +///ǿ +#define THOST_FTDC_OF_ForceOff '5' +///ǿƽ +#define THOST_FTDC_OF_LocalForceClose '6' + +typedef char TThostFtdcOffsetFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseReasonTypeһǿƽԭ +///////////////////////////////////////////////////////////////////////// +///ǿƽ +#define THOST_FTDC_FCC_NotForceClose '0' +///ʽ +#define THOST_FTDC_FCC_LackDeposit '1' +///ͻ +#define THOST_FTDC_FCC_ClientOverPositionLimit '2' +///Ա +#define THOST_FTDC_FCC_MemberOverPositionLimit '3' +///ֲַ +#define THOST_FTDC_FCC_NotMultiple '4' +///Υ +#define THOST_FTDC_FCC_Violation '5' +/// +#define THOST_FTDC_FCC_Other '6' +///Ȼٽ +#define THOST_FTDC_FCC_PersonDeliv '7' + +typedef char TThostFtdcForceCloseReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ORDT_Normal '0' +/// +#define THOST_FTDC_ORDT_DeriveFromQuote '1' +/// +#define THOST_FTDC_ORDT_DeriveFromCombination '2' +///ϱ +#define THOST_FTDC_ORDT_Combination '3' +/// +#define THOST_FTDC_ORDT_ConditionalOrder '4' +/// +#define THOST_FTDC_ORDT_Swap '5' + +typedef char TThostFtdcOrderTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeConditionTypeһЧ +///////////////////////////////////////////////////////////////////////// +///ɣ +#define THOST_FTDC_TC_IOC '1' +///Ч +#define THOST_FTDC_TC_GFS '2' +///Ч +#define THOST_FTDC_TC_GFD '3' +///ָǰЧ +#define THOST_FTDC_TC_GTD '4' +///ǰЧ +#define THOST_FTDC_TC_GTC '5' +///ϾЧ +#define THOST_FTDC_TC_GFA '6' + +typedef char TThostFtdcTimeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeConditionTypeһɽ +///////////////////////////////////////////////////////////////////////// +///κ +#define THOST_FTDC_VC_AV '1' +///С +#define THOST_FTDC_VC_MV '2' +///ȫ +#define THOST_FTDC_VC_CV '3' + +typedef char TThostFtdcVolumeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContingentConditionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CC_Immediately '1' +///ֹ +#define THOST_FTDC_CC_Touch '2' +///ֹӮ +#define THOST_FTDC_CC_TouchProfit '3' +///Ԥ +#define THOST_FTDC_CC_ParkedOrder '4' +///¼۴ +#define THOST_FTDC_CC_LastPriceGreaterThanStopPrice '5' +///¼۴ڵ +#define THOST_FTDC_CC_LastPriceGreaterEqualStopPrice '6' +///¼С +#define THOST_FTDC_CC_LastPriceLesserThanStopPrice '7' +///¼Сڵ +#define THOST_FTDC_CC_LastPriceLesserEqualStopPrice '8' +///һ۴ +#define THOST_FTDC_CC_AskPriceGreaterThanStopPrice '9' +///һ۴ڵ +#define THOST_FTDC_CC_AskPriceGreaterEqualStopPrice 'A' +///һС +#define THOST_FTDC_CC_AskPriceLesserThanStopPrice 'B' +///һСڵ +#define THOST_FTDC_CC_AskPriceLesserEqualStopPrice 'C' +///һ۴ +#define THOST_FTDC_CC_BidPriceGreaterThanStopPrice 'D' +///һ۴ڵ +#define THOST_FTDC_CC_BidPriceGreaterEqualStopPrice 'E' +///һС +#define THOST_FTDC_CC_BidPriceLesserThanStopPrice 'F' +///һСڵ +#define THOST_FTDC_CC_BidPriceLesserEqualStopPrice 'H' + +typedef char TThostFtdcContingentConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActionFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +///ɾ +#define THOST_FTDC_AF_Delete '0' +///޸ +#define THOST_FTDC_AF_Modify '3' + +typedef char TThostFtdcActionFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRightTypeһȨ +///////////////////////////////////////////////////////////////////////// +///Խ +#define THOST_FTDC_TR_Allow '0' +///ֻƽ +#define THOST_FTDC_TR_CloseOnly '1' +///ܽ +#define THOST_FTDC_TR_Forbidden '2' + +typedef char TThostFtdcTradingRightType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSourceTypeһԴ +///////////////////////////////////////////////////////////////////////// +///Բ +#define THOST_FTDC_OSRC_Participant '0' +///ԹԱ +#define THOST_FTDC_OSRC_Administrator '1' + +typedef char TThostFtdcOrderSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTypeTypeһɽ +///////////////////////////////////////////////////////////////////////// +///ϳֲֲΪһֲ,ʼӦ͵ijֲ +#define THOST_FTDC_TRDT_SplitCombination '#' +///ͨɽ +#define THOST_FTDC_TRDT_Common '0' +///Ȩִ +#define THOST_FTDC_TRDT_OptionsExecution '1' +///OTCɽ +#define THOST_FTDC_TRDT_OTC '2' +///תɽ +#define THOST_FTDC_TRDT_EFPDerived '3' +///ɽ +#define THOST_FTDC_TRDT_CombinationDerived '4' + +typedef char TThostFtdcTradeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceSourceTypeһɽԴ +///////////////////////////////////////////////////////////////////////// +///ǰɽ +#define THOST_FTDC_PSRC_LastPrice '0' +///ίм +#define THOST_FTDC_PSRC_Buy '1' +///ίм +#define THOST_FTDC_PSRC_Sell '2' + +typedef char TThostFtdcPriceSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentStatusTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +///ǰ +#define THOST_FTDC_IS_BeforeTrading '0' +///ǽ +#define THOST_FTDC_IS_NoTrading '1' +/// +#define THOST_FTDC_IS_Continous '2' +///Ͼ۱ +#define THOST_FTDC_IS_AuctionOrdering '3' +///Ͼۼ۸ƽ +#define THOST_FTDC_IS_AuctionBalance '4' +///Ͼ۴ +#define THOST_FTDC_IS_AuctionMatch '5' +/// +#define THOST_FTDC_IS_Closed '6' + +typedef char TThostFtdcInstrumentStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstStatusEnterReasonTypeһƷֽ뽻״̬ԭ +///////////////////////////////////////////////////////////////////////// +///Զл +#define THOST_FTDC_IER_Automatic '1' +///ֶл +#define THOST_FTDC_IER_Manual '2' +///۶ +#define THOST_FTDC_IER_Fuse '3' + +typedef char TThostFtdcInstStatusEnterReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionRefTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcOrderActionRefType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstallCountTypeһװ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcInstallCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstallIDTypeһװ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcInstallIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcErrorIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSettlementIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFrontIDTypeһǰñ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFrontIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSessionIDTypeһỰ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSessionIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSequenceNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandNoTypeһDB +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCommandNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMillisecTypeһʱ䣨룩 +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMillisecType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeMultipleTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcVolumeMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingSegmentSNTypeһ׽׶α +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradingSegmentSNType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRequestIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRequestIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYearTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcYearType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMonthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBoolTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBoolType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcPriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombOffsetFlagTypeһϿƽ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombOffsetFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombHedgeFlagTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombHedgeFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRatioTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcRatioType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLargeVolumeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcLargeVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceSeriesTypeһϵк +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcSequenceSeriesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommPhaseNoTypeһͨѶʱα +///////////////////////////////////////////////////////////////////////// +typedef short TThostFtdcCommPhaseNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceLabelTypeһб +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSequenceLabelType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUnderlyingMultipleTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcUnderlyingMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriorityTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcPriorityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContractCodeTypeһͬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcContractCodeType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCityTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCityType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsStockTypeһǷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIsStockType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcChannelTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcChannelType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAddressTypeһͨѶַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAddressType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcZipCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcZipCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTelephoneTypeһϵ绰 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTelephoneType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFaxTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFaxType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMobileTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMobileType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEMailTypeһʼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEMailType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMemoTypeһע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMemoType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCompanyCodeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCompanyCodeType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWebsiteTypeһվַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWebsiteType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTaxNoTypeһ˰ǼǺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTaxNoType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBatchStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δϴ +#define THOST_FTDC_BS_NoUpload '1' +///ϴ +#define THOST_FTDC_BS_Uploaded '2' +///ʧ +#define THOST_FTDC_BS_Failed '3' + +typedef char TThostFtdcBatchStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyIDTypeһԴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLicenseNoTypeһӪҵִպ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLicenseNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentIDTypeһ˴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentGroupIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentGroupIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentGroupNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentGroupNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnStyleTypeһƷַʽ +///////////////////////////////////////////////////////////////////////// +///Ʒ +#define THOST_FTDC_RS_All '1' +///Ʒ +#define THOST_FTDC_RS_ByProduct '2' + +typedef char TThostFtdcReturnStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnPatternTypeһģʽ +///////////////////////////////////////////////////////////////////////// +///ɽ +#define THOST_FTDC_RP_ByVolume '1' +/// +#define THOST_FTDC_RP_ByFeeOnHand '2' + +typedef char TThostFtdcReturnPatternType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnLevelTypeһ +///////////////////////////////////////////////////////////////////////// +///1 +#define THOST_FTDC_RL_Level1 '1' +///2 +#define THOST_FTDC_RL_Level2 '2' +///3 +#define THOST_FTDC_RL_Level3 '3' +///4 +#define THOST_FTDC_RL_Level4 '4' +///5 +#define THOST_FTDC_RL_Level5 '5' +///6 +#define THOST_FTDC_RL_Level6 '6' +///7 +#define THOST_FTDC_RL_Level7 '7' +///8 +#define THOST_FTDC_RL_Level8 '8' +///9 +#define THOST_FTDC_RL_Level9 '9' + +typedef char TThostFtdcReturnLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnStandardTypeһ׼ +///////////////////////////////////////////////////////////////////////// +///ֽ׶η +#define THOST_FTDC_RSD_ByPeriod '1' +///ijһ׼ +#define THOST_FTDC_RSD_ByStandard '2' + +typedef char TThostFtdcReturnStandardType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMortgageTypeTypeһѺ +///////////////////////////////////////////////////////////////////////// +///ʳ +#define THOST_FTDC_MT_Out '0' +/// +#define THOST_FTDC_MT_In '1' + +typedef char TThostFtdcMortgageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorSettlementParamIDTypeһͶ߽ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_ISPI_BaseMargin '1' +///Ȩ׼ +#define THOST_FTDC_ISPI_LowestInterest '2' +///Ѻ +#define THOST_FTDC_ISPI_MortgageRatio '4' +///֤㷨 +#define THOST_FTDC_ISPI_MarginWay '5' +///ctp :㵥ǷѺ +///sgit:㵥()Ȩڽ +#define THOST_FTDC_ISPI_BillDeposit '9' + +typedef char TThostFtdcInvestorSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeSettlementParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_ESPI_MortgageRatio '1' +///ʽ +#define THOST_FTDC_ESPI_OtherFundItem '2' +///ʽ뽻 +#define THOST_FTDC_ESPI_OtherFundImport '3' +///ȡʽ +#define THOST_FTDC_ESPI_SHFEDelivFee '4' +///ȡʽ +#define THOST_FTDC_ESPI_DCEDelivFee '5' +///нͿý +#define THOST_FTDC_ESPI_CFFEXMinPrepa '6' +///֣㷽ʽ +#define THOST_FTDC_ESPI_CZCESettlementType '7' +///ȡʽ +#define THOST_FTDC_ESPI_ExchDelivFeeMode '9' +///Ͷ߽ȡʽ +#define THOST_FTDC_ESPI_DelivFeeMode '0' +///֣ϳֱֲ֤ȡʽ +#define THOST_FTDC_ESPI_CZCEComMarginType 'A' +///֤ǷŻ +#define THOST_FTDC_ESPI_DceComMarginType 'B' +///ֵȨ֤Żݱ +#define THOST_FTDC_ESPI_OptOutDisCountRate 'a' +///ͱϵ +#define THOST_FTDC_ESPI_OptMiniGuarantee 'b' + +typedef char TThostFtdcExchangeSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemParamIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +///ͶߴС +#define THOST_FTDC_SPI_InvestorIDMinLength '1' +///ͶʺŴС +#define THOST_FTDC_SPI_AccountIDMinLength '2' +///Ͷ߿Ĭϵ¼Ȩ +#define THOST_FTDC_SPI_UserRightLogon '3' +///Ͷ߽׽㵥ɽܷʽ +#define THOST_FTDC_SPI_SettlementBillTrade '4' +///ͳһ½ױ뷽ʽ +#define THOST_FTDC_SPI_TradingCode '5' +///Ƿжϴδ˵ijͷʽ +#define THOST_FTDC_SPI_CheckFund '6' +///ǷģȨ +#define THOST_FTDC_SPI_CommModelRight '7' +///Ƿñ֤ģȨ +#define THOST_FTDC_SPI_MarginModelRight '9' +///Ƿ淶ûܼ +#define THOST_FTDC_SPI_IsStandardActive '8' +///ϴĽļ· +#define THOST_FTDC_SPI_UploadSettlementFile 'U' +///ϱ֤ļ· +#define THOST_FTDC_SPI_DownloadCSRCFile 'D' +///ɵĽ㵥ļ· +#define THOST_FTDC_SPI_SettlementBillFile 'S' +///֤ļʶ +#define THOST_FTDC_SPI_CSRCOthersFile 'C' +///ͶƬ· +#define THOST_FTDC_SPI_InvestorPhoto 'P' +///ȫᾭ͹˾ϴļ· +#define THOST_FTDC_SPI_CSRCData 'R' +///¼뷽ʽ +#define THOST_FTDC_SPI_InvestorPwdModel 'I' +///Ͷнļ· +#define THOST_FTDC_SPI_CFFEXInvestorSettleFile 'F' +///Ͷߴ뷽ʽ +#define THOST_FTDC_SPI_InvestorIDType 'a' +///߻Ȩ +#define THOST_FTDC_SPI_FreezeMaxReMain 'r' +///زʵʱϳ +#define THOST_FTDC_SPI_IsSync 'A' +///Ȩ +#define THOST_FTDC_SPI_RelieveOpenLimit 'O' +///Ƿ淶û +#define THOST_FTDC_SPI_IsStandardFreeze 'X' +///֣Ƿ񿪷Ʒױ +#define THOST_FTDC_SPI_CZCENormalProductHedge 'B' + +typedef char TThostFtdcSystemParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeParamIDTypeһϵͳ +///////////////////////////////////////////////////////////////////////// +///ϵͳ㷨 +#define THOST_FTDC_TPID_EncryptionStandard 'E' +///ϵͳ㷨 +#define THOST_FTDC_TPID_RiskMode 'R' +///ϵͳ㷨Ƿȫ 0- 1- +#define THOST_FTDC_TPID_RiskModeGlobal 'G' +///㷨 +#define THOST_FTDC_TPID_modeEncode 'P' +///۸Сλ +#define THOST_FTDC_TPID_tickMode 'T' +///ûỰ +#define THOST_FTDC_TPID_SingleUserSessionMaxNum 'S' +///¼ʧ +#define THOST_FTDC_TPID_LoginFailMaxNum 'L' +///Ƿǿ֤ +#define THOST_FTDC_TPID_IsAuthForce 'A' +///Ƿ񶳽֤ȯֲ +#define THOST_FTDC_TPID_IsPosiFreeze 'F' +///Ƿ޲ +#define THOST_FTDC_TPID_IsPosiLimit 'M' +///֣ѯʱ +#define THOST_FTDC_TPID_ForQuoteTimeInterval 'Q' + +typedef char TThostFtdcTradeParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementParamValueTypeһֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettlementParamValueType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCounterIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCounterIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorGroupNameTypeһͶ߷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorGroupNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrandCodeTypeһƺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrandCodeType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWarehouseTypeһֿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWarehouseType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProductDateType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGradeTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcGradeType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClassifyTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClassifyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPositionType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYieldlyTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcYieldlyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWeightTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWeightType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubEntryFundNoTypeһʽˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSubEntryFundNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileIDTypeһļʶ +///////////////////////////////////////////////////////////////////////// +///ʽ +#define THOST_FTDC_FI_SettlementFund 'F' +///ɽ +#define THOST_FTDC_FI_Trade 'T' +///Ͷֲ߳ +#define THOST_FTDC_FI_InvestorPosition 'P' +///Ͷ߷ʽ +#define THOST_FTDC_FI_SubEntryFund 'O' +///ctp :ϳֲ +///sgit:֣ϳֲ +#define THOST_FTDC_FI_CZCECombinationPos 'C' +///ϱ֤ +#define THOST_FTDC_FI_CSRCData 'R' +///֣ƽ˽ +#define THOST_FTDC_FI_CZCEClose 'L' +///֣ƽ˽ +#define THOST_FTDC_FI_CZCENoClose 'N' +///ֲϸ +#define THOST_FTDC_FI_PositionDtl 'D' +///Ȩִļ +#define THOST_FTDC_FI_OptionStrike 'S' +///۱ȶļ +#define THOST_FTDC_FI_SettlementPriceComparison 'M' +///dzֱֲ䶯ϸ +#define THOST_FTDC_FI_NonTradePosChange 'B' + +typedef char TThostFtdcFileIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFileNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileTypeTypeһļϴ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FUT_Settlement '0' +///˶ +#define THOST_FTDC_FUT_Check '1' + +typedef char TThostFtdcFileTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileFormatTypeһļʽ +///////////////////////////////////////////////////////////////////////// +///ıļ(.txt) +#define THOST_FTDC_FFT_Txt '0' +///ѹļ(.zip) +#define THOST_FTDC_FFT_Zip '1' +///DBFļ(.dbf) +#define THOST_FTDC_FFT_DBF '2' + +typedef char TThostFtdcFileFormatType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileUploadStatusTypeһļ״̬ +///////////////////////////////////////////////////////////////////////// +///ϴɹ +#define THOST_FTDC_FUS_SucceedUpload '1' +///ϴʧ +#define THOST_FTDC_FUS_FailedUpload '2' +///ɹ +#define THOST_FTDC_FUS_SucceedLoad '3' +///벿ֳɹ +#define THOST_FTDC_FUS_PartSucceedLoad '4' +///ʧ +#define THOST_FTDC_FUS_FailedLoad '5' + +typedef char TThostFtdcFileUploadStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferDirectionTypeһƲַ +///////////////////////////////////////////////////////////////////////// +///Ƴ +#define THOST_FTDC_TD_Out '0' +/// +#define THOST_FTDC_TD_In '1' + +typedef char TThostFtdcTransferDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUploadModeTypeһϴļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUploadModeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountIDTypeһͶʺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAccountIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankFlagTypeһͳһʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankFlagType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenNameTypeһ˻Ŀ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOpenNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenBankTypeһ˻Ŀ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOpenBankType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPublishPathTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPublishPathType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorIDTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperatorIDType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthCountTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcMonthCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAdvanceMonthArrayTypeһ·ǰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAdvanceMonthArrayType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDateExprTypeһڱʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDateExprType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDExprTypeһԼʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDExprType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentNameExprTypeһԼƱʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentNameExprType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSpecialCreateRuleTypeһĴ +///////////////////////////////////////////////////////////////////////// +///ûⴴ +#define THOST_FTDC_SC_NoSpecialRule '0' +/// +#define THOST_FTDC_SC_NoSpringFestival '1' + +typedef char TThostFtdcSpecialCreateRuleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBasisPriceTypeTypeһƻ׼ +///////////////////////////////////////////////////////////////////////// +///һԼ +#define THOST_FTDC_IPT_LastSettlement '1' +///һԼ̼ +#define THOST_FTDC_IPT_LaseClose '2' + +typedef char TThostFtdcBasisPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductLifePhaseTypeһƷ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_PLP_Active '1' +///Ծ +#define THOST_FTDC_PLP_NonActive '2' +///ע +#define THOST_FTDC_PLP_Canceled '3' + +typedef char TThostFtdcProductLifePhaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeliveryModeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///ֽ𽻸 +#define THOST_FTDC_DM_CashDeliv '1' +///ʵサ +#define THOST_FTDC_DM_CommodityDeliv '2' + +typedef char TThostFtdcDeliveryModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLogLevelTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLogLevelType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessNameTypeһ洢 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperationMemoTypeһժҪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperationMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundIOTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FIOT_FundIO '1' +///ת +#define THOST_FTDC_FIOT_Transfer '2' +///ڻ +#define THOST_FTDC_FIOT_SwapCurrency '3'//sgit + +typedef char TThostFtdcFundIOTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundTypeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_FT_Deposite '1' +///ʽ +#define THOST_FTDC_FT_ItemFund '2' +///˾ +#define THOST_FTDC_FT_Company '3' +///ʽת +#define THOST_FTDC_FT_InnerTransfer '4'//sgit: + +typedef char TThostFtdcFundTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FD_In '1' +/// +#define THOST_FTDC_FD_Out '2' + +typedef char TThostFtdcFundDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundStatusTypeһʽ״̬ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_FS_Record '1' +///Ѹ +#define THOST_FTDC_FS_Check '2' +///ѳ +#define THOST_FTDC_FS_Charge '3' + +typedef char TThostFtdcFundStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillNoTypeһƱݺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBillNoType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillNameTypeһƱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBillNameType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPublishStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PS_None '1' +///ڷ +#define THOST_FTDC_PS_Publishing '2' +///ѷ +#define THOST_FTDC_PS_Published '3' + +typedef char TThostFtdcPublishStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueIDTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueIDType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueTypeTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueLabelTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueLabelType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEnumValueResultTypeһöֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEnumValueResultType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemStatusTypeһϵͳ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_ES_NonActive '1' +/// +#define THOST_FTDC_ES_Startup '2' +///׿ʼʼ +#define THOST_FTDC_ES_Initialize '3' +///ɳʼ +#define THOST_FTDC_ES_Initialized '4' +///пʼ +#define THOST_FTDC_ES_Close '5' +/// +#define THOST_FTDC_ES_Closed '6' +/// +#define THOST_FTDC_ES_Settlement '7' + +typedef char TThostFtdcSystemStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ʼ +#define THOST_FTDC_STS_Initialize '0' +/// +#define THOST_FTDC_STS_Settlementing '1' +///ѽ +#define THOST_FTDC_STS_Settlemented '2' +/// +#define THOST_FTDC_STS_Finished '3' + +typedef char TThostFtdcSettlementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntTypeTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntFromTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntFromType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRangeIntToTypeһ޶ֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRangeIntToType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionIDTypeһܴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionIDType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionValueCodeTypeһܱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionValueCodeType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleIDTypeһɫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRoleIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleNameTypeһɫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRoleNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDescriptionTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDescriptionType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombineIDTypeһϱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombineIDType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombineTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombineTypeType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CT_Person '0' +/// +#define THOST_FTDC_CT_Company '1' +///Ͷʻ +#define THOST_FTDC_CT_Fund '2' +///ⷨ +#define THOST_FTDC_CT_SpecialOrgan '3'//sgit +///ʹܻ +#define THOST_FTDC_CT_Asset '4'//sgit + +typedef char TThostFtdcInvestorTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerTypeTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +///׻Ա +#define THOST_FTDC_BT_Trade '0' +///׽Ա +#define THOST_FTDC_BT_TradeSettle '1' + +typedef char TThostFtdcBrokerTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskLevelTypeһյȼ +///////////////////////////////////////////////////////////////////////// +///ͷտͻ +#define THOST_FTDC_FAS_Low '1' +///ͨͻ +#define THOST_FTDC_FAS_Normal '2' +///עͻ +#define THOST_FTDC_FAS_Focus '3' +///տͻ +#define THOST_FTDC_FAS_Risk '4' + +typedef char TThostFtdcRiskLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFeeAcceptStyleTypeһȡʽ +///////////////////////////////////////////////////////////////////////// +///ȡ +#define THOST_FTDC_FAS_ByTrade '1' +///ȡ +#define THOST_FTDC_FAS_ByDeliv '2' +/// +#define THOST_FTDC_FAS_None '3' +///ָȡ +#define THOST_FTDC_FAS_FixFee '4' + +typedef char TThostFtdcFeeAcceptStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PWDT_Trade '1' +///ʽ +#define THOST_FTDC_PWDT_Account '2' + +typedef char TThostFtdcPasswordTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAlgorithmTypeһӯ㷨 +///////////////////////////////////////////////////////////////////////// +///ӯ +#define THOST_FTDC_AG_All '1' +///ӯƣ +#define THOST_FTDC_AG_OnlyLost '2' +///ӯƣ +#define THOST_FTDC_AG_OnlyGain '3' +///ӯ +#define THOST_FTDC_AG_None '4' + +typedef char TThostFtdcAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIncludeCloseProfitTypeһǷƽӯ +///////////////////////////////////////////////////////////////////////// +///ƽӯ +#define THOST_FTDC_ICP_Include '0' +///ƽӯ +#define THOST_FTDC_ICP_NotInclude '2' + +typedef char TThostFtdcIncludeCloseProfitType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAllWithoutTradeTypeһǷܿ +///////////////////////////////////////////////////////////////////////// +///޲޳ɽܿ +#define THOST_FTDC_AWT_Enable '0' +///ܿ +#define THOST_FTDC_AWT_Disable '2' +///޲ֲܿ +#define THOST_FTDC_AWT_NoHoldEnable '3'//sgit + +typedef char TThostFtdcAllWithoutTradeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommentTypeһӯ㷨˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommentType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVersionTypeһ汾 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcVersionType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeCodeTypeһ״ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeSerialType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSerialNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradeSerialNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureIDTypeһڻ˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankIDTypeһд +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankBrchIDTypeһзĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankBrchIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankBranchIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankBranchIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperNoTypeһ׹Ա +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperNoType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeviceIDTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDeviceIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRecordNumTypeһ¼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRecordNumType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccountTypeһڻʽ˺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccountType[22]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFuturePwdFlagTypeһʽ˶Ա־ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_FPWD_UnCheck '0' +///˶ +#define THOST_FTDC_FPWD_Check '1' + +typedef char TThostFtdcFuturePwdFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferTypeTypeһת +///////////////////////////////////////////////////////////////////////// +///תڻ +#define THOST_FTDC_TT_BankToFuture '0' +///ڻת +#define THOST_FTDC_TT_FutureToBank '1' + +typedef char TThostFtdcTransferTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccPwdTypeһڻʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccPwdType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyCodeType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRetCodeTypeһӦ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRetCodeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRetInfoTypeһӦϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRetInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeAmtTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTradeAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUseAmtTypeһп +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUseAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFetchAmtTypeһпȡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFetchAmtType[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferValidFlagTypeһתЧ־ +///////////////////////////////////////////////////////////////////////// +///Чʧ +#define THOST_FTDC_TVF_Invalid '0' +///Ч +#define THOST_FTDC_TVF_Valid '1' +/// +#define THOST_FTDC_TVF_Reverse '2' + +typedef char TThostFtdcTransferValidFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCertCodeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCertCodeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReasonTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_RN_CD '0' +///ʽ; +#define THOST_FTDC_RN_ZT '1' +/// +#define THOST_FTDC_RN_QT '2' + +typedef char TThostFtdcReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundProjectIDTypeһʽĿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFundProjectIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSexTypeһԱ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_SEX_None '0' +/// +#define THOST_FTDC_SEX_Man '1' +///Ů +#define THOST_FTDC_SEX_Woman '2' + +typedef char TThostFtdcSexType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProfessionTypeһְҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProfessionType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNationalTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNationalType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProvinceTypeһʡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProvinceType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRegionTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRegionType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCountryTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCountryType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLicenseNOTypeһӪҵִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLicenseNOType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCompanyTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCompanyTypeType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessScopeTypeһӪΧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessScopeType[1001]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCapitalCurrencyTypeһעʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCapitalCurrencyType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserTypeTypeһû +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_UT_Investor '0' +///Ա +#define THOST_FTDC_UT_Operator '1' +///Ա +#define THOST_FTDC_UT_SuperUser '2' + +typedef char TThostFtdcUserTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_RATETYPE_MarginRate '2' + +typedef char TThostFtdcRateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNoteTypeTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +///׽㵥 +#define THOST_FTDC_NOTETYPE_TradeSettleBill '1' +///׽± +#define THOST_FTDC_NOTETYPE_TradeSettleMonth '2' +///׷ӱ֤֪ͨ +#define THOST_FTDC_NOTETYPE_CallMarginNotes '3' +///ǿƽ֪ͨ +#define THOST_FTDC_NOTETYPE_ForceCloseNotes '4' +///ɽ֪ͨ +#define THOST_FTDC_NOTETYPE_TradeNotes '5' +///֪ͨ +#define THOST_FTDC_NOTETYPE_DelivNotes '6' + +typedef char TThostFtdcNoteTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementStyleTypeһ㵥ʽ +///////////////////////////////////////////////////////////////////////// +///ն +#define THOST_FTDC_SBS_Day '1' +///ʶԳ +#define THOST_FTDC_SBS_Volume '2' + +typedef char TThostFtdcSettlementStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerDNSTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBrokerDNSType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSentenceTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSentenceType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementBillTypeTypeһ㵥 +///////////////////////////////////////////////////////////////////////// +///ձ +#define THOST_FTDC_ST_Day '0' +///± +#define THOST_FTDC_ST_Month '1' + +typedef char TThostFtdcSettlementBillTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserRightTypeTypeһͻȨ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_URT_Logon '1' +///ת +#define THOST_FTDC_URT_Transfer '2' +///ʼĽ㵥 +#define THOST_FTDC_URT_EMail '3' +///㵥 +#define THOST_FTDC_URT_Fax '4' +/// +#define THOST_FTDC_URT_ConditionOrder '5' + +typedef char TThostFtdcUserRightTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginPriceTypeTypeһ֤۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_MPT_PreSettlementPrice '1' +///¼ +#define THOST_FTDC_MPT_SettlementPrice '2' +///ɽ +#define THOST_FTDC_MPT_AveragePrice '3' +///ּ +#define THOST_FTDC_MPT_OpenPrice '4' + +typedef char TThostFtdcMarginPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillGenStatusTypeһ㵥״̬ +///////////////////////////////////////////////////////////////////////// +///δ +//sgit: +#define THOST_FTDC_BGS_None '0' +/// +//sigt:δ +#define THOST_FTDC_BGS_NoGenerated '1' +/// +#define THOST_FTDC_BGS_Generated '2' + +typedef char TThostFtdcBillGenStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAlgoTypeTypeһ㷨 +///////////////////////////////////////////////////////////////////////// +///ֲִ㷨 +#define THOST_FTDC_AT_HandlePositionAlgo '1' +///Ѱұ֤㷨 +#define THOST_FTDC_AT_FindMarginRateAlgo '2' + +typedef char TThostFtdcAlgoTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandlePositionAlgoIDTypeһֲִ㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HPA_Base '1' +///Ʒ +#define THOST_FTDC_HPA_DCE '2' +///֣Ʒ +#define THOST_FTDC_HPA_CZCE '3' + +typedef char TThostFtdcHandlePositionAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFindMarginRateAlgoIDTypeһѰұ֤㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FMRA_Base '1' +///Ʒ +#define THOST_FTDC_FMRA_DCE '2' +///֣Ʒ +#define THOST_FTDC_FMRA_CZCE '3' + +typedef char TThostFtdcFindMarginRateAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandleTradingAccountAlgoIDTypeһʽ㷨 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HTAA_Base '1' +///Ʒ +#define THOST_FTDC_HTAA_DCE '2' +///֣Ʒ +#define THOST_FTDC_HTAA_CZCE '3' + +typedef char TThostFtdcHandleTradingAccountAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPersonTypeTypeһϵ +///////////////////////////////////////////////////////////////////////// +///ָµ +#define THOST_FTDC_PST_Order '1' +///Ȩ +#define THOST_FTDC_PST_Open '2' +///ʽ +#define THOST_FTDC_PST_Fund '3' +///㵥ȷ +#define THOST_FTDC_PST_Settlement '4' +/// +#define THOST_FTDC_PST_Company '5' +///˴ +#define THOST_FTDC_PST_Corporation '6' +///Ͷϵ +#define THOST_FTDC_PST_LinkMan '7' +///ֻʲ +#define THOST_FTDC_PST_Ledger '8'//,sgit +///У +#define THOST_FTDC_PST_Trustee '9' +///Уܻ˴ +#define THOST_FTDC_PST_TrusteeCorporation 'A' +///УܻȨ +#define THOST_FTDC_PST_TrusteeOpen 'B' +///Уܻϵ +#define THOST_FTDC_PST_TrusteeContact 'C' +///Ȼ˲ο֤ +#define THOST_FTDC_PST_ForeignerRefer 'D' +///˴ο֤ +#define THOST_FTDC_PST_CorporationRefer 'E' + +typedef char TThostFtdcPersonTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQueryInvestorRangeTypeһѯΧ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_QIR_All '1' +///ѯ +#define THOST_FTDC_QIR_Group '2' +///һͶ +#define THOST_FTDC_QIR_Single '3' + +typedef char TThostFtdcQueryInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorRiskStatusTypeһͶ߷״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_IRS_Normal '1' +/// +#define THOST_FTDC_IRS_Warn '2' +///׷ +#define THOST_FTDC_IRS_Call '3' +///ǿƽ +#define THOST_FTDC_IRS_Force '4' +///쳣 +#define THOST_FTDC_IRS_Exception '5' + +typedef char TThostFtdcInvestorRiskStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLegIDTypeһȱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLegIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLegMultipleTypeһȳ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLegMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcImplyLevelTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcImplyLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearAccountType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganNOTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganNOType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearbarchIDTypeһ˻к +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearbarchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventTypeTypeһû¼ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_UET_Login '1' +///dz +#define THOST_FTDC_UET_Logout '2' +///׳ɹ +#define THOST_FTDC_UET_Trading '3' +///ʧ +#define THOST_FTDC_UET_TradingError '4' +///޸ +#define THOST_FTDC_UET_UpdatePassword '5' +///ͻ֤ +#define THOST_FTDC_UET_Authenticate '6' +/// +#define THOST_FTDC_UET_Other '9' + +typedef char TThostFtdcUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventInfoTypeһû¼Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserEventInfoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCloseStyleTypeһƽַʽ +///////////////////////////////////////////////////////////////////////// +///ȿƽ +#define THOST_FTDC_ICS_Close '0' +///ƽƽ +#define THOST_FTDC_ICS_CloseToday '1' + +typedef char TThostFtdcCloseStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStatModeTypeһͳƷʽ +///////////////////////////////////////////////////////////////////////// +///---- +#define THOST_FTDC_SM_Non '0' +///Լͳ +#define THOST_FTDC_SM_Instrument '1' +///Ʒͳ +#define THOST_FTDC_SM_Product '2' +///Ͷͳ +#define THOST_FTDC_SM_Investor '3' + +typedef char TThostFtdcStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParkedOrderStatusTypeһԤ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PAOS_NotSend '1' +///ѷ +#define THOST_FTDC_PAOS_Send '2' +///ɾ +#define THOST_FTDC_PAOS_Deleted '3' + +typedef char TThostFtdcParkedOrderStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParkedOrderIDTypeһԤ񱨵 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParkedOrderIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParkedOrderActionIDTypeһԤ񳷵 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParkedOrderActionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirDealStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ڴ +#define THOST_FTDC_VDS_Dealing '1' +///ɹ +#define THOST_FTDC_VDS_DeaclSucceed '2' + +typedef char TThostFtdcVirDealStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrgSystemIDTypeһԭϵͳ +///////////////////////////////////////////////////////////////////////// +///ۺϽƽ̨ +#define THOST_FTDC_ORGS_Standard '0' +///ʢϵͳ +#define THOST_FTDC_ORGS_ESunny '1' +///˴V6ϵͳ +#define THOST_FTDC_ORGS_KingStarV6 '2' + +typedef char TThostFtdcOrgSystemIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirTradeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VTS_NaturalDeal '0' +///ɹ +#define THOST_FTDC_VTS_SucceedEnd '1' +///ʧܽ +#define THOST_FTDC_VTS_FailedEND '2' +///쳣 +#define THOST_FTDC_VTS_Exception '3' +///˹쳣 +#define THOST_FTDC_VTS_ManualDeal '4' +///ͨѶ쳣 ˹ +#define THOST_FTDC_VTS_MesException '5' +///ϵͳ˹ +#define THOST_FTDC_VTS_SysException '6' + +typedef char TThostFtdcVirTradeStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirBankAccTypeTypeһʻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VBAT_BankBook '1' +/// +#define THOST_FTDC_VBAT_BankCard '2' +///ÿ +#define THOST_FTDC_VBAT_CreditCard '3' + +typedef char TThostFtdcVirBankAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementStatusTypeһʻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_VMS_Natural '0' +/// +#define THOST_FTDC_VMS_Canceled '9' + +typedef char TThostFtdcVirementStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementAvailAbilityTypeһЧ־ +///////////////////////////////////////////////////////////////////////// +///δȷ +#define THOST_FTDC_VAA_NoAvailAbility '0' +///Ч +#define THOST_FTDC_VAA_AvailAbility '1' +/// +#define THOST_FTDC_VAA_Repeal '2' + +typedef char TThostFtdcVirementAvailAbilityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVirementTradeCodeTypeһ״ +///////////////////////////////////////////////////////////////////////// +///зʽתڻ +#define THOST_FTDC_VTC_BankBankToFuture '102001' +///зڻʽת +#define THOST_FTDC_VTC_BankFutureToBank '102002' +///ڻʽתڻ +#define THOST_FTDC_VTC_FutureBankToFuture '202001' +///ڻڻʽת +#define THOST_FTDC_VTC_FutureFutureToBank '202002' + +typedef char TThostFtdcVirementTradeCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoTypeNameTypeһӰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoTypeNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoTypeIDTypeһӰʹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoTypeIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPhotoNameTypeһӰ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPhotoNameType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTopicIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTopicIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReportTypeIDTypeһױͱʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcReportTypeIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCharacterIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCharacterIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLParamIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInvestorTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInvestorTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLIdCardTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLIdCardTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradeDirectTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradeDirectType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradeModelTypeһʽʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradeModelType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLParamIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLOpParamValueTypeһҵֵ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcAMLOpParamValueType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCustomerCardTypeTypeһͻ֤/֤ļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCustomerCardTypeType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionNameTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLDistrictIDTypeһڻڵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLDistrictIDType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLRelationShipTypeһڻ׵Ĺϵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLRelationShipType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionTypeTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLInstitutionIDTypeһڻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLInstitutionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLAccountTypeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTradingTypeTypeһ׷ʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTradingTypeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLTransactClassTypeһ֧׷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLTransactClassType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCapitalIOTypeһʽոʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCapitalIOType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSiteTypeһ׵ص +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSiteType[10]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCapitalPurposeTypeһʽ; +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLCapitalPurposeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLReportTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLReportTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSerialNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSerialNoType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLStatusType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLGenStatusTypeһAmlɷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_GEN_Program '0' +///˹ +#define THOST_FTDC_GEN_HandWork '1' + +typedef char TThostFtdcAMLGenStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLSeqCodeTypeһҵʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLSeqCodeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLFileNameTypeһAMLļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLFileNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLMoneyTypeһϴǮʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcAMLMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLFileAmountTypeһϴǮʽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcAMLFileAmountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCKeyTypeһԿ(֤) +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCFMMCKeyType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCTokenTypeһ(֤) +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCFMMCTokenType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFMMCKeyKindTypeһ̬Կ(֤) +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CFMMCKK_REQUEST 'R' +///CFMMCԶ +#define THOST_FTDC_CFMMCKK_AUTO 'A' +///CFMMCֶ +#define THOST_FTDC_CFMMCKK_MANUAL 'M' + +typedef char TThostFtdcCFMMCKeyKindType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLReportNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAMLReportNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIndividualNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIndividualNameType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyIDTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustNumberTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCustNumberType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganCodeType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSuperOrganCodeTypeһϼ,ڻ˾ܲ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSuperOrganCodeType[12]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubBranchIDTypeһ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSubBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSubBranchNameTypeһ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSubBranchNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchNetCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBranchNetCodeType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchNetNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBranchNetNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganFlagTypeһʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOrganFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankCodingForFutureTypeһжڻ˾ı +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankCodingForFutureType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankReturnCodeTypeһжԷĶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankReturnCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPlateReturnCodeTypeһתƽ̨ԷĶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPlateReturnCodeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankSubBranchIDTypeһз֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankSubBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureBranchIDTypeһڻ֧ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReturnCodeTypeһش +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcReturnCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorCodeTypeһԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOperatorCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearDepIDTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearDepIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearBrchIDTypeһʻк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearBrchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClearNameTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClearNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountNameTypeһʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountNameType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvDepIDTypeһͶ˺Ż +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvDepIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvBrchIDTypeһͶк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvBrchIDType[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMessageFormatVersionTypeһϢʽ汾 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMessageFormatVersionType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDigestTypeһժҪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDigestType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthenticDataTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthenticDataType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPasswordKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccountNameTypeһڻʻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureAccountNameType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMobilePhoneTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcMobilePhoneType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureMainKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureMainKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureWorkKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureWorkKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureTransKeyTypeһڻ˾Կ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFutureTransKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankMainKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankMainKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankWorkKeyTypeһйԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankWorkKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankTransKeyTypeһдԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankTransKeyType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankServerDescriptionTypeһзϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankServerDescriptionType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAddInfoTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAddInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDescrInfoForReturnCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDescrInfoForReturnCodeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCountryCodeTypeһҴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCountryCodeType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPlateSerialTypeһƽ̨ˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcPlateSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankSerialType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCorrectSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCorrectSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureSerialTypeһڻ˾ˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFutureSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplicationIDTypeһӦñʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcApplicationIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankProxyIDTypeһдʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcBankProxyIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTCoreIDTypeһתʺϵͳʶ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBTCoreIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServerPortTypeһ˿ں +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServerPortType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepealedTimesTypeһѾ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRepealedTimesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepealTimeIntervalTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRepealTimeIntervalType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTotalTimesTypeһÿۼתʴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTotalTimesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTRequestIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBTRequestIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeAmountTypeһ׽Ԫ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcTradeAmountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustFeeTypeһӦտͻãԪ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCustFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureFeeTypeһӦڻ˾ãԪ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcFutureFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSingleMaxAmtTypeһ޶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcSingleMaxAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSingleMinAmtTypeһ޶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcSingleMinAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTotalAmtTypeһÿۼתʶ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcTotalAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCertificationTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_CFT_IDCard '0' +/// +#define THOST_FTDC_CFT_Passport '1' +///֤ +#define THOST_FTDC_CFT_OfficerIDCard '2' +///ʿ֤ +#define THOST_FTDC_CFT_SoldierIDCard '3' +///֤ +#define THOST_FTDC_CFT_HomeComingCard '4' +///ڲ +#define THOST_FTDC_CFT_HouseholdRegister '5' +///Ӫҵִպ +#define THOST_FTDC_CFT_LicenseNo '6' +///֤֯ +#define THOST_FTDC_CFT_InstitutionCodeCard '7' +///ʱӪҵִպ +#define THOST_FTDC_CFT_TempLicenseNo '8' +///ҵǼ֤ +#define THOST_FTDC_CFT_NoEnterpriseLicenseNo '9' +///֤ +#define THOST_FTDC_CFT_OtherCard 'x' +///ܲ +#define THOST_FTDC_CFT_SuperDepAgree 'a' + +typedef char TThostFtdcCertificationTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileBusinessCodeTypeһļҵ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBC_Others '0' +///ת˽ϸ +#define THOST_FTDC_FBC_TransferDetails '1' +///ͻ˻״̬ +#define THOST_FTDC_FBC_CustAccStatus '2' +///˻ཻϸ +#define THOST_FTDC_FBC_AccountTradeDetails '3' +///ڻ˻Ϣϸ +#define THOST_FTDC_FBC_FutureAccountChangeInfoDetails '4' +///ͻʽ̨ϸ +#define THOST_FTDC_FBC_CustMoneyDetail '5' +///ͻϢϸ +#define THOST_FTDC_FBC_CustCancelAccountInfo '6' +///ͻʽ˽ +#define THOST_FTDC_FBC_CustMoneyResult '7' +///쳣ļ +#define THOST_FTDC_FBC_OthersExceptionResult '8' +///ͻϢϸ +#define THOST_FTDC_FBC_CustInterestNetMoneyDetails '9' +///ͻʽϸ +#define THOST_FTDC_FBC_CustMoneySendAndReceiveDetails 'a' +///˴ʽջ +#define THOST_FTDC_FBC_CorporationMoneyTotal 'b' +///ʽջ +#define THOST_FTDC_FBC_MainbodyMoneyTotal 'c' +///ܷƽ +#define THOST_FTDC_FBC_MainPartMonitorData 'd' +///б +#define THOST_FTDC_FBC_PreparationMoney 'e' +///Эʽ +#define THOST_FTDC_FBC_BankMoneyMonitorData 'f' + +typedef char TThostFtdcFileBusinessCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCashExchangeCodeTypeһ㳮־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CEC_Exchange '1' +/// +#define THOST_FTDC_CEC_Cash '2' + +typedef char TThostFtdcCashExchangeCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYesNoIndicatorTypeһǻʶ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_YNI_Yes '0' +/// +#define THOST_FTDC_YNI_No '1' + +typedef char TThostFtdcYesNoIndicatorType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBanlanceTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ǰ +#define THOST_FTDC_BLT_CurrentMoney '0' +/// +#define THOST_FTDC_BLT_UsableMoney '1' +///ȡ +#define THOST_FTDC_BLT_FetchableMoney '2' +/// +#define THOST_FTDC_BLT_FreezeMoney '3' + +typedef char TThostFtdcBanlanceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGenderTypeһԱ +///////////////////////////////////////////////////////////////////////// +///δ֪״̬ +#define THOST_FTDC_GD_Unknown '0' +/// +#define THOST_FTDC_GD_Male '1' +///Ů +#define THOST_FTDC_GD_Female '2' + +typedef char TThostFtdcGenderType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFeePayFlagTypeһ֧־ +///////////////////////////////////////////////////////////////////////// +///淽֧ +#define THOST_FTDC_FPF_BEN '0' +///ɷͷ֧ +#define THOST_FTDC_FPF_OUR '1' +///ɷͷ֧ķã淽֧ܵķ +#define THOST_FTDC_FPF_SHA '2' + +typedef char TThostFtdcFeePayFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPassWordKeyTypeTypeһԿ +///////////////////////////////////////////////////////////////////////// +///Կ +#define THOST_FTDC_PWKT_ExchangeKey '0' +///Կ +#define THOST_FTDC_PWKT_PassWordKey '1' +///MACԿ +#define THOST_FTDC_PWKT_MACKey '2' +///Կ +#define THOST_FTDC_PWKT_MessageKey '3' + +typedef char TThostFtdcPassWordKeyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTPassWordTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ѯ +#define THOST_FTDC_PWT_Query '0' +///ȡ +#define THOST_FTDC_PWT_Fetch '1' +///ת +#define THOST_FTDC_PWT_Transfer '2' +/// +#define THOST_FTDC_PWT_Trade '3' + +typedef char TThostFtdcFBTPassWordTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTEncryModeTypeһܷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EM_NoEncry '0' +///DES +#define THOST_FTDC_EM_DES '1' +///3DES +#define THOST_FTDC_EM_3DES '2' + +typedef char TThostFtdcFBTEncryModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankRepealFlagTypeһг־ +///////////////////////////////////////////////////////////////////////// +///Զ +#define THOST_FTDC_BRF_BankNotNeedRepeal '0' +///дԶ +#define THOST_FTDC_BRF_BankWaitingRepeal '1' +///Զ +#define THOST_FTDC_BRF_BankBeenRepealed '2' + +typedef char TThostFtdcBankRepealFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerRepealFlagTypeһ̳־ +///////////////////////////////////////////////////////////////////////// +///Զ +#define THOST_FTDC_BRORF_BrokerNotNeedRepeal '0' +///̴Զ +#define THOST_FTDC_BRORF_BrokerWaitingRepeal '1' +///Զ +#define THOST_FTDC_BRORF_BrokerBeenRepealed '2' + +typedef char TThostFtdcBrokerRepealFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstitutionTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TS_Bank '0' +/// +#define THOST_FTDC_TS_Future '1' +///ȯ +#define THOST_FTDC_TS_Store '2' + +typedef char TThostFtdcInstitutionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastFragmentTypeһƬ־ +///////////////////////////////////////////////////////////////////////// +///Ƭ +#define THOST_FTDC_LF_Yes '0' +///Ƭ +#define THOST_FTDC_LF_No '1' + +typedef char TThostFtdcLastFragmentType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccStatusTypeһ˻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_BAS_Normal '0' +/// +#define THOST_FTDC_BAS_Freeze '1' +///ʧ +#define THOST_FTDC_BAS_ReportLoss '2' + +typedef char TThostFtdcBankAccStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoneyAccountStatusTypeһʽ˻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_MAS_Normal '0' +/// +#define THOST_FTDC_MAS_Cancel '1' + +typedef char TThostFtdcMoneyAccountStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcManageStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///ָ +#define THOST_FTDC_MSS_Point '0' +///Ԥָ +#define THOST_FTDC_MSS_PrePoint '1' +///ָ +#define THOST_FTDC_MSS_CancelPoint '2' + +typedef char TThostFtdcManageStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemTypeTypeһӦϵͳ +///////////////////////////////////////////////////////////////////////// +///ת +#define THOST_FTDC_SYT_FutureBankTransfer '0' +///֤ת +#define THOST_FTDC_SYT_StockBankTransfer '1' +/// +#define THOST_FTDC_SYT_TheThirdPartStore '2' + +typedef char TThostFtdcSystemTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTxnEndFlagTypeһתʻת־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TEF_NormalProcessing '0' +///ɹ +#define THOST_FTDC_TEF_Success '1' +///ʧܽ +#define THOST_FTDC_TEF_Failed '2' +///쳣 +#define THOST_FTDC_TEF_Abnormal '3' +///˹쳣 +#define THOST_FTDC_TEF_ManualProcessedForException '4' +///ͨѶ쳣 ˹ +#define THOST_FTDC_TEF_CommuFailedNeedManualProcess '5' +///ϵͳ˹ +#define THOST_FTDC_TEF_SysErrorNeedManualProcess '6' + +typedef char TThostFtdcTxnEndFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessStatusTypeһתʷ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_PSS_NotProcess '0' +///ʼ +#define THOST_FTDC_PSS_StartProcess '1' +/// +#define THOST_FTDC_PSS_Finished '2' + +typedef char TThostFtdcProcessStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustTypeTypeһͻ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CUSTT_Person '0' +/// +#define THOST_FTDC_CUSTT_Institution '1' + +typedef char TThostFtdcCustTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTTransferDirectionTypeһתʷ +///////////////////////////////////////////////////////////////////////// +///תڻ +#define THOST_FTDC_FBTTD_FromBankToFuture '1' +///ڻת +#define THOST_FTDC_FBTTD_FromFutureToBank '2' + +typedef char TThostFtdcFBTTransferDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOpenOrDestroyTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OOD_Open '1' +/// +#define THOST_FTDC_OOD_Destroy '0' + +typedef char TThostFtdcOpenOrDestroyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAvailabilityFlagTypeһЧ־ +///////////////////////////////////////////////////////////////////////// +///δȷ +#define THOST_FTDC_AVAF_Invalid '0' +///Ч +#define THOST_FTDC_AVAF_Valid '1' +/// +#define THOST_FTDC_AVAF_Repeal '2' + +typedef char TThostFtdcAvailabilityFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_OT_Bank '1' +///ǰ +#define THOST_FTDC_OT_Future '2' +///תƽ̨ +#define THOST_FTDC_OT_PlateForm '9' + +typedef char TThostFtdcOrganTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganLevelTypeһ +///////////////////////////////////////////////////////////////////////// +///лܲ +#define THOST_FTDC_OL_HeadQuarters '1' +///зĻڻ˾Ӫҵ +#define THOST_FTDC_OL_Branch '2' + +typedef char TThostFtdcOrganLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProtocalIDTypeһЭ +///////////////////////////////////////////////////////////////////////// +///Э +#define THOST_FTDC_PID_FutureProtocal '0' +///Э +#define THOST_FTDC_PID_ICBCProtocal '1' +///ũЭ +#define THOST_FTDC_PID_ABCProtocal '2' +///йЭ +#define THOST_FTDC_PID_CBCProtocal '3' +///Э +#define THOST_FTDC_PID_CCBProtocal '4' +///Э +#define THOST_FTDC_PID_BOCOMProtocal '5' +///תƽ̨Э +#define THOST_FTDC_PID_FBTPlateFormProtocal 'X' + +typedef char TThostFtdcProtocalIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcConnectModeTypeһ׽ӷʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CM_ShortConnect '0' +/// +#define THOST_FTDC_CM_LongConnect '1' + +typedef char TThostFtdcConnectModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncModeTypeһ׽ͨŷʽ +///////////////////////////////////////////////////////////////////////// +///첽 +#define THOST_FTDC_SRM_ASync '0' +///ͬ +#define THOST_FTDC_SRM_Sync '1' + +typedef char TThostFtdcSyncModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccTypeTypeһʺ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_BAT_BankBook '1' +/// +#define THOST_FTDC_BAT_SavingCard '2' +///ÿ +#define THOST_FTDC_BAT_CreditCard '3' + +typedef char TThostFtdcBankAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureAccTypeTypeһڻ˾ʺ +///////////////////////////////////////////////////////////////////////// +///д +#define THOST_FTDC_FAT_BankBook '1' +/// +#define THOST_FTDC_FAT_SavingCard '2' +///ÿ +#define THOST_FTDC_FAT_CreditCard '3' + +typedef char TThostFtdcFutureAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrganStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_OS_Ready '0' +///ǩ +#define THOST_FTDC_OS_CheckIn '1' +///ǩ +#define THOST_FTDC_OS_CheckOut '2' +///ļ +#define THOST_FTDC_OS_CheckFileArrived '3' +/// +#define THOST_FTDC_OS_CheckDetail '4' +/// +#define THOST_FTDC_OS_DayEndClean '5' +///ע +#define THOST_FTDC_OS_Invalid '9' + +typedef char TThostFtdcOrganStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCCBFeeModeTypeһշģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CCBFM_ByAmount '1' +///¿ +#define THOST_FTDC_CCBFM_ByMonth '2' + +typedef char TThostFtdcCCBFeeModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommApiTypeTypeһͨѶAPI +///////////////////////////////////////////////////////////////////////// +///ͻ +#define THOST_FTDC_CAPIT_Client '1' +/// +#define THOST_FTDC_CAPIT_Server '2' +///ϵͳUserApi +#define THOST_FTDC_CAPIT_UserApi '3' + +typedef char TThostFtdcCommApiTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServiceIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceLineNoTypeһ· +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcServiceLineNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcServiceNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcServiceNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLinkStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿ +#define THOST_FTDC_LS_Connected '1' +///û +#define THOST_FTDC_LS_Disconnected '2' + +typedef char TThostFtdcLinkStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommApiPointerTypeһͨѶAPIָ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCommApiPointerType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPwdFlagTypeһ˶Ա־ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_BPWDF_NoCheck '0' +///ĺ˶ +#define THOST_FTDC_BPWDF_BlankCheck '1' +///ĺ˶ +#define THOST_FTDC_BPWDF_EncryptCheck '2' + +typedef char TThostFtdcPwdFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSecuAccTypeTypeһڻʺ +///////////////////////////////////////////////////////////////////////// +///ʽʺ +#define THOST_FTDC_SAT_AccountID '1' +///ʽ𿨺 +#define THOST_FTDC_SAT_CardID '2' +///Ϻɶʺ +#define THOST_FTDC_SAT_SHStockholderID '3' +///ڹɶʺ +#define THOST_FTDC_SAT_SZStockholderID '4' + +typedef char TThostFtdcSecuAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferStatusTypeһת˽״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_TRFS_Normal '0' +/// +#define THOST_FTDC_TRFS_Repealed '1' + +typedef char TThostFtdcTransferStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSponsorTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SPTYPE_Broker '0' +/// +#define THOST_FTDC_SPTYPE_Bank '1' + +typedef char TThostFtdcSponsorTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReqRspTypeTypeһӦ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_REQRSP_Request '0' +///Ӧ +#define THOST_FTDC_REQRSP_Response '1' + +typedef char TThostFtdcReqRspTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTUserEventTypeTypeһתû¼ +///////////////////////////////////////////////////////////////////////// +///ǩ +#define THOST_FTDC_FBTUET_SignIn '0' +///תڻ +#define THOST_FTDC_FBTUET_FromBankToFuture '1' +///ڻת +#define THOST_FTDC_FBTUET_FromFutureToBank '2' +/// +#define THOST_FTDC_FBTUET_OpenAccount '3' +/// +#define THOST_FTDC_FBTUET_CancelAccount '4' +///˻ +#define THOST_FTDC_FBTUET_ChangeAccount '5' +///תڻ +#define THOST_FTDC_FBTUET_RepealFromBankToFuture '6' +///ڻת +#define THOST_FTDC_FBTUET_RepealFromFutureToBank '7' +///ѯ˻ +#define THOST_FTDC_FBTUET_QueryBankAccount '8' +///ѯڻ˻ +#define THOST_FTDC_FBTUET_QueryFutureAccount '9' +///ǩ +#define THOST_FTDC_FBTUET_SignOut 'A' +///Կͬ +#define THOST_FTDC_FBTUET_SyncKey 'B' +/// +#define THOST_FTDC_FBTUET_Other 'Z' + +typedef char TThostFtdcFBTUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankIDByBankTypeһԼı +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankIDByBankType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankOperNoTypeһвԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankOperNoType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankCustNoTypeһпͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankCustNoType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBOPSeqNoTypeһк +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDBOPSeqNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTableNameTypeһFBT +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTableNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPKNameTypeһFBT +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPKNameType[201]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPKValueTypeһFBTֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPKValueType[501]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBOperationTypeһ¼ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_DBOP_Insert '0' +/// +#define THOST_FTDC_DBOP_Update '1' +///ɾ +#define THOST_FTDC_DBOP_Delete '2' + +typedef char TThostFtdcDBOperationType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncFlagTypeһͬ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_SYNF_Yes '0' +///δͬ +#define THOST_FTDC_SYNF_No '1' + +typedef char TThostFtdcSyncFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTargetIDTypeһͬĿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTargetIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncTypeTypeһͬ +///////////////////////////////////////////////////////////////////////// +///һͬ +#define THOST_FTDC_SYNT_OneOffSync '0' +///ʱͬ +#define THOST_FTDC_SYNT_TimerSync '1' +///ʱȫͬ +#define THOST_FTDC_SYNT_TimerFullSync '2' + +typedef char TThostFtdcSyncTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBETimeTypeһֻʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBETimeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankNoTypeһк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBECertNoTypeһƾ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBECertNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExDirectionTypeһ㷽 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBEDIR_Settlement '0' +///ۻ +#define THOST_FTDC_FBEDIR_Sale '1' + +typedef char TThostFtdcExDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankAccountType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBankAccountNameTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBankAccountNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEAmtTypeһֻ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcFBEAmtType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBusinessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEPostScriptTypeһ㸽 +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEPostScriptType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBERemarkTypeһ㱸ע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBERemarkType[71]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExRateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcExRateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEResultFlagTypeһɹ־ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_FBERES_Success '0' +///˻ +#define THOST_FTDC_FBERES_InsufficientBalance '1' +///׽δ֪ +#define THOST_FTDC_FBERES_UnknownTrading '8' +///ʧ +#define THOST_FTDC_FBERES_Fail 'x' + +typedef char TThostFtdcFBEResultFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBERtnMsgTypeһ㷵Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBERtnMsgType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEExtendMsgTypeһչϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEExtendMsgType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBusinessSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBusinessSerialType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBESystemSerialTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBESystemSerialType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBETotalExCntTypeһ㽻ܱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcFBETotalExCntType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEExchStatusTypeһ㽻״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FBEES_Normal '0' +///ط +#define THOST_FTDC_FBEES_ReExchange '1' + +typedef char TThostFtdcFBEExchStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEFileFlagTypeһļ־ +///////////////////////////////////////////////////////////////////////// +///ݰ +#define THOST_FTDC_FBEFG_DataPackage '0' +///ļ +#define THOST_FTDC_FBEFG_File '1' + +typedef char TThostFtdcFBEFileFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEAlreadyTradeTypeһѽױ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FBEAT_NotTrade '0' +///ѽ +#define THOST_FTDC_FBEAT_Trade '1' + +typedef char TThostFtdcFBEAlreadyTradeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEOpenBankTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEOpenBankType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEUserEventTypeTypeһڻû¼ +///////////////////////////////////////////////////////////////////////// +///ǩ +#define THOST_FTDC_FBEUET_SignIn '0' +/// +#define THOST_FTDC_FBEUET_Exchange '1' +///ط +#define THOST_FTDC_FBEUET_ReExchange '2' +///˻ѯ +#define THOST_FTDC_FBEUET_QueryBankAccount '3' +///ϸѯ +#define THOST_FTDC_FBEUET_QueryExchDetial '4' +///ܲѯ +#define THOST_FTDC_FBEUET_QueryExchSummary '5' +///ʲѯ +#define THOST_FTDC_FBEUET_QueryExchRate '6' +///ļ֪ͨ +#define THOST_FTDC_FBEUET_CheckBankAccount '7' +///ǩ +#define THOST_FTDC_FBEUET_SignOut '8' +/// +#define THOST_FTDC_FBEUET_Other 'Z' + +typedef char TThostFtdcFBEUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEFileNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEBatchSerialTypeһκ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBEBatchSerialType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBEReqFlagTypeһ㷢ͱ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FBERF_UnProcessed '0' +///ȴ +#define THOST_FTDC_FBERF_WaitSend '1' +///ͳɹ +#define THOST_FTDC_FBERF_SendSuccess '2' +///ʧ +#define THOST_FTDC_FBERF_SendFailed '3' +///ȴط +#define THOST_FTDC_FBERF_WaitReSend '4' + +typedef char TThostFtdcFBEReqFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNotifyClassTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_NC_NOERROR '0' +///ʾ +#define THOST_FTDC_NC_Warn '1' +///׷ +#define THOST_FTDC_NC_Call '2' +///ǿƽ +#define THOST_FTDC_NC_Force '3' +/// +#define THOST_FTDC_NC_CHUANCANG '4' +///쳣 +#define THOST_FTDC_NC_Exception '5' + +typedef char TThostFtdcNotifyClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNofityInfoTypeһͻ֪ͨϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRiskNofityInfoType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseSceneIdTypeһǿƽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcForceCloseSceneIdType[24]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseTypeTypeһǿƽ +///////////////////////////////////////////////////////////////////////// +///ֹǿƽ +#define THOST_FTDC_FCT_Manual '0' +///һͶ߸ǿƽ +#define THOST_FTDC_FCT_Single '1' +///Ͷ߸ǿƽ +#define THOST_FTDC_FCT_Group '2' + +typedef char TThostFtdcForceCloseTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDsTypeһƷ,+ָ,cu+zn +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInstrumentIDsType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNotifyMethodTypeһ֪ͨ; +///////////////////////////////////////////////////////////////////////// +///ϵͳ֪ͨ +#define THOST_FTDC_RNM_System '0' +///֪ͨ +#define THOST_FTDC_RNM_SMS '1' +///ʼ֪ͨ +#define THOST_FTDC_RNM_EMail '2' +///˹֪ͨ +#define THOST_FTDC_RNM_Manual '3' + +typedef char TThostFtdcRiskNotifyMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskNotifyStatusTypeһ֪ͨ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_RNS_NotGen '0' +///δ +#define THOST_FTDC_RNS_Generated '1' +///ʧ +#define THOST_FTDC_RNS_SendError '2' +///ѷδ +#define THOST_FTDC_RNS_SendOk '3' +///ѽδȷ +#define THOST_FTDC_RNS_Received '4' +///ȷ +#define THOST_FTDC_RNS_Confirmed '5' + +typedef char TThostFtdcRiskNotifyStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskUserEventTypeһû¼ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_RUE_ExportData '0' + +typedef char TThostFtdcRiskUserEventType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamIDTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParamNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParamValueTypeһֵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcParamValueType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcConditionalOrderSortTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ʹ¼ +#define THOST_FTDC_COST_LastPriceAsc '0' +///ʹ¼۽ +#define THOST_FTDC_COST_LastPriceDesc '1' +///ʹ +#define THOST_FTDC_COST_AskPriceAsc '2' +///ʹ۽ +#define THOST_FTDC_COST_AskPriceDesc '3' +///ʹ +#define THOST_FTDC_COST_BidPriceAsc '4' +///ʹ۽ +#define THOST_FTDC_COST_BidPriceDesc '5' + +typedef char TThostFtdcConditionalOrderSortTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSendTypeTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UOAST_NoSend '0' +///ѷ +#define THOST_FTDC_UOAST_Sended '1' +/// +#define THOST_FTDC_UOAST_Generated '2' +///ʧ +#define THOST_FTDC_UOAST_SendFail '3' +///ճɹ +#define THOST_FTDC_UOAST_Success '4' +///ʧ +#define THOST_FTDC_UOAST_Fail '5' +///ȡ +#define THOST_FTDC_UOAST_Cancel '6' + +typedef char TThostFtdcSendTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDStatusTypeһױ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UOACS_NoApply '1' +///ύ +#define THOST_FTDC_UOACS_Submited '2' +///ѷ +#define THOST_FTDC_UOACS_Sended '3' +/// +#define THOST_FTDC_UOACS_Success '4' +///ܾ +#define THOST_FTDC_UOACS_Refuse '5' +///ѳ +#define THOST_FTDC_UOACS_Cancel '6' + +typedef char TThostFtdcClientIDStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIndustryIDTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIndustryIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionIDTypeһϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcQuestionIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionContentTypeһϢ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcQuestionContentType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionIDTypeһѡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOptionIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionContentTypeһѡ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOptionContentType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQuestionTypeTypeһϢ +///////////////////////////////////////////////////////////////////////// +///ѡ +#define THOST_FTDC_QT_Radio '1' +///ѡ +#define THOST_FTDC_QT_Option '2' +/// +#define THOST_FTDC_QT_Blank '3' + +typedef char TThostFtdcQuestionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessIDTypeһҵˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSeqNoTypeһˮ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSeqNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAProcessStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAProcessStatusType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessTypeTypeһ̹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcProcessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_BT_Request '1' +///Ӧ +#define THOST_FTDC_BT_Response '2' +///֪ͨ +#define THOST_FTDC_BT_Notice '3' + +typedef char TThostFtdcBusinessTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCfmmcReturnCodeTypeһķ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_CRC_Success '0' +///ÿͻѾڴ +#define THOST_FTDC_CRC_Working '1' +///пͻϼʧ +#define THOST_FTDC_CRC_InfoFail '2' +///ʵƼʧ +#define THOST_FTDC_CRC_IDCardFail '3' +/// +#define THOST_FTDC_CRC_OtherFail '4' + +typedef char TThostFtdcCfmmcReturnCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExReturnCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcExReturnCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientTypeTypeһͻ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CfMMCCT_All '0' +/// +#define THOST_FTDC_CfMMCCT_Person '1' +///λ +#define THOST_FTDC_CfMMCCT_Company '2' +/// +#define THOST_FTDC_CfMMCCT_Other '3'//sgit +///ⷨ +#define THOST_FTDC_CfMMCCT_SpecialOrgan '4' +///ʹܻ +#define THOST_FTDC_CfMMCCT_Asset '5' + +typedef char TThostFtdcClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeIDTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///Ϻڻ +#define THOST_FTDC_EIDT_SHFE 'S' +///֣Ʒ +#define THOST_FTDC_EIDT_CZCE 'Z' +///Ʒ +#define THOST_FTDC_EIDT_DCE 'D' +///йڻ +#define THOST_FTDC_EIDT_CFFEX 'J' +///ϺԴĹɷ޹˾ +#define THOST_FTDC_EIDT_INE 'N'//sgit +///ƽ +#define THOST_FTDC_EIDT_GOLD 'G'// sgit +///PAT +#define THOST_FTDC_EIDT_PAT 'P' +/// +#define THOST_FTDC_EIDT_LTS 'L' + +typedef char TThostFtdcExchangeIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExClientIDTypeTypeһױ +///////////////////////////////////////////////////////////////////////// +///ױ +#define THOST_FTDC_ECIDT_Hedge '1' +/// +#define THOST_FTDC_ECIDT_Arbitrage '2' +///Ͷ +#define THOST_FTDC_ECIDT_Speculation '3' + +typedef char TThostFtdcExClientIDTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientClassifyTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientClassifyType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAOrganTypeTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAOrganTypeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOACountryCodeTypeһҴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOACountryCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAreaCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAreaCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFuturesIDTypeһΪͻĴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFuturesIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffmcDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffmcDateType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffmcTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffmcTimeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcNocIDTypeһ֯ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcNocIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUpdateFlagTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_UF_NoUpdate '0' +///ȫϢɹ +#define THOST_FTDC_UF_Success '1' +///ȫϢʧ +#define THOST_FTDC_UF_Fail '2' +///½ױɹ +#define THOST_FTDC_UF_TCSuccess '3' +///½ױʧ +#define THOST_FTDC_UF_TCFail '4' +///Ѷ +#define THOST_FTDC_UF_Cancel '5' + +typedef char TThostFtdcUpdateFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyOperateIDTypeһ붯 +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AOID_OpenInvestor '1' +///޸Ϣ +#define THOST_FTDC_AOID_ModifyIDCard '2' +///޸һϢ +#define THOST_FTDC_AOID_ModifyNoIDCard '3' +///뽻ױ +#define THOST_FTDC_AOID_ApplyTradingCode '4' +///ױ +#define THOST_FTDC_AOID_CancelTradingCode '5' +/// +#define THOST_FTDC_AOID_CancelInvestor '6' +///˻ +#define THOST_FTDC_AOID_FreezeAccount '8' +///˻ +#define THOST_FTDC_AOID_ActiveFreezeAccount '9' + +typedef char TThostFtdcApplyOperateIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyStatusIDTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δȫ +#define THOST_FTDC_ASID_NoComplete '1' +///ύ +#define THOST_FTDC_ASID_Submited '2' +/// +#define THOST_FTDC_ASID_Checked '3' +///Ѿܾ +#define THOST_FTDC_ASID_Refused '4' +///ɾ +#define THOST_FTDC_ASID_Deleted '5' + +typedef char TThostFtdcApplyStatusIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSendMethodTypeһͷʽ +///////////////////////////////////////////////////////////////////////// +///ļ +#define THOST_FTDC_UOASM_ByAPI '1' +///ӷ +#define THOST_FTDC_UOASM_ByFile '2' + +typedef char TThostFtdcSendMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEventTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcEventTypeType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcEventModeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EvM_ADD '1' +///޸ +#define THOST_FTDC_EvM_UPDATE '2' +///ɾ +#define THOST_FTDC_EvM_DELETE '3' +/// +#define THOST_FTDC_EvM_CHECK '4' +/// +#define THOST_FTDC_EvM_COPY '5' +///ע +#define THOST_FTDC_EvM_CANCEL '6' +/// +#define THOST_FTDC_EvM_Reverse '7' + +typedef char TThostFtdcEventModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAAutoSendTypeһͳһԶ +///////////////////////////////////////////////////////////////////////// +///ԶͲ +#define THOST_FTDC_UOAA_ASR '1' +///ԶͣԶ +#define THOST_FTDC_UOAA_ASNR '2' +///ԶͣԶ +#define THOST_FTDC_UOAA_NSAR '3' +///ԶͣҲԶ +#define THOST_FTDC_UOAA_NSR '4' + +typedef char TThostFtdcUOAAutoSendType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcQueryDepthTypeһѯ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcQueryDepthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataCenterIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDataCenterIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFlowIDTypeһID +///////////////////////////////////////////////////////////////////////// +///Ͷ߶ӦͶ +#define THOST_FTDC_EvM_InvestorGroupFlow '1' +///Ͷ +#define THOST_FTDC_EvM_InvestorRate '2' +///Ͷģϵ +#define THOST_FTDC_EvM_InvestorCommRateModel '3' + +typedef char TThostFtdcFlowIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckLevelTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///㼶 +#define THOST_FTDC_CL_Zero '0' +///һ +#define THOST_FTDC_CL_One '1' +/// +#define THOST_FTDC_CL_Two '2' + +typedef char TThostFtdcCheckLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckNoTypeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcCheckNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckStatusTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_CHS_Init '0' +/// +#define THOST_FTDC_CHS_Checking '1' +///Ѹ +#define THOST_FTDC_CHS_Checked '2' +///ܾ +#define THOST_FTDC_CHS_Refuse '3' +/// +#define THOST_FTDC_CHS_Cancel '4' + +typedef char TThostFtdcCheckStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUsedStatusTypeһЧ״̬ +///////////////////////////////////////////////////////////////////////// +///δЧ +#define THOST_FTDC_CHU_Unused '0' +///Ч +#define THOST_FTDC_CHU_Used '1' +///Чʧ +#define THOST_FTDC_CHU_Fail '2' + +typedef char TThostFtdcUsedStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTemplateNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRateTemplateNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyStringTypeһڲѯͶֶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPropertyStringType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAcountOriginTypeһ˻Դ +///////////////////////////////////////////////////////////////////////// +///ֹ¼ +#define THOST_FTDC_BAO_ByAccProperty '0' +///ת +#define THOST_FTDC_BAO_ByFBTransfer '1' + +typedef char TThostFtdcBankAcountOriginType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthBillTradeSumTypeһ㵥±ɽܷʽ +///////////////////////////////////////////////////////////////////////// +///ͬͬԼ +#define THOST_FTDC_MBTS_ByInstrument '0' +///ͬͬԼͬ۸ +#define THOST_FTDC_MBTS_ByDayInsPrc '1' +///ͬԼ +#define THOST_FTDC_MBTS_ByDayIns '2' + +typedef char TThostFtdcMonthBillTradeSumType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTTradeCodeEnumTypeһڽ״ö +///////////////////////////////////////////////////////////////////////// +///зתڻ +#define THOST_FTDC_FTC_BankLaunchBankToBroker '102001' +///ڻתڻ +#define THOST_FTDC_FTC_BrokerLaunchBankToBroker '202001' +///зڻת +#define THOST_FTDC_FTC_BankLaunchBrokerToBank '102002' +///ڻڻת +#define THOST_FTDC_FTC_BrokerLaunchBrokerToBank '202002' + +typedef char TThostFtdcFBTTradeCodeEnumType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateTemplateIDTypeһģʹ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRateTemplateIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRiskRateTypeһն +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRiskRateType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimestampTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTimestampType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDRuleNameTypeһŶι +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDRuleNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDRuleExprTypeһŶιʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorIDRuleExprType[513]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastDriftTypeһϴOTPƯֵ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLastDriftType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastSuccessTypeһϴOTPɹֵ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcLastSuccessType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthKeyTypeһԿ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthKeyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialNumberTypeһк +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSerialNumberType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPTypeTypeһ̬ +///////////////////////////////////////////////////////////////////////// +///޶̬ +#define THOST_FTDC_OTP_NONE '0' +///ʱ +#define THOST_FTDC_OTP_TOTP '1' + +typedef char TThostFtdcOTPTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPVendorsIDTypeһ̬ṩ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOTPVendorsIDType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPVendorsNameTypeһ̬ṩ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOTPVendorsNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPStatusTypeһ̬״̬ +///////////////////////////////////////////////////////////////////////// +///δʹ +#define THOST_FTDC_OTPS_Unused '0' +///ʹ +#define THOST_FTDC_OTPS_Used '1' +///ע +#define THOST_FTDC_OTPS_Disuse '2' + +typedef char TThostFtdcOTPStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerUserTypeTypeһù˾û +///////////////////////////////////////////////////////////////////////// +///Ͷ +#define THOST_FTDC_BUT_Investor '1' +///Ա +#define THOST_FTDC_BUT_BrokerUser '2' + +typedef char TThostFtdcBrokerUserTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFutureTypeTypeһڻ +///////////////////////////////////////////////////////////////////////// +///Ʒڻ +#define THOST_FTDC_FUTT_Commodity '1' +///ڻ +#define THOST_FTDC_FUTT_Financial '2' + +typedef char TThostFtdcFutureTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundEventTypeTypeһʽ +///////////////////////////////////////////////////////////////////////// +///ת޶ +#define THOST_FTDC_FET_Restriction '0' +///ת޶ +#define THOST_FTDC_FET_TodayRestriction '1' +///ˮ +#define THOST_FTDC_FET_Transfer '2' +///ʽ𶳽 +#define THOST_FTDC_FET_Credit '3' +///Ͷ߿ʽ +#define THOST_FTDC_FET_InvestorWithdrawAlm '4' +///ʻת޶ +#define THOST_FTDC_FET_BankRestriction '5' +///ǩԼ˻ +#define THOST_FTDC_FET_Accountregister '6' +/// +#define THOST_FTDC_FET_ExchangeFundIO '7' +///Ͷ߳ +#define THOST_FTDC_FET_InvestorFundIO '8' + +typedef char TThostFtdcFundEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountSourceTypeTypeһʽ˻Դ +///////////////////////////////////////////////////////////////////////// +///ͬ +#define THOST_FTDC_AST_FBTransfer '0' +///ֹ¼ +#define THOST_FTDC_AST_ManualEntry '1' + +typedef char TThostFtdcAccountSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCodeSourceTypeTypeһױԴ +///////////////////////////////////////////////////////////////////////// +///ͳһ(ѹ淶) +#define THOST_FTDC_CST_UnifyAccount '0' +///ֹ¼(δ淶) +#define THOST_FTDC_CST_ManualEntry '1' + +typedef char TThostFtdcCodeSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserRangeTypeһԱΧ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_UR_All '0' +///һԱ +#define THOST_FTDC_UR_Single '1' + +typedef char TThostFtdcUserRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeSpanTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcTimeSpanType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcImportSequenceIDTypeһ̬Ƶα +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcImportSequenceIDType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcByGroupTypeһͳƱͻͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Ͷͳ +#define THOST_FTDC_BG_Investor '2' +///ͳ +#define THOST_FTDC_BG_Group '1' + +typedef char TThostFtdcByGroupType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSumStatModeTypeһͳƱΧͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Լͳ +#define THOST_FTDC_TSSM_Instrument '1' +///Ʒͳ +#define THOST_FTDC_TSSM_Product '2' +///ͳ +#define THOST_FTDC_TSSM_Exchange '3' + +typedef char TThostFtdcTradeSumStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcComTypeTypeһϳɽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcComTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductIDTypeһƷʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductNameTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserProductMemoTypeһƷ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUserProductMemoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCCancelFlagTypeһ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCCancelFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCDateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCDateType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCInvestorNameTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCInvestorNameType[201]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOpenInvestorNameTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOpenInvestorNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCInvestorIDTypeһͻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCInvestorIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCIdentifiedCardNoTypeһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCIdentifiedCardNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCClientIDTypeһױ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCClientIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCBankFlagTypeһбʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCBankFlagType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCBankAccountTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCBankAccountType[23]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOpenNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOpenNameType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMemoTypeһ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMemoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTimeTypeһʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTimeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTradeIDTypeһɽˮ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTradeIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCExchangeInstIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMortgageNameTypeһѺƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMortgageNameType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCReasonTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCReasonType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsSettlementTypeһǷΪǽԱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcIsSettlementType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCPriceTypeһ۸ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCPriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCOptionsTypeTypeһȨ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCOptionsTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCStrikePriceTypeһִм +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCSRCStrikePriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTargetProductIDTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTargetProductIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCTargetInstrIDTypeһĺԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCTargetInstrIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommModelNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommModelNameType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommModelMemoTypeһģ屸ע +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCommModelMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExprSetModeTypeһڱʽ +///////////////////////////////////////////////////////////////////////// +///й +#define THOST_FTDC_ESM_Relative '1' +/// +#define THOST_FTDC_ESM_Typical '2' + +typedef char TThostFtdcExprSetModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRateInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +///˾׼ +//sgit: +#define THOST_FTDC_RIR_All '1' +///ģ +#define THOST_FTDC_RIR_Model '2' +///һͶ +#define THOST_FTDC_RIR_Single '3' + +typedef char TThostFtdcRateInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAgentBrokerIDTypeһ͹˾ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAgentBrokerIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDRIdentityIDTypeһĴ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDRIdentityIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDRIdentityNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDRIdentityNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDBLinkIDTypeһDBLinkʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDBLinkIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSyncDataStatusTypeһϵͳͬ״̬ +///////////////////////////////////////////////////////////////////////// +///δͬ +#define THOST_FTDC_SDS_Initialize '0' +///ͬ +#define THOST_FTDC_SDS_Settlementing '1' +///ͬ +#define THOST_FTDC_SDS_Settlemented '2' + +typedef char TThostFtdcSyncDataStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSourceTypeһɽԴ +///////////////////////////////////////////////////////////////////////// +///Խͨر +#define THOST_FTDC_TSRC_NORMAL '0' +///Բѯ +#define THOST_FTDC_TSRC_QUERY '1' + +typedef char TThostFtdcTradeSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFlexStatModeTypeһƷԼͳƷʽ +///////////////////////////////////////////////////////////////////////// +///Ʒͳ +#define THOST_FTDC_FSM_Product '1' +///ͳ +#define THOST_FTDC_FSM_Exchange '2' +///ͳ +#define THOST_FTDC_FSM_All '3' + +typedef char TThostFtdcFlexStatModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcByInvestorRangeTypeһͶ߷ΧͳƷʽ +///////////////////////////////////////////////////////////////////////// +///ͳ +#define THOST_FTDC_BIR_Property '1' +///ͳ +#define THOST_FTDC_BIR_All '2' + +typedef char TThostFtdcByInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSRiskRateTypeһն +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSRiskRateType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceNo12Typeһ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcSequenceNo12Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPropertyInvestorRangeTypeһͶ߷Χ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_PIR_All '1' +///Ͷ +#define THOST_FTDC_PIR_Property '2' +///һͶ +#define THOST_FTDC_PIR_Single '3' + +typedef char TThostFtdcPropertyInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileStatusTypeһļ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_FIS_NoCreate '0' +/// +#define THOST_FTDC_FIS_Created '1' +///ʧ +#define THOST_FTDC_FIS_Failed '2' + +typedef char TThostFtdcFileStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFileGenStyleTypeһļɷʽ +///////////////////////////////////////////////////////////////////////// +///· +#define THOST_FTDC_FGS_FileTransmit '0' +/// +#define THOST_FTDC_FGS_FileGen '1' + +typedef char TThostFtdcFileGenStyleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysOperModeTypeһϵͳ־ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SoM_Add '1' +///޸ +#define THOST_FTDC_SoM_Update '2' +///ɾ +#define THOST_FTDC_SoM_Delete '3' +/// +#define THOST_FTDC_SoM_Copy '4' +/// +#define THOST_FTDC_SoM_AcTive '5' +///ע +#define THOST_FTDC_SoM_CanCel '6' +/// +#define THOST_FTDC_SoM_ReSet '7' + +typedef char TThostFtdcSysOperModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSysOperTypeTypeһϵͳ־ +///////////////////////////////////////////////////////////////////////// +///޸IJԱ +#define THOST_FTDC_SoT_UpdatePassword '0' +///Աܹ֯ϵ +#define THOST_FTDC_SoT_UserDepartment '1' +///ɫ +#define THOST_FTDC_SoT_RoleManager '2' +///ɫ +#define THOST_FTDC_SoT_RoleFunction '3' +/// +#define THOST_FTDC_SoT_BaseParam '4' +///òԱ +#define THOST_FTDC_SoT_SetUserID '5' +///ûɫ +#define THOST_FTDC_SoT_SetUserRole '6' +///ûIP +#define THOST_FTDC_SoT_UserIpRestriction '7' +///ܹ֯ +#define THOST_FTDC_SoT_DepartmentManager '8' +///ܹ֯ѯิ +#define THOST_FTDC_SoT_DepartmentCopy '9' +///ױ +#define THOST_FTDC_SoT_Tradingcode 'A' +///Ͷ״̬ά +#define THOST_FTDC_SoT_InvestorStatus 'B' +///ͶȨ޹ +#define THOST_FTDC_SoT_InvestorAuthority 'C' +/// +#define THOST_FTDC_SoT_PropertySet 'D' +///Ͷ +#define THOST_FTDC_SoT_ReSetInvestorPasswd 'E' +///Ͷ߸Ϣά +#define THOST_FTDC_SoT_InvestorPersonalityInfo 'F' + +typedef char TThostFtdcSysOperTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCDataQueyTypeTypeһϱݲѯ +///////////////////////////////////////////////////////////////////////// +///ѯǰձ͵ +#define THOST_FTDC_CSRCQ_Current '0' +///ѯʷ͵Ĵ͹˾ +#define THOST_FTDC_CSRCQ_History '1' + +typedef char TThostFtdcCSRCDataQueyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFreezeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///Ծ +#define THOST_FTDC_FRS_Normal '1' +/// +#define THOST_FTDC_FRS_Freeze '0' + +typedef char TThostFtdcFreezeStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStandardStatusTypeһ淶״̬ +///////////////////////////////////////////////////////////////////////// +///ѹ淶 +#define THOST_FTDC_STST_Standard '0' +///δ淶 +#define THOST_FTDC_STST_NonStandard '1' + +typedef char TThostFtdcStandardStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCFreezeStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCFreezeStatusType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightParamTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///߻ +#define THOST_FTDC_RPT_Freeze '1' +///߻ +#define THOST_FTDC_RPT_FreezeActive '2' +///Ȩ +#define THOST_FTDC_RPT_OpenLimit '3'//sgit +///Ȩ +#define THOST_FTDC_RPT_RelieveOpenLimit '4' + +typedef char TThostFtdcRightParamTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightTemplateIDTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRightTemplateIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightTemplateNameTypeһģ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcRightTemplateNameType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataStatusTypeһϴǮ˱״̬ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMLDS_Normal '0' +///ɾ +#define THOST_FTDC_AMLDS_Deleted '1' + +typedef char TThostFtdcDataStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAMLCheckStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_AMLCHS_Init '0' +/// +#define THOST_FTDC_AMLCHS_Checking '1' +///Ѹ +#define THOST_FTDC_AMLCHS_Checked '2' +///ܾϱ +#define THOST_FTDC_AMLCHS_RefuseReport '3' + +typedef char TThostFtdcAMLCheckStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlDateTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMLDT_DrawDay '0' +/// +#define THOST_FTDC_AMLDT_TouchDay '1' + +typedef char TThostFtdcAmlDateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlCheckLevelTypeһ˼ +///////////////////////////////////////////////////////////////////////// +///㼶 +#define THOST_FTDC_AMLCL_CheckLevel0 '0' +///һ +#define THOST_FTDC_AMLCL_CheckLevel1 '1' +/// +#define THOST_FTDC_AMLCL_CheckLevel2 '2' +/// +#define THOST_FTDC_AMLCL_CheckLevel3 '3' + +typedef char TThostFtdcAmlCheckLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmlCheckFlowTypeһϴǮݳȡ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAmlCheckFlowType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcDataTypeType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExportFileTypeTypeһļ +///////////////////////////////////////////////////////////////////////// +///CSV +#define THOST_FTDC_EFT_CSV '0' +///Excel +#define THOST_FTDC_EFT_EXCEL '1' +///DBF +#define THOST_FTDC_EFT_DBF '2' + +typedef char TThostFtdcExportFileTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ǰ׼ +#define THOST_FTDC_SMT_Before '1' +/// +#define THOST_FTDC_SMT_Settlement '2' +///˶ +#define THOST_FTDC_SMT_After '3' +/// +#define THOST_FTDC_SMT_Settlemented '4' + +typedef char TThostFtdcSettleManagerTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerIDTypeһô +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettleManagerIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSettleManagerNameType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerLevelTypeһõȼ +///////////////////////////////////////////////////////////////////////// +///Ҫ +#define THOST_FTDC_SML_Must '1' +/// +#define THOST_FTDC_SML_Alarm '2' +///ʾ +#define THOST_FTDC_SML_Prompt '3' +/// +#define THOST_FTDC_SML_Ignore '4' + +typedef char TThostFtdcSettleManagerLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleManagerGroupTypeһģ +///////////////////////////////////////////////////////////////////////// +///˶ +#define THOST_FTDC_SMG_Exhcange '1' +///ڲ˶ +#define THOST_FTDC_SMG_ASP '2' +///ϱݺ˶ +#define THOST_FTDC_SMG_CSRC '3' + +typedef char TThostFtdcSettleManagerGroupType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckResultMemoTypeһ˶Խ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCheckResultMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionUrlTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFunctionUrlType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthInfoTypeһͻ֤Ϣ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthCodeTypeһͻ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAuthCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLimitUseTypeTypeһֵʹ +///////////////////////////////////////////////////////////////////////// +///ظʹ +#define THOST_FTDC_LUT_Repeatable '1' +///ظʹ +#define THOST_FTDC_LUT_Unrepeatable '2' + +typedef char TThostFtdcLimitUseTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataResourceTypeһԴ +///////////////////////////////////////////////////////////////////////// +///ϵͳ +#define THOST_FTDC_DAR_Settle '1' +/// +#define THOST_FTDC_DAR_Exchange '2' +/// +#define THOST_FTDC_DAR_CSRC '3' + +typedef char TThostFtdcDataResourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginTypeTypeһ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_MGT_ExchMarginRate '0' +///Ͷ֤߱ +#define THOST_FTDC_MGT_InstrMarginRate '1' +///Ͷ߽ױ֤ +#define THOST_FTDC_MGT_InstrMarginRateTrade '2' + +typedef char TThostFtdcMarginTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActiveTypeTypeһЧ +///////////////////////////////////////////////////////////////////////// +///Ч +#define THOST_FTDC_ACT_Intraday '1' +///Ч +#define THOST_FTDC_ACT_Long '2' + +typedef char TThostFtdcActiveTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginRateTypeTypeһͻ֤ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_MRT_Exchange '1' +///Ͷ֤߱ +#define THOST_FTDC_MRT_Investor '2' +///Ͷ߽ױ֤ +#define THOST_FTDC_MRT_InvestorTrade '3' + +typedef char TThostFtdcMarginRateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBackUpStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δɱ +#define THOST_FTDC_BUS_UnBak '0' +/// +#define THOST_FTDC_BUS_BakUp '1' +///ɱ +#define THOST_FTDC_BUS_BakUped '2' +///ʧ +#define THOST_FTDC_BUS_BakFail '3' + +typedef char TThostFtdcBackUpStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInitSettlementTypeһʼ״̬ +///////////////////////////////////////////////////////////////////////// +///ʼδʼ +#define THOST_FTDC_SIS_UnInitialize '0' +///ʼ +#define THOST_FTDC_SIS_Initialize '1' +///ʼ +#define THOST_FTDC_SIS_Initialized '2' + +typedef char TThostFtdcInitSettlementType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReportStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///δɱ +#define THOST_FTDC_SRS_NoCreate '0' +/// +#define THOST_FTDC_SRS_Create '1' +///ɱ +#define THOST_FTDC_SRS_Created '2' +///ɱʧ +#define THOST_FTDC_SRS_CreateFail '3' + +typedef char TThostFtdcReportStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSaveStatusTypeһݹ鵵״̬ +///////////////////////////////////////////////////////////////////////// +///鵵δ +#define THOST_FTDC_SSS_UnSaveData '0' +///鵵 +#define THOST_FTDC_SSS_SaveDatad '1' + +typedef char TThostFtdcSaveStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettArchiveStatusTypeһȷݹ鵵״̬ +///////////////////////////////////////////////////////////////////////// +///δ鵵 +#define THOST_FTDC_SAS_UnArchived '0' +///ݹ鵵 +#define THOST_FTDC_SAS_Archiving '1' +///ѹ鵵 +#define THOST_FTDC_SAS_Archived '2' +///鵵ʧ +#define THOST_FTDC_SAS_ArchiveFail '3' + +typedef char TThostFtdcSettArchiveStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCTPTypeTypeһCTPϵͳ +///////////////////////////////////////////////////////////////////////// +///δ֪ +#define THOST_FTDC_CTPT_Unkown '0' +/// +#define THOST_FTDC_CTPT_MainCenter '1' +/// +#define THOST_FTDC_CTPT_BackUp '2' + +typedef char TThostFtdcCTPTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcToolIDTypeһߴ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcToolIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcToolNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcToolNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCloseDealTypeTypeһƽִ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CDT_Normal '0' +///Ͷƽ +#define THOST_FTDC_CDT_SpecFirst '1' + +typedef char TThostFtdcCloseDealTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMortgageFundUseRangeTypeһѺʽ÷Χ +///////////////////////////////////////////////////////////////////////// +///ʹ +#define THOST_FTDC_MFUR_None '0' +///ڱ֤ +#define THOST_FTDC_MFUR_Margin '1' +///ѡӯ֤ +#define THOST_FTDC_MFUR_All '2' + +typedef char TThostFtdcMortgageFundUseRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyUnitTypeһֵλ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcCurrencyUnitType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeRateTypeһ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcExchangeRateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSpecProductTypeTypeһƷ +///////////////////////////////////////////////////////////////////////// +///֣ױƷ +#define THOST_FTDC_SPT_CzceHedge '1' +///ѺƷ +#define THOST_FTDC_SPT_IneForeignCurrency '2' +///߿ƽֲƷ +#define THOST_FTDC_SPT_DceOpenClose '3' + +typedef char TThostFtdcSpecProductTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortgageTypeTypeһѺ +///////////////////////////////////////////////////////////////////////// +///Ѻ +#define THOST_FTDC_FMT_Mortgage '1' +/// +#define THOST_FTDC_FMT_Redemption '2' + +typedef char TThostFtdcFundMortgageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountSettlementParamIDTypeһͶ˻ +///////////////////////////////////////////////////////////////////////// +///֤ +#define THOST_FTDC_ASPI_BaseMargin '1' +///Ȩ׼ +#define THOST_FTDC_ASPI_LowestInterest '2' + +typedef char TThostFtdcAccountSettlementParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyNameTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencyNameType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySignTypeһַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencySignType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortDirectionTypeһѺ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_FMD_In '1' +///ʳ +#define THOST_FTDC_FMD_Out '2' + +typedef char TThostFtdcFundMortDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessClassTypeһ +///////////////////////////////////////////////////////////////////////// +///ӯ +#define THOST_FTDC_BT_Profit '0' +/// +#define THOST_FTDC_BT_Loss '1' +/// +#define THOST_FTDC_BT_Other 'Z' + +typedef char TThostFtdcBusinessClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSwapSourceTypeTypeһԴ +///////////////////////////////////////////////////////////////////////// +///ֹ +#define THOST_FTDC_SST_Manual '0' +///Զ +#define THOST_FTDC_SST_Automatic '1' + +typedef char TThostFtdcSwapSourceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrExDirectionTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CED_Settlement '0' +///ۻ +#define THOST_FTDC_CED_Sale '1' + +typedef char TThostFtdcCurrExDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySwapStatusTypeһ״̬ +///////////////////////////////////////////////////////////////////////// +///¼ +#define THOST_FTDC_CSS_Entry '1' +/// +#define THOST_FTDC_CSS_Approve '2' +///Ѿܾ +#define THOST_FTDC_CSS_Refuse '3' +///ѳ +#define THOST_FTDC_CSS_Revoke '4' +///ѷ +#define THOST_FTDC_CSS_Send '5' +///ɹ +#define THOST_FTDC_CSS_Success '6' +///ʧ +#define THOST_FTDC_CSS_Failure '7' + +typedef char TThostFtdcCurrencySwapStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrExchCertNoTypeһƾ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrExchCertNoType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBatchSerialNoTypeһκ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBatchSerialNoType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcReqFlagTypeһ㷢ͱ־ +///////////////////////////////////////////////////////////////////////// +///δ +#define THOST_FTDC_REQF_NoSend '0' +///ͳɹ +#define THOST_FTDC_REQF_SendSuccess '1' +///ʧ +#define THOST_FTDC_REQF_SendFailed '2' +///ȴط +#define THOST_FTDC_REQF_WaitReSend '3' + +typedef char TThostFtdcReqFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcResFlagTypeһ㷵سɹ־ +///////////////////////////////////////////////////////////////////////// +///ɹ +#define THOST_FTDC_RESF_Success '0' +///˻ +#define THOST_FTDC_RESF_InsuffiCient '1' +///׽δ֪ +#define THOST_FTDC_RESF_UnKnown '8' + +typedef char TThostFtdcResFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPageControlTypeһҳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPageControlType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRecordCountTypeһ¼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcRecordCountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencySwapMemoTypeһȷϢ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCurrencySwapMemoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExStatusTypeһ޸״̬ +///////////////////////////////////////////////////////////////////////// +///޸ǰ +#define THOST_FTDC_EXS_Before '0' +///޸ĺ +#define THOST_FTDC_EXS_After '1' + +typedef char TThostFtdcExStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientRegionTypeһͻ +///////////////////////////////////////////////////////////////////////// +///ڿͻ +#define THOST_FTDC_CR_Domestic '1' +///۰̨ͻ +#define THOST_FTDC_CR_GMT '2' +///ͻ +#define THOST_FTDC_CR_Foreign '3' + +typedef char TThostFtdcClientRegionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWorkPlaceTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWorkPlaceType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessPeriodTypeһӪ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBusinessPeriodType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWebSiteTypeһַ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcWebSiteType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAIdCardTypeTypeһͳһ֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAIdCardTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientModeTypeһģʽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcClientModeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorFullNameTypeһͶȫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestorFullNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOABrokerIDTypeһнID +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOABrokerIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAZipCodeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAZipCodeType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAEMailTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOAEMailType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOldCityTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcOldCityType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCorporateIdentifiedCardNoTypeһ˴֤ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCorporateIdentifiedCardNoType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHasBoardTypeһǷж» +///////////////////////////////////////////////////////////////////////// +///û +#define THOST_FTDC_HB_No '0' +/// +#define THOST_FTDC_HB_Yes '1' + +typedef char TThostFtdcHasBoardType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStartModeTypeһģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_SM_Normal '1' +///Ӧ +#define THOST_FTDC_SM_Emerge '2' +///ָ +#define THOST_FTDC_SM_Restore '3' + +typedef char TThostFtdcStartModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTemplateTypeTypeһģ +///////////////////////////////////////////////////////////////////////// +///ȫ +#define THOST_FTDC_TPT_Full '1' +/// +#define THOST_FTDC_TPT_Increment '2' +/// +#define THOST_FTDC_TPT_BackUp '3' + +typedef char TThostFtdcTemplateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLoginModeTypeһ¼ģʽ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_LM_Trade '0' +///ת +#define THOST_FTDC_LM_Transfer '1' + +typedef char TThostFtdcLoginModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPromptTypeTypeһʾ +///////////////////////////////////////////////////////////////////////// +///Լ +#define THOST_FTDC_CPT_Instrument '1' +///ֶ֤Ч +#define THOST_FTDC_CPT_Margin '2' + +typedef char TThostFtdcPromptTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLedgerManageIDTypeһֻʲ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLedgerManageIDType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestVarietyTypeһͶƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInvestVarietyType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcBankAccountTypeType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLedgerManageBankTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcLedgerManageBankType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffexDepartmentNameTypeһӪҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffexDepartmentNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCffexDepartmentCodeTypeһӪҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCffexDepartmentCodeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHasTrusteeTypeһǷй +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_HT_Yes '1' +///û +#define THOST_FTDC_HT_No '0' + +typedef char TThostFtdcHasTrusteeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCMemo1Typeһ˵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCMemo1Type[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrCFullNameTypeһʲҵڻ˾ȫ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrCFullNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrApprovalNOTypeһʲҵĺ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrApprovalNOType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrMgrNameTypeһʲҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAssetmgrMgrNameType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_AMT_Bank '1' +///֤ȯ˾ +#define THOST_FTDC_AMT_Securities '2' +///˾ +#define THOST_FTDC_AMT_Fund '3' +///չ˾ +#define THOST_FTDC_AMT_Insurance '4' +///й˾ +#define THOST_FTDC_AMT_Trust '5' +/// +#define THOST_FTDC_AMT_Other '9' + +typedef char TThostFtdcAmTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCAmTypeTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCAmTypeType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCFundIOTypeTypeһ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CFIOT_FundIO '0' +///ڻ +#define THOST_FTDC_CFIOT_SwapCurrency '1' + +typedef char TThostFtdcCSRCFundIOTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCusAccountTypeTypeһ˻ +///////////////////////////////////////////////////////////////////////// +///ڻ˻ +#define THOST_FTDC_CAT_Futures '1' +///ڻʹҵµʹܽ˻ +#define THOST_FTDC_CAT_AssetmgrFuture '2' +///ۺʹҵµڻʹй˻ +#define THOST_FTDC_CAT_AssetmgrTrustee '3' +///ۺʹҵµʽת˻ +#define THOST_FTDC_CAT_AssetmgrTransfer '4' + +typedef char TThostFtdcCusAccountTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCNationalTypeһ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCNationalType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCSRCSecAgentIDTypeһID +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCSRCSecAgentIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLanguageTypeTypeһ֪ͨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_LT_Chinese '1' +///Ӣ +#define THOST_FTDC_LT_English '2' + +typedef char TThostFtdcLanguageTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAmAccountTypeһͶ˻ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcAmAccountType[23]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrClientTypeTypeһʲͻ +///////////////////////////////////////////////////////////////////////// +///ʹܿͻ +#define THOST_FTDC_AMCT_Person '1' +///λʹܿͻ +#define THOST_FTDC_AMCT_Organ '2' +///ⵥλʹܿͻ +#define THOST_FTDC_AMCT_SpecialOrgan '4' + +typedef char TThostFtdcAssetmgrClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAssetmgrTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_ASST_Futures '3' +///ۺ +#define THOST_FTDC_ASST_SpecialOrgan '4' + +typedef char TThostFtdcAssetmgrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOMTypeһλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcUOMType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEInstLifePhaseTypeһԼ״̬ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSHFEInstLifePhaseType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEProductClassTypeһƷ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSHFEProductClassType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceDecimalTypeһ۸Сλ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcPriceDecimalType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInTheMoneyFlagTypeһƽֵȨ־ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcInTheMoneyFlagType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCheckInstrTypeTypeһԼȽ +///////////////////////////////////////////////////////////////////////// +///Լ +#define THOST_FTDC_CIT_HasExch '0' +///Լϵͳ +#define THOST_FTDC_CIT_HasATP '1' +///ԼȽϲһ +#define THOST_FTDC_CIT_HasDiff '2' + +typedef char TThostFtdcCheckInstrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeliveryTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ֹ +#define THOST_FTDC_DT_HandDeliv '1' +///ڽ +#define THOST_FTDC_DT_PersonDeliv '2' + +typedef char TThostFtdcDeliveryTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBigMoneyTypeһʽ +///////////////////////////////////////////////////////////////////////// +typedef double TThostFtdcBigMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMaxMarginSideAlgorithmTypeһ֤߱㷨 +///////////////////////////////////////////////////////////////////////// +///ʹô֤߱㷨 +#define THOST_FTDC_MMSA_NO '0' +///ʹô֤߱㷨 +#define THOST_FTDC_MMSA_YES '1' + +typedef char TThostFtdcMaxMarginSideAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDAClientTypeTypeһʲͻ +///////////////////////////////////////////////////////////////////////// +///Ȼ +#define THOST_FTDC_CACT_Person '0' +/// +#define THOST_FTDC_CACT_Company '1' +/// +#define THOST_FTDC_CACT_Other '2' + +typedef char TThostFtdcDAClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinInstrIDTypeһԼ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombinInstrIDType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinSettlePriceTypeһȽ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcCombinSettlePriceType[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDCEPriorityTypeһȼ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcDCEPriorityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeGroupIDTypeһɽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcTradeGroupIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIsCheckPrepaTypeһǷУ鿪ʽ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcIsCheckPrepaType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUOAAssetmgrTypeTypeһͶ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_UOAAT_Futures '1' +///ۺ +#define THOST_FTDC_UOAAT_SpecialOrgan '2' + +typedef char TThostFtdcUOAAssetmgrTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDirectionEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Buy +#define THOST_FTDC_DEN_Buy '0' +///Sell +#define THOST_FTDC_DEN_Sell '1' + +typedef char TThostFtdcDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetFlagEnTypeһƽ־ +///////////////////////////////////////////////////////////////////////// +///Position Opening +#define THOST_FTDC_OFEN_Open '0' +///Position Close +#define THOST_FTDC_OFEN_Close '1' +///Forced Liquidation +#define THOST_FTDC_OFEN_ForceClose '2' +///Close Today +#define THOST_FTDC_OFEN_CloseToday '3' +///Close Prev. +#define THOST_FTDC_OFEN_CloseYesterday '4' +///Forced Reduction +#define THOST_FTDC_OFEN_ForceOff '5' +///Local Forced Liquidation +#define THOST_FTDC_OFEN_LocalForceClose '6' + +typedef char TThostFtdcOffsetFlagEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHedgeFlagEnTypeһͶױ־ +///////////////////////////////////////////////////////////////////////// +///Speculation +#define THOST_FTDC_HFEN_Speculation '1' +///Arbitrage +#define THOST_FTDC_HFEN_Arbitrage '2' +///Hedge +#define THOST_FTDC_HFEN_Hedge '3' + +typedef char TThostFtdcHedgeFlagEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundIOTypeEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Deposit/Withdrawal +#define THOST_FTDC_FIOTEN_FundIO '1' +///Bank-Futures Transfer +#define THOST_FTDC_FIOTEN_Transfer '2' +///Bank-Futures FX Exchange +#define THOST_FTDC_FIOTEN_SwapCurrency '3' + +typedef char TThostFtdcFundIOTypeEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundTypeEnTypeһʽ +///////////////////////////////////////////////////////////////////////// +///Bank Deposit +#define THOST_FTDC_FTEN_Deposite '1' +///Payment/Fee +#define THOST_FTDC_FTEN_ItemFund '2' +///Brokerage Adj +#define THOST_FTDC_FTEN_Company '3' +///Internal Transfer +#define THOST_FTDC_FTEN_InnerTransfer '4' + +typedef char TThostFtdcFundTypeEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundDirectionEnTypeһ +///////////////////////////////////////////////////////////////////////// +///Deposit +#define THOST_FTDC_FDEN_In '1' +///Withdrawal +#define THOST_FTDC_FDEN_Out '2' + +typedef char TThostFtdcFundDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundMortDirectionEnTypeһѺ +///////////////////////////////////////////////////////////////////////// +///Pledge +#define THOST_FTDC_FMDEN_In '1' +///Redemption +#define THOST_FTDC_FMDEN_Out '2' + +typedef char TThostFtdcFundMortDirectionEnType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSwapBusinessTypeTypeһҵ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcSwapBusinessTypeType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionsTypeTypeһȨ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CP_CallOptions '1' +/// +#define THOST_FTDC_CP_PutOptions '2' + +typedef char TThostFtdcOptionsTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeModeTypeһִзʽ +///////////////////////////////////////////////////////////////////////// +///ŷʽ +#define THOST_FTDC_STM_Continental '0' +///ʽ +#define THOST_FTDC_STM_American '1' +///Ľ +#define THOST_FTDC_STM_Bermuda '2' + +typedef char TThostFtdcStrikeModeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeTypeTypeһִ +///////////////////////////////////////////////////////////////////////// +///Գ +#define THOST_FTDC_STT_Hedge '0' +///ƥִ +#define THOST_FTDC_STT_Match '1' + +typedef char TThostFtdcStrikeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcApplyTypeTypeһнȨִ +///////////////////////////////////////////////////////////////////////// +///ִ +#define THOST_FTDC_APPT_NotStrikeNum '4' + +typedef char TThostFtdcApplyTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcGiveUpDataSourceTypeһִԴ +///////////////////////////////////////////////////////////////////////// +///ϵͳ +#define THOST_FTDC_GUDS_Gen '0' +///ֹ +#define THOST_FTDC_GUDS_Hand '1' + +typedef char TThostFtdcGiveUpDataSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderSysIDTypeһִϵͳ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcExecOrderSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecResultTypeһִн +///////////////////////////////////////////////////////////////////////// +///ûִ +#define THOST_FTDC_OER_NoExec 'n' +///Ѿȡ +#define THOST_FTDC_OER_Canceled 'c' +///ִгɹ +#define THOST_FTDC_OER_OK '0' +///Ȩֲֲ +#define THOST_FTDC_OER_NoPosition '1' +///ʽ𲻹 +#define THOST_FTDC_OER_NoDeposit '2' +///Ա +#define THOST_FTDC_OER_NoParticipant '3' +///ͻ +#define THOST_FTDC_OER_NoClient '4' +///Լ +#define THOST_FTDC_OER_NoInstrument '6' +///ûִȨ +#define THOST_FTDC_OER_NoRight '7' +/// +#define THOST_FTDC_OER_InvalidVolume '8' +///û㹻ʷɽ +#define THOST_FTDC_OER_NoEnoughHistoryTrade '9' +///δ֪ +#define THOST_FTDC_OER_Unknown 'a' + +typedef char TThostFtdcExecResultType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeSequenceTypeһִ +///////////////////////////////////////////////////////////////////////// +typedef int TThostFtdcStrikeSequenceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStrikeTimeTypeһִʱ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcStrikeTimeType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombinationTypeTypeһ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_COMBT_Future '0' +///ֱ۲BUL +#define THOST_FTDC_COMBT_BUL '1' +///ֱ۲BER +#define THOST_FTDC_COMBT_BER '2' +///ʽ +#define THOST_FTDC_COMBT_STD '3' +///ʽ +#define THOST_FTDC_COMBT_STG '4' +/// +#define THOST_FTDC_COMBT_PRT '5' +///ʱ۲ +#define THOST_FTDC_COMBT_CLD '6' + +typedef char TThostFtdcCombinationTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOptionRoyaltyPriceTypeTypeһȨȨ۸ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_ORPT_PreSettlementPrice '1' +///ּ +#define THOST_FTDC_ORPT_OpenPrice '4' + +typedef char TThostFtdcOptionRoyaltyPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBalanceAlgorithmTypeһȨ㷨 +///////////////////////////////////////////////////////////////////////// +///Ȩֵӯ +#define THOST_FTDC_BLAG_Default '1' +///Ȩֵ +#define THOST_FTDC_BLAG_IncludeOptValLost '2' + +typedef char TThostFtdcBalanceAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActionTypeTypeһִ +///////////////////////////////////////////////////////////////////////// +///ִ +#define THOST_FTDC_ACTP_Exec '1' +/// +#define THOST_FTDC_ACTP_Abandon '2' + +typedef char TThostFtdcActionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForQuoteStatusTypeһѯ״̬ +///////////////////////////////////////////////////////////////////////// +///Ѿύ +#define THOST_FTDC_FQST_Submitted 'a' +///Ѿ +#define THOST_FTDC_FQST_Accepted 'b' +///Ѿܾ +#define THOST_FTDC_FQST_Rejected 'c' + +typedef char TThostFtdcForQuoteStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcValueMethodTypeһȡֵʽ +///////////////////////////////////////////////////////////////////////// +///ֵ +#define THOST_FTDC_VM_Absolute '0' +/// +#define THOST_FTDC_VM_Ratio '1' + +typedef char TThostFtdcValueMethodType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderPositionFlagTypeһȨȨǷڻͷı +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_EOPF_Reserve '0' +/// +#define THOST_FTDC_EOPF_UnReserve '1' + +typedef char TThostFtdcExecOrderPositionFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExecOrderCloseFlagTypeһȨȨɵͷǷԶƽ +///////////////////////////////////////////////////////////////////////// +///Զƽ +#define THOST_FTDC_EOCF_AutoClose '0' +///Զƽ +#define THOST_FTDC_EOCF_NotToClose '1' + +typedef char TThostFtdcExecOrderCloseFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductTypeTypeһƷ +///////////////////////////////////////////////////////////////////////// +///ڻ +#define THOST_FTDC_PTE_Futures '1' +///Ȩ +#define THOST_FTDC_PTE_Options '2' + +typedef char TThostFtdcProductTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCZCEUploadFileNameTypeһ֣ļ +///////////////////////////////////////////////////////////////////////// +///^\d{8}_zz_\d{4} +#define THOST_FTDC_CUFN_CUFN_O 'O' +///^\d{8}ɽ +#define THOST_FTDC_CUFN_CUFN_T 'T' +///^\d{8}ȳֱֲnew +#define THOST_FTDC_CUFN_CUFN_P 'P' +///^\d{8}ƽ˽ +#define THOST_FTDC_CUFN_CUFN_N 'N' +///^\d{8}ƽֱ +#define THOST_FTDC_CUFN_CUFN_L 'L' +///^\d{8}ʽ +#define THOST_FTDC_CUFN_CUFN_F 'F' +///^\d{8}ϳֱֲ +#define THOST_FTDC_CUFN_CUFN_C 'C' +///^\d{8}֤ +#define THOST_FTDC_CUFN_CUFN_M 'M' + +typedef char TThostFtdcCZCEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDCEUploadFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +///^\d{8}_dl_\d{3} +#define THOST_FTDC_DUFN_DUFN_O 'O' +///^\d{8}_ɽ +#define THOST_FTDC_DUFN_DUFN_T 'T' +///^\d{8}_ֱֲ +#define THOST_FTDC_DUFN_DUFN_P 'P' +///^\d{8}_ʽ +#define THOST_FTDC_DUFN_DUFN_F 'F' +///^\d{8}_Żϳֲϸ +#define THOST_FTDC_DUFN_DUFN_C 'C' +///^\d{8}_ֲϸ +#define THOST_FTDC_DUFN_DUFN_D 'D' +///^\d{8}_֤ +#define THOST_FTDC_DUFN_DUFN_M 'M' +///^\d{8}_Ȩִб +#define THOST_FTDC_DUFN_DUFN_S 'S' + +typedef char TThostFtdcDCEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSHFEUploadFileNameTypeһļ +///////////////////////////////////////////////////////////////////////// +///^\d{4}_\d{8}_\d{8}_DailyFundChg +#define THOST_FTDC_SUFN_SUFN_O 'O' +///^\d{4}_\d{8}_\d{8}_Trade +#define THOST_FTDC_SUFN_SUFN_T 'T' +///^\d{4}_\d{8}_\d{8}_SettlementDetail +#define THOST_FTDC_SUFN_SUFN_P 'P' +///^\d{4}_\d{8}_\d{8}_Capital +#define THOST_FTDC_SUFN_SUFN_F 'F' + +typedef char TThostFtdcSHFEUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCFFEXUploadFileNameTypeһнļ +///////////////////////////////////////////////////////////////////////// +///^\d{4}_SG\d{1}_\d{8}_\d{1}_Trade +#define THOST_FTDC_CFUFN_SUFN_T 'T' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_SettlementDetail +#define THOST_FTDC_CFUFN_SUFN_P 'P' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_Capital +#define THOST_FTDC_CFUFN_SUFN_F 'F' +///^\d{4}_SG\d{1}_\d{8}_\d{1}_OptionExec +#define THOST_FTDC_CFUFN_SUFN_S 'S' + +typedef char TThostFtdcCFFEXUploadFileNameType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombDirectionTypeһָ +///////////////////////////////////////////////////////////////////////// +/// +#define THOST_FTDC_CMDR_Comb '0' +/// +#define THOST_FTDC_CMDR_UnComb '1' + +typedef char TThostFtdcCombDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFBTBankIDTypeһбʶ +///////////////////////////////////////////////////////////////////////// +typedef char TThostFtdcFBTBankIDType[2]; + +/// +}; +#endif diff --git a/include/Sgit/SgitFtdcUserApiStruct.h b/include/Sgit/SgitFtdcUserApiStruct.h new file mode 100644 index 0000000..058f8ab --- /dev/null +++ b/include/Sgit/SgitFtdcUserApiStruct.h @@ -0,0 +1,7837 @@ + ///////////////////////////////////////////////////////////////////////// +///@system +///@company +///@file SgitFtdcUserApiStruct.h +///@brief ˿ͻ˽ӿʹõҵݽṹ +///@history +///20150810 +///////////////////////////////////////////////////////////////////////// + +#if !defined(SGIT_FTDCSTRUCT_H) +#define SGIT_FTDCSTRUCT_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SgitFtdcUserApiDataType.h" +// +namespace fstech{ +/// +///Ϣַ +struct CThostFtdcDisseminationField +{ + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///к + TThostFtdcSequenceNoType SequenceNo; +}; + +///û¼ +struct CThostFtdcReqUserLoginField +{ + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///նIPַ + TThostFtdcIPAddressType ClientIPAddress; +}; + +///û¼Ӧ +struct CThostFtdcRspUserLoginField +{ + /// + TThostFtdcDateType TradingDay; + ///¼ɹʱ + TThostFtdcTimeType LoginTime; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Դʱ + TThostFtdcTimeType INETime; +}; + +///ûdz +struct CThostFtdcUserLogoutField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ǿƽԱ˳ +struct CThostFtdcForceUserLogoutField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ͻ֤ +struct CThostFtdcReqAuthenticateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤ + TThostFtdcAuthCodeType AuthCode; +}; + +///ͻ֤Ӧ +struct CThostFtdcRspAuthenticateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; +}; + +///ͻ֤Ϣ +struct CThostFtdcAuthenticationInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///֤Ϣ + TThostFtdcAuthInfoType AuthInfo; + ///ǷΪ֤ + TThostFtdcBoolType IsResult; +}; + +///תʱͷ +struct CThostFtdcTransferHeaderField +{ + ///汾ţ1.0 + TThostFtdcVersionType Version; + ///״룬 + TThostFtdcTradeCodeType TradeCode; + ///ڣʽyyyymmdd + TThostFtdcTradeDateType TradeDate; + ///ʱ䣬ʽhhmmss + TThostFtdcTradeTimeType TradeTime; + ///ˮţN/A + TThostFtdcTradeSerialType TradeSerial; + ///ڻ˾룬 + TThostFtdcFutureIDType FutureID; + ///д룬ݲѯеõ + TThostFtdcBankIDType BankID; + ///зĴ룬ݲѯеõ + TThostFtdcBankBrchIDType BankBrchID; + ///ԱN/A + TThostFtdcOperNoType OperNo; + ///豸ͣN/A + TThostFtdcDeviceIDType DeviceID; + ///¼N/A + TThostFtdcRecordNumType RecordNum; + ///ỰţN/A + TThostFtdcSessionIDType SessionID; + ///ţN/A + TThostFtdcRequestIDType RequestID; +}; + +///ʽתڻTradeCode=202001 +struct CThostFtdcTransferBankToFutureReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ʽתڻӦ +struct CThostFtdcTransferBankToFutureRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ڻʽתTradeCode=202002 +struct CThostFtdcTransferFutureToBankReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///ת˽ + TThostFtdcMoneyType TradeAmt; + ///ͻ + TThostFtdcMoneyType CustFee; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ڻʽתӦ +struct CThostFtdcTransferFutureToBankRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///תʽ + TThostFtdcMoneyType TradeAmt; + ///Ӧտͻ + TThostFtdcMoneyType CustFee; + /// + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ѯʽTradeCode=204002 +struct CThostFtdcTransferQryBankReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; + ///־ + TThostFtdcFuturePwdFlagType FuturePwdFlag; + /// + TThostFtdcFutureAccPwdType FutureAccPwd; + ///֣RMB- USD-Բ HKD-Ԫ + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ѯʽӦ +struct CThostFtdcTransferQryBankRspField +{ + ///Ӧ + TThostFtdcRetCodeType RetCode; + ///ӦϢ + TThostFtdcRetInfoType RetInfo; + ///ʽ˻ + TThostFtdcAccountIDType FutureAccount; + /// + TThostFtdcMoneyType TradeAmt; + ///п + TThostFtdcMoneyType UseAmt; + ///пȡ + TThostFtdcMoneyType FetchAmt; + /// + TThostFtdcCurrencyCodeType CurrencyCode; +}; + +///ѯнϸTradeCode=204999 +struct CThostFtdcTransferQryDetailReqField +{ + ///ڻʽ˻ + TThostFtdcAccountIDType FutureAccount; +}; + +///ѯнϸӦ +struct CThostFtdcTransferQryDetailRspField +{ + /// + TThostFtdcDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///ڻˮ + TThostFtdcTradeSerialNoType FutureSerial; + ///ڻ˾ + TThostFtdcFutureIDType FutureID; + ///ʽʺ + TThostFtdcFutureAccountType FutureAccount; + ///ˮ + TThostFtdcTradeSerialNoType BankSerial; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + ///˺ + TThostFtdcBankAccountType BankAccount; + ///֤ + TThostFtdcCertCodeType CertCode; + ///Ҵ + TThostFtdcCurrencyCodeType CurrencyCode; + /// + TThostFtdcMoneyType TxAmount; + ///Ч־ + TThostFtdcTransferValidFlagType Flag; +}; + +///ӦϢ +struct CThostFtdcRspInfoField +{ + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +/// +struct CThostFtdcExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcExchangeNameType ExchangeName; + /// + TThostFtdcExchangePropertyType ExchangeProperty; +}; + +///Ʒ +struct CThostFtdcProductField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductNameType ProductName; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceType PriceTick; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///ֲ + TThostFtdcPositionTypeType PositionType; + ///ֲ + TThostFtdcPositionDateTypeType PositionDateType; + ///ƽִ + TThostFtdcCloseDealTypeType CloseDealType; + ///ױ + TThostFtdcCurrencyIDType TradeCurrencyID; + ///Ѻʽ÷Χ + TThostFtdcMortgageFundUseRangeType MortgageFundUseRange; + ///Ʒ + TThostFtdcInstrumentIDType ExchangeProductID; + ///ԼƷ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; +}; + +///Լ +struct CThostFtdcInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentNameType InstrumentName; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; + /// + TThostFtdcYearType DeliveryYear; + /// + TThostFtdcMonthType DeliveryMonth; + ///м۵µ + TThostFtdcVolumeType MaxMarketOrderVolume; + ///м۵Сµ + TThostFtdcVolumeType MinMarketOrderVolume; + ///޼۵µ + TThostFtdcVolumeType MaxLimitOrderVolume; + ///޼۵Сµ + TThostFtdcVolumeType MinLimitOrderVolume; + ///Լ + TThostFtdcVolumeMultipleType VolumeMultiple; + ///С䶯λ + TThostFtdcPriceType PriceTick; + /// + TThostFtdcDateType CreateDate; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcDateType ExpireDate; + ///ʼ + TThostFtdcDateType StartDelivDate; + /// + TThostFtdcDateType EndDelivDate; + ///Լ״̬ + TThostFtdcInstLifePhaseType InstLifePhase; + ///ǰǷ + TThostFtdcBoolType IsTrading; + ///ֲ + TThostFtdcPositionTypeType PositionType; + ///ֲ + TThostFtdcPositionDateTypeType PositionDateType; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatio; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatio; + ///Ƿʹô֤߱㷨 + TThostFtdcMaxMarginSideAlgorithmType MaxMarginSideAlgorithm; + ///Ʒ + TThostFtdcInstrumentIDType UnderlyingInstrID; + ///ִм + TThostFtdcPriceType StrikePrice; + ///Ȩ + TThostFtdcOptionsTypeType OptionsType; + ///ԼƷ + TThostFtdcUnderlyingMultipleType UnderlyingMultiple; + /// + TThostFtdcCombinationTypeType CombinationType; +}; + +///͹˾ +struct CThostFtdcBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ + TThostFtdcBrokerAbbrType BrokerAbbr; + ///͹˾ + TThostFtdcBrokerNameType BrokerName; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///Ա +struct CThostFtdcTraderField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallCountType InstallCount; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///Ͷ +struct CThostFtdcInvestorField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcDateType OpenDate; + ///ֻ + TThostFtdcMobileType Mobile; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ױ +struct CThostFtdcTradingCodeField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; +}; + +///Ա;͹˾ձ +struct CThostFtdcPartBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///û +struct CThostFtdcSuperUserField +{ + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + /// + TThostFtdcPasswordType Password; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///ûȨ +struct CThostFtdcSuperUserFunctionField +{ + ///û + TThostFtdcUserIDType UserID; + ///ܴ + TThostFtdcFunctionCodeType FunctionCode; +}; + +///Ͷ +struct CThostFtdcInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ߷ + TThostFtdcInvestorGroupNameType InvestorGroupName; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ϴѺ + TThostFtdcMoneyType PreMortgage; + ///ϴö + TThostFtdcMoneyType PreCredit; + ///ϴδ + TThostFtdcMoneyType PreDeposit; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///Ϣ + TThostFtdcMoneyType InterestBase; + ///Ϣ + TThostFtdcMoneyType Interest; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + ///ʽ + TThostFtdcMoneyType Available; + ///ȡʽ + TThostFtdcMoneyType WithdrawQuota; + ///׼ + TThostFtdcMoneyType Reserve; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ö + TThostFtdcMoneyType Credit; + ///Ѻ + TThostFtdcMoneyType Mortgage; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///Ͷ߽֤ + TThostFtdcMoneyType DeliveryMargin; + ///֤ + TThostFtdcMoneyType ExchangeDeliveryMargin; + ///ڻ׼ + TThostFtdcMoneyType ReserveBalance; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ϴλ + TThostFtdcMoneyType PreFundMortgageIn; + ///ϴλʳ + TThostFtdcMoneyType PreFundMortgageOut; + /// + TThostFtdcMoneyType FundMortgageIn; + ///ʳ + TThostFtdcMoneyType FundMortgageOut; + ///Ѻ + TThostFtdcMoneyType FundMortgageAvailable; + ///Ѻҽ + TThostFtdcMoneyType MortgageableFund; + ///Ʒռñ֤ + TThostFtdcMoneyType SpecProductMargin; + ///Ʒᱣ֤ + TThostFtdcMoneyType SpecProductFrozenMargin; + ///Ʒ + TThostFtdcMoneyType SpecProductCommission; + ///Ʒ + TThostFtdcMoneyType SpecProductFrozenCommission; + ///Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfit; + ///Ʒƽӯ + TThostFtdcMoneyType SpecProductCloseProfit; + ///ݳֲӯ㷨Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfitByAlg; + ///Ʒ֤ + TThostFtdcMoneyType SpecProductExchangeMargin; +}; + +///Ͷֲ߳ +struct CThostFtdcInvestorPositionField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcPositionDateType PositionDate; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ճֲ + TThostFtdcVolumeType Position; + ///ͷ + TThostFtdcVolumeType LongFrozen; + ///ͷ + TThostFtdcVolumeType ShortFrozen; + ///ֶ + TThostFtdcMoneyType LongFrozenAmount; + ///ֶ + TThostFtdcMoneyType ShortFrozenAmount; + /// + TThostFtdcVolumeType OpenVolume; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ֽ + TThostFtdcMoneyType OpenAmount; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ֲֳɱ + TThostFtdcMoneyType PositionCost; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ֳɱ + TThostFtdcMoneyType OpenCost; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///ϳɽγɵijֲ + TThostFtdcVolumeType CombPosition; + ///϶ͷ + TThostFtdcVolumeType CombLongFrozen; + ///Ͽͷ + TThostFtdcVolumeType CombShortFrozen; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///ճֲ + TThostFtdcVolumeType TodayPosition; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ִж//sgit + TThostFtdcVolumeType StrikeFrozen; + ///ִж + TThostFtdcMoneyType StrikeFrozenAmount; + ///ִж + TThostFtdcVolumeType AbandonFrozen; +}; + +///Լ֤ +struct CThostFtdcInstrumentMarginRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; +}; + +///Լ +struct CThostFtdcInstrumentCommissionRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; +}; + +/// +struct CThostFtdcDepthMarketDataField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; + ///վ + TThostFtdcPriceType AveragePrice; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +///ͶߺԼȨ +struct CThostFtdcInstrumentTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ȩ + TThostFtdcTradingRightType TradingRight; +}; + +///͹˾û +struct CThostFtdcBrokerUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û + TThostFtdcUserNameType UserName; + ///û + TThostFtdcUserTypeType UserType; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///Ƿʹ + TThostFtdcBoolType IsUsingOTP; +}; + +///͹˾û +struct CThostFtdcBrokerUserPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcPasswordType Password; +}; + +///͹˾ûȨ +struct CThostFtdcBrokerUserFunctionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///͹˾ܴ + TThostFtdcBrokerFunctionCodeType BrokerFunctionCode; +}; + +///Ա̻ +struct CThostFtdcTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ϯλɽ + TThostFtdcTradeIDType MaxTradeID; + ///ϯλ󱨵 + TThostFtdcReturnCodeType MaxOrderMessageReference; +}; + +///Ͷ߽ +struct CThostFtdcSettlementInfoField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType Content; +}; + +///Լ֤ʵ +struct CThostFtdcInstrumentMarginRateAdjustField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; +}; + +///֤ +struct CThostFtdcExchangeMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; +}; + +///֤ʵ +struct CThostFtdcExchangeMarginRateAdjustField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///潻Ͷ߶ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///潻Ͷ߶ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///潻Ͷ߿ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///潻Ͷ߿ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ExchLongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ExchLongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ExchShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ExchShortMarginRatioByVolume; + ///潻Ͷ߶ͷ֤ + TThostFtdcRatioType NoLongMarginRatioByMoney; + ///潻Ͷ߶ͷ֤ + TThostFtdcMoneyType NoLongMarginRatioByVolume; + ///潻Ͷ߿ͷ֤ + TThostFtdcRatioType NoShortMarginRatioByMoney; + ///潻Ͷ߿ͷ֤ + TThostFtdcMoneyType NoShortMarginRatioByVolume; +}; + +/// +struct CThostFtdcExchangeRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Դֵλ + TThostFtdcCurrencyUnitType FromCurrencyUnit; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; + /// + TThostFtdcExchangeRateType ExchangeRate; +}; + +/// +struct CThostFtdcSettlementRefField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; +}; + +///ǰʱ +struct CThostFtdcCurrentTimeField +{ + ///ǰ + TThostFtdcDateType CurrDate; + ///ǰʱ + TThostFtdcTimeType CurrTime; + ///ǰʱ䣨룩 + TThostFtdcMillisecType CurrMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +///ͨѶ׶ +struct CThostFtdcCommPhaseField +{ + /// + TThostFtdcDateType TradingDay; + ///ͨѶʱα + TThostFtdcCommPhaseNoType CommPhaseNo; + ///ϵͳ + TThostFtdcSystemIDType SystemID; +}; + +///¼Ϣ +struct CThostFtdcLoginInfoField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///ϵͳ + TThostFtdcSystemNameType SystemName; + /// + TThostFtdcPasswordType Password; + ///󱨵 + TThostFtdcOrderRefType MaxOrderRef; + ///ʱ + TThostFtdcTimeType SHFETime; + ///ʱ + TThostFtdcTimeType DCETime; + ///֣ʱ + TThostFtdcTimeType CZCETime; + ///нʱ + TThostFtdcTimeType FFEXTime; + ///Macַ + TThostFtdcMacAddressType MacAddress; + ///̬ + TThostFtdcPasswordType OneTimePassword; + ///Դʱ + TThostFtdcTimeType INETime; +}; + +///¼Ϣ +struct CThostFtdcLogoutAllField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ϵͳ + TThostFtdcSystemNameType SystemName; +}; + +///ǰ״̬ +struct CThostFtdcFrontStatusField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///û +struct CThostFtdcUserPasswordUpdateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; +}; + +///뱨 +struct CThostFtdcInputOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///־ + TThostFtdcBoolType IsSwapOrder; + // + ///onRspOrderInsertʹ,ReqOrderInsertвд. + TThostFtdcOrderSysIDType OrderSysID; + TThostFtdcExchangeIDType ExchangeID; + +}; + +/// +struct CThostFtdcOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ//sigt + TThostFtdcVolumeType ZCETotalTradedVolume; + ///־ + TThostFtdcBoolType IsSwapOrder; +}; + +/// +struct CThostFtdcExchangeOrderField +{ + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; +}; + +///ʧ +struct CThostFtdcExchangeOrderInsertErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///뱨 +struct CThostFtdcInputOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ױ + //TThostFtdcClientIDType ClientID; +}; + +/// +struct CThostFtdcOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +/// +struct CThostFtdcExchangeOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; +}; + +///ʧ +struct CThostFtdcExchangeOrderActionErrorField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ɽ +struct CThostFtdcExchangeTradeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ɽԴ + TThostFtdcTradeSourceType TradeSource; +}; + +///ɽ +struct CThostFtdcTradeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///׽ɫ + TThostFtdcTradingRoleType TradingRole; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; + ///ɽʱ + TThostFtdcDateType TradeDate; + ///ɽʱ + TThostFtdcTimeType TradeTime; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ɽԴ + TThostFtdcPriceSourceType PriceSource; + ///Ա + TThostFtdcTraderIDType TraderID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ɽԴ + TThostFtdcTradeSourceType TradeSource; +}; + +///ûỰ +struct CThostFtdcUserSessionField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ + TThostFtdcDateType LoginDate; + ///¼ʱ + TThostFtdcTimeType LoginTime; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///ӿڶ˲ƷϢ + TThostFtdcProductInfoType InterfaceProductInfo; + ///ЭϢ + TThostFtdcProtocolInfoType ProtocolInfo; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///ѯ󱨵 +struct CThostFtdcQueryMaxOrderVolumeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; +}; + +///Ͷ߽ȷϢ +struct CThostFtdcSettlementInfoConfirmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ȷ + TThostFtdcDateType ConfirmDate; + ///ȷʱ + TThostFtdcTimeType ConfirmTime; +}; + +///ͬ +struct CThostFtdcSyncDepositField +{ + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcMoneyType Deposit; + ///Ƿǿƽ + TThostFtdcBoolType IsForce; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///Ѻͬ +struct CThostFtdcSyncFundMortgageField +{ + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Ѻ + TThostFtdcMoneyType MortgageAmount; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; +}; + +///͹˾ͬ +struct CThostFtdcBrokerSyncField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ͬеͶ +struct CThostFtdcSyncingInvestorField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ + TThostFtdcPartyNameType InvestorName; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcDateType OpenDate; + ///ֻ + TThostFtdcMobileType Mobile; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ͬеĽ״ +struct CThostFtdcSyncingTradingCodeField +{ + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ǷԾ + TThostFtdcBoolType IsActive; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; +}; + +///ͬеͶ߷ +struct CThostFtdcSyncingInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷ + TThostFtdcInvestorIDType InvestorGroupID; + ///Ͷ߷ + TThostFtdcInvestorGroupNameType InvestorGroupName; +}; + +///ͬеĽ˺ +struct CThostFtdcSyncingTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ϴѺ + TThostFtdcMoneyType PreMortgage; + ///ϴö + TThostFtdcMoneyType PreCredit; + ///ϴδ + TThostFtdcMoneyType PreDeposit; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///Ϣ + TThostFtdcMoneyType InterestBase; + ///Ϣ + TThostFtdcMoneyType Interest; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + ///ʽ + TThostFtdcMoneyType Available; + ///ȡʽ + TThostFtdcMoneyType WithdrawQuota; + ///׼ + TThostFtdcMoneyType Reserve; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ö + TThostFtdcMoneyType Credit; + ///Ѻ + TThostFtdcMoneyType Mortgage; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///Ͷ߽֤ + TThostFtdcMoneyType DeliveryMargin; + ///֤ + TThostFtdcMoneyType ExchangeDeliveryMargin; + ///ڻ׼//sgit + TThostFtdcMoneyType ReserveBalance; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ϴλ + TThostFtdcMoneyType PreFundMortgageIn; + ///ϴλʳ + TThostFtdcMoneyType PreFundMortgageOut; + /// + TThostFtdcMoneyType FundMortgageIn; + ///ʳ + TThostFtdcMoneyType FundMortgageOut; + ///Ѻ + TThostFtdcMoneyType FundMortgageAvailable; + ///Ѻҽ + TThostFtdcMoneyType MortgageableFund; + ///Ʒռñ֤ + TThostFtdcMoneyType SpecProductMargin; + ///Ʒᱣ֤ + TThostFtdcMoneyType SpecProductFrozenMargin; + ///Ʒ + TThostFtdcMoneyType SpecProductCommission; + ///Ʒ + TThostFtdcMoneyType SpecProductFrozenCommission; + ///Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfit; + ///Ʒƽӯ + TThostFtdcMoneyType SpecProductCloseProfit; + ///ݳֲӯ㷨Ʒֲӯ + TThostFtdcMoneyType SpecProductPositionProfitByAlg; + ///Ʒ֤ + TThostFtdcMoneyType SpecProductExchangeMargin; +}; + +///ͬеͶֲ߳ +struct CThostFtdcSyncingInvestorPositionField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ֲֶշ + TThostFtdcPosiDirectionType PosiDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ֲ + TThostFtdcPositionDateType PositionDate; + ///ճֲ + TThostFtdcVolumeType YdPosition; + ///ճֲ + TThostFtdcVolumeType Position; + ///ͷ + TThostFtdcVolumeType LongFrozen; + ///ͷ + TThostFtdcVolumeType ShortFrozen; + ///ֶ + TThostFtdcMoneyType LongFrozenAmount; + ///ֶ + TThostFtdcMoneyType ShortFrozenAmount; + /// + TThostFtdcVolumeType OpenVolume; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ֽ + TThostFtdcMoneyType OpenAmount; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; + ///ֲֳɱ + TThostFtdcMoneyType PositionCost; + ///ϴռõı֤ + TThostFtdcMoneyType PreMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ʽ + TThostFtdcMoneyType FrozenCash; + /// + TThostFtdcMoneyType FrozenCommission; + ///ʽ + TThostFtdcMoneyType CashIn; + /// + TThostFtdcMoneyType Commission; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ֳɱ + TThostFtdcMoneyType OpenCost; + ///֤ + TThostFtdcMoneyType ExchangeMargin; + ///ϳɽγɵijֲ + TThostFtdcVolumeType CombPosition; + ///϶ͷ + TThostFtdcVolumeType CombLongFrozen; + ///Ͽͷ + TThostFtdcVolumeType CombShortFrozen; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///ճֲ + TThostFtdcVolumeType TodayPosition; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ִж//sgit + TThostFtdcVolumeType StrikeFrozen; + ///ִж + TThostFtdcMoneyType StrikeFrozenAmount; + ///ִж + TThostFtdcVolumeType AbandonFrozen; +}; + +///ͬеĺԼ֤ +struct CThostFtdcSyncingInstrumentMarginRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ͷ֤ + TThostFtdcRatioType LongMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType LongMarginRatioByVolume; + ///ͷ֤ + TThostFtdcRatioType ShortMarginRatioByMoney; + ///ͷ֤ + TThostFtdcMoneyType ShortMarginRatioByVolume; + ///ǷԽȡ + TThostFtdcBoolType IsRelative; +}; + +///ͬеĺԼ +struct CThostFtdcSyncingInstrumentCommissionRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; +}; + +///ͬеĺԼȨ +struct CThostFtdcSyncingInstrumentTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ȩ + TThostFtdcTradingRightType TradingRight; +}; + +///ѯ +struct CThostFtdcQryOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ѯɽ +struct CThostFtdcQryTradeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ɽ + TThostFtdcTradeIDType TradeID; + ///ʼʱ + TThostFtdcTimeType TradeTimeStart; + ///ʱ + TThostFtdcTimeType TradeTimeEnd; +}; + +///ѯͶֲ߳ +struct CThostFtdcQryInvestorPositionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯʽ˻ +struct CThostFtdcQryTradingAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯͶ +struct CThostFtdcQryInvestorField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ѯױ +struct CThostFtdcQryTradingCodeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ױ + TThostFtdcClientIDTypeType ClientIDType; +}; + +///ѯͶ +struct CThostFtdcQryInvestorGroupField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯԼ֤ +struct CThostFtdcQryInstrumentMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯ +struct CThostFtdcQryInstrumentCommissionRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯԼȨ +struct CThostFtdcQryInstrumentTradingRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯ͹˾ +struct CThostFtdcQryBrokerField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ѯԱ +struct CThostFtdcQryTraderField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯûȨ +struct CThostFtdcQrySuperUserFunctionField +{ + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯûỰ +struct CThostFtdcQryUserSessionField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ͹˾Ա +struct CThostFtdcQryPartBrokerField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; +}; + +///ѯǰ״̬ +struct CThostFtdcQryFrontStatusField +{ + ///ǰñ + TThostFtdcFrontIDType FrontID; +}; + +///ѯ +struct CThostFtdcQryExchangeOrderField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯ +struct CThostFtdcQryOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯ +struct CThostFtdcQryExchangeOrderActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯû +struct CThostFtdcQrySuperUserField +{ + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ +struct CThostFtdcQryExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯƷ +struct CThostFtdcQryProductField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///Ʒ + TThostFtdcProductClassType ProductClass; +}; + +///ѯԼ +struct CThostFtdcQryInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ʒ + TThostFtdcInstrumentIDType ProductID; +}; + +///ѯ +struct CThostFtdcQryDepthMarketDataField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯ͹˾û +struct CThostFtdcQryBrokerUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ͹˾ûȨ +struct CThostFtdcQryBrokerUserFunctionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯԱ̻ +struct CThostFtdcQryTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯˮ +struct CThostFtdcQrySyncDepositField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ˮ + TThostFtdcDepositSeqNoType DepositSeqNo; +}; + +///ѯͶ߽ +struct CThostFtdcQrySettlementInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; +}; + +///ѯ֤ +struct CThostFtdcQryExchangeMarginRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯ֤ +struct CThostFtdcQryExchangeMarginRateAdjustField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯ +struct CThostFtdcQryExchangeRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Դ + TThostFtdcCurrencyIDType FromCurrencyID; + ///Ŀ + TThostFtdcCurrencyIDType ToCurrencyID; +}; + +///ѯѺˮ +struct CThostFtdcQrySyncFundMortgageField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ѻˮ + TThostFtdcDepositSeqNoType MortgageSeqNo; +}; + +///ѯ +struct CThostFtdcQryHisOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; +}; + +///ǰȨԼС֤ +struct CThostFtdcOptionInstrMiniMarginField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///λ֣ȨԼС֤ + TThostFtdcMoneyType MinMargin; + ///ȡֵʽ + TThostFtdcValueMethodType ValueMethod; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; +}; + +///ǰȨԼ֤ϵ +struct CThostFtdcOptionInstrMarginAdjustField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷͷ֤ϵ + TThostFtdcRatioType SShortMarginRatioByMoney; + ///Ͷͷ֤ϵ + TThostFtdcMoneyType SShortMarginRatioByVolume; + ///ֵͷ֤ϵ + TThostFtdcRatioType HShortMarginRatioByMoney; + ///ֵͷ֤ϵ + TThostFtdcMoneyType HShortMarginRatioByVolume; + ///ͷ֤ϵ + TThostFtdcRatioType AShortMarginRatioByMoney; + ///ͷ֤ϵ + TThostFtdcMoneyType AShortMarginRatioByVolume; + ///Ƿ潻ȡ + TThostFtdcBoolType IsRelative; +}; + +///ǰȨԼѵϸ +struct CThostFtdcOptionInstrCommRateField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcRatioType OpenRatioByMoney; + /// + TThostFtdcRatioType OpenRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseRatioByVolume; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByMoney; + ///ƽ + TThostFtdcRatioType CloseTodayRatioByVolume; + ///ִ + TThostFtdcRatioType StrikeRatioByMoney; + ///ִ + TThostFtdcRatioType StrikeRatioByVolume; +}; + +///Ȩ׳ɱ +struct CThostFtdcOptionInstrTradeCostField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType FixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType MiniMargin; + ///ȨԼȨ + TThostFtdcMoneyType Royalty; + ///ȨԼ֤𲻱䲿 + TThostFtdcMoneyType ExchFixedMargin; + ///ȨԼС֤ + TThostFtdcMoneyType ExchMiniMargin; +}; + +///Ȩ׳ɱѯ +struct CThostFtdcQryOptionInstrTradeCostField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ȨԼ + TThostFtdcPriceType InputPrice; + ///ļ۸,0 + TThostFtdcPriceType UnderlyingPrice; +}; + +///Ȩʲѯ +struct CThostFtdcQryOptionInstrCommRateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ָָֻ +struct CThostFtdcIndexPriceField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ָֻ̼ + TThostFtdcPriceType ClosePrice; +}; + +///ִ +struct CThostFtdcInputExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; +}; + +///ִ +struct CThostFtdcInputExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ִ +struct CThostFtdcExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerExecOrderSeq; +}; + +///ִ +struct CThostFtdcExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ִѯ +struct CThostFtdcQryExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ִϢ +struct CThostFtdcExchangeExecOrderField +{ + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///ִн + TThostFtdcExecResultType ExecResult; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; +}; + +///ִѯ +struct CThostFtdcQryExchangeExecOrderField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ִѯ +struct CThostFtdcQryExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ִ +struct CThostFtdcExchangeExecOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ִ + TThostFtdcOrderLocalIDType ExecOrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///ִ + TThostFtdcActionTypeType ActionType; +}; + +///ִѯ +struct CThostFtdcQryExchangeExecOrderActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ִ +struct CThostFtdcErrExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcVolumeType Volume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ִ + TThostFtdcActionTypeType ActionType; + ///ͷijֲַ + TThostFtdcPosiDirectionType PosiDirection; + ///ȨȨǷڻͷı + TThostFtdcExecOrderPositionFlagType ReservePositionFlag; + ///ȨȨɵͷǷԶƽ + TThostFtdcExecOrderCloseFlagType CloseFlag; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯִ +struct CThostFtdcQryErrExecOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ִ +struct CThostFtdcErrExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcOrderActionRefType ExecOrderActionRef; + ///ִ + TThostFtdcOrderRefType ExecOrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ִ + TThostFtdcExecOrderSysIDType ExecOrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯִ +struct CThostFtdcQryErrExecOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ͶȨԼȨ +struct CThostFtdcOptionInstrTradingRightField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDirectionType Direction; + ///Ȩ + TThostFtdcTradingRightType TradingRight; +}; + +///ѯȨԼȨ +struct CThostFtdcQryOptionInstrTradingRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; +}; + +///ѯ +struct CThostFtdcInputForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ +struct CThostFtdcForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ + TThostFtdcOrderRefType ForQuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ѯ۱ + TThostFtdcSequenceNoType BrokerForQutoSeq; +}; + +///ѯ۲ѯ +struct CThostFtdcQryForQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///ѯϢ +struct CThostFtdcExchangeForQuoteField +{ + ///ѯ۱ + TThostFtdcOrderLocalIDType ForQuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ѯ״̬ + TThostFtdcForQuoteStatusType ForQuoteStatus; +}; + +///ѯ۲ѯ +struct CThostFtdcQryExchangeForQuoteField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ı +struct CThostFtdcInputQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; +}; + +///뱨۲ +struct CThostFtdcInputQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +/// +struct CThostFtdcQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType QuoteRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾۱ + TThostFtdcSequenceNoType BrokerQuoteSeq; + /// + TThostFtdcOrderRefType AskOrderRef; + ///򱨵 + TThostFtdcOrderRefType BidOrderRef; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; +}; + +///۲ +struct CThostFtdcQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///۲ + TThostFtdcOrderActionRefType QuoteActionRef; + /// + TThostFtdcOrderRefType QuoteRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///۲ѯ +struct CThostFtdcQryQuoteField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + ///ʼʱ + TThostFtdcTimeType InsertTimeStart; + ///ʱ + TThostFtdcTimeType InsertTimeEnd; +}; + +///Ϣ +struct CThostFtdcExchangeQuoteField +{ + ///۸ + TThostFtdcPriceType AskPrice; + ///۸ + TThostFtdcPriceType BidPrice; + /// + TThostFtdcVolumeType AskVolume; + /// + TThostFtdcVolumeType BidVolume; + /// + TThostFtdcRequestIDType RequestID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///ƽ־ + TThostFtdcOffsetFlagType AskOffsetFlag; + ///ƽ־ + TThostFtdcOffsetFlagType BidOffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType AskHedgeFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType BidHedgeFlag; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///۱ + TThostFtdcOrderSysIDType QuoteSysID; + /// + TThostFtdcDateType InsertDate; + ///ʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///״̬ + TThostFtdcOrderStatusType QuoteStatus; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + /// + TThostFtdcOrderSysIDType AskOrderSysID; + ///򷽱 + TThostFtdcOrderSysIDType BidOrderSysID; + ///Ӧ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; +}; + +///۲ѯ +struct CThostFtdcQryExchangeQuoteField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///۲ѯ +struct CThostFtdcQryQuoteActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///۲ +struct CThostFtdcExchangeQuoteActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///۲ + TThostFtdcOrderSysIDType QuoteSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر۱ + TThostFtdcOrderLocalIDType QuoteLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; +}; + +///۲ѯ +struct CThostFtdcQryExchangeQuoteActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ȨԼdeltaֵ +struct CThostFtdcOptionInstrDeltaField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Deltaֵ + TThostFtdcRatioType Delta; +}; + +///̵ѯ +struct CThostFtdcForQuoteRspField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ѯ۱ + TThostFtdcOrderSysIDType ForQuoteSysID; + ///ѯʱ + TThostFtdcTimeType ForQuoteTime; + ///ҵ + TThostFtdcDateType ActionDay; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ǰȨԼִƫֵϸ +struct CThostFtdcStrikeOffsetField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִƫֵ + TThostFtdcMoneyType Offset; +}; + +///Ȩִƫֵѯ +struct CThostFtdcQryStrikeOffsetField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +/// +struct CThostFtdcInputBatchOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///û + TThostFtdcUserIDType UserID; +}; + +/// +struct CThostFtdcBatchOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; +}; + +/// +struct CThostFtdcExchangeBatchOrderActionField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; +}; + +///ѯ +struct CThostFtdcQryBatchOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ϺԼȫϵ +struct CThostFtdcCombInstrumentGuardField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcRatioType GuarantRatio; +}; + +///ϺԼȫϵѯ +struct CThostFtdcQryCombInstrumentGuardField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +/// +struct CThostFtdcInputCombActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +/// +struct CThostFtdcCombActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType CombActionRef; + ///û + TThostFtdcUserIDType UserID; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϱ + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///״̬ + TThostFtdcOrderActionStatusType ActionStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; +}; + +///ϲѯ +struct CThostFtdcQryCombActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///Ϣ +struct CThostFtdcExchangeCombActionField +{ + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcVolumeType Volume; + ///ָ + TThostFtdcCombDirectionType CombDirection; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + ///ϱ + TThostFtdcOrderLocalIDType ActionLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///״̬ + TThostFtdcOrderActionStatusType ActionStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcSequenceNoType SequenceNo; +}; + +///ϲѯ +struct CThostFtdcQryExchangeCombActionField +{ + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///Ʒۻ +struct CThostFtdcProductExchRateField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + ///۱ + TThostFtdcCurrencyIDType QuoteCurrencyID; + /// + TThostFtdcExchangeRateType ExchangeRate; +}; + +///Ʒۻʲѯ +struct CThostFtdcQryProductExchRateField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; +}; + +///ѯѯۼ۲ +struct CThostFtdcQryForQuoteParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯۼ۲ +struct CThostFtdcForQuoteParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///¼ + TThostFtdcPriceType LastPrice; + ///۲ + TThostFtdcPriceType PriceInterval; +}; + +///г +struct CThostFtdcMarketDataField +{ + /// + TThostFtdcDateType TradingDay; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///¼ + TThostFtdcPriceType LastPrice; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; + /// + TThostFtdcPriceType ClosePrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ʵ + TThostFtdcRatioType PreDelta; + ///ʵ + TThostFtdcRatioType CurrDelta; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +/// +struct CThostFtdcMarketDataBaseField +{ + /// + TThostFtdcDateType TradingDay; + ///ϴν + TThostFtdcPriceType PreSettlementPrice; + /// + TThostFtdcPriceType PreClosePrice; + ///ֲ + TThostFtdcLargeVolumeType PreOpenInterest; + ///ʵ + TThostFtdcRatioType PreDelta; +}; + +///龲̬ +struct CThostFtdcMarketDataStaticField +{ + /// + TThostFtdcPriceType OpenPrice; + ///߼ + TThostFtdcPriceType HighestPrice; + ///ͼ + TThostFtdcPriceType LowestPrice; + /// + TThostFtdcPriceType ClosePrice; + ///ͣ + TThostFtdcPriceType UpperLimitPrice; + ///ͣ + TThostFtdcPriceType LowerLimitPrice; + ///ν + TThostFtdcPriceType SettlementPrice; + ///ʵ + TThostFtdcRatioType CurrDelta; +}; + +///³ɽ +struct CThostFtdcMarketDataLastMatchField +{ + ///¼ + TThostFtdcPriceType LastPrice; + /// + TThostFtdcVolumeType Volume; + ///ɽ + TThostFtdcMoneyType Turnover; + ///ֲ + TThostFtdcLargeVolumeType OpenInterest; +}; + +///ż +struct CThostFtdcMarketDataBestPriceField +{ + ///һ + TThostFtdcPriceType BidPrice1; + ///һ + TThostFtdcVolumeType BidVolume1; + ///һ + TThostFtdcPriceType AskPrice1; + ///һ + TThostFtdcVolumeType AskVolume1; +}; + +/// +struct CThostFtdcMarketDataBid23Field +{ + ///۶ + TThostFtdcPriceType BidPrice2; + /// + TThostFtdcVolumeType BidVolume2; + /// + TThostFtdcPriceType BidPrice3; + /// + TThostFtdcVolumeType BidVolume3; +}; + +/// +struct CThostFtdcMarketDataAsk23Field +{ + ///۶ + TThostFtdcPriceType AskPrice2; + /// + TThostFtdcVolumeType AskVolume2; + /// + TThostFtdcPriceType AskPrice3; + /// + TThostFtdcVolumeType AskVolume3; +}; + +///ġ +struct CThostFtdcMarketDataBid45Field +{ + /// + TThostFtdcPriceType BidPrice4; + /// + TThostFtdcVolumeType BidVolume4; + /// + TThostFtdcPriceType BidPrice5; + /// + TThostFtdcVolumeType BidVolume5; +}; + +///ġ +struct CThostFtdcMarketDataAsk45Field +{ + /// + TThostFtdcPriceType AskPrice4; + /// + TThostFtdcVolumeType AskVolume4; + /// + TThostFtdcPriceType AskPrice5; + /// + TThostFtdcVolumeType AskVolume5; +}; + +///ʱ +struct CThostFtdcMarketDataUpdateTimeField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///޸ĺ + TThostFtdcMillisecType UpdateMillisec; + ///ҵ + TThostFtdcDateType ActionDay; +}; + +///齻 +struct CThostFtdcMarketDataExchangeField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ָĺԼ +struct CThostFtdcSpecificInstrumentField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///Լ״̬ +struct CThostFtdcInstrumentStatusField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + /// + TThostFtdcSettlementGroupIDType SettlementGroupID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Լ״̬ + TThostFtdcInstrumentStatusType InstrumentStatus; + ///׽׶α + TThostFtdcTradingSegmentSNType TradingSegmentSN; + ///뱾״̬ʱ + TThostFtdcTimeType EnterTime; + ///뱾״̬ԭ + TThostFtdcInstStatusEnterReasonType EnterReason; +}; + +///ѯԼ״̬ +struct CThostFtdcQryInstrumentStatusField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; +}; + +///Ͷ˻ +struct CThostFtdcInvestorAccountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ӯ㷨 +struct CThostFtdcPositionProfitAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///ע + TThostFtdcMemoType Memo; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///Աʽۿ +struct CThostFtdcDiscountField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʽۿ۱ + TThostFtdcRatioType Discount; +}; + +///ѯת +struct CThostFtdcQryTransferBankField +{ + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; +}; + +///ת +struct CThostFtdcTransferBankField +{ + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; + ///ǷԾ + TThostFtdcBoolType IsActive; +}; + +///ѯͶֲ߳ϸ +struct CThostFtdcQryInvestorPositionDetailField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///Ͷֲ߳ϸ +struct CThostFtdcInvestorPositionDetailField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + /// + TThostFtdcDateType OpenDate; + ///ɽ + TThostFtdcTradeIDType TradeID; + /// + TThostFtdcVolumeType Volume; + ///ּ + TThostFtdcPriceType OpenPrice; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ɽ + TThostFtdcTradeTypeType TradeType; + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///նƽӯ + TThostFtdcMoneyType CloseProfitByDate; + ///ʶԳƽӯ + TThostFtdcMoneyType CloseProfitByTrade; + ///նгֲӯ + TThostFtdcMoneyType PositionProfitByDate; + ///ʶԳֲӯ + TThostFtdcMoneyType PositionProfitByTrade; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + /// + TThostFtdcPriceType LastSettlementPrice; + /// + TThostFtdcPriceType SettlementPrice; + ///ƽ + TThostFtdcVolumeType CloseVolume; + ///ƽֽ + TThostFtdcMoneyType CloseAmount; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///鱨̻ +struct CThostFtdcMDTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///Ա״̬ + TThostFtdcTraderConnectStatusType TraderConnectStatus; + /// + TThostFtdcDateType ConnectRequestDate; + ///ʱ + TThostFtdcTimeType ConnectRequestTime; + ///ϴα + TThostFtdcDateType LastReportDate; + ///ϴαʱ + TThostFtdcTimeType LastReportTime; + /// + TThostFtdcDateType ConnectDate; + ///ʱ + TThostFtdcTimeType ConnectTime; + /// + TThostFtdcDateType StartDate; + ///ʱ + TThostFtdcTimeType StartTime; + /// + TThostFtdcDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ϯλɽ + TThostFtdcTradeIDType MaxTradeID; + ///ϯλ󱨵 + TThostFtdcReturnCodeType MaxOrderMessageReference; +}; + +///ѯ鱨̻ +struct CThostFtdcQryMDTraderOfferField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///Ա + TThostFtdcTraderIDType TraderID; +}; + +///ѯͻ֪ͨ +struct CThostFtdcQryNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///ͻ֪ͨ +struct CThostFtdcNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ϣ + TThostFtdcContentType Content; + ///͹˾֪ͨк + TThostFtdcSequenceLabelType SequenceLabel; +}; + +///ûȨ +struct CThostFtdcUserRightField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ͻȨ + TThostFtdcUserRightTypeType UserRightType; + ///Ƿֹ + TThostFtdcBoolType IsForbidden; +}; + +///ѯϢȷ +struct CThostFtdcQrySettlementInfoConfirmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///װؽϢ +struct CThostFtdcLoadSettlementInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///͹˾ʽ㷨 +struct CThostFtdcBrokerWithdrawAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ʽ㷨 + TThostFtdcAlgorithmType WithdrawAlgorithm; + ///ʽʹ + TThostFtdcRatioType UsingRatio; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType IncludeCloseProfit; + ///޲޳ɽͻǷܿ + TThostFtdcAllWithoutTradeType AllWithoutTrade; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///Ƿû¼ + TThostFtdcBoolType IsBrokerUserEvent; + ///ִ//sgit + TThostFtdcCurrencyIDType CurrencyID; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; + ///Ȩ㷨 + TThostFtdcBalanceAlgorithmType BalanceAlgorithm; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordUpdateV1Field +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; +}; + +///ʽ˻ +struct CThostFtdcTradingAccountPasswordUpdateField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ԭĿ + TThostFtdcPasswordType OldPassword; + ///µĿ + TThostFtdcPasswordType NewPassword; + ///ִ//sgit + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ѯϺԼ +struct CThostFtdcQryCombinationLegField +{ + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; +}; + +///ѯϺԼ +struct CThostFtdcQrySyncStatusField +{ + /// + TThostFtdcDateType TradingDay; +}; + +///Ͻ׺Լĵ +struct CThostFtdcCombinationLegField +{ + ///ϺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȺԼ + TThostFtdcInstrumentIDType LegInstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + /// + TThostFtdcImplyLevelType ImplyLevel; +}; + +///ͬ״̬ +struct CThostFtdcSyncStatusField +{ + /// + TThostFtdcDateType TradingDay; + ///ͬ״̬ + TThostFtdcDataSyncStatusType DataSyncStatus; +}; + +///ѯϵ +struct CThostFtdcQryLinkManField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ϵ +struct CThostFtdcLinkManField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵ + TThostFtdcPersonTypeType PersonType; + ///֤ + TThostFtdcIdCardTypeType IdentifiedCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + /// + TThostFtdcPartyNameType PersonName; + ///ϵ绰 + TThostFtdcTelephoneType Telephone; + ///ͨѶַ + TThostFtdcAddressType Address; + /// + TThostFtdcZipCodeType ZipCode; + ///ȼ + TThostFtdcPriorityType Priority; + /////sgit + TThostFtdcUOAZipCodeType UOAZipCode; + ///ȫ + TThostFtdcInvestorFullNameType PersonFullName; +}; + +///ѯ͹˾û¼ +struct CThostFtdcQryBrokerUserEventField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; +}; + +///ѯ͹˾û¼ +struct CThostFtdcBrokerUserEventField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///û¼ + TThostFtdcUserEventTypeType UserEventType; + ///û¼ + TThostFtdcSequenceNoType EventSequenceNo; + ///¼ + TThostFtdcDateType EventDate; + ///¼ʱ + TThostFtdcTimeType EventTime; + ///û¼Ϣ + TThostFtdcUserEventInfoType UserEventInfo; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯǩԼ +struct CThostFtdcQryContractBankField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; +}; + +///ѯǩԼӦ +struct CThostFtdcContractBankField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///д + TThostFtdcBankIDType BankID; + ///зĴ + TThostFtdcBankBrchIDType BankBrchID; + /// + TThostFtdcBankNameType BankName; +}; + +///Ͷϳֲϸ +struct CThostFtdcInvestorPositionCombineDetailField +{ + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcDateType OpenDate; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSettlementIDType SettlementID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϱ + TThostFtdcTradeIDType ComTradeID; + ///ϱ + TThostFtdcTradeIDType TradeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcDirectionType Direction; + ///ֲ + TThostFtdcVolumeType TotalAmt; + ///Ͷ֤߱ + TThostFtdcMoneyType Margin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///֤ + TThostFtdcRatioType MarginRateByMoney; + ///֤() + TThostFtdcRatioType MarginRateByVolume; + ///ȱ + TThostFtdcLegIDType LegID; + ///ȳ + TThostFtdcLegMultipleType LegMultiple; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; + ///ɽ + TThostFtdcTradeGroupIDType TradeGroupID; +}; + +///Ԥ +struct CThostFtdcParkedOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ԥ񱨵 + TThostFtdcParkedOrderIDType ParkedOrderID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ״̬ + TThostFtdcParkedOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; +}; + +///Ԥ񵥲 +struct CThostFtdcParkedOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + ///û + TThostFtdcUserIDType UserID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///Ԥ񳷵 + TThostFtdcParkedOrderActionIDType ParkedOrderActionID; + ///û + TThostFtdcUserTypeType UserType; + ///Ԥ񳷵״̬ + TThostFtdcParkedOrderStatusType Status; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯԤ +struct CThostFtdcQryParkedOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ѯԤ񳷵 +struct CThostFtdcQryParkedOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ɾԤ +struct CThostFtdcRemoveParkedOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񱨵 + TThostFtdcParkedOrderIDType ParkedOrderID; +}; + +///ɾԤ񳷵 +struct CThostFtdcRemoveParkedOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ԥ񳷵 + TThostFtdcParkedOrderActionIDType ParkedOrderActionID; +}; + +///͹˾ʽ㷨 +struct CThostFtdcInvestorWithdrawAlgorithmField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʽ + TThostFtdcRatioType UsingRatio; + ///ִ//sgit + TThostFtdcCurrencyIDType CurrencyID; + ///Ѻ + TThostFtdcRatioType FundMortgageRatio; +}; + +///ѯϳֲϸ +struct CThostFtdcQryInvestorPositionCombineDetailField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϳֲֺԼ + TThostFtdcInstrumentIDType CombInstrumentID; +}; + +///ɽ +struct CThostFtdcMarketDataAveragePriceField +{ + ///վ + TThostFtdcPriceType AveragePrice; +}; + +///УͶ +struct CThostFtdcVerifyInvestorPasswordField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcPasswordType Password; +}; + +///ûIP +struct CThostFtdcUserIPField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; + ///IPַ + TThostFtdcIPAddressType IPMask; + ///Macַ + TThostFtdcMacAddressType MacAddress; +}; + +///û¼֪ͨϢ +struct CThostFtdcTradingNoticeInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ʱ + TThostFtdcTimeType SendTime; + ///Ϣ + TThostFtdcContentType FieldContent; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///к + TThostFtdcSequenceNoType SequenceNo; +}; + +///û¼֪ͨ +struct CThostFtdcTradingNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷ߷Χ + TThostFtdcInvestorRangeType InvestorRange; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ϵк + TThostFtdcSequenceSeriesType SequenceSeries; + ///û + TThostFtdcUserIDType UserID; + ///ʱ + TThostFtdcTimeType SendTime; + ///к + TThostFtdcSequenceNoType SequenceNo; + ///Ϣ + TThostFtdcContentType FieldContent; +}; + +///ѯ¼֪ͨ +struct CThostFtdcQryTradingNoticeField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///ѯ󱨵 +struct CThostFtdcQryErrOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///󱨵 +struct CThostFtdcErrOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־//sgit + TThostFtdcBoolType IsSwapOrder; +}; + +///ѯ󱨵 +struct CThostFtdcErrorConditionalOrderField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcOrderRefType OrderRef; + ///û + TThostFtdcUserIDType UserID; + ///۸ + TThostFtdcOrderPriceTypeType OrderPriceType; + /// + TThostFtdcDirectionType Direction; + ///Ͽƽ־ + TThostFtdcCombOffsetFlagType CombOffsetFlag; + ///Ͷױ־ + TThostFtdcCombHedgeFlagType CombHedgeFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + /// + TThostFtdcVolumeType VolumeTotalOriginal; + ///Ч + TThostFtdcTimeConditionType TimeCondition; + ///GTD + TThostFtdcDateType GTDDate; + ///ɽ + TThostFtdcVolumeConditionType VolumeCondition; + ///Сɽ + TThostFtdcVolumeType MinVolume; + /// + TThostFtdcContingentConditionType ContingentCondition; + ///ֹ + TThostFtdcPriceType StopPrice; + ///ǿƽԭ + TThostFtdcForceCloseReasonType ForceCloseReason; + ///Զ־ + TThostFtdcBoolType IsAutoSuspend; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + /// + TThostFtdcRequestIDType RequestID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ԼڽĴ + TThostFtdcExchangeInstIDType ExchangeInstID; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ύ״̬ + TThostFtdcOrderSubmitStatusType OrderSubmitStatus; + ///ʾ + TThostFtdcSequenceNoType NotifySequence; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///Դ + TThostFtdcOrderSourceType OrderSource; + ///״̬ + TThostFtdcOrderStatusType OrderStatus; + /// + TThostFtdcOrderTypeType OrderType; + ///ɽ + TThostFtdcVolumeType VolumeTraded; + ///ʣ + TThostFtdcVolumeType VolumeTotal; + /// + TThostFtdcDateType InsertDate; + ///ίʱ + TThostFtdcTimeType InsertTime; + ///ʱ + TThostFtdcTimeType ActiveTime; + ///ʱ + TThostFtdcTimeType SuspendTime; + ///޸ʱ + TThostFtdcTimeType UpdateTime; + ///ʱ + TThostFtdcTimeType CancelTime; + ///޸ĽԱ + TThostFtdcTraderIDType ActiveTraderID; + ///Ա + TThostFtdcParticipantIDType ClearingPartID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + ///û˲ƷϢ + TThostFtdcProductInfoType UserProductInfo; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///ûǿ־ + TThostFtdcBoolType UserForceClose; + ///û + TThostFtdcUserIDType ActiveUserID; + ///͹˾ + TThostFtdcSequenceNoType BrokerOrderSeq; + ///ر + TThostFtdcOrderSysIDType RelativeOrderSysID; + ///֣ɽ + TThostFtdcVolumeType ZCETotalTradedVolume; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///־ + TThostFtdcBoolType IsSwapOrder; +}; + +///ѯ󱨵 +struct CThostFtdcQryErrOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///󱨵 +struct CThostFtdcErrOrderActionField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcOrderActionRefType OrderActionRef; + /// + TThostFtdcOrderRefType OrderRef; + /// + TThostFtdcRequestIDType RequestID; + ///ǰñ + TThostFtdcFrontIDType FrontID; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcOrderSysIDType OrderSysID; + ///־ + TThostFtdcActionFlagType ActionFlag; + ///۸ + TThostFtdcPriceType LimitPrice; + ///仯 + TThostFtdcVolumeType VolumeChange; + /// + TThostFtdcDateType ActionDate; + ///ʱ + TThostFtdcTimeType ActionTime; + ///Ա + TThostFtdcTraderIDType TraderID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ر + TThostFtdcOrderLocalIDType OrderLocalID; + ///ر + TThostFtdcOrderLocalIDType ActionLocalID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + ///ͻ + TThostFtdcClientIDType ClientID; + ///ҵԪ + TThostFtdcBusinessUnitType BusinessUnit; + ///״̬ + TThostFtdcOrderActionStatusType OrderActionStatus; + ///û + TThostFtdcUserIDType UserID; + ///״̬Ϣ + TThostFtdcErrorMsgType StatusMsg; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ״̬ +struct CThostFtdcQryExchangeSequenceField +{ + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///״̬ +struct CThostFtdcExchangeSequenceField +{ + /// + TThostFtdcExchangeIDType ExchangeID; + /// + TThostFtdcSequenceNoType SequenceNo; + ///Լ״̬ + TThostFtdcInstrumentStatusType MarketStatus; +}; + +///ݼ۸ѯ󱨵 +struct CThostFtdcQueryMaxOrderVolumeWithPriceField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///ƽ־ + TThostFtdcOffsetFlagType OffsetFlag; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType MaxVolume; + ///۸ + TThostFtdcPriceType Price; +}; + +///ѯ͹˾ײ +struct CThostFtdcQryBrokerTradingParamsField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///͹˾ײ +struct CThostFtdcBrokerTradingParamsField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///֤۸ + TThostFtdcMarginPriceTypeType MarginPriceType; + ///ӯ㷨 + TThostFtdcAlgorithmType Algorithm; + ///Ƿƽӯ + TThostFtdcIncludeCloseProfitType AvailIncludeCloseProfit; + ///ִ//sgit + TThostFtdcCurrencyIDType CurrencyID; + ///ȨȨ۸ + TThostFtdcOptionRoyaltyPriceTypeType OptionRoyaltyPriceType; +}; + +///ѯ͹˾㷨 +struct CThostFtdcQryBrokerTradingAlgosField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///͹˾㷨 +struct CThostFtdcBrokerTradingAlgosField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///ֲִ㷨 + TThostFtdcHandlePositionAlgoIDType HandlePositionAlgoID; + ///Ѱұ֤㷨 + TThostFtdcFindMarginRateAlgoIDType FindMarginRateAlgoID; + ///ʽ㷨 + TThostFtdcHandleTradingAccountAlgoIDType HandleTradingAccountAlgoID; +}; + +///ѯ͹˾ʽ +struct CThostFtdcQueryBrokerDepositField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///͹˾ʽ +struct CThostFtdcBrokerDepositField +{ + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ա + TThostFtdcParticipantIDType ParticipantID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///ϴν׼ + TThostFtdcMoneyType PreBalance; + ///ǰ֤ܶ + TThostFtdcMoneyType CurrMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + ///ڻ׼ + TThostFtdcMoneyType Balance; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcMoneyType Withdraw; + ///ʽ + TThostFtdcMoneyType Available; + ///׼ + TThostFtdcMoneyType Reserve; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; +}; + +///ѯ֤ϵͳ͹˾Կ +struct CThostFtdcQryCFMMCBrokerKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; +}; + +///֤ϵͳ͹˾Կ +struct CThostFtdcCFMMCBrokerKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Կ + TThostFtdcDateType CreateDate; + ///Կʱ + TThostFtdcTimeType CreateTime; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬Կ + TThostFtdcCFMMCKeyType CurrentKey; + ///̬Կ + TThostFtdcCFMMCKeyKindType KeyKind; +}; + +///֤ϵͳ͹˾ʽ˻Կ +struct CThostFtdcCFMMCTradingAccountKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬Կ + TThostFtdcCFMMCKeyType CurrentKey; +}; + +///ѯ֤ϵͳ͹˾ʽ˻Կ +struct CThostFtdcQryCFMMCTradingAccountKeyField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///û̬Ʋ +struct CThostFtdcBrokerUserOTPParamField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ṩ + TThostFtdcOTPVendorsIDType OTPVendorsID; + ///̬к + TThostFtdcSerialNumberType SerialNumber; + ///Կ + TThostFtdcAuthKeyType AuthKey; + ///Ưֵ + TThostFtdcLastDriftType LastDrift; + ///ɹֵ + TThostFtdcLastSuccessType LastSuccess; + ///̬ + TThostFtdcOTPTypeType OTPType; +}; + +///ֹͬû̬ +struct CThostFtdcManualSyncBrokerUserOTPField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///̬ + TThostFtdcOTPTypeType OTPType; + ///һ̬ + TThostFtdcPasswordType FirstOTP; + ///ڶ̬ + TThostFtdcPasswordType SecondOTP; +}; + +///Ͷģ +struct CThostFtdcCommRateModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; + ///ģ + TThostFtdcCommModelNameType CommModelName; +}; + +///ѯͶģ +struct CThostFtdcQryCommRateModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///ģ + TThostFtdcInvestorIDType CommModelID; +}; + +///Ͷ֤߱ģ +struct CThostFtdcMarginModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; + ///ģ + TThostFtdcCommModelNameType MarginModelName; +}; + +///ѯͶ֤߱ģ +struct CThostFtdcQryMarginModelField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///֤ģ + TThostFtdcInvestorIDType MarginModelID; +}; + +///ֵ۵Ϣ +struct CThostFtdcEWarrantOffsetField +{ + /// + TThostFtdcTradeDateType TradingDay; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + /// + TThostFtdcDirectionType Direction; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; + /// + TThostFtdcVolumeType Volume; +}; + +///ѯֵ۵Ϣ +struct CThostFtdcQryEWarrantOffsetField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; + +///ѯͶƷ/Ʒֱ֤ +struct CThostFtdcQryInvestorProductGroupMarginField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ͶƷ/Ʒֱ֤ +struct CThostFtdcInvestorProductGroupMarginField +{ + ///Ʒ/Ʒֱʾ + TThostFtdcInstrumentIDType ProductGroupID; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcDateType TradingDay; + /// + TThostFtdcSettlementIDType SettlementID; + ///ı֤ + TThostFtdcMoneyType FrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType LongFrozenMargin; + ///ͷı֤ + TThostFtdcMoneyType ShortFrozenMargin; + ///ռõı֤ + TThostFtdcMoneyType UseMargin; + ///ͷ֤ + TThostFtdcMoneyType LongUseMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortUseMargin; + ///֤ + TThostFtdcMoneyType ExchMargin; + ///ͷ֤ + TThostFtdcMoneyType LongExchMargin; + ///ͷ֤ + TThostFtdcMoneyType ShortExchMargin; + ///ƽӯ + TThostFtdcMoneyType CloseProfit; + /// + TThostFtdcMoneyType FrozenCommission; + /// + TThostFtdcMoneyType Commission; + ///ʽ + TThostFtdcMoneyType FrozenCash; + ///ʽ + TThostFtdcMoneyType CashIn; + ///ֲӯ + TThostFtdcMoneyType PositionProfit; + ///۵ܽ + TThostFtdcMoneyType OffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortOffsetAmount; + ///۵ܽ + TThostFtdcMoneyType ExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType LongExchOffsetAmount; + ///ͷ۵ܽ + TThostFtdcMoneyType ShortExchOffsetAmount; + ///Ͷױ־ + TThostFtdcHedgeFlagType HedgeFlag; +}; + +///ѯû +struct CThostFtdcQueryCFMMCTradingAccountTokenField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; +}; + +///û +struct CThostFtdcCFMMCTradingAccountTokenField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///͹˾ͳһ + TThostFtdcParticipantIDType ParticipantID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Կ + TThostFtdcSequenceNoType KeyID; + ///̬ + TThostFtdcCFMMCTokenType Token; +}; + +///ѯƷ +struct CThostFtdcQryProductGroupField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; +}; + +///ͶƷ/Ʒֱ֤Ʒ +struct CThostFtdcProductGroupField +{ + ///Ʒ + TThostFtdcInstrumentIDType ProductID; + /// + TThostFtdcExchangeIDType ExchangeID; + ///Ʒ + TThostFtdcInstrumentIDType ProductGroupID; +}; + +///תʿ +struct CThostFtdcReqOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; +}; + +///ת +struct CThostFtdcReqCancelAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; +}; + +///˻ +struct CThostFtdcReqChangeAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ת +struct CThostFtdcReqTransferField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; +}; + +///зʽתڻӦ +struct CThostFtdcRspTransferField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +/// +struct CThostFtdcReqRepealField +{ + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; +}; + +///Ӧ +struct CThostFtdcRspRepealField +{ + ///ʱ + TThostFtdcRepealTimeIntervalType RepealTimeInterval; + ///Ѿ + TThostFtdcRepealedTimesType RepealedTimes; + ///г־ + TThostFtdcBankRepealFlagType BankRepealFlag; + ///̳־ + TThostFtdcBrokerRepealFlagType BrokerRepealFlag; + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateRepealSerial; + ///ˮ + TThostFtdcBankSerialType BankRepealSerial; + ///ڻˮ + TThostFtdcFutureSerialType FutureRepealSerial; + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ڻȡ + TThostFtdcTradeAmountType FutureFetchAmount; + ///֧־ + TThostFtdcFeePayFlagType FeePayFlag; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///ͷշϢ + TThostFtdcAddInfoType Message; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///ת˽״̬ + TThostFtdcTransferStatusType TransferStatus; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ˻Ϣ +struct CThostFtdcReqQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ѯ˻ϢӦ +struct CThostFtdcRspQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; +}; + +///ǩǩ +struct CThostFtdcFutureSignIOField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ǩӦ +struct CThostFtdcRspFutureSignInField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; +}; + +///ǩ +struct CThostFtdcReqFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///ǩӦ +struct CThostFtdcRspFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯָˮŵĽ׽ +struct CThostFtdcReqQueryTradeResultBySerialField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ˮ + TThostFtdcSerialType Reference; + ///ˮŷߵĻ + TThostFtdcInstitutionTypeType RefrenceIssureType; + ///ˮŷ߻ + TThostFtdcOrganCodeType RefrenceIssure; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ѯָˮŵĽ׽Ӧ +struct CThostFtdcRspQueryTradeResultBySerialField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///ˮ + TThostFtdcSerialType Reference; + ///ˮŷߵĻ + TThostFtdcInstitutionTypeType RefrenceIssureType; + ///ˮŷ߻ + TThostFtdcOrganCodeType RefrenceIssure; + ///ԭʼش + TThostFtdcReturnCodeType OriginReturnCode; + ///ԭʼ + TThostFtdcDescrInfoForReturnCodeType OriginDescrInfoForReturnCode; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///תʽ + TThostFtdcTradeAmountType TradeAmount; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ļ +struct CThostFtdcReqDayEndFileReadyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ļҵ + TThostFtdcFileBusinessCodeType FileBusinessCode; + ///ժҪ + TThostFtdcDigestType Digest; +}; + +///ؽ +struct CThostFtdcReturnResultField +{ + ///ش + TThostFtdcReturnCodeType ReturnCode; + /// + TThostFtdcDescrInfoForReturnCodeType DescrInfoForReturnCode; +}; + +///֤ڻʽ +struct CThostFtdcVerifyFuturePasswordField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///װ + TThostFtdcInstallIDType InstallID; + ///ID + TThostFtdcTIDType TID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///֤ͻϢ +struct CThostFtdcVerifyCustInfoField +{ + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; +}; + +///֤ڻʽͿͻϢ +struct CThostFtdcVerifyFuturePasswordAndCustInfoField +{ + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///֤ڻʽͿͻϢ +struct CThostFtdcDepositResultInformField +{ + ///ˮţˮΪڱ̷صˮ + TThostFtdcDepositSeqNoType DepositSeqNo; + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + /// + TThostFtdcMoneyType Deposit; + /// + TThostFtdcRequestIDType RequestID; + ///ش + TThostFtdcReturnCodeType ReturnCode; + /// + TThostFtdcDescrInfoForReturnCodeType DescrInfoForReturnCode; +}; + +///׺ڱ̷Կͬ +struct CThostFtdcReqSyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; +}; + +///׺ڱ̷ԿͬӦ +struct CThostFtdcRspSyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯ˻Ϣ֪ͨ +struct CThostFtdcNotifyQueryAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + ///пý + TThostFtdcTradeAmountType BankUseAmount; + ///пȡ + TThostFtdcTradeAmountType BankFetchAmount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ת˽ˮ +struct CThostFtdcTransferSerialField +{ + ///ƽ̨ˮ + TThostFtdcPlateSerialType PlateSerial; + ///׷ + TThostFtdcTradeDateType TradeDate; + /// + TThostFtdcDateType TradingDay; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///״ + TThostFtdcTradeCodeType TradeCode; + ///Ự + TThostFtdcSessionIDType SessionID; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///ڻ˾ʺ + TThostFtdcFutureAccTypeType FutureAccType; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///Ͷߴ + TThostFtdcInvestorIDType InvestorID; + ///ڻ˾ˮ + TThostFtdcFutureSerialType FutureSerial; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///׽ + TThostFtdcTradeAmountType TradeAmount; + ///Ӧտͻ + TThostFtdcCustFeeType CustFee; + ///Ӧڻ˾ + TThostFtdcFutureFeeType BrokerFee; + ///Ч־ + TThostFtdcAvailabilityFlagType AvailabilityFlag; + ///Ա + TThostFtdcOperatorCodeType OperatorCode; + ///ʺ + TThostFtdcBankAccountType BankNewAccount; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯתˮ +struct CThostFtdcQryTransferSerialField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ǩ֪ͨ +struct CThostFtdcNotifyFutureSignInField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; + ///PINԿ + TThostFtdcPasswordKeyType PinKey; + ///MACԿ + TThostFtdcPasswordKeyType MacKey; +}; + +///ǩ֪ͨ +struct CThostFtdcNotifyFutureSignOutField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///ժҪ + TThostFtdcDigestType Digest; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///׺ڱ̷Կ֪ͬͨ +struct CThostFtdcNotifySyncKeyField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///װ + TThostFtdcInstallIDType InstallID; + ///ûʶ + TThostFtdcUserIDType UserID; + ///׺ĸڱ̵Ϣ + TThostFtdcAddInfoType Message; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///׹Ա + TThostFtdcOperNoType OperNo; + /// + TThostFtdcRequestIDType RequestID; + ///ID + TThostFtdcTIDType TID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ѯǩԼϵ +struct CThostFtdcQryAccountregisterField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///б + TThostFtdcBankIDType BankID; + ///з֧//sgit + TThostFtdcBankBrchIDType BankBranchID; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ͻϢ +struct CThostFtdcAccountregisterField +{ + /// + TThostFtdcTradeDateType TradeDay; + ///б + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///ʺ + TThostFtdcBankAccountType BankAccount; + ///ڻ˾ + TThostFtdcBrokerIDType BrokerID; + ///ڻ˾֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + /// + TThostFtdcOpenOrDestroyType OpenOrDestroy; + ///ǩԼ + TThostFtdcTradeDateType RegDate; + ///Լ + TThostFtdcTradeDateType OutDate; + ///ID + TThostFtdcTIDType TID; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; +}; + +///ڿϢ +struct CThostFtdcOpenAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///Ϣ +struct CThostFtdcCancelAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///㳮־ + TThostFtdcCashExchangeCodeType CashExchangeCode; + ///ժҪ + TThostFtdcDigestType Digest; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///־ + TThostFtdcDeviceIDType DeviceID; + ///ڻλʺ + TThostFtdcBankAccTypeType BankSecuAccType; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///ڻλʺ + TThostFtdcBankAccountType BankSecuAcc; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///׹Ա + TThostFtdcOperNoType OperNo; + ///ID + TThostFtdcTIDType TID; + ///ûʶ + TThostFtdcUserIDType UserID; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ڱ˺Ϣ +struct CThostFtdcChangeAccountField +{ + ///ҵ + TThostFtdcTradeCodeType TradeCode; + ///д + TThostFtdcBankIDType BankID; + ///з֧ + TThostFtdcBankBrchIDType BankBranchID; + ///̴ + TThostFtdcBrokerIDType BrokerID; + ///̷֧ + TThostFtdcFutureBranchIDType BrokerBranchID; + /// + TThostFtdcTradeDateType TradeDate; + ///ʱ + TThostFtdcTradeTimeType TradeTime; + ///ˮ + TThostFtdcBankSerialType BankSerial; + ///ϵͳ + TThostFtdcTradeDateType TradingDay; + ///ƽ̨Ϣˮ + TThostFtdcSerialType PlateSerial; + ///Ƭ־ + TThostFtdcLastFragmentType LastFragment; + ///Ự + TThostFtdcSessionIDType SessionID; + ///ͻ + TThostFtdcIndividualNameType CustomerName; + ///֤ + TThostFtdcIdCardTypeType IdCardType; + ///֤ + TThostFtdcIdentifiedCardNoType IdentifiedCardNo; + ///Ա + TThostFtdcGenderType Gender; + ///Ҵ + TThostFtdcCountryCodeType CountryCode; + ///ͻ + TThostFtdcCustTypeType CustType; + ///ַ + TThostFtdcAddressType Address; + ///ʱ + TThostFtdcZipCodeType ZipCode; + ///绰 + TThostFtdcTelephoneType Telephone; + ///ֻ + TThostFtdcMobilePhoneType MobilePhone; + /// + TThostFtdcFaxType Fax; + ///ʼ + TThostFtdcEMailType EMail; + ///ʽ˻״̬ + TThostFtdcMoneyAccountStatusType MoneyAccountStatus; + ///ʺ + TThostFtdcBankAccountType BankAccount; + /// + TThostFtdcPasswordType BankPassWord; + ///ʺ + TThostFtdcBankAccountType NewBankAccount; + /// + TThostFtdcPasswordType NewBankPassWord; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///ڻ + TThostFtdcPasswordType Password; + ///ʺ + TThostFtdcBankAccTypeType BankAccType; + ///װ + TThostFtdcInstallIDType InstallID; + ///֤ͻ֤־ + TThostFtdcYesNoIndicatorType VerifyCertNoFlag; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; + ///ڻ˾б + TThostFtdcBankCodingForFutureType BrokerIDByBank; + ///־ + TThostFtdcPwdFlagType BankPwdFlag; + ///ڻʽ˶Ա־ + TThostFtdcPwdFlagType SecuPwdFlag; + ///ID + TThostFtdcTIDType TID; + ///ժҪ + TThostFtdcDigestType Digest; + /// + TThostFtdcErrorIDType ErrorID; + ///Ϣ + TThostFtdcErrorMsgType ErrorMsg; +}; + +///ԱȨ +struct CThostFtdcSecAgentACIDMapField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcCurrencyIDType CurrencyID; + ///нʽʺ + TThostFtdcAccountIDType BrokerSecAgentID; +}; + +///ԱȨ޲ѯ +struct CThostFtdcQrySecAgentACIDMapField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///ʽ˻ + TThostFtdcAccountIDType AccountID; + /// + TThostFtdcCurrencyIDType CurrencyID; +}; + +///ֱĽȨ +struct CThostFtdcUserRightsAssignField +{ + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; +}; + +///ù˾ǷڱʾĽȨ +struct CThostFtdcBrokerUserRightAssignField +{ + ///ӦõԪ + TThostFtdcBrokerIDType BrokerID; + ///Ĵ + TThostFtdcDRIdentityIDType DRIdentityID; + ///ܷ + TThostFtdcBoolType Tradeable; +}; + +///ֱת +struct CThostFtdcDRTransferField +{ + ///ԭĴ + TThostFtdcDRIdentityIDType OrigDRIdentityID; + ///Ŀ꽻Ĵ + TThostFtdcDRIdentityIDType DestDRIdentityID; + ///ԭӦõԪ + TThostFtdcBrokerIDType OrigBrokerID; + ///ĿõԪ + TThostFtdcBrokerIDType DestBrokerID; +}; + +///FensûϢ +struct CThostFtdcFensUserInfoField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///¼ģʽ + TThostFtdcLoginModeType LoginMode; +}; + +///ǰ +struct CThostFtdcCurrTransferIdentityField +{ + ///Ĵ + TThostFtdcDRIdentityIDType IdentityID; +}; + +///ֹ¼û +struct CThostFtdcLoginForbiddenUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; + ///IPַ + TThostFtdcIPAddressType IPAddress; +}; + +///ѯֹ¼û +struct CThostFtdcQryLoginForbiddenUserField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///û + TThostFtdcUserIDType UserID; +}; + +///UDP鲥Ϣ +struct CThostFtdcMulticastGroupInfoField +{ + ///鲥IPַ + TThostFtdcIPAddressType GroupIP; + ///鲥IP˿ + TThostFtdcIPPortType GroupPort; + ///Դַ + TThostFtdcIPAddressType SourceIP; +}; + +///ʽ˻׼ +struct CThostFtdcTradingAccountReserveField +{ + ///͹˾ + TThostFtdcBrokerIDType BrokerID; + ///Ͷʺ + TThostFtdcAccountIDType AccountID; + ///׼ + TThostFtdcMoneyType Reserve; + ///ִ + TThostFtdcCurrencyIDType CurrencyID; +}; + +///Լλѯ +struct CThostMBLQuotReq +{ + ///ʼԼ + TThostFtdcInstrumentIDType StartInstrumentID; + ///Լ + TThostFtdcInstrumentIDType EndInstrumentID; + ///־ + TThostFtdcDirectionType Direction; +}; + +///Լλ +struct CThostMBLQuotData +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; + ///־ + TThostFtdcDirectionType Direction; + ///۸ + TThostFtdcPriceType Price; + /// + TThostFtdcVolumeType Volume; +}; + +///ĺԼ +struct CThostSubQuotField +{ + ///Լ + TThostFtdcInstrumentIDType InstrumentID; +}; +/// +struct CThostDeferDeliveryQuot +{ + TThostFtdcInstrumentIDType InstrumentID; //Լ + TThostFtdcVolumeType AskVolume; // + TThostFtdcVolumeType BidVolume; // + TThostFtdcVolumeType MidAskVolume; // + TThostFtdcVolumeType MidBidVolume; // +}; + + +}; + +#endif diff --git "a/include/Sgit/doc/FS\346\216\245\345\217\243\344\275\277\347\224\250\350\257\264\346\230\216_4.2\347\211\210.doc" "b/include/Sgit/doc/FS\346\216\245\345\217\243\344\275\277\347\224\250\350\257\264\346\230\216_4.2\347\211\210.doc" new file mode 100644 index 0000000..f50c82a Binary files /dev/null and "b/include/Sgit/doc/FS\346\216\245\345\217\243\344\275\277\347\224\250\350\257\264\346\230\216_4.2\347\211\210.doc" differ diff --git a/include/Sgit/doc/SgitApi4.2Q&A.pdf b/include/Sgit/doc/SgitApi4.2Q&A.pdf new file mode 100644 index 0000000..a2fe37f Binary files /dev/null and b/include/Sgit/doc/SgitApi4.2Q&A.pdf differ diff --git "a/include/Sgit/doc/SgitApi\345\217\230\346\233\264(4.1-4.2).doc" "b/include/Sgit/doc/SgitApi\345\217\230\346\233\264(4.1-4.2).doc" new file mode 100644 index 0000000..3709de7 Binary files /dev/null and "b/include/Sgit/doc/SgitApi\345\217\230\346\233\264(4.1-4.2).doc" differ diff --git "a/include/Sgit/doc/\344\277\256\346\255\243\345\206\205\345\256\271.txt" "b/include/Sgit/doc/\344\277\256\346\255\243\345\206\205\345\256\271.txt" new file mode 100644 index 0000000..1d6736a --- /dev/null +++ "b/include/Sgit/doc/\344\277\256\346\255\243\345\206\205\345\256\271.txt" @@ -0,0 +1,62 @@ +20160629------------------------------ +1,ÿͻϢѯReqQryInvestorҪ̨60622֮İ汾֧ +2,ֲϸѯ,ֺͽ +3,Ϣȷϲѯ,Ӧ,ԶΪȷ. +4,,μAPIErrorCode.hAPIErrorCode.xml +5,ReqQryInstrumentMarginRate() + OnRspQryInstrumentMarginRate() + ReqQryInstrumentCommissionRate() + OnRspQryInstrumentCommissionRate() + ԭΪѯ֮󷵻ģ,ַغԼľʺͱ֤ + ע:ʱ,ʽ˺ű +6,ӺԼ鶩Ӧ,ͳӦ. +7,ֲֲѯ,ֲַ.. + +20160630------------------------------------ +sgitTradeapi_4.2.12.60630 +1,OnRspOrderInsert,ֶExchangID, + ԭΪ<ַ궨,ƽ"7">,޸Ϊ<ַ,ƽ"SGE"> +2,ͷʽRestart/Quick/ReSume, + ע:̨pg_4.2.15.60630Լ֮İ汾,֮ǰİ汾ֻRestartģʽ. + +20160712------------------------------------ +sgitTradeapi_4.2.13.60712 +1,OnRspQryInstrument()ԼϢCThostFtdcInstrumentField::ProductID +ֻapi + +20160715------------------------------------ +sgitTradeapi_4.2.14.60715 +ֲϸ,ExchangMarginͳһΪ֤,PreSettlePrice. + +20160718------------------------------------ +SgitQuotApi_4.2.4.60718 +1,api־ļƸΪQuotAPIPackage.txt +2,OnRtnDepthMarketData:: CThostFtdcDepthMarketDataField:: UpdateMillisec. +ԭ : Ϊɽ仯,Ϊ0 + : нЧ,Ϊ0 +ע:ӿsgitQuotApi_4.2.4.60718 ,̨qg4.2.6_20160718֮汾Ч + +20160726------------------------------------ +sgitApi4.2.15.60726 +1,Լѯ +2,֤ѯ +3,ϵͳѯ +ע:׺̨pg4.2.19-20160726֮汾Ч +4,Ӻ + virtual int InitLog(TThostFtdcBoolType bLog=TRUE) = 0; + virtual int IsReviveNtyCapital(TThostFtdcBoolType bRecive=TRUE) = 0; +20160817-------------------------------------- +sgitApi4.2.17.60817 +1,ֲϸ. + +20160907-------------------------------------- +sgitquotapi4.2.7.60907 +1,ӽ. +SgitFtdcTraderApi.h +virtual int InitLog(TThostFtdcBoolType bLog=TRUE) = 0; +޸Ϊ +virtual int InitLog(TThostFtdcBoolType bLog=TRUE) = 0; + +virtual int IsReviveNtyCapital(TThostFtdcBoolType bRecive=1) = 0; +޸Ϊ +virtual int IsReviveNtyCapital(TThostFtdcBoolType bRecive=1) = 0; diff --git a/include/Sgit/linux64/libsgitquotapi.so.64 b/include/Sgit/linux64/libsgitquotapi.so.64 new file mode 100644 index 0000000..91dd363 Binary files /dev/null and b/include/Sgit/linux64/libsgitquotapi.so.64 differ diff --git a/include/Sgit/linux64/libsgittradeapi.so.64 b/include/Sgit/linux64/libsgittradeapi.so.64 new file mode 100644 index 0000000..8a5fdac Binary files /dev/null and b/include/Sgit/linux64/libsgittradeapi.so.64 differ diff --git a/include/Sgit/win32/sgitquotapi.dll b/include/Sgit/win32/sgitquotapi.dll new file mode 100644 index 0000000..63a0e93 Binary files /dev/null and b/include/Sgit/win32/sgitquotapi.dll differ diff --git a/include/Sgit/win32/sgitquotapi.lib b/include/Sgit/win32/sgitquotapi.lib new file mode 100644 index 0000000..e21aee8 Binary files /dev/null and b/include/Sgit/win32/sgitquotapi.lib differ diff --git a/include/Sgit/win32/sgittradeapi.dll b/include/Sgit/win32/sgittradeapi.dll new file mode 100644 index 0000000..f4daef8 Binary files /dev/null and b/include/Sgit/win32/sgittradeapi.dll differ diff --git a/include/Sgit/win32/sgittradeapi.lib b/include/Sgit/win32/sgittradeapi.lib new file mode 100644 index 0000000..1ce5887 Binary files /dev/null and b/include/Sgit/win32/sgittradeapi.lib differ diff --git a/include/Tdx/Log.h b/include/Tdx/Log.h new file mode 100644 index 0000000..3e76afb --- /dev/null +++ b/include/Tdx/Log.h @@ -0,0 +1,155 @@ +#pragma once + +#include "stdafx.h" +/** +* 用于输出log文件的类. +*/ + + +#ifndef LOG_H +#define LOG_H + + +//log文件路径 +#define LOG_FILE_NAME "log.txt" + +//启用开关 +#define LOG_ENABLE + +#include +#include +#include +#include + +//#include "Toolkit.h" + +using namespace std; + +class CLog +{ +public: + static void GetLogFilePath(CHAR* szPath) + { + GetModuleFileNameA(NULL, szPath, MAX_PATH); + ZeroMemory(strrchr(szPath, '\\'), strlen(strrchr(szPath, '\\'))*sizeof(CHAR)); + strcat(szPath, "\\"); + strcat(szPath, LOG_FILE_NAME); + + //char szPath[MAX_PATH] = { 0 }; + //char drive[_MAX_DRIVE]; + //char dir[_MAX_DIR]; + //_splitpath(szPath, drive, dir, NULL, NULL); + + //_makepath(szPath, drive, dir, LOG_FILE_NAME, NULL); + } + + static void Reset() + { + CHAR szPath[MAX_PATH] = { 0 }; + GetLogFilePath(szPath); + + ofstream fout(szPath, ios::trunc); + fout.close(); + } + + //输出一个内容,可以是字符串(ascii)、整数、浮点数、布尔、枚举 + //格式为:[2011-11-11 11:11:11] aaaaaaa并换行 + template + static void WriteLog(T x) + { + CHAR szPath[MAX_PATH] = { 0 }; + GetLogFilePath(szPath); + + // 配合一下,输出到DOS中 + cout << GetSystemTime() << x << endl; + + ofstream fout(szPath, ios::app); + fout.seekp(ios::end); + //fout << GetSystemTime() << x << endl; + + // 写文件时使用密文 + //char buf[1024] = { 0 }; + //endecrypt((char*)x, buf, 1); + //fout << buf << endl; + + fout << x << endl; + + fout.close(); + } + + //输出2个内容,以等号连接。一般用于前面是一个变量的描述字符串,后面接这个变量的值 + template + static void WriteLog2(T1 x1, T2 x2) + { + CHAR szPath[MAX_PATH] = { 0 }; + GetLogFilePath(szPath); + ofstream fout(szPath, ios::app); + fout.seekp(ios::end); + fout << GetSystemTime() << x1 << " = " << x2 << endl; + fout.close(); + } + + //输出一行当前函数开始的标志,宏传入__FUNCTION__ + template + static void WriteFuncBegin(T x) + { + CHAR szPath[MAX_PATH] = { 0 }; + GetLogFilePath(szPath); + ofstream fout(szPath, ios::app); + fout.seekp(ios::end); + fout << GetSystemTime() << " --------------------" << x << " Begin--------------------" << endl; + fout.close(); + } + + //输出一行当前函数结束的标志,宏传入__FUNCTION__ + template + static void WriteFuncEnd(T x) + { + CHAR szPath[MAX_PATH] = { 0 }; + GetLogFilePath(szPath); + ofstream fout(szPath, ios::app); + fout.seekp(ios::end); + fout << GetSystemTime() << "--------------------" << x << " End --------------------" << endl; + fout.close(); + } + + +private: + //获取本地时间,格式如"[2011-11-11 11:11:11] "; + static string GetSystemTime() + { + time_t tNowTime; + time(&tNowTime); + tm* tLocalTime = localtime(&tNowTime); + char szTime[30] = { '\0' }; + strftime(szTime, 30, "[%Y-%m-%d %H:%M:%S] ", tLocalTime); + string strTime = szTime; + return strTime; + } + +}; + +#ifdef LOG_ENABLE + +#define LOG_RESET CLog::Reset(); //括号内可以是字符串(ascii)、整数、浮点数、bool等 + +//用下面这些宏来使用本文件 +#define LOG(x) CLog::WriteLog(x); //括号内可以是字符串(ascii)、整数、浮点数、bool等 +#define LOG2(x1,x2) CLog::WriteLog2(x1,x2); +#define LOG_FUNC LOG(__FUNCTION__) //输出当前所在函数名 +#define LOG_LINE LOG(__LINE__) //输出当前行号 +#define LOG_FUNC_BEGIN CLog::WriteFuncBegin(__FUNCTION__); //形式如:[时间]"------------FuncName Begin------------" +#define LOG_FUNC_END CLog::WriteFuncEnd(__FUNCTION__); //形式如:[时间]"------------FuncName End------------" + +#else + +#define LOG(x) +#define LOG2(x1,x2) +#define LOG_FUNC +#define LOG_LINE +#define LOG_FUNC_BEGIN +#define LOG_FUNC_END + +#endif + +#endif \ No newline at end of file diff --git a/include/Tdx/TdxApi.h b/include/Tdx/TdxApi.h index b12d158..44d4e62 100644 --- a/include/Tdx/TdxApi.h +++ b/include/Tdx/TdxApi.h @@ -17,48 +17,50 @@ #include "tdx_request.h" #include "tdx_field.h" + +class CTdxApi; + +class CTdxSpi +{ +public: + virtual void OnResponse(CTdxApi* pApi, RequestResponse_STRUCT* pRespone){}; +}; + +////////////////////////////////////////////////////////////////////////// +//支持同券商多账号登录、下单、撤单 class TDXAPI_API CTdxApi { public: // 创建API - // TdxPath*:通达信安装目录,需以"\\"结束。 - static CTdxApi* CreateApi(const char* TdxPath); + static CTdxApi* CreateApi(); virtual void Release() = 0; public: - virtual void LoadScript(const char* LuaFileOrString, bool bFileOrString, bool bEncrypted) = 0; + virtual void RegisterSpi(CTdxSpi *pSpi) = 0; + virtual void LoadScript(const char* LuaFileOrString, bool bFileOrString, bool bEncrypted) = 0; + // TdxPath*:通达信安装目录,需以"\\"结束。 virtual void Init(const char* TdxPath, Error_STRUCT** ppErr) = 0; virtual void Exit() = 0; - virtual void* Login(const char* szAccount, const char* szPassword, const char* szCode, char*** pppResults, Error_STRUCT** ppErr) = 0; + virtual void* Login(const char* szAccount, const char* szPassword, const char* szCode, Error_STRUCT** ppErr) = 0; virtual void Logout(void* client) = 0; public: // 弹出通达信内部的版本对话框 virtual void Version() = 0; - // 下单时必须指定股东代码,所以需要先查询股东列表才能实现下单。下单时会进行授权查询,失败时不会发单出去 - virtual int SendMultiOrders(Order_STRUCT* pOrders, int count, FieldInfo_STRUCT*** pppFieldInfos, char*** pppResults, Error_STRUCT*** pppErrs) = 0; - virtual int SendMultiOrders(Order_STRUCT** ppOrders, int count, FieldInfo_STRUCT*** pppFieldInfos, char*** pppResults, Error_STRUCT*** pppErrs) = 0; + virtual int GetTableHeader(void* client, int request, FieldInfo_STRUCT*** pppResults) = 0; + virtual bool IsLogined(void* client) = 0; - virtual int CancelMultiOrders(Order_STRUCT* pOrders, int count, FieldInfo_STRUCT*** pppFieldInfos, char*** pppResults, Error_STRUCT*** pppErrs) = 0; - virtual int CancelMultiOrders(Order_STRUCT** ppOrders, int count, FieldInfo_STRUCT*** pppFieldInfos, char*** pppResults, Error_STRUCT*** pppErrs) = 0; - // 发送查询请求 - // 有些请求是当日数据,后面的起始和结束日期自动忽略 - // 对于历史数据,需要查询的区别,格式“yyyyMMdd”,客户端上有60天或90天的时间限制,这里没有,但如果数据太多,间隔设成一周或一月 - // 订阅行情时只需要最后的股票代码 - virtual void* ReqQueryData(int requestType, FieldInfo_STRUCT*** pppFieldInfos, char*** pppResults, Error_STRUCT** ppErr, char * szKSRQ = "", char* szZZRQ = "", char* szZQDM = "") = 0; + virtual int SendRequest(RequestResponse_STRUCT* pRequest) = 0; -public: - // 设置会话 - virtual void SetClient(void* client) = 0; - - virtual void* GetClient() = 0; - // 设置资金账号 - virtual void SetAccount(const char* szAccount) = 0; - // 得到资金账号 - virtual const char* GetAccount() = 0; + virtual RequestResponse_STRUCT* MakeQueryData(ReqQueryData_STRUCT* query) = 0; + + virtual RequestResponse_STRUCT* MakeOrder(Order_STRUCT* pOrder) = 0; + // 撤单 + virtual RequestResponse_STRUCT* MakeCancelOrder(CancelOrder_STRUCT* pCancelOrder) = 0; + virtual RequestResponse_STRUCT* MakeCancelOrder(WTLB_STRUCT* pOrder) = 0; protected: CTdxApi(); diff --git a/include/Tdx/easyhook/EasyHook32.lib b/include/Tdx/easyhook/EasyHook32.lib new file mode 100644 index 0000000..4aabc46 Binary files /dev/null and b/include/Tdx/easyhook/EasyHook32.lib differ diff --git a/include/Tdx/easyhook/easyhook.h b/include/Tdx/easyhook/easyhook.h new file mode 100644 index 0000000..657e411 --- /dev/null +++ b/include/Tdx/easyhook/easyhook.h @@ -0,0 +1,442 @@ +/* + EasyHook - The reinvention of Windows API hooking + + Copyright (C) 2009 Christoph Husse + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + Please visit http://www.codeplex.com/easyhook for more information + about the project and latest updates. +*/ + +#ifndef _EASYHOOK_H_ +#define _EASYHOOK_H_ + +#ifdef DRIVER + + #include + #include + + typedef int BOOL; + typedef void* HMODULE; + +#else + + #define NTDDI_VERSION NTDDI_WIN2KSP4 + #define _WIN32_WINNT 0x500 + #define _WIN32_IE_ _WIN32_IE_WIN2KSP4 + + #include + #include + #include + +#endif + + +#ifdef __cplusplus +extern "C"{ +#endif + +#ifdef EASYHOOK_EXPORTS + #define EASYHOOK_API __declspec(dllexport) __stdcall + #define DRIVER_SHARED_API(type, decl) EXTERN_C type EASYHOOK_API decl +#else + #ifndef DRIVER + #define EASYHOOK_API __declspec(dllimport) __stdcall + #define DRIVER_SHARED_API(type, decl) EXTERN_C type EASYHOOK_API decl + #else + #define EASYHOOK_API __stdcall + #define DRIVER_SHARED_API(type, decl) typedef type EASYHOOK_API PROC_##decl; EXTERN_C type EASYHOOK_API decl + #endif +#endif + +/* + This is the typical sign that a defined method is exported... + + Methods marked with this attribute need special attention + during parameter validation and documentation. +*/ +#define EASYHOOK_NT_EXPORT EXTERN_C NTSTATUS EASYHOOK_API +#define EASYHOOK_BOOL_EXPORT EXTERN_C BOOL EASYHOOK_API + +#define MAX_HOOK_COUNT 128 +#define MAX_ACE_COUNT 128 +#define MAX_THREAD_COUNT 128 +#define MAX_PASSTHRU_SIZE 1024 * 64 + +typedef struct _LOCAL_HOOK_INFO_* PLOCAL_HOOK_INFO; + +typedef struct _HOOK_TRACE_INFO_ +{ + PLOCAL_HOOK_INFO Link; +}HOOK_TRACE_INFO, *TRACED_HOOK_HANDLE; + +DRIVER_SHARED_API(NTSTATUS, RtlGetLastError()); + +DRIVER_SHARED_API(PWCHAR, RtlGetLastErrorString()); + +#ifndef DRIVER +DRIVER_SHARED_API(PWCHAR, RtlGetLastErrorStringCopy()); +#endif + +DRIVER_SHARED_API(NTSTATUS, LhInstallHook( + void* InEntryPoint, + void* InHookProc, + void* InCallback, + TRACED_HOOK_HANDLE OutHandle)); + +DRIVER_SHARED_API(NTSTATUS, LhUninstallAllHooks()); + +DRIVER_SHARED_API(NTSTATUS, LhUninstallHook(TRACED_HOOK_HANDLE InHandle)); + +DRIVER_SHARED_API(NTSTATUS, LhWaitForPendingRemovals()); + +/* + Setup the ACLs after hook installation. Please note that every + hook starts suspended. You will have to set a proper ACL to + make it active! +*/ +#ifdef DRIVER + + DRIVER_SHARED_API(NTSTATUS, LhSetInclusiveACL( + ULONG* InProcessIdList, + ULONG InProcessCount, + TRACED_HOOK_HANDLE InHandle)); + + DRIVER_SHARED_API(NTSTATUS, LhSetExclusiveACL( + ULONG* InProcessIdList, + ULONG InProcessCount, + TRACED_HOOK_HANDLE InHandle)); + + DRIVER_SHARED_API(NTSTATUS, LhSetGlobalInclusiveACL( + ULONG* InProcessIdList, + ULONG InProcessCount)); + + DRIVER_SHARED_API(NTSTATUS, LhSetGlobalExclusiveACL( + ULONG* InProcessIdList, + ULONG InProcessCount)); + + DRIVER_SHARED_API(NTSTATUS, LhIsProcessIntercepted( + TRACED_HOOK_HANDLE InHook, + ULONG InProcessID, + BOOL* OutResult)); + +#else + + EASYHOOK_NT_EXPORT LhSetInclusiveACL( + ULONG* InThreadIdList, + ULONG InThreadCount, + TRACED_HOOK_HANDLE InHandle); + + EASYHOOK_NT_EXPORT LhSetExclusiveACL( + ULONG* InThreadIdList, + ULONG InThreadCount, + TRACED_HOOK_HANDLE InHandle); + + EASYHOOK_NT_EXPORT LhSetGlobalInclusiveACL( + ULONG* InThreadIdList, + ULONG InThreadCount); + + EASYHOOK_NT_EXPORT LhSetGlobalExclusiveACL( + ULONG* InThreadIdList, + ULONG InThreadCount); + + EASYHOOK_NT_EXPORT LhIsThreadIntercepted( + TRACED_HOOK_HANDLE InHook, + ULONG InThreadID, + BOOL* OutResult); + +#endif // !DRIVER + +/* + The following barrier methods are meant to be used in hook handlers only! + + They will all fail with STATUS_NOT_SUPPORTED if called outside a + valid hook handler... +*/ +DRIVER_SHARED_API(NTSTATUS, LhBarrierGetCallback(PVOID* OutValue)); + +DRIVER_SHARED_API(NTSTATUS, LhBarrierGetReturnAddress(PVOID* OutValue)); + +DRIVER_SHARED_API(NTSTATUS, LhBarrierGetAddressOfReturnAddress(PVOID** OutValue)); + +DRIVER_SHARED_API(NTSTATUS, LhBarrierBeginStackTrace(PVOID* OutBackup)); + +DRIVER_SHARED_API(NTSTATUS, LhBarrierEndStackTrace(PVOID InBackup)); + +typedef struct _MODULE_INFORMATION_* PMODULE_INFORMATION; + +typedef struct _MODULE_INFORMATION_ +{ + PMODULE_INFORMATION Next; + UCHAR* BaseAddress; + ULONG ImageSize; + CHAR Path[256]; + PCHAR ModuleName; +}MODULE_INFORMATION; + +EASYHOOK_NT_EXPORT LhUpdateModuleInformation(); + +DRIVER_SHARED_API(NTSTATUS, LhBarrierPointerToModule( + PVOID InPointer, + MODULE_INFORMATION* OutModule)); + +DRIVER_SHARED_API(NTSTATUS, LhEnumModules( + HMODULE* OutModuleArray, + ULONG InMaxModuleCount, + ULONG* OutModuleCount)); + +DRIVER_SHARED_API(NTSTATUS, LhBarrierGetCallingModule(MODULE_INFORMATION* OutModule)); + +DRIVER_SHARED_API(NTSTATUS, LhBarrierCallStackTrace( + PVOID* OutMethodArray, + ULONG InMaxMethodCount, + ULONG* OutMethodCount)); + +#ifdef DRIVER + + #define DRIVER_EXPORT(proc) PROC_##proc * proc + + #define EASYHOOK_INTERFACE_v_1 0x0001 + + #define EASYHOOK_WIN32_DEVICE_NAME L"\\\\.\\EasyHook" + #define EASYHOOK_DEVICE_NAME L"\\Device\\EasyHook" + #define EASYHOOK_DOS_DEVICE_NAME L"\\DosDevices\\EasyHook" + #define FILE_DEVICE_EASYHOOK 0x893F + + typedef struct _EASYHOOK_INTERFACE_API_v_1_ + { + DRIVER_EXPORT(RtlGetLastError); + DRIVER_EXPORT(RtlGetLastErrorString); + DRIVER_EXPORT(LhInstallHook); + DRIVER_EXPORT(LhUninstallHook); + DRIVER_EXPORT(LhWaitForPendingRemovals); + DRIVER_EXPORT(LhBarrierGetCallback); + DRIVER_EXPORT(LhBarrierGetReturnAddress); + DRIVER_EXPORT(LhBarrierGetAddressOfReturnAddress); + DRIVER_EXPORT(LhBarrierBeginStackTrace); + DRIVER_EXPORT(LhBarrierEndStackTrace); + DRIVER_EXPORT(LhBarrierPointerToModule); + DRIVER_EXPORT(LhBarrierGetCallingModule); + DRIVER_EXPORT(LhBarrierCallStackTrace); + DRIVER_EXPORT(LhSetGlobalExclusiveACL); + DRIVER_EXPORT(LhSetGlobalInclusiveACL); + DRIVER_EXPORT(LhSetExclusiveACL); + DRIVER_EXPORT(LhSetInclusiveACL); + DRIVER_EXPORT(LhIsProcessIntercepted); + }EASYHOOK_INTERFACE_API_v_1, *PEASYHOOK_INTERFACE_API_v_1; + + typedef struct _EASYHOOK_DEVICE_EXTENSION_ + { + ULONG MaxVersion; + // enumeration of APIs + EASYHOOK_INTERFACE_API_v_1 API_v_1; + }EASYHOOK_DEVICE_EXTENSION, *PEASYHOOK_DEVICE_EXTENSION; + + static NTSTATUS EasyHookQueryInterface( + ULONG InInterfaceVersion, + PVOID OutInterface, + PFILE_OBJECT* OutEasyHookDrv) + { + /* + Description: + + Provides a convenient way to load the desired EasyHook interface. + The method will only work if the EasyHook support driver is loaded, of course. + If you don't need the interface anymore, you have to release the + file object with ObDereferenceObject(). + + Parameters: + + - InInterfaceVersion + + The desired interface version. Any future EasyHook driver will ALWAYS + be backward compatible. This is the reason why I provide such a flexible + interface mechanism. + + - OutInterface + + A pointer to the interface structure to be filled with data. If you specify + EASYHOOK_INTERFACE_v_1 as InInterfaceVersion, you will have to provide a + pointer to a EASYHOOK_INTERFACE_API_v_1 structure, for example... + + - OutEasyHookDrv + + A reference to the EasyHook driver. Make sure that you dereference it if + you don't need the interface any longer! As long as you keep this handle, + the EasyHook driver CAN'T be unloaded... + + */ + UNICODE_STRING DeviceName; + PDEVICE_OBJECT hEasyHookDrv = NULL; + NTSTATUS NtStatus = STATUS_INTERNAL_ERROR; + EASYHOOK_DEVICE_EXTENSION* DevExt; + + /* + Open log file... + */ + RtlInitUnicodeString(&DeviceName, EASYHOOK_DEVICE_NAME); + + if(!NT_SUCCESS(NtStatus = IoGetDeviceObjectPointer(&DeviceName, FILE_READ_DATA, OutEasyHookDrv, &hEasyHookDrv))) + return NtStatus; + + __try + { + DevExt = (EASYHOOK_DEVICE_EXTENSION*)hEasyHookDrv->DeviceExtension; + + if(DevExt->MaxVersion < InInterfaceVersion) + return STATUS_NOT_SUPPORTED; + + switch(InInterfaceVersion) + { + case EASYHOOK_INTERFACE_v_1: memcpy(OutInterface, &DevExt->API_v_1, sizeof(DevExt->API_v_1)); break; + default: + return STATUS_INVALID_PARAMETER_1; + } + + return STATUS_SUCCESS; + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + ObDereferenceObject(*OutEasyHookDrv); + + return NtStatus; + } + } + + +#endif // DRIVER + +#ifndef DRIVER + /* + Debug helper API. + */ + EASYHOOK_BOOL_EXPORT DbgIsAvailable(); + + EASYHOOK_BOOL_EXPORT DbgIsEnabled(); + + EASYHOOK_NT_EXPORT DbgAttachDebugger(); + + EASYHOOK_NT_EXPORT DbgDetachDebugger(); + + EASYHOOK_NT_EXPORT DbgGetThreadIdByHandle( + HANDLE InThreadHandle, + ULONG* OutThreadId); + + EASYHOOK_NT_EXPORT DbgGetProcessIdByHandle( + HANDLE InProcessHandle, + ULONG* OutProcessId); + + EASYHOOK_NT_EXPORT DbgHandleToObjectName( + HANDLE InNamedHandle, + UNICODE_STRING* OutNameBuffer, + ULONG InBufferSize, + ULONG* OutRequiredSize); + /* + Test API + */ + typedef struct _TEST_FUNC_HOOKS_OPTIONS + { + LPSTR Filename; + LPSTR FilterByName; + } TEST_FUNC_HOOKS_OPTIONS; + + typedef struct _TEST_FUNC_HOOKS_RESULT + { + LPSTR FnName; + LPSTR ModuleRedirect; + LPSTR FnRedirect; + void* FnAddress; + void* RelocAddress; + LPSTR EntryDisasm; + LPSTR RelocDisasm; + LPSTR Error; + } TEST_FUNC_HOOKS_RESULT; + + EASYHOOK_NT_EXPORT TestFuncHooks(ULONG pId, + PCHAR module, + TEST_FUNC_HOOKS_OPTIONS options, + TEST_FUNC_HOOKS_RESULT** outResults, + int* resultCount); + + EASYHOOK_NT_EXPORT ReleaseTestFuncHookResults(TEST_FUNC_HOOKS_RESULT* results, int count); + /* + Injection support API. + */ + typedef struct _REMOTE_ENTRY_INFO_ + { + ULONG HostPID; + UCHAR* UserData; + ULONG UserDataSize; + }REMOTE_ENTRY_INFO; + + typedef void __stdcall REMOTE_ENTRY_POINT(REMOTE_ENTRY_INFO* InRemoteInfo); + + #define EASYHOOK_INJECT_DEFAULT 0x00000000 + #define EASYHOOK_INJECT_STEALTH 0x10000000 // (experimental) + #define EASYHOOK_INJECT_NET_DEFIBRILLATOR 0x20000000 // USE THIS ONLY IN UNMANAGED CODE AND ONLY WITH CreateAndInject() FOR MANAGED PROCESSES!! + + EASYHOOK_NT_EXPORT RhCreateStealthRemoteThread( + ULONG InTargetPID, + LPTHREAD_START_ROUTINE InRemoteRoutine, + PVOID InRemoteParam, + HANDLE* OutRemoteThread); + + EASYHOOK_NT_EXPORT RhInjectLibrary( + ULONG InTargetPID, + ULONG InWakeUpTID, + ULONG InInjectionOptions, + WCHAR* InLibraryPath_x86, + WCHAR* InLibraryPath_x64, + PVOID InPassThruBuffer, + ULONG InPassThruSize); + + EASYHOOK_NT_EXPORT RhCreateAndInject( + WCHAR* InEXEPath, + WCHAR* InCommandLine, + ULONG InProcessCreationFlags, + ULONG InInjectionOptions, + WCHAR* InLibraryPath_x86, + WCHAR* InLibraryPath_x64, + PVOID InPassThruBuffer, + ULONG InPassThruSize, + ULONG* OutProcessId); + + EASYHOOK_BOOL_EXPORT RhIsX64System(); + + EASYHOOK_NT_EXPORT RhIsX64Process( + ULONG InProcessId, + BOOL* OutResult); + + EASYHOOK_BOOL_EXPORT RhIsAdministrator(); + + EASYHOOK_NT_EXPORT RhWakeUpProcess(); + + EASYHOOK_NT_EXPORT RhInstallSupportDriver(); + + EASYHOOK_NT_EXPORT RhInstallDriver( + WCHAR* InDriverPath, + WCHAR* InDriverName); + + typedef struct _GACUTIL_INFO_* HGACUTIL; + + +#endif // !DRIVER + +#ifdef __cplusplus +}; +#endif + +#endif \ No newline at end of file diff --git a/include/Tdx/tdx_enum.h b/include/Tdx/tdx_enum.h index 67fa276..9a98152 100644 --- a/include/Tdx/tdx_enum.h +++ b/include/Tdx/tdx_enum.h @@ -3,44 +3,71 @@ #ifndef _TDX_ENUM_H_ #define _TDX_ENUM_H_ -#define COL_EACH_ROW (64) //每行多少例,相当重要 +#include "tdx_request.h" // 125_帐号类别 +// 37 期权 +// 40 沪港通 +// 603_交易类型 +#define JYLX_Creation 0 // ETF申购 +#define JYLX_Redemption 1 // ETF赎回 +#define MMBZ_ETF_Creation JYLX_Creation // ETF申购 +#define MMBZ_ETF_Redemption JYLX_Redemption // ETF赎回 // 130_买卖标志 // 下单时使用买卖标志来指定报单类型 // 查询时,单子只简单的表示了买卖方向,是否要启用委托类别? -#define MMBZ_Buy_Limit 0 // 限价买 -#define MMBZ_Sell_Limit 1 // 限价卖 +#define MMBZ_Buy_Limit 0 // 限价买, 204下:可转债转股 +#define MMBZ_Sell_Limit 1 // 限价卖, 204下:债券回售 #define MMBZ_Cancel 2 // 撤买/撤卖 -#define MMBZ_3 3 // 融券 +#define MMBZ_Buy_Cancel 3 // 撤买,没有测的 +#define MMBZ_Sell_Cancel 4 // 撤卖,信达证券结果 +#define MMBZ_Merge 12 // 基金合并 +#define MMBZ_Split 13 // 基金分拆 +#define MMBZ_Buy_DBP 15 // 担保品买入 +#define MMBZ_Sell_DBP 16 // 担保品卖出 +#define MMBZ_Sell_RQ_ZRT 24 // 转融通融券卖出 +#define MMBZ_Buy_HQ_ZRT 34 // 转融通买券还券 +#define MMBZ_XQ_HQ_ZRT 36 // 转融通现券还券 #define MMBZ_Buy_Market 67 // 市价买 #define MMBZ_Sell_Market 68 // 市价卖 +#define MMBZ_Buy_RZ 69 // 融资买入 +#define MMBZ_Sell_RQ 70 // 融券卖出 +#define MMBZ_Buy_HQ 71 // 买券还券 +#define MMBZ_XQ_HQ 73 // 现券还券 +#define MMBZ_DBP_HZ 74 // 担保品划转 +#define MMBZ_XJ_HK 75 // 现金还款 +#define MMBZ_Sell_HK 76 // 卖券还款 #define MMBZ_Creation 79 // 基金申购 #define MMBZ_Redemption 80 // 基金赎回 -#define MMBZ_Merge 12 // 基金合并 -#define MMBZ_Split 13 // 基金分拆 +#define MMBZ_86 86 // 权证行权 + +// 131_委托类别,这是自己定定义的,用来将字符串转成数字 +#define WTLB_Buy REQUEST_WT*100+ MMBZ_Buy_Limit // 买入 +#define WTLB_Sell REQUEST_WT*100+ MMBZ_Sell_Limit // 卖出 +#define WTLB_Buy_Cancel REQUEST_WT*100+ 2 // 撤买 +#define WTLB_Sell_Cancel REQUEST_WT*100+ 3 // 撤卖 +#define WTLB_LOFCreation REQUEST_WT*100+ MMBZ_Creation // 基金申购 +#define WTLB_LOFRedemption REQUEST_WT*100+ MMBZ_Redemption // 基金赎回 +#define WTLB_ETFCreation REQUEST_ETF_SGSH*100+ MMBZ_ETF_Creation // ETF申购 +#define WTLB_ETFRedemption REQUEST_ETF_SGSH*100+ MMBZ_ETF_Redemption // ETF赎回 +#define WTLB_Merge REQUEST_WT*100+ MMBZ_Merge // 合并 +#define WTLB_Split REQUEST_WT*100+ MMBZ_Split // 分拆 + +#define MMBZ_CB_Conv 0 // 204下:可转债转股 +#define MMBZ_CB_Red 1 // 204下:债券回售 + + + // 5565_委托类别 #define WTLB_MM 0; // 买卖 #define WTLB_CD 1; // 撤单 -// 131_委托类别 -// 3|投票 -// 3|融券 -// 0|买入 -// 1|卖出 // 166_委托方式 // 上海只有046,深圳只有012345,所以市价只发4最简单 -// 0 限1,买卖 -// 1 对 -// 2 本 -// 3 剩 撤 -// 4 五 撤 -// 5 全 撤 -// 6 转 #define WTFS_Limit 0 // 限价,限价委托,买卖 #define WTFS_Best_Reverse 1 // 对手方最优价格委托,对方最优价格,对手方最优价格委托, #define WTFS_Best_Forward 2 // 本方最优价格委托,本方最优价格,本方最优价格委托, @@ -49,7 +76,18 @@ #define WTFS_FOK 5 // 全额成交或撤销委托,全额成交或撤销,全额成交或撤销委托, #define WTFS_Five_Limit 6 // 五档即时成交剩余转限,五档即成转限价,最优五档即时成交剩余转限价委托, +#define WTFS_HRXYZH 0 // 划入信用账户 +#define WTFS_HCXYZH 1 // 划出信用账户 + +#define WTFS_ZQXJP 2 // 增强限价盘 +#define WTFS_JJXJP 3 // 竞价限价盘 +// 113_操作标志 +#define CZBZ_Open 1 // 开仓 +#define CZBZ_Close 2 // 平仓 +#define CZBZ_3 3 // ? +#define CZBZ_Lock 4 // 锁定 +#define CZBZ_Unlock 5 // 解锁 // 281_融资融券标识 #define RZRQBS_NO 0 // 非融资融券 @@ -63,9 +101,10 @@ #define ZTSM_4 4 // #define ZTSM_PartiallyFilled 5 // 5-部分成交 #define ZTSM_AllFilled 6 // 6-全部成交,已成,全部成交 -#define ZTSM_PartiallyCancelled 7 // 部撤,这是猜的,需要以后修正 +#define ZTSM_PartiallyCancelled 7 // 7-部成部撤,部撤 #define ZTSM_AllCancelled 8 // 8-全部撤单,已撤,全部撤单 #define ZTSM_CancelRejected 9 // 9-撤单未成 只会出现撤单记录中 +#define ZTSM_WaitingForReport 10 // 10-等待人工申报 // 已成,部成,废单,已撤,部撤 diff --git a/include/Tdx/tdx_field.h b/include/Tdx/tdx_field.h index 9a4bcf5..53f0005 100644 --- a/include/Tdx/tdx_field.h +++ b/include/Tdx/tdx_field.h @@ -7,6 +7,7 @@ ID一样,中文名可能不一样 */ +#define FIELD_CZSJ 50 // 50_(参数)操作数据 #define FIELD_JYSDM 100 // 100_交易所代码 #define FIELD_JYSMC 101 // 101_交易所名称 #define FIELD_WTFS_110 110 // 110_委托方式 @@ -39,13 +40,19 @@ ID一样,中文名可能不一样 #define FIELD_CJSJ 151 // 151_成交时间 #define FIELD_CJSL 152 // 152_成交数量 #define FIELD_CJJG 153 // 153_成交价格 +#define FIELD_CJJE 154 // 154_成交金额 #define FIELD_CJBH 155 // 155_成交编号 #define FIELD_DJSL 160 // 160_冻结数量 #define FIELD_DJZJ 161 // 161_冻结资金 #define FIELD_CDSL 162 // 162_撤单数量 +#define FIELD_164 164 // 164_ +#define FIELD_165 165 // 165_ #define FIELD_WTFS 166 // 166_委托方式 #define FIELD_CDBZ 167 // 167_撤单标志 #define FIELD_168 168 // ? +#define FIELD_PHRQ 170 // 170_配号日期 +#define FIELD_QSPH 171 // 171_起始配号 +#define FIELD_PHSL 172 // 172_配号数量 #define FIELD_XWDM 173 // 173_席位代码 #define FIELD_ZXJYGS 187 // 187_最小交易股数 #define FIELD_BJFS 194 // 194_报价方式 @@ -59,12 +66,15 @@ ID一样,中文名可能不一样 #define FIELD_CJF 208 // 208_成交费 #define FIELD_JSF 209 // 209_结算费 #define FIELD_YHS 210 // 210_印花税 +#define FIELD_JMSL 215 // 215_今买数量 #define FIELD_ZXMRBDJW 226 // 226_最小买入变动价位 #define FIELD_ZXMCBDJW 227 // 227_最小卖出变动价位 #define FIELD_CKYKBL 230 // 230_参考盈亏比例(%) #define FIELD_SXYK 232 // 232_实现盈亏 #define FIELD_LX 234 // 234_类型 #define FIELD_ZHZT 238 // 238_帐户状态 +#define FIELD_DFGDDM 244 // 244_对方股东代码 +#define FIELD_DFZHLB 245 // 245_对方帐号类别 #define FIELD_RZRQBS 281 // 281_融资融券标识 #define FIELD_FJZH 294 // 294_附加账号 #define FIELD_ZJYE 300 // 300_资金余额 @@ -77,6 +87,7 @@ ID一样,中文名可能不一样 #define FIELD_FNLX 333 // 333_方案类型 #define FIELD_ZZC_350 350 // 350_总资产 #define FIELD_CPDM 391 // 391_产品代码 +#define FIELD_FXJG 418 // 418_发行价格 #define FIELD_TJRDM 485 // 485_推荐人代码 #define FIELD_HYDM 510 // 510_合约代码 #define FIELD_HYMC 511 // 511_合约名称 @@ -84,15 +95,23 @@ ID一样,中文名可能不一样 #define FIELD_TBBZ 514 // 514_投保标志 #define FIELD_JGYF 540 // 540_交割月份 #define FIELD_BZJ 541 // 541_保证金 +#define FIELD_ETFDM 601 // 601_ETF代码 +#define FIELD_JYLX 603 // 603_交易类型 +#define FIELD_RGSL 604 // 604_认购数量 #define FIELD_PCH 606 // 606_批次号 #define FIELD_FXD 700 // 700_风险度 #define FIELD_718 718 // ? +#define FIELD_ZGSL 961 // 961_最高数量 +#define FIELD_SGED_961 961 // 961_申购额度,在申万宏源中居然也是961 +#define FIELD_ZDSL 962 // 962_最低数量 #define FIELD_QSXH 1207 // 1207_起始序号 #define FIELD_BLXX 1213 // 1213_保留信息 #define FIELD_JCFXBZ 1223 // 1223_检查风险标志 -#define FIELD_BZ_1217 1217 // 1217_备注 +#define FIELD_BZ_1217 1217 // 1217_备注 感觉是给当成备兑用了 +#define FIELD_FJYZHBZ 1224 // 1224_非交易帐号标志 #define FIELD_CS 1227 // 1227_参数 #define FIELD_XSYS 1231 // 1231_显示颜色 +#define FIELD_JB 1233 // 1233_句柄 #define FIELD_KHQZ 5250 // 5250_客户群组 #define FIELD_KHYYB 5251 // 5251_客户营业部 @@ -102,17 +121,30 @@ ID一样,中文名可能不一样 #define FIELD_HHH 5255 // 5255_会话号 #define FIELD_KHDM 5256 // 5256_客户代码 +#define FIELD_GFZY 5507 // 5507_股份昨余 +#define FIELD_SJSL 5508 // 5508_实际数量 + +#define FIELD_XGSGED_5564 5564 // 5564_新股申购额度 #define FIELD_WTLB_5565 5565 // 5565_委托类别 #define FIELD_JSHL 5599 // 5599_结算汇率 #define FIELD_JYF 5630 // 5630_交易费 #define FIELD_DSGF 5638 // 5638_代收规费 #define FIELD_GYWTBS 5639 // 5639_隔夜委托标识 +#define FIELD_FXRQ_5653 5653 // 5653_发行日期 #define FIELD_ZZHBH 5673 // 5673_子账户编号 #define FIELD_JSJG 5674 // 5674_结算机构 #define FIELD_JSZH 5675 // 5675_结算账号 #define FIELD_DJRQ 5676 // 5676_登记日期 - +#define FIELD_XGSGED_5679 5679 // 5679_新股申购额度 +#define FIELD_DQSL 5712 // 5712_当前数量 +#define FIELD_XGSGED_5718 5718 // 5718_新股申购额度 +#define FIELD_KHSZED_5759 5759 // 5759_客户市值额度 +#define FIELD_KHSZED 5771 // 5771_客户市值额度 +#define FIELD_ZHED 5772 // 5772_账户额度 +#define FIELD_KSGED 5801 // 5801_可申购额度 +#define FIELD_SGSX 5905 // 5905_申购上限 +#define FIELD_FXRQ_5906 5906 // 5906_发行日期 #define FIELD_YMTZH 5925 // 5925_一码通账号 #define FIELD_MMFX 5935 // 5935_买卖方向 #define FIELD_BJFS_6027 6027 // 6027_报价方式 diff --git a/include/Tdx/tdx_function.cpp b/include/Tdx/tdx_function.cpp index 8118292..7e95b1e 100644 --- a/include/Tdx/tdx_function.cpp +++ b/include/Tdx/tdx_function.cpp @@ -12,7 +12,6 @@ using namespace std; #ifdef TDXAPI_EXPORTS - /* 注意:以下代码只是几个数据表的读写方式,当做示例使用 此cpp请不要添加到项目中,而是只添加h文件 @@ -21,14 +20,6 @@ using namespace std; */ -void GetUpdateTime_HH_mm_ss(char* UpdateTime, int* _HH, int* _mm, int* _ss) -{ - *_HH = atoi(&UpdateTime[0]); - *_mm = atoi(&UpdateTime[3]); - *_ss = atoi(&UpdateTime[6]); -} - - void PrintTableHeader(FieldInfo_STRUCT** ppHeader) { if (ppHeader == nullptr) @@ -48,24 +39,6 @@ void PrintTableHeader(FieldInfo_STRUCT** ppHeader) printf("\n"); } -void OutputCSVTableHeader(FILE* pFile, FieldInfo_STRUCT** ppHeader) -{ - if (ppHeader == nullptr || pFile == nullptr) - return; - - int i = 0; - FieldInfo_STRUCT* pRow = ppHeader[i]; - while (pRow != 0) - { - char buf[512] = { 0 }; - fprintf(pFile,"%d_%s,",//"%d,%s,%d,%d,%d,%d,%d", - pRow->FieldID, pRow->FieldName, pRow->a, pRow->b, pRow->Len, pRow->d, pRow->e); - - ++i; - pRow = ppHeader[i]; - } - fprintf(pFile, "\n"); -} FieldInfo_STRUCT** CopyTableHeader(FieldInfo_STRUCT** ppHeader) { @@ -78,7 +51,6 @@ FieldInfo_STRUCT** CopyTableHeader(FieldInfo_STRUCT** ppHeader) for (int i = 0; i < count;++i) { - //ppNew[i] = ppHeader[i]; ppNew[i] = new FieldInfo_STRUCT; memcpy(ppNew[i], ppHeader[i], sizeof(FieldInfo_STRUCT)); } @@ -90,9 +62,6 @@ void DeleteTableHeader(FieldInfo_STRUCT** ppHeader) if (ppHeader == nullptr) return; - //原有创建方法是一个连续区域,使用时容易出错 - //delete[] ppHeader; - int i = 0; while (ppHeader[i] != 0) { @@ -215,61 +184,6 @@ void PrintTableBody(char** ppTable, int count) return; } -void OutputCSVTableBody(FILE* pFile, char** ppTable) -{ - if (ppTable == nullptr || pFile == nullptr) - return; - - // 如果有数据,第一列就不为空 - int i = 0; - int j = 0; - char* p = ppTable[i * COL_EACH_ROW + j]; - while (p != nullptr) - { - //printf("%d:", i); - for (j = 0; j < COL_EACH_ROW; ++j) - { - p = ppTable[i * COL_EACH_ROW + j]; - if (p) - { - fprintf(pFile, "%s,", p); - } - else - break; - } - fprintf(pFile, "\n"); - j = 0; - ++i; - p = ppTable[i * COL_EACH_ROW + j]; - } - - return; -} - -void OutputCSVTableBody(FILE* pFile, char** ppTable, int count) -{ - if (ppTable == nullptr || pFile == nullptr) - return; - - for (int i = 0; i < count; ++i) - { - //printf("%d:", i); - for (int j = 0; j < COL_EACH_ROW; ++j) - { - char* p = ppTable[i * COL_EACH_ROW + j]; - if (p) - { - fprintf(pFile, "%s,", p); - - } - else - break; - } - fprintf(pFile, "\n"); - } - - return; -} // 得到某一行某一列 char* GetAtTableBody(char** ppTable, int row, int col) @@ -397,50 +311,6 @@ void PrintErrors(Error_STRUCT** pErrs, int count) } } -void OutputCSVError(FILE* pFile, Error_STRUCT* pErr) -{ - if (pErr == nullptr) - { - return; - } - - fprintf(pFile, "%d,%d,%s\n", pErr->ErrType, pErr->ErrCode, pErr->ErrInfo); -} - -void OutputCSVErrors(FILE* pFile, Error_STRUCT** pErrs) -{ - if (pErrs == nullptr) - return; - - int i = 0; - Error_STRUCT* pErr = pErrs[i]; - while (pErr != nullptr) - { - fprintf(pFile, "%d:%d,%d,%s\n", i, pErr->ErrType, pErr->ErrCode, pErr->ErrInfo); - - ++i; - pErr = pErrs[i]; - } -} - -void OutputCSVErrors(FILE* pFile, Error_STRUCT** pErrs, int count) -{ - if (pErrs == nullptr) - { - return; - } - - for (int i = 0; i < count; ++i) - { - Error_STRUCT* pErr = pErrs[i]; - if (pErr) - { - fprintf(pFile, "%d:%d,%d,%s\n", i, pErr->ErrType, pErr->ErrCode, pErr->ErrInfo); - } - else - fprintf(pFile, "\n"); - } -} void DeleteError(Error_STRUCT* pErr) { @@ -493,96 +363,7 @@ int GetCountErrors(Error_STRUCT** pErrs) ////////////////////////////////////////////////////////////////////////// -int ZTSM_str_2_int(char* pIn) -{ - char* pCheng = strstr(pIn, "成"); - char* pChe = strstr(pIn, "撤"); - char* pBu = strstr(pIn, "部"); - - if (pChe) - { - if (pBu) - { - return ZTSM_PartiallyCancelled; - } - return ZTSM_AllCancelled; - } - else if (pCheng) - { - if (pBu) - { - // 部成是啥?这里需要完成 - return ZTSM_PartiallyFilled; - } - return ZTSM_AllFilled; - } - - char* pQ = strstr(pIn, "全"); - char* pY = strstr(pIn, "已"); - char* pBao = strstr(pIn, "报"); - char* pF = strstr(pIn, "废"); - - if (pF) - { - return ZTSM_Illegal; - } - - return ZTSM_New; -} - -// 将中文的报价方式转成委托方式,这是根据字符串的特点进行分类 -int BJFS_2_WTFS(char* pIn) -{ - char* pX1 = strstr(pIn, "限"); - - if (pX1 == pIn) - { - // 第一个字是限价 - return WTFS_Limit; - } - else - { - char* pMM = strstr(pIn, "买卖"); - if (pMM) - { - // 华泰返回买卖是表示限价 - return WTFS_Limit; - } - char* pC = strstr(pIn, "撤"); - if (pC) - { - char* p5 = strstr(pIn, "五"); - if (p5) - { - return WTFS_Five_IOC; - } - char* pQ = strstr(pIn, "全"); - if (pQ) - { - return WTFS_FOK; - } - return WTFS_IOC; // 剩 - } - else - { - char* pZ = strstr(pIn, "转"); - if (pZ) - { - return WTFS_Five_Limit; - } - char* pD = strstr(pIn, "对"); - if (pD) - { - return WTFS_Best_Reverse; - } - return WTFS_Best_Forward; // 本 - } - } -} - -////////////////////////////////////////////////////////////////////////// - -void CharTable2GDLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, GDLB_STRUCT*** pppResults) +void CharTable2GDLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, GDLB_STRUCT*** pppResults, void* Client) { *pppResults = nullptr; if (ppTable == nullptr) @@ -596,317 +377,573 @@ void CharTable2GDLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, GDLB_STRUCT ppResults[count] = nullptr; *pppResults = ppResults; - int col_123 = GetIndexByFieldID(ppFieldInfos, FIELD_GDDM); - int col_124 = GetIndexByFieldID(ppFieldInfos, FIELD_GDMC); - int col_125 = GetIndexByFieldID(ppFieldInfos, FIELD_ZHLB); - int col_121 = GetIndexByFieldID(ppFieldInfos, FIELD_ZJZH); - int col_173 = GetIndexByFieldID(ppFieldInfos, FIELD_XWDM); - int col_281 = GetIndexByFieldID(ppFieldInfos, FIELD_RZRQBS); - int col_1213 = GetIndexByFieldID(ppFieldInfos, FIELD_BLXX); - for (int i = 0; i < count; ++i) { ppResults[i] = new GDLB_STRUCT(); - //if (col_123 >= 0) - strcpy_s(ppResults[i]->GDDM, ppTable[i * COL_EACH_ROW + col_123]); - //if (col_124 >= 0) - strcpy_s(ppResults[i]->GDMC, ppTable[i * COL_EACH_ROW + col_124]); - if (col_121 >= 0) - strcpy_s(ppResults[i]->ZJZH, ppTable[i * COL_EACH_ROW + col_121]); - //if (col_125 >= 0) - strcpy_s(ppResults[i]->ZHLB, ppTable[i * COL_EACH_ROW + col_125]); - if (col_173 >= 0) - strcpy_s(ppResults[i]->XWDM, ppTable[i * COL_EACH_ROW + col_173]); - if (col_281 >= 0) - strcpy_s(ppResults[i]->RZRQBS, ppTable[i * COL_EACH_ROW + col_281]); - if (col_1213 >= 0) - strcpy_s(ppResults[i]->BLXX, ppTable[i * COL_EACH_ROW + col_1213]); + int j = 0; + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + while (pRow != 0) + { + char* t = ppTable[i * COL_EACH_ROW + j]; + switch (pRow->FieldID) + { + case FIELD_GDDM: + strcpy_s(ppResults[i]->GDDM, t); + break; + case FIELD_GDMC: + strcpy_s(ppResults[i]->GDMC, t); + break; + case FIELD_ZHLB: + strcpy_s(ppResults[i]->ZHLB, t); + break; + case FIELD_ZJZH: + strcpy_s(ppResults[i]->ZJZH, t); + break; + case FIELD_XWDM: + strcpy_s(ppResults[i]->XWDM, t); + break; + case FIELD_RZRQBS: + strcpy_s(ppResults[i]->RZRQBS, t); + break; + case FIELD_BLXX: + strcpy_s(ppResults[i]->BLXX, t); + break; + } + + ++j; + pRow = ppFieldInfos[j]; + } ppResults[i]->ZHLB_ = atoi(ppResults[i]->ZHLB); ppResults[i]->RZRQBS_ = atoi(ppResults[i]->RZRQBS); + + ppResults[i]->Client = Client; } } - - -void CharTable2WTLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, WTLB_STRUCT*** pppResults) +void DeleteStructs(void*** pppStructs) { - *pppResults = nullptr; - if (ppTable == nullptr) + if (pppStructs == nullptr) return; - int count = GetRowCountTableBody(ppTable); - if (count <= 0) + if (*pppStructs == nullptr) return; - WTLB_STRUCT** ppResults = new WTLB_STRUCT*[count + 1](); - ppResults[count] = nullptr; - *pppResults = ppResults; - - int col_142 = GetIndexByFieldID(ppFieldInfos, FIELD_WTRQ); - int col_143 = GetIndexByFieldID(ppFieldInfos, FIELD_WTSJ); - int col_123 = GetIndexByFieldID(ppFieldInfos, FIELD_GDDM); - int col_140 = GetIndexByFieldID(ppFieldInfos, FIELD_ZQDM); - int col_141 = GetIndexByFieldID(ppFieldInfos, FIELD_ZQMC); - int col_130 = GetIndexByFieldID(ppFieldInfos, FIELD_MMBZ); - int col_131 = GetIndexByFieldID(ppFieldInfos, FIELD_WTLB); - int col_100 = GetIndexByFieldID(ppFieldInfos, FIELD_JYSDM); - int col_145 = GetIndexByFieldID(ppFieldInfos, FIELD_WTJG); - int col_144 = GetIndexByFieldID(ppFieldInfos, FIELD_WTSL); - int col_153 = GetIndexByFieldID(ppFieldInfos, FIELD_CJJG); - int col_152 = GetIndexByFieldID(ppFieldInfos, FIELD_CJSL); - int col_162 = GetIndexByFieldID(ppFieldInfos, FIELD_CDSL); - int col_146 = GetIndexByFieldID(ppFieldInfos, FIELD_WTBH); - int col_194 = GetIndexByFieldID(ppFieldInfos, FIELD_BJFS); - int col_147 = GetIndexByFieldID(ppFieldInfos, FIELD_ZTSM); - int col_161 = GetIndexByFieldID(ppFieldInfos, FIELD_DJZJ); - int col_1213 = GetIndexByFieldID(ppFieldInfos, FIELD_BLXX); + void** ppStructs = *pppStructs; - for (int i = 0; i < count; ++i) + int i = 0; + while (ppStructs[i] != 0) { - ppResults[i] = new WTLB_STRUCT(); - - if (col_142 >= 0) - strcpy_s(ppResults[i]->WTRQ, ppTable[i * COL_EACH_ROW + col_142]); - if (col_143 >= 0) - strcpy_s(ppResults[i]->WTSJ, ppTable[i * COL_EACH_ROW + col_143]); - //if (col_123 >= 0) - strcpy_s(ppResults[i]->GDDM, ppTable[i * COL_EACH_ROW + col_123]); - //if (col_140 >= 0) - strcpy_s(ppResults[i]->ZQDM, ppTable[i * COL_EACH_ROW + col_140]); - //if (col_141 >= 0) - strcpy_s(ppResults[i]->ZQMC, ppTable[i * COL_EACH_ROW + col_141]); - //if (col_130 >= 0) - strcpy_s(ppResults[i]->MMBZ, ppTable[i * COL_EACH_ROW + col_130]); - //if (col_131 >= 0) - strcpy_s(ppResults[i]->WTLB, ppTable[i * COL_EACH_ROW + col_131]); - //if (col_100 >= 0) - strcpy_s(ppResults[i]->JYSDM, ppTable[i * COL_EACH_ROW + col_100]); - //if (col_145 >= 0) - strcpy_s(ppResults[i]->WTJG, ppTable[i * COL_EACH_ROW + col_145]); - //if (col_144 >= 0) - strcpy_s(ppResults[i]->WTSL, ppTable[i * COL_EACH_ROW + col_144]); - //if (col_153 >= 0) - strcpy_s(ppResults[i]->CJJG, ppTable[i * COL_EACH_ROW + col_153]); - //if (col_152 >= 0) - strcpy_s(ppResults[i]->CJSL, ppTable[i * COL_EACH_ROW + col_152]); - if (col_162 >= 0) - strcpy_s(ppResults[i]->CDSL, ppTable[i * COL_EACH_ROW + col_162]); - //if (col_146 >= 0) - strcpy_s(ppResults[i]->WTBH, ppTable[i * COL_EACH_ROW + col_146]); - //if (col_194 >= 0) - strcpy_s(ppResults[i]->BJFS, ppTable[i * COL_EACH_ROW + col_194]); - if (col_147 >= 0) - strcpy_s(ppResults[i]->ZTSM, ppTable[i * COL_EACH_ROW + col_147]); - if (col_161 >= 0) - strcpy_s(ppResults[i]->DJZJ, ppTable[i * COL_EACH_ROW + col_161]); - if (col_1213 >= 0) - strcpy_s(ppResults[i]->BLXX, ppTable[i * COL_EACH_ROW + col_1213]); - - ppResults[i]->WTRQ_ = atoi(ppResults[i]->WTRQ); - ppResults[i]->MMBZ_ = atoi(ppResults[i]->MMBZ); - ppResults[i]->JYSDM_ = atoi(ppResults[i]->JYSDM); - ppResults[i]->WTJG_ = atof(ppResults[i]->WTJG); - ppResults[i]->WTSL_ = atoi(ppResults[i]->WTSL); - ppResults[i]->CJJG_ = atof(ppResults[i]->CJJG); - ppResults[i]->CJSL_ = atoi(ppResults[i]->CJSL); - ppResults[i]->DJZJ_ = atof(ppResults[i]->DJZJ); - - // 可能没有,怎么办 - ppResults[i]->CDSL_ = atoi(ppResults[i]->CDSL); - - int HH = 0, mm = 0, ss = 0; - GetUpdateTime_HH_mm_ss(ppResults[i]->WTSJ, &HH, &mm, &ss); - ppResults[i]->WTSJ_ = HH * 10000 + mm * 100 + ss; - - // 第一个的字符,并转成数字 - if (ppResults[i]->ZTSM[1] == '-') - { - ppResults[i]->ZTSM_ = ppResults[i]->ZTSM[0] - '0'; - } - else - { - ppResults[i]->ZTSM_ = ZTSM_str_2_int(ppResults[i]->ZTSM); - } + delete[] ppStructs[i]; + ppStructs[i] = nullptr; - ppResults[i]->BJFS_ = BJFS_2_WTFS(ppResults[i]->BJFS); + ++i; } + + delete[] ppStructs; + *pppStructs = nullptr; } -void CharTable2CJLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, CJLB_STRUCT*** pppResults) -{ - *pppResults = nullptr; - if (ppTable == nullptr) - return; - int count = GetRowCountTableBody(ppTable); - if (count <= 0) - return; +/* +6 +A74168961|WK |05000000100801|1| 0| | +013086113|WK |05000000100801|0| 0| | - CJLB_STRUCT** ppResults = new CJLB_STRUCT*[count + 1](); - ppResults[count] = nullptr; - *pppResults = ppResults; +7 +A12121217|ZHT|1| 40690000|28356| 0|主股东| +015597938|ZHT|0| 40690000|394232|0|主股东| - int col_150 = GetIndexByFieldID(ppFieldInfos, FIELD_CJRQ); - int col_151 = GetIndexByFieldID(ppFieldInfos, FIELD_CJSJ); - int col_123 = GetIndexByFieldID(ppFieldInfos, FIELD_GDDM); - int col_140 = GetIndexByFieldID(ppFieldInfos, FIELD_ZQDM); - int col_141 = GetIndexByFieldID(ppFieldInfos, FIELD_ZQMC); - int col_130 = GetIndexByFieldID(ppFieldInfos, FIELD_MMBZ); - int col_131 = GetIndexByFieldID(ppFieldInfos, FIELD_WTLB); - int col_153 = GetIndexByFieldID(ppFieldInfos, FIELD_CJJG); - int col_152 = GetIndexByFieldID(ppFieldInfos, FIELD_CJSL); - int col_303 = GetIndexByFieldID(ppFieldInfos, FIELD_FSJE); - int col_304 = GetIndexByFieldID(ppFieldInfos, FIELD_SYJE); - int col_206 = GetIndexByFieldID(ppFieldInfos, FIELD_YJ); - int col_210 = GetIndexByFieldID(ppFieldInfos, FIELD_YHS); - int col_207 = GetIndexByFieldID(ppFieldInfos, FIELD_GHF); - int col_208 = GetIndexByFieldID(ppFieldInfos, FIELD_CJF); - int col_155 = GetIndexByFieldID(ppFieldInfos, FIELD_CJBH); - int col_167 = GetIndexByFieldID(ppFieldInfos, FIELD_CDBZ); - int col_146 = GetIndexByFieldID(ppFieldInfos, FIELD_WTBH); +5 +A341083000|LK|1| |主股东| +0189181400|LK|0| |主股东| - for (int i = 0; i < count; ++i) - { - ppResults[i] = new CJLB_STRUCT(); - - if (col_150 >= 0) - strcpy_s(ppResults[i]->CJRQ, ppTable[i * COL_EACH_ROW + col_150]); - if (col_151 >= 0) - strcpy_s(ppResults[i]->CJSJ, ppTable[i * COL_EACH_ROW + col_151]); - //if (col_123 >= 0) - strcpy_s(ppResults[i]->GDDM, ppTable[i * COL_EACH_ROW + col_123]); - //if (col_140 >= 0) - strcpy_s(ppResults[i]->ZQDM, ppTable[i * COL_EACH_ROW + col_140]); - //if (col_141 >= 0) - strcpy_s(ppResults[i]->ZQMC, ppTable[i * COL_EACH_ROW + col_141]); - //if (col_130 >= 0) - strcpy_s(ppResults[i]->MMBZ, ppTable[i * COL_EACH_ROW + col_130]); - //if (col_131 >= 0) - strcpy_s(ppResults[i]->WTLB, ppTable[i * COL_EACH_ROW + col_131]); - //if (col_153 >= 0) - strcpy_s(ppResults[i]->CJJG, ppTable[i * COL_EACH_ROW + col_153]); - //if (col_152 >= 0) - strcpy_s(ppResults[i]->CJSL, ppTable[i * COL_EACH_ROW + col_152]); - if (col_303 >= 0) - strcpy_s(ppResults[i]->FSJE, ppTable[i * COL_EACH_ROW + col_303]); - if (col_304 >= 0) - strcpy_s(ppResults[i]->SYJE, ppTable[i * COL_EACH_ROW + col_304]); - if (col_206 >= 0) - strcpy_s(ppResults[i]->YJ, ppTable[i * COL_EACH_ROW + col_206]); - if (col_210 >= 0) - strcpy_s(ppResults[i]->YHS, ppTable[i * COL_EACH_ROW + col_210]); - if (col_207 >= 0) - strcpy_s(ppResults[i]->GHF, ppTable[i * COL_EACH_ROW + col_207]); - if (col_208 >= 0) - strcpy_s(ppResults[i]->CJF, ppTable[i * COL_EACH_ROW + col_208]); - //if (col_155 >= 0) - strcpy_s(ppResults[i]->CJBH, ppTable[i * COL_EACH_ROW + col_155]); - if (col_167 >= 0) - strcpy_s(ppResults[i]->CDBZ, ppTable[i * COL_EACH_ROW + col_167]); - if (col_146 >= 0) - strcpy_s(ppResults[i]->WTBH, ppTable[i * COL_EACH_ROW + col_146]); - - - ppResults[i]->CJRQ_ = atoi(ppResults[i]->CJRQ); - //ppResults[i]->CJSJ_ = atoi(ppResults[i]->CJSJ); - ppResults[i]->MMBZ_ = atoi(ppResults[i]->MMBZ); - ppResults[i]->WTLB_ = atoi(ppResults[i]->WTLB); - ppResults[i]->CJJG_ = atof(ppResults[i]->CJJG); - ppResults[i]->CJSL_ = atoi(ppResults[i]->CJSL); - ppResults[i]->SYJE_ = atof(ppResults[i]->SYJE); - ppResults[i]->YJ_ = atof(ppResults[i]->YJ); - ppResults[i]->YHS_ = atof(ppResults[i]->YHS); - ppResults[i]->GHF_ = atof(ppResults[i]->GHF); - ppResults[i]->CJF_ = atof(ppResults[i]->CJF); - ppResults[i]->CDBZ_ = atoi(ppResults[i]->CDBZ); - - // 可能没有 - ppResults[i]->FSJE_ = atof(ppResults[i]->FSJE); - - int HH = 0, mm = 0, ss = 0; - GetUpdateTime_HH_mm_ss(ppResults[i]->CJSJ, &HH, &mm, &ss); - ppResults[i]->CJSJ_ = HH * 10000 + mm * 100 + ss; - } -} +8 +E015976151|HT|1|88500918| 12982|1| |主股东| +0601605823|HT|0|88500918| 354000|1| |主股东| -void CharTable2GFLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, GFLB_STRUCT*** pppResults) +8 +101313017766|0026087534|ZL|0| 304300|0|0|主股东| +101313017766|A511876656|ZL|1| 55005|0|0|主股东| +*/ +// 发现不准,从登录信息中猜测式解析不准,需要换一种方式 +void String2GDLB1(char* szString, GDLB_STRUCT*** pppResults, void* Client) { *pppResults = nullptr; - if (ppTable == nullptr) - return; - - int count = GetRowCountTableBody(ppTable); - if (count <= 0) + if (szString == nullptr) return; - GFLB_STRUCT** ppResults = new GFLB_STRUCT*[count + 1](); - ppResults[count] = nullptr; - *pppResults = ppResults; + char* pBuf = new char[strlen(szString) + 1]; + strcpy(pBuf, szString); - int col_140 = GetIndexByFieldID(ppFieldInfos, FIELD_ZQDM); - int col_141 = GetIndexByFieldID(ppFieldInfos, FIELD_ZQMC); - int col_200 = GetIndexByFieldID(ppFieldInfos, FIELD_ZQSL); - int col_201 = GetIndexByFieldID(ppFieldInfos, FIELD_KMSL); - int col_202 = GetIndexByFieldID(ppFieldInfos, FIELD_TBCBJ); - int col_949 = GetIndexByFieldID(ppFieldInfos, FIELD_DQJ); - int col_205 = GetIndexByFieldID(ppFieldInfos, FIELD_ZXSZ); - int col_204 = GetIndexByFieldID(ppFieldInfos, FIELD_TBFDYK); - int col_232 = GetIndexByFieldID(ppFieldInfos, FIELD_SXYK); - int col_230 = GetIndexByFieldID(ppFieldInfos, FIELD_CKYKBL); - int col_160 = GetIndexByFieldID(ppFieldInfos, FIELD_DJSL); - int col_123 = GetIndexByFieldID(ppFieldInfos, FIELD_GDDM); - int col_100 = GetIndexByFieldID(ppFieldInfos, FIELD_JYSDM); - int col_101 = GetIndexByFieldID(ppFieldInfos, FIELD_JYSMC); - int col_1213 = GetIndexByFieldID(ppFieldInfos, FIELD_BLXX); + vector vct; - for (int i = 0; i < count; ++i) + // 分好多少列 + char* token = strtok(pBuf, "\r\n"); + int i = 0; + while (token) { - ppResults[i] = new GFLB_STRUCT(); - - //if (col_140 >= 0) - strcpy_s(ppResults[i]->ZQDM, ppTable[i * COL_EACH_ROW + col_140]); - //if (col_141 >= 0) - strcpy_s(ppResults[i]->ZQMC, ppTable[i * COL_EACH_ROW + col_141]); - //if (col_200 >= 0) - strcpy_s(ppResults[i]->ZQSL, ppTable[i * COL_EACH_ROW + col_200]); - //if (col_201 >= 0) - strcpy_s(ppResults[i]->KMSL, ppTable[i * COL_EACH_ROW + col_201]); - //if (col_202 >= 0) - strcpy_s(ppResults[i]->TBCBJ, ppTable[i * COL_EACH_ROW + col_202]); - //if (col_949 >= 0) - strcpy_s(ppResults[i]->DQJ, ppTable[i * COL_EACH_ROW + col_949]); - //if (col_205 >= 0) - strcpy_s(ppResults[i]->ZXSZ, ppTable[i * COL_EACH_ROW + col_205]); - //if (col_204 >= 0) - strcpy_s(ppResults[i]->TBFDYK, ppTable[i * COL_EACH_ROW + col_204]); - if (col_232 >= 0) - strcpy_s(ppResults[i]->SXYK, ppTable[i * COL_EACH_ROW + col_232]); - if (col_230 >= 0) - strcpy_s(ppResults[i]->CKYKBL, ppTable[i * COL_EACH_ROW + col_230]); - if (col_160 >= 0) - strcpy_s(ppResults[i]->DJSL, ppTable[i * COL_EACH_ROW + col_160]); - //if (col_123 >= 0) - strcpy_s(ppResults[i]->GDDM, ppTable[i * COL_EACH_ROW + col_123]); - if (col_100 >= 0) - strcpy_s(ppResults[i]->JYSDM, ppTable[i * COL_EACH_ROW + col_100]); - if (col_101 >= 0) - strcpy_s(ppResults[i]->JYSMC, ppTable[i * COL_EACH_ROW + col_101]); - //if (col_1213 >= 0) - strcpy_s(ppResults[i]->BLXX, ppTable[i * COL_EACH_ROW + col_1213]); - - - ppResults[i]->ZQSL_ = atoi(ppResults[i]->ZQSL); - ppResults[i]->KMSL_ = atoi(ppResults[i]->KMSL); - ppResults[i]->TBCBJ_ = atof(ppResults[i]->TBCBJ); - ppResults[i]->DQJ_ = atof(ppResults[i]->DQJ); - ppResults[i]->ZXSZ_ = atof(ppResults[i]->ZXSZ); - ppResults[i]->DJSL_ = atof(ppResults[i]->DJSL); + if (i>0) + { + vct.push_back(token); + } + token = strtok(nullptr, "\r\n"); + ++i; + } + + int count = vct.size(); + + GDLB_STRUCT** ppResults = new GDLB_STRUCT*[count + 1](); + ppResults[count] = nullptr; + *pppResults = ppResults; + + for (int i = 0; i < count;++i) + { + ppResults[i] = new GDLB_STRUCT(); + + vector v1; + vector v2; + vector v3; + char* t = strtok(vct[i], "|"); + int j = 0; + while (t) + { + int len = strlen(t); + if (len == 1) + { + v2.push_back(t); + } + else if (len>0) + { + if (t[0]>127||t[0]<0) + { + v3.push_back(t); + } + else + { + v1.push_back(t); + } + } + t = strtok(nullptr, "|"); + } + + strcpy_s(ppResults[i]->GDDM, v1[0]); + if (v1.size() > 1) + strcpy_s(ppResults[i]->ZJZH, v1[1]); + if (v1.size() > 2) + strcpy_s(ppResults[i]->XWDM, v1[2]); + + strcpy_s(ppResults[i]->ZHLB, v2[0]); + if (v2.size() > 1) + strcpy_s(ppResults[i]->RZRQBS, v2[1]); + + if (v3.size()>0) + strcpy_s(ppResults[i]->GDMC, v3[0]); + if (v3.size()>1) + strcpy_s(ppResults[i]->BLXX, v3[1]); + + ppResults[i]->ZHLB_ = atoi(ppResults[i]->ZHLB); + ppResults[i]->RZRQBS_ = atoi(ppResults[i]->RZRQBS); + + ppResults[i]->Client = Client; + } + + delete[] pBuf; +} + +// 这种方式假定登录时的格式与直接查询的格式是完全一样的 +void String2GDLB2(FieldInfo_STRUCT** ppFieldInfos, char* szString, GDLB_STRUCT*** pppResults, void* Client, char* ZJZH) +{ + *pppResults = nullptr; + if (szString == nullptr) + return; + + char* pBuf = new char[strlen(szString) + 1]; + strcpy(pBuf, szString); + + vector vct; + + // 分好多少列 + char* token = strtok(pBuf, "\r\n"); + int i = 0; + while (token) + { + if (i>0) + { + vct.push_back(token); + } + token = strtok(nullptr, "\r\n"); + ++i; + } + + int count = vct.size(); + + GDLB_STRUCT** ppResults = new GDLB_STRUCT*[count + 1](); + ppResults[count] = nullptr; + *pppResults = ppResults; + + for (int i = 0; i < count; ++i) + { + ppResults[i] = new GDLB_STRUCT(); + + int header_count = GetCountTableHeader(ppFieldInfos); + + char* pLast = vct[i]; + char* pCurr = strstr(vct[i], "|"); + + for (int j = 0; j < header_count; ++j) + { + if (pCurr == nullptr) + break; + + *pCurr = 0; + char* t = pLast; + + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + switch (pRow->FieldID) + { + case FIELD_GDDM: + strcpy_s(ppResults[i]->GDDM, t); + break; + case FIELD_GDMC: + strcpy_s(ppResults[i]->GDMC, t); + break; + case FIELD_ZHLB: + strcpy_s(ppResults[i]->ZHLB, t); + break; + case FIELD_ZJZH: + strcpy_s(ppResults[i]->ZJZH, t); + // 银河证券会出现资金账号为空的情况,只能从其它地方获取 + if (strlen(t) <= 0) + { + strcpy_s(ppResults[i]->ZJZH, ZJZH); + } + break; + case FIELD_XWDM: + strcpy_s(ppResults[i]->XWDM, t); + break; + case FIELD_RZRQBS: + strcpy_s(ppResults[i]->RZRQBS, t); + break; + case FIELD_BLXX: + strcpy_s(ppResults[i]->BLXX, t); + break; + case FIELD_JB: + strcpy_s(ppResults[i]->JB, t); + default: + break; + } + + pLast = pCurr + 1; + pCurr = strstr(pLast, "|"); + } + + ppResults[i]->ZHLB_ = atoi(ppResults[i]->ZHLB); + ppResults[i]->RZRQBS_ = atoi(ppResults[i]->RZRQBS); + + ppResults[i]->Client = Client; + } + + delete[] pBuf; +} + +void String_148(FieldInfo_STRUCT** ppFieldInfos, char* szString, REQ148_STRUCT*** pppResults, void* Client) +{ + *pppResults = nullptr; + if (szString == nullptr) + return; + + char* pBuf = new char[strlen(szString) + 1]; + strcpy(pBuf, szString); + + vector vct; + + // 分好多少列 + char* token = strtok(pBuf, "\r\n"); + int i = 0; + while (token) + { + if (i>0) + { + vct.push_back(token); + } + token = strtok(nullptr, "\r\n"); + ++i; + } + + int count = vct.size(); + + REQ148_STRUCT** ppResults = new REQ148_STRUCT*[count + 1](); + ppResults[count] = nullptr; + *pppResults = ppResults; + + for (int i = 0; i < count; ++i) + { + ppResults[i] = new REQ148_STRUCT(); + + // 不用strtok是因为第1位,和空白位会丢失,导致数据处理错误 + int header_count = GetCountTableHeader(ppFieldInfos); + + char* pLast = vct[i]; + char* pCurr = strstr(vct[i], "|"); + + for (int j = 0; j < header_count; ++j) + { + // 国金,取出来的一条记录没有4个,只有3个 + if (pCurr == nullptr) + break; + + *pCurr = 0; + char* t = pLast; + + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + switch (pRow->FieldID) + { + case FIELD_KHH: + strcpy_s(ppResults[i]->CPZH, t); + break; + case FIELD_ZHLB: + strcpy_s(ppResults[i]->ZHLB, t); + break; + case FIELD_FJYZHBZ: + strcpy_s(ppResults[i]->FJYZHBZ, t); + break; + case FIELD_RZRQBS: + strcpy_s(ppResults[i]->RZRQBS, t); + break; + case FIELD_BLXX: + strcpy_s(ppResults[i]->BLXX, t); + break; + default: + break; + } + + pLast = pCurr + 1; + pCurr = strstr(pLast, "|"); + } + + ppResults[i]->Client = Client; + } + + delete[] pBuf; +} + +void CharTable2GDLB3(char* ppTable, GDLB_STRUCT*** pppResults, void* Client) +{ + *pppResults = nullptr; + if (ppTable == nullptr) + return; + +} + +void CharTable2Login(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, GDLB_STRUCT*** pppResults, void* Client, FieldInfo_STRUCT** ppFieldInfos_148,char* CPZH) +{ + *pppResults = nullptr; + if (ppTable == nullptr) + return; + + bool bFind = false; + // 如果有数据,第一列就不为空 + int i = 0; + int j = 0; + char* p = ppTable[i * COL_EACH_ROW + j]; + + // 产品账号,即资金账号 + //char CPZH[32] = { 0 }; + while (p != nullptr) + { + int requstid = atoi(p); + // 银河证券没有资金账号,只有句柄,得想法转成资金账号 + if ((requstid == REQUEST_148 + 1) && (ppFieldInfos_148 != nullptr)) + { + // 这里假定句柄关系可以提前取到 + REQ148_STRUCT** ppRS = nullptr; + String_148(ppFieldInfos_148, ppTable[i * COL_EACH_ROW + 2], &ppRS, Client); + // 复制,然后清理 + int count = GetCountStructs((void**)ppRS); + if (count > 0) + { + strcpy(CPZH, ppRS[0]->CPZH); + } + + DeleteStructs((void***)&ppRS); + } + + if (requstid == REQUEST_GDLB + 1) + { + String2GDLB2(ppFieldInfos, ppTable[i * COL_EACH_ROW + 2], pppResults, Client, CPZH); + bFind = true; + } + + ++i; + p = ppTable[i * COL_EACH_ROW + j]; + } + + // 香港账号可能没有开头的一些数字,只能自己识别 + // 光证国际,登录时的资金帐号,查询股东列表,两个数据完全不一样,再查一次会覆盖 + if (!bFind) + { + int count = 1; + GDLB_STRUCT** ppResults = new GDLB_STRUCT*[count + 1](); + ppResults[count] = nullptr; + *pppResults = ppResults; + + + int i = 0; + int j = 0; + char* p = ppTable[i * COL_EACH_ROW + j]; + int pos = 0; + + while (p != nullptr) + { + char * flag = ppTable[i * COL_EACH_ROW + 10]; + if (flag) + { + if (strcmp(flag, "资金帐号") == 0) + { + ppResults[pos] = new GDLB_STRUCT(); + + strcpy_s(ppResults[pos]->ZJZH, ppTable[i * COL_EACH_ROW + 0]); + strcpy_s(ppResults[pos]->GDMC, ppTable[i * COL_EACH_ROW + 1]); + ++pos; + } + } + + ++i; + p = ppTable[i * COL_EACH_ROW + j]; + } + } + + return; +} + +int GetCountStructs(void** ppResults) +{ + if (ppResults == nullptr) + return -1; + + int i = 0; + void* pRow = ppResults[i]; + while (pRow != 0) + { + ++i; + pRow = ppResults[i]; + } + return i; +} + +void DeleteRequestRespone(RequestResponse_STRUCT* pRespone) +{ + if (pRespone == nullptr) + return; + + DeleteTableBody(pRespone->ppResults); + DeleteError(pRespone->pErr); + // 会不会是由它导致的每次内存没有释放干净? + //delete[] pRespone; +} + +void CharTable2XGSGEDCX(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, XGSGEDCX_STRUCT*** pppResults, void* Client) +{ + *pppResults = nullptr; + if (ppTable == nullptr) + return; + + int count = GetRowCountTableBody(ppTable); + if (count <= 0) + return; + + XGSGEDCX_STRUCT** ppResults = new XGSGEDCX_STRUCT*[count + 1](); + ppResults[count] = nullptr; + *pppResults = ppResults; + + for (int i = 0; i < count; ++i) + { + ppResults[i] = new XGSGEDCX_STRUCT(); + + int j = 0; + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + while (pRow != 0) + { + char* t = ppTable[i * COL_EACH_ROW + j]; + switch (pRow->FieldID) + { + case FIELD_ZJZH: + strcpy_s(ppResults[i]->ZJZH, t); + break; + case FIELD_CS: + strcpy_s(ppResults[i]->CS, t); + break; + case FIELD_ZHLB: + strcpy_s(ppResults[i]->ZHLB, t); + break; + case FIELD_GDDM: + strcpy_s(ppResults[i]->GDDM, t); + break; + case FIELD_JYSMC: + strcpy_s(ppResults[i]->JYSMC, t); + break; + case FIELD_XGSGED_5679: + strcpy_s(ppResults[i]->XGSGED, t); + break; + case FIELD_KSGED: + strcpy_s(ppResults[i]->KSGED, t); + break; + case FIELD_CZSJ: + strcpy_s(ppResults[i]->CZSJ, t); + break; + case FIELD_JB: + strcpy_s(ppResults[i]->JB, t); + break; + case FIELD_BLXX: + strcpy_s(ppResults[i]->BLXX, t); + break; + case FIELD_SGED_961: + strcpy_s(ppResults[i]->SGED_961, t); + break; + case FIELD_XGSGED_5564: + strcpy_s(ppResults[i]->XGSGED_5564, t); + break; + case FIELD_XGSGED_5718: + strcpy_s(ppResults[i]->XGSGED_5718, t); + break; + case FIELD_KHSZED_5759: + strcpy_s(ppResults[i]->KHSZED_5759, t); + break; + case FIELD_ZHED: + strcpy_s(ppResults[i]->ZHED, t); + break; + } + ++j; + pRow = ppFieldInfos[j]; + } + + + ppResults[i]->CS_ = atof(ppResults[i]->CS); + ppResults[i]->ZHLB_ = atoi(ppResults[i]->ZHLB); + ppResults[i]->XGSGED_ = atof(ppResults[i]->XGSGED); + ppResults[i]->SGED_961_ = atof(ppResults[i]->SGED_961); + ppResults[i]->KSGED_ = atof(ppResults[i]->KSGED); + ppResults[i]->XGSGED_5564_ = atof(ppResults[i]->XGSGED_5564); + ppResults[i]->XGSGED_5718_ = atof(ppResults[i]->XGSGED_5718); + ppResults[i]->ZHED_ = atof(ppResults[i]->ZHED); + ppResults[i]->KHSZED_5759_ = atof(ppResults[i]->KHSZED_5759); + + ppResults[i]->XGSGED_ = max(ppResults[i]->XGSGED_, ppResults[i]->SGED_961_); + ppResults[i]->XGSGED_ = max(ppResults[i]->XGSGED_, ppResults[i]->KSGED_); + ppResults[i]->XGSGED_ = max(ppResults[i]->XGSGED_, ppResults[i]->XGSGED_5564_); + ppResults[i]->XGSGED_ = max(ppResults[i]->XGSGED_, ppResults[i]->XGSGED_5718_); + ppResults[i]->XGSGED_ = max(ppResults[i]->XGSGED_, ppResults[i]->ZHED_); + ppResults[i]->XGSGED_ = max(ppResults[i]->XGSGED_, ppResults[i]->KHSZED_5759_); + + + ppResults[i]->Client = Client; } } -void CharTable2ZJYE(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, ZJYE_STRUCT*** pppResults) + +void CharTable2KSGXGCX(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, KSGXGCX_STRUCT*** pppResults, void* Client) { *pppResults = nullptr; if (ppTable == nullptr) @@ -916,47 +953,90 @@ void CharTable2ZJYE(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, ZJYE_STRUCT if (count <= 0) return; - ZJYE_STRUCT** ppResults = new ZJYE_STRUCT*[count + 1](); + KSGXGCX_STRUCT** ppResults = new KSGXGCX_STRUCT*[count + 1](); ppResults[count] = nullptr; *pppResults = ppResults; - int col_132 = GetIndexByFieldID(ppFieldInfos, FIELD_BZ); - int col_300 = GetIndexByFieldID(ppFieldInfos, FIELD_ZJYE); - int col_301 = GetIndexByFieldID(ppFieldInfos, FIELD_KYZJ); - int col_310 = GetIndexByFieldID(ppFieldInfos, FIELD_ZZC_310); - int col_302 = GetIndexByFieldID(ppFieldInfos, FIELD_KQZJ); - int col_121 = GetIndexByFieldID(ppFieldInfos, FIELD_ZJZH); - int col_205 = GetIndexByFieldID(ppFieldInfos, FIELD_ZXSZ); - for (int i = 0; i < count; ++i) { - ppResults[i] = new ZJYE_STRUCT(); - - //if (col_132 >= 0) - strcpy_s(ppResults[i]->BZ, ppTable[i * COL_EACH_ROW + col_132]); - //if (col_300 >= 0) - strcpy_s(ppResults[i]->ZJYE, ppTable[i * COL_EACH_ROW + col_300]); - //if (col_301 >= 0) - strcpy_s(ppResults[i]->KYZJ, ppTable[i * COL_EACH_ROW + col_301]); - //if (col_310 >= 0) - strcpy_s(ppResults[i]->ZZC, ppTable[i * COL_EACH_ROW + col_310]); - if (col_302 >= 0) - strcpy_s(ppResults[i]->KQZJ, ppTable[i * COL_EACH_ROW + col_302]); - if (col_121 >= 0) - strcpy_s(ppResults[i]->ZJZH, ppTable[i * COL_EACH_ROW + col_121]); - if (col_205 >= 0) - strcpy_s(ppResults[i]->ZXSZ, ppTable[i * COL_EACH_ROW + col_205]); - - - ppResults[i]->ZJYE_ = atof(ppResults[i]->ZJYE); - ppResults[i]->KYZJ_ = atof(ppResults[i]->KYZJ); - ppResults[i]->ZZC_ = atof(ppResults[i]->ZZC); - ppResults[i]->KQZJ_ = atof(ppResults[i]->KQZJ); - ppResults[i]->ZXSZ_ = atof(ppResults[i]->ZXSZ); + ppResults[i] = new KSGXGCX_STRUCT(); + + int j = 0; + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + while (pRow != 0) + { + char* t = ppTable[i * COL_EACH_ROW + j]; + switch (pRow->FieldID) + { + case FIELD_ZQDM: + strcpy_s(ppResults[i]->ZQDM, t); + break; + case FIELD_ZQMC: + strcpy_s(ppResults[i]->ZQMC, t); + break; + case FIELD_FXJG: + strcpy_s(ppResults[i]->FXJG, t); + break; + case FIELD_ZDSL: + strcpy_s(ppResults[i]->ZDSL, t); + break; + case FIELD_ZGSL: + strcpy_s(ppResults[i]->ZGSL, t); + break; + case FIELD_WTSL: + strcpy_s(ppResults[i]->WTSL, t); + break; + case FIELD_WTRQ: + strcpy_s(ppResults[i]->WTRQ, t); + break; + case FIELD_JYSDM: + strcpy_s(ppResults[i]->JYSDM, t); + break; + case FIELD_JYSMC: + strcpy_s(ppResults[i]->JYSMC, t); + break; + case FIELD_CZSJ: + strcpy_s(ppResults[i]->CZSJ, t); + break; + case FIELD_JB: + strcpy_s(ppResults[i]->JB, t); + break; + case FIELD_BLXX: + strcpy_s(ppResults[i]->BLXX, t); + break; + case FIELD_SGSX: + strcpy_s(ppResults[i]->SGSX, t); + break; + case FIELD_WTJG: + strcpy_s(ppResults[i]->WTJG, t); + break; + case FIELD_ZHLB: + strcpy_s(ppResults[i]->ZHLB, t); + break; + } + ++j; + pRow = ppFieldInfos[j]; + } + + ppResults[i]->FXJG_ = atof(ppResults[i]->FXJG); + ppResults[i]->ZDSL_ = atof(ppResults[i]->ZDSL); + ppResults[i]->ZGSL_ = atof(ppResults[i]->ZGSL); + ppResults[i]->WTSL_ = atof(ppResults[i]->WTSL); + ppResults[i]->WTRQ_ = atoi(ppResults[i]->WTRQ); + ppResults[i]->JYSDM_ = atoi(ppResults[i]->JYSDM); + ppResults[i]->SGSX_ = atof(ppResults[i]->SGSX); + ppResults[i]->WTJG_ = atof(ppResults[i]->WTJG); + ppResults[i]->ZHLB_ = atof(ppResults[i]->ZHLB); + + ppResults[i]->ZGSL_ = max(ppResults[i]->ZGSL_, ppResults[i]->SGSX_); + ppResults[i]->FXJG_ = max(ppResults[i]->FXJG_, ppResults[i]->WTJG_); + ppResults[i]->JYSDM_ = max(ppResults[i]->JYSDM_, ppResults[i]->ZHLB_); + + ppResults[i]->Client = Client; } } -void CharTable2HQ(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, HQ_STRUCT*** pppResults) +void CharTable2HQ(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, HQ_STRUCT*** pppResults, void* Client) { *pppResults = nullptr; if (ppTable == nullptr) @@ -970,120 +1050,129 @@ void CharTable2HQ(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, HQ_STRUCT*** ppResults[count] = nullptr; *pppResults = ppResults; - int col_140 = GetIndexByFieldID(ppFieldInfos, FIELD_ZQDM); - int col_141 = GetIndexByFieldID(ppFieldInfos, FIELD_ZQMC); - int col_946 = GetIndexByFieldID(ppFieldInfos, FIELD_ZSJ); - int col_945 = GetIndexByFieldID(ppFieldInfos, FIELD_JKJ); - int col_948 = GetIndexByFieldID(ppFieldInfos, FIELD_GZLX); - int col_949 = GetIndexByFieldID(ppFieldInfos, FIELD_DQJ); - int col_910 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_PRICE_1); - int col_911 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_PRICE_2); - int col_912 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_PRICE_3); - int col_913 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_PRICE_4); - int col_914 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_PRICE_5); - int col_900 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_SIZE_1); - int col_901 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_SIZE_2); - int col_902 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_SIZE_3); - int col_903 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_SIZE_4); - int col_904 = GetIndexByFieldID(ppFieldInfos, FIELD_BID_SIZE_5); - int col_930 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_PRICE_1); - int col_931 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_PRICE_2); - int col_932 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_PRICE_3); - int col_933 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_PRICE_4); - int col_934 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_PRICE_5); - int col_920 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_SIZE_1); - int col_921 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_SIZE_2); - int col_922 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_SIZE_3); - int col_923 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_SIZE_4); - int col_924 = GetIndexByFieldID(ppFieldInfos, FIELD_ASK_SIZE_5); - int col_100 = GetIndexByFieldID(ppFieldInfos, FIELD_JYSDM); - int col_187 = GetIndexByFieldID(ppFieldInfos, FIELD_ZXJYGS); - int col_226 = GetIndexByFieldID(ppFieldInfos, FIELD_ZXMRBDJW); - int col_227 = GetIndexByFieldID(ppFieldInfos, FIELD_ZXMCBDJW); - int col_125 = GetIndexByFieldID(ppFieldInfos, FIELD_ZHLB); - int col_132 = GetIndexByFieldID(ppFieldInfos, FIELD_BZ); - int col_958 = GetIndexByFieldID(ppFieldInfos, FIELD_GZBS); - int col_940 = GetIndexByFieldID(ppFieldInfos, FIELD_ZTJG); - int col_941 = GetIndexByFieldID(ppFieldInfos, FIELD_DTJG); - int col_1213 = GetIndexByFieldID(ppFieldInfos, FIELD_BLXX); - for (int i = 0; i < count; ++i) { ppResults[i] = new HQ_STRUCT(); - //if (col_140 >= 0) - strcpy_s(ppResults[i]->ZQDM, ppTable[i * COL_EACH_ROW + col_140]); - if (col_141 >= 0) - strcpy_s(ppResults[i]->ZQMC, ppTable[i * COL_EACH_ROW + col_141]); - if (col_946 >= 0) - strcpy_s(ppResults[i]->ZSJ, ppTable[i * COL_EACH_ROW + col_946]); - if (col_945 >= 0) - strcpy_s(ppResults[i]->JKJ, ppTable[i * COL_EACH_ROW + col_945]); - if (col_948 >= 0) - strcpy_s(ppResults[i]->GZLX, ppTable[i * COL_EACH_ROW + col_948]); - //if (col_949 >= 0) - strcpy_s(ppResults[i]->DQJ, ppTable[i * COL_EACH_ROW + col_949]); - //if (col_910 >= 0) - strcpy_s(ppResults[i]->BidPrice1, ppTable[i * COL_EACH_ROW + col_910]); - //if (col_911 >= 0) - strcpy_s(ppResults[i]->BidPrice2, ppTable[i * COL_EACH_ROW + col_911]); - //if (col_912 >= 0) - strcpy_s(ppResults[i]->BidPrice3, ppTable[i * COL_EACH_ROW + col_912]); - //if (col_913 >= 0) - strcpy_s(ppResults[i]->BidPrice4, ppTable[i * COL_EACH_ROW + col_913]); - //if (col_914 >= 0) - strcpy_s(ppResults[i]->BidPrice5, ppTable[i * COL_EACH_ROW + col_914]); - //if (col_900 >= 0) - strcpy_s(ppResults[i]->BidSize1, ppTable[i * COL_EACH_ROW + col_900]); - //if (col_901 >= 0) - strcpy_s(ppResults[i]->BidSize2, ppTable[i * COL_EACH_ROW + col_901]); - //if (col_902 >= 0) - strcpy_s(ppResults[i]->BidSize3, ppTable[i * COL_EACH_ROW + col_902]); - //if (col_903 >= 0) - strcpy_s(ppResults[i]->BidSize4, ppTable[i * COL_EACH_ROW + col_903]); - //if (col_904 >= 0) - strcpy_s(ppResults[i]->BidSize5, ppTable[i * COL_EACH_ROW + col_904]); - //if (col_930 >= 0) - strcpy_s(ppResults[i]->AskPrice1, ppTable[i * COL_EACH_ROW + col_930]); - //if (col_931 >= 0) - strcpy_s(ppResults[i]->AskPrice2, ppTable[i * COL_EACH_ROW + col_931]); - //if (col_932 >= 0) - strcpy_s(ppResults[i]->AskPrice3, ppTable[i * COL_EACH_ROW + col_932]); - //if (col_933 >= 0) - strcpy_s(ppResults[i]->AskPrice4, ppTable[i * COL_EACH_ROW + col_933]); - //if (col_934 >= 0) - strcpy_s(ppResults[i]->AskPrice5, ppTable[i * COL_EACH_ROW + col_934]); - //if (col_920 >= 0) - strcpy_s(ppResults[i]->AskSize1, ppTable[i * COL_EACH_ROW + col_920]); - //if (col_921 >= 0) - strcpy_s(ppResults[i]->AskSize2, ppTable[i * COL_EACH_ROW + col_921]); - //if (col_922 >= 0) - strcpy_s(ppResults[i]->AskSize3, ppTable[i * COL_EACH_ROW + col_922]); - //if (col_923 >= 0) - strcpy_s(ppResults[i]->AskSize4, ppTable[i * COL_EACH_ROW + col_923]); - //if (col_924 >= 0) - strcpy_s(ppResults[i]->AskSize5, ppTable[i * COL_EACH_ROW + col_924]); - //if (col_100 >= 0) - strcpy_s(ppResults[i]->JYSDM, ppTable[i * COL_EACH_ROW + col_100]); - //if (col_187 >= 0) - strcpy_s(ppResults[i]->ZXJYGS, ppTable[i * COL_EACH_ROW + col_187]); - //if (col_226 >= 0) - strcpy_s(ppResults[i]->ZXMRBDJW, ppTable[i * COL_EACH_ROW + col_226]); - //if (col_227 >= 0) - strcpy_s(ppResults[i]->ZXMCBDJW, ppTable[i * COL_EACH_ROW + col_227]); - //if (col_125 >= 0) - strcpy_s(ppResults[i]->ZHLB, ppTable[i * COL_EACH_ROW + col_125]); - //if (col_132 >= 0) - strcpy_s(ppResults[i]->BZ, ppTable[i * COL_EACH_ROW + col_132]); - //if (col_958 >= 0) - strcpy_s(ppResults[i]->GZBS, ppTable[i * COL_EACH_ROW + col_958]); - if (col_940 >= 0) - strcpy_s(ppResults[i]->ZTJG, ppTable[i * COL_EACH_ROW + col_940]); - if (col_941 >= 0) - strcpy_s(ppResults[i]->DTJG, ppTable[i * COL_EACH_ROW + col_941]); - if (col_1213 >= 0) - strcpy_s(ppResults[i]->BLXX, ppTable[i * COL_EACH_ROW + col_1213]); - + int j = 0; + FieldInfo_STRUCT* pRow = ppFieldInfos[j]; + while (pRow != 0) + { + char* t = ppTable[i * COL_EACH_ROW + j]; + switch (pRow->FieldID) + { + case FIELD_ZQDM: + strcpy_s(ppResults[i]->ZQDM, t); + break; + case FIELD_ZQMC: + strcpy_s(ppResults[i]->ZQMC, t); + break; + case FIELD_ZSJ: + strcpy_s(ppResults[i]->ZSJ, t); + break; + case FIELD_JKJ: + strcpy_s(ppResults[i]->JKJ, t); + break; + case FIELD_GZLX: + strcpy_s(ppResults[i]->GZLX, t); + break; + case FIELD_DQJ: + strcpy_s(ppResults[i]->DQJ, t); + break; + case FIELD_BID_PRICE_1: + strcpy_s(ppResults[i]->BidPrice1, t); + break; + case FIELD_BID_PRICE_2: + strcpy_s(ppResults[i]->BidPrice2, t); + break; + case FIELD_BID_PRICE_3: + strcpy_s(ppResults[i]->BidPrice3, t); + break; + case FIELD_BID_PRICE_4: + strcpy_s(ppResults[i]->BidPrice4, t); + break; + case FIELD_BID_PRICE_5: + strcpy_s(ppResults[i]->BidPrice5, t); + break; + case FIELD_BID_SIZE_1: + strcpy_s(ppResults[i]->BidSize1, t); + break; + case FIELD_BID_SIZE_2: + strcpy_s(ppResults[i]->BidSize2, t); + break; + case FIELD_BID_SIZE_3: + strcpy_s(ppResults[i]->BidSize3, t); + break; + case FIELD_BID_SIZE_4: + strcpy_s(ppResults[i]->BidSize4, t); + break; + case FIELD_BID_SIZE_5: + strcpy_s(ppResults[i]->BidSize5, t); + break; + case FIELD_ASK_PRICE_1: + strcpy_s(ppResults[i]->AskPrice1, t); + break; + case FIELD_ASK_PRICE_2: + strcpy_s(ppResults[i]->AskPrice2, t); + break; + case FIELD_ASK_PRICE_3: + strcpy_s(ppResults[i]->AskPrice3, t); + break; + case FIELD_ASK_PRICE_4: + strcpy_s(ppResults[i]->AskPrice4, t); + break; + case FIELD_ASK_PRICE_5: + strcpy_s(ppResults[i]->AskPrice5, t); + break; + case FIELD_ASK_SIZE_1: + strcpy_s(ppResults[i]->AskSize1, t); + break; + case FIELD_ASK_SIZE_2: + strcpy_s(ppResults[i]->AskSize2, t); + break; + case FIELD_ASK_SIZE_3: + strcpy_s(ppResults[i]->AskSize3, t); + break; + case FIELD_ASK_SIZE_4: + strcpy_s(ppResults[i]->AskSize4, t); + break; + case FIELD_ASK_SIZE_5: + strcpy_s(ppResults[i]->AskSize5, t); + break; + case FIELD_JYSDM: + strcpy_s(ppResults[i]->JYSDM, t); + break; + case FIELD_ZXJYGS: + strcpy_s(ppResults[i]->ZXJYGS, t); + break; + case FIELD_ZXMRBDJW: + strcpy_s(ppResults[i]->ZXMRBDJW, t); + break; + case FIELD_ZXMCBDJW: + strcpy_s(ppResults[i]->ZXMCBDJW, t); + break; + case FIELD_ZHLB: + strcpy_s(ppResults[i]->ZHLB, t); + break; + case FIELD_BZ: + strcpy_s(ppResults[i]->BZ, t); + break; + case FIELD_GZBS: + strcpy_s(ppResults[i]->GZBS, t); + break; + case FIELD_ZTJG: + strcpy_s(ppResults[i]->ZTJG, t); + break; + case FIELD_DTJG: + strcpy_s(ppResults[i]->DTJG, t); + break; + case FIELD_BLXX: + strcpy_s(ppResults[i]->BLXX, t); + break; + } + ++j; + pRow = ppFieldInfos[j]; + } ppResults[i]->ZSJ_ = atof(ppResults[i]->ZSJ); ppResults[i]->JKJ_ = atof(ppResults[i]->JKJ); @@ -1115,169 +1204,197 @@ void CharTable2HQ(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, HQ_STRUCT*** ppResults[i]->ZXMCBDJW_ = atof(ppResults[i]->ZXMCBDJW); ppResults[i]->ZTJG_ = atof(ppResults[i]->ZTJG); ppResults[i]->DTJG_ = atof(ppResults[i]->DTJG); + + ppResults[i]->Client = Client; } } +//void CharTable2XGPHCX(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, XGPHCX_STRUCT*** pppResults, void* Client) +//{ +// *pppResults = nullptr; +// if (ppTable == nullptr) +// return; +// +// int count = GetRowCountTableBody(ppTable); +// if (count <= 0) +// return; +// +// XGPHCX_STRUCT** ppResults = new XGPHCX_STRUCT*[count + 1](); +// ppResults[count] = nullptr; +// *pppResults = ppResults; +// +// for (int i = 0; i < count; ++i) +// { +// ppResults[i] = new XGPHCX_STRUCT(); +// +// int j = 0; +// FieldInfo_STRUCT* pRow = ppFieldInfos[j]; +// while (pRow != 0) +// { +// char* t = ppTable[i * COL_EACH_ROW + j]; +// switch (pRow->FieldID) +// { +// case FIELD_PHRQ: +// strcpy_s(ppResults[i]->PHRQ, t); +// break; +// case FIELD_ZQDM: +// strcpy_s(ppResults[i]->ZQDM, t); +// break; +// case FIELD_ZQMC: +// strcpy_s(ppResults[i]->ZQMC, t); +// break; +// case FIELD_QSPH: +// strcpy_s(ppResults[i]->QSPH, t); +// break; +// case FIELD_PHSL: +// strcpy_s(ppResults[i]->PHSL, t); +// break; +// case FIELD_ZHLB: +// strcpy_s(ppResults[i]->ZHLB, t); +// break; +// case FIELD_BLXX: +// strcpy_s(ppResults[i]->BLXX, t); +// break; +// } +// ++j; +// pRow = ppFieldInfos[j]; +// } +// +// ppResults[i]->PHRQ_ = atoi(ppResults[i]->PHRQ); +// ppResults[i]->QSPH_ = atoi(ppResults[i]->QSPH); +// ppResults[i]->PHSL_ = atoi(ppResults[i]->PHSL); +// ppResults[i]->ZHLB_ = atoi(ppResults[i]->ZHLB); +// +// ppResults[i]->Client = Client; +// } +//} -void DeleteStructs(void*** pppStructs) +#else + + +void OutputCSVTableHeader(FILE* pFile, FieldInfo_STRUCT** ppHeader) { - if (*pppStructs == nullptr) + if (ppHeader == nullptr || pFile == nullptr) return; - void** ppStructs = *pppStructs; - int i = 0; - while (ppStructs[i] != 0) + FieldInfo_STRUCT* pRow = ppHeader[i]; + while (pRow != 0) { - delete[] ppStructs[i]; - ppStructs[i] = nullptr; + char buf[512] = { 0 }; + fprintf(pFile, "%d_%s,",//"%d,%s,%d,%d,%d,%d,%d", + pRow->FieldID, pRow->FieldName, pRow->a, pRow->b, pRow->Len, pRow->d, pRow->e); ++i; + pRow = ppHeader[i]; } - - delete[] ppStructs; - *pppStructs = nullptr; + fprintf(pFile, "\n"); } -/* -6 -A74168961|WK |05000000100801|1| 0| | -013086113|WK |05000000100801|0| 0| | - -7 -A12121217|ZHT|1| 40690000|28356| 0|主股东| -015597938|ZHT|0| 40690000|394232|0|主股东| - -5 -A341083000|LK|1| |主股东| -0189181400|LK|0| |主股东| - -8 -E015976151|HT|1|88500918| 12982|1| |主股东| -0601605823|HT|0|88500918| 354000|1| |主股东| -*/ -void String2GDLB(char* szString, GDLB_STRUCT*** pppResults) +void OutputCSVTableBody(FILE* pFile, char** ppTable) { - *pppResults = nullptr; - if (szString == nullptr) + if (ppTable == nullptr || pFile == nullptr) return; - char* pBuf = new char[strlen(szString) + 1]; - strcpy(pBuf, szString); - - vector vct; - - // 分好多少列 - char* token = strtok(pBuf, "\r\n"); + // 如果有数据,第一列就不为空 int i = 0; - while (token) + int j = 0; + char* p = ppTable[i * COL_EACH_ROW + j]; + while (p != nullptr) { - if (i>0) + //printf("%d:", i); + for (j = 0; j < COL_EACH_ROW; ++j) { - vct.push_back(token); + p = ppTable[i * COL_EACH_ROW + j]; + if (p) + { + fprintf(pFile, "%s,", p); + } + else + break; } - token = strtok(nullptr, "\r\n"); + fprintf(pFile, "\n"); + j = 0; ++i; + p = ppTable[i * COL_EACH_ROW + j]; } - int count = vct.size(); + return; +} - GDLB_STRUCT** ppResults = new GDLB_STRUCT*[count + 1](); - ppResults[count] = nullptr; - *pppResults = ppResults; +void OutputCSVTableBody(FILE* pFile, char** ppTable, int count) +{ + if (ppTable == nullptr || pFile == nullptr) + return; - for (int i = 0; i < count;++i) + for (int i = 0; i < count; ++i) { - ppResults[i] = new GDLB_STRUCT(); - - vector v1; - vector v2; - vector v3; - char* t = strtok(vct[i], "|"); - int j = 0; - while (t) + //printf("%d:", i); + for (int j = 0; j < COL_EACH_ROW; ++j) { - int len = strlen(t); - if (len == 1) - { - v2.push_back(t); - } - else if (len>0) + char* p = ppTable[i * COL_EACH_ROW + j]; + if (p) { - if (t[0]>127||t[0]<0) - { - v3.push_back(t); - } - else - { - v1.push_back(t); - } + fprintf(pFile, "%s,", p); + } - t = strtok(nullptr, "|"); + else + break; } + fprintf(pFile, "\n"); + } - strcpy_s(ppResults[i]->GDDM, v1[0]); - if (v1.size() > 1) - strcpy_s(ppResults[i]->ZJZH, v1[1]); - if (v1.size() > 2) - strcpy_s(ppResults[i]->XWDM, v1[2]); - - strcpy_s(ppResults[i]->ZHLB, v2[0]); - if (v2.size() > 1) - strcpy_s(ppResults[i]->RZRQBS, v2[1]); + return; +} - if (v3.size()>0) - strcpy_s(ppResults[i]->GDMC, v3[0]); - if (v3.size()>1) - strcpy_s(ppResults[i]->BLXX, v3[1]); - ppResults[i]->ZHLB_ = atoi(ppResults[i]->ZHLB); - ppResults[i]->RZRQBS_ = atoi(ppResults[i]->RZRQBS); +void OutputCSVError(FILE* pFile, Error_STRUCT* pErr) +{ + if (pErr == nullptr) + { + return; } - delete[] pBuf; + fprintf(pFile, "%d,%d,%s\n", pErr->ErrType, pErr->ErrCode, pErr->ErrInfo); } -void CharTable2Login(char** ppTable, GDLB_STRUCT*** pppResults) +void OutputCSVErrors(FILE* pFile, Error_STRUCT** pErrs) { - *pppResults = nullptr; - if (ppTable == nullptr) + if (pErrs == nullptr) return; - // 如果有数据,第一列就不为空 int i = 0; - int j = 0; - char* p = ppTable[i * COL_EACH_ROW + j]; - while (p != nullptr) + Error_STRUCT* pErr = pErrs[i]; + while (pErr != nullptr) { - int requstid = atoi(p); - if (requstid == REQUEST_GDLB + 1) - { - String2GDLB(ppTable[i * COL_EACH_ROW + 2], pppResults); - } + fprintf(pFile, "%d:%d,%d,%s\n", i, pErr->ErrType, pErr->ErrCode, pErr->ErrInfo); ++i; - p = ppTable[i * COL_EACH_ROW + j]; + pErr = pErrs[i]; } - - return; } -int GetCountStructs(void** ppResults) +void OutputCSVErrors(FILE* pFile, Error_STRUCT** pErrs, int count) { - if (ppResults == nullptr) - return -1; + if (pErrs == nullptr) + { + return; + } - int i = 0; - void* pRow = ppResults[i]; - while (pRow != 0) + for (int i = 0; i < count; ++i) { - ++i; - pRow = ppResults[i]; + Error_STRUCT* pErr = pErrs[i]; + if (pErr) + { + fprintf(pFile, "%d:%d,%d,%s\n", i, pErr->ErrType, pErr->ErrCode, pErr->ErrInfo); + } + else + fprintf(pFile, "\n"); } - return i; } -#else + + + #endif \ No newline at end of file diff --git a/include/Tdx/tdx_function.h b/include/Tdx/tdx_function.h index 1f96d2f..05c0fa7 100644 --- a/include/Tdx/tdx_function.h +++ b/include/Tdx/tdx_function.h @@ -14,18 +14,24 @@ TDXAPI_API FieldInfo_STRUCT** CopyTableHeader(FieldInfo_STRUCT** ppHeader); #else #define TDXAPI_API __declspec(dllimport) -#endif +// 在编写代码时发现FILE不能跨DLL +void OutputCSVTableHeader(FILE* pFile, FieldInfo_STRUCT** ppHeader); + +void OutputCSVTableBody(FILE* pFile, char** ppTable); +void OutputCSVTableBody(FILE* pFile, char** ppTable, int count); -// 得到时间 -//TDXAPI_API void GetUpdateTime_HH_mm_ss(char* UpdateTime, int* _HH, int* _mm, int* _ss); +void OutputCSVError(FILE* pFile, Error_STRUCT* pErr); +void OutputCSVErrors(FILE* pFile, Error_STRUCT** pErrs); +void OutputCSVErrors(FILE* pFile, Error_STRUCT** pErrs, int count); + +#endif ////////////////////////////////////////////////////////////////////////// // 表头处理 // 打印表头信息,实际是一个指针数组,指针指向字段信息,数组最后一个指针为null TDXAPI_API void PrintTableHeader(FieldInfo_STRUCT** ppHeader); -TDXAPI_API void OutputCSVTableHeader(FILE* pFile, FieldInfo_STRUCT** ppHeader); // 根据字段名得到列索引 TDXAPI_API int GetIndexByFieldName(FieldInfo_STRUCT** ppHeader,char* FieldName); @@ -41,9 +47,6 @@ TDXAPI_API int GetCountTableHeader(FieldInfo_STRUCT** ppHeader); TDXAPI_API void PrintTableBody(char** ppTable); TDXAPI_API void PrintTableBody(char** ppTable, int count); -TDXAPI_API void OutputCSVTableBody(FILE* pFile, char** ppTable); -TDXAPI_API void OutputCSVTableBody(FILE* pFile, char** ppTable, int count); - // 取出的数据看情况是否要删除 TDXAPI_API void DeleteTableBody(char** ppTable); TDXAPI_API void DeleteTableBody(char** ppTable, int count); @@ -58,32 +61,35 @@ TDXAPI_API void PrintError(Error_STRUCT* pErr); TDXAPI_API void PrintErrors(Error_STRUCT** pErrs); TDXAPI_API void PrintErrors(Error_STRUCT** pErrs, int count); -TDXAPI_API void OutputCSVError(FILE* pFile, Error_STRUCT* pErr); -TDXAPI_API void OutputCSVErrors(FILE* pFile, Error_STRUCT** pErrs); -TDXAPI_API void OutputCSVErrors(FILE* pFile, Error_STRUCT** pErrs, int count); - TDXAPI_API void DeleteError(Error_STRUCT* pErr); TDXAPI_API void DeleteErrors(Error_STRUCT** pErrs); TDXAPI_API void DeleteErrors(Error_STRUCT** pErrs, int count); // 得到错误数 TDXAPI_API int GetCountErrors(Error_STRUCT** pErrs); - ////////////////////////////////////////////////////////////////////////// -// 将字符串表转成特定对 -TDXAPI_API void CharTable2GDLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, GDLB_STRUCT*** pppResults); - -TDXAPI_API void CharTable2WTLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, WTLB_STRUCT*** pppResults); - -TDXAPI_API void CharTable2CJLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, CJLB_STRUCT*** pppResults); - -TDXAPI_API void CharTable2GFLB(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, GFLB_STRUCT*** pppResults); +TDXAPI_API int GetCountStructs(void** ppResults); +// 删除,注意,也存在Debug与Release的问题,所以在别的dll中生成的内存最好也在别的地方删 +TDXAPI_API void DeleteStructs(void*** pppStructs); +////////////////////////////////////////////////////////////////////////// +// 股东列表处理,用于授权部分 +TDXAPI_API void CharTable2GDLB(FieldInfo_STRUCT** ppFieldInfos_1122, char** ppTable, GDLB_STRUCT*** pppResults, void* Client); +// 由于部分券商股东列表中没有资金账号,只能从登录信息中另外获取 +TDXAPI_API void CharTable2Login(FieldInfo_STRUCT** ppFieldInfos_1122, char** ppTable, GDLB_STRUCT*** pppResults, void* Client, FieldInfo_STRUCT** ppFieldInfos_148, char* CPZH); +// 删除请求和响应,进行内存释放 +TDXAPI_API void DeleteRequestRespone(RequestResponse_STRUCT* pRespone); -TDXAPI_API void CharTable2ZJYE(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, ZJYE_STRUCT*** pppResults); +////////////////////////////////////////////////////////////////////////// +// 打新结构体解析 -TDXAPI_API void CharTable2HQ(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, HQ_STRUCT*** pppResults); +// 新股申购额度查询 +TDXAPI_API void CharTable2XGSGEDCX(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, XGSGEDCX_STRUCT*** pppResults, void* Client); +// 可申购新股查询 +TDXAPI_API void CharTable2KSGXGCX(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, KSGXGCX_STRUCT*** pppResults, void* Client); +//// 新股配号查询,只有收盘后或第二天才能查询到 +//TDXAPI_API void CharTable2XGPHCX(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, XGPHCX_STRUCT*** pppResults, void* Client); -TDXAPI_API void CharTable2Login(char** ppTable, GDLB_STRUCT*** pppResults); +////////////////////////////////////////////////////////////////////////// +// 行情解析 +TDXAPI_API void CharTable2HQ(FieldInfo_STRUCT** ppFieldInfos, char** ppTable, HQ_STRUCT*** pppResults, void* Client); -TDXAPI_API int GetCountStructs(void** ppResults); -TDXAPI_API void DeleteStructs(void*** pppStructs); \ No newline at end of file diff --git a/include/Tdx/tdx_request.h b/include/Tdx/tdx_request.h index 270205d..a757021 100644 --- a/include/Tdx/tdx_request.h +++ b/include/Tdx/tdx_request.h @@ -28,7 +28,7 @@ _卖一量|921_卖二量|922_卖三量|923_卖四量|924_卖五量|100_交易所 132_币种|300_资金余额|301_可用资金|310_总资产|302_可取资金|121_资金帐号|1213_保 留信息| */ -#define REQUEST_ZJYE 104 // 资金余额 +#define REQUEST_ZJYE 104 // 资金余额,信用与普通的区别是121_资金帐号不同 /* 120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|140_ 证券代码|130_买卖标志|949_当前价|301_可用资金|166_委托方式|510_合约代码|513_开平 @@ -41,7 +41,14 @@ _卖一量|921_卖二量|922_卖三量|923_卖四量|924_卖五量|100_交易所 201_可卖数量|301_可用资金|1163_融资负债|1150_融资利息|1159_融资管理费|251_提示信 息1|1213_保留信息| */ -#define REQUEST_110 110 +#define REQUEST_110 110 // 限额查询,基本就是一个下单指令 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|140_证券代码|362_页面标识|5250_CPU|5251_HD|5252_LIP|5253_系统节点编号|5254_真实营业部代码|5255_客户姓名|5256_客户代码|5257_股东代码表|5258_信用交易标志|5259_认证编 号|5261_机器绑定信息|5262_机器信息|5263_客户端版本| +=============== +100_交易所代码|140_证券代码|141_证券名称|125_帐号类别|132_币种|1228_模式|958_国债标识|960_证券类别|1213_保留信息| +*/ +#define REQUEST_178 178 // 不知道什么功能 /* 120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|100_ @@ -69,6 +76,15 @@ UID|5254_信用交易标识|5255_会话号|5256_客户代码| */ #define REQUEST_WT 202 // 委托 /* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|130_ +买卖标志|140_证券代码|144_委托数量|145_委托价格|5250_客户群组|5251_客户营业部|52 +52_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本号 +| +=============== +146_委托编号|1213_保留信息| +*/ +#define REQUEST_ZGHS 204 // 转股回售 +/* 120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207 _起始序号|126_开始日期|127_终止日期|1227_参数|101_交易所名称|5250_客户群组|5251_ 客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代 @@ -131,7 +147,16 @@ _起始序号|140_证券代码|113_操作标志|1228_模式|1299_功能版本|10 5_最新市值|204_摊簿浮动盈亏|232_实现盈亏|230_参考盈亏比例(%)|160_冻结数量|123_股 东代码|100_交易所代码|101_交易所名称|1213_保留信息| */ -#define REQUEST_GFLB 1114 // 股份列表 +#define REQUEST_GFLB 1114 // 股份列表,信用与普通的区别是121_资金帐号不同 + + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|126_开始日期|127_终止日期|1207_起始序号|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本号| +=============== +170_配号日期|123_股东代码|140_证券代码|141_证券名称|171_起始配号|172_配号数量|1213_保留信息| +*/ +#define REQUEST_XGSG_XGPHCX 1116 // 新股配号查询 + /* 120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|113_ 操作标志|299_对方分支代码|298_对方客户代码|243_对方资金帐号|158_对方密码|361_升 @@ -154,13 +179,28 @@ _起始序号|140_证券代码|113_操作标志|1228_模式|1299_功能版本|10 险标志|251_提示信息1|252_提示信息2|397_产品标志|291_字段代码|125_帐号类别|145_委 托价格|241_约定序号|201_可卖数量|144_委托数量|1213_保留信息| */ -#define REQUEST_1124 1124 // +#define REQUEST_1124 1124 // + + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|100_交易所代码|140_证券代码|1207_起始序号|126_开始日期|127_终止日期|1227_参数|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本号| +=============== +176_中签日期|140_证券代码|141_证券名称|152_成交数量|123_股东代码|1213_保留信息| +*/ +#define REQUEST_XGSG_XGZQCX 1126 // 新股中签查询 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|126_开始日期|127_终止日期|113_操作标志|1207_起始序号|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本 号| +=============== +5850_发行日期|141_证券名称|140_证券代码|418_发行价格|961_最高数量|962_最低数量|142_委托日期|101_交易所名称|1227_参数|125_帐号类别|1213_保留信息| +*/ +#define REQUEST_XGSG_KSGXGCX 1156 // 可申购新股查询 ////////////////////////////////////////////////////////////////////////// // 期权部分 /* */ -#define REQUEST_BDQSD_QQ 1294 // 备兑券锁定/解锁/撤单 +#define REQUEST_WT_QQ 1294 // 备兑券锁定/解锁/撤单 /* 120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|100_ 交易所代码|294_附加账号|234_类型|140_证券代码|391_产品代码|510_合约代码|1207_起 @@ -285,6 +325,126 @@ CPUID|5254_信用交易标识|5255_会话号|5256_客户代码| */ #define REQUEST_CYXYCX_QQ 1320 // 可用合约查询 +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|100_交易所代码|1207_起始序号|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本号| +=============== +120_客户号|100_交易所代码|101_交易所名称|123_股东代码|173_席位代码|5747_申购额度|1227_参数|125_帐号类别|1213_保留信息| +*/ +#define REQUEST_XGSG_XGSGEDCX 1340 // 新股申购额度查询 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|126_开始日期|127_终止日期|113_操作标志|1207_起始序号|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本 号| +=============== +120_客户号|140_证券代码|141_证券名称|153_成交价格|132_币种|174_中签数|1088_中签金额|5811_已缴款数量|5814_已缴款金额|5812_应补缴数量|5815_应补缴金额|5736_到账日期|123_股东代码|101_交易所名称|1213_保留信息| +*/ +#define REQUEST_XGSG_XGSGDJKCX 1370 // 新股申购待缴款查询,在国信证券中叫 新股中签查询 + +/* +*/ +#define REQUEST_XGSG_LSZQCX 1372 // 历史中签查询,在国信证券中有这个功能 + +#define REQUEST_WT_HGT 1450 // 委托,沪港通 +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|603_ +交易类型|601_ETF代码|140_证券代码|145_委托价格|604_认购数量|245_对方帐号类别|244 +_对方股东代码|485_推荐人代码|234_类型|5250_客户群组|5251_客户营业部|5252_硬盘序 +列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本号| +=============== +146_委托编号|1213_保留信息| +*/ +#define REQUEST_ETF_SGSH 3000 // ETF申购赎回 + +////////////////////////////////////////////////////////////////////////// +// 融资融券 +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|140_证券代码|130_买卖标志|166_委托方式|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本 号| +=============== +5560_信用资金额度|5563_数值|5566_--|5561_融资信息|5564_数值|5567_--|5562_融券信息|5565_数值|1213_保留信息| +*/ +#define REQUEST_XYZCXC 3200 // 信用资产查询 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|130_买卖标志|166_委托方式|140_证券代码|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本 号| +=============== +140_证券代码|141_证券名称|5982_可融数量|546_保证金比例|1187_股票折算率|5546_融券利率|101_交易所名称|1213_保留信息| +*/ +#define REQUEST_RQBDZQLB 3202 // 融券标的证券列表 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|130_买卖标志|166_委托方式|140_证券代码|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本 号| +=============== +140_证券代码|141_证券名称|1190_融资保证金比例|1191_融券保证金比例|5545_融资利率|5546_融券利率|1187_股票折算率|125_帐号类别|101_交易所名称|1213_保留信息| +*/ +#define REQUEST_RZBDZQLB 3216 // 融资标的证券列表 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|140_证券代码|1287_起始行号|1288_请求行数|1286_定位字串|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客 户代码|5257_版本号| +=============== +140_证券代码|141_证券名称|1187_股票折算率|125_帐号类别|101_交易所名称|1213_保留信息| +*/ +#define REQUEST_DBPZQCX 3220 // 担保品证券查询 + +/* +120_客户代码|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|140_证券代码|1287_起始行号|1288_请求行数|1286_定位字串|5251_用户令牌|5252_主(资金)账号|5253_(资金)账号列表|5254_(开户)超过18个月|5255_普通(资金)账号|5256_硬盘代码|5257_实际营业部| +=============== +140_证券代码|141_证券名称|546_保证金比例|1217_备注|1231_显示颜色|1213_保留信息| +*/ +#define REQUEST_RZMRBDCX 3230 // 融资买入标的查询 + +/* +120_客户代码|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|140_证券代码|1287_起始行号|1288_请求行数|1286_定位字串|130_买卖标志|5251_用户令牌|5252_主(资金)账号|5253_(资金)账号列表|5254_(开户)超过18个月|5255_ 普通(资金)账号|5256_硬盘代码|5257_实际营业部| +=============== +140_证券代码|141_证券名称|201_可用股份|546_保证金比例|125_帐号类别|101_交易所名称|1213_保留信息| +*/ +#define REQUEST_RQMCBDCX 3232 // 融券卖出标的查询 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本号| +=============== +169_流水号|522_开仓日期|1176_平仓日期|130_买卖标志|131_委托类别|140_证券代码|141_证券名称|5584_负债数量|622_保留数量|5549_已还数量|5552_当日已还数量|125_帐号类别|101_交易所名称|123_股东代码|5605_浮动盈亏|1213_保留信息| +*/ +#define REQUEST_MQHQCX 3234 // 买券还券查询,130=71 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本号| +=============== +169_流水号|522_开仓日期|1176_平仓日期|130_买卖标志|131_委托类别|140_证券代码|141_证券名称|5584_负债数量|622_保留数量|5549_已还数量|5552_当日已还数量|125_帐号类别|101_交易所名称|123_股东代码|5605_浮动盈亏|1213_保留信息| +*/ +#define REQUEST_RQHYXXLB 3238 // 现券还券,融券合约信息列表,130=73 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|130_买卖标志|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本号| +=============== +169_流水号|522_开仓日期|1176_平仓日期|130_买卖标志|131_委托类别|140_证券代码|141_证券名称|5547_负债金额|5555_尚欠金额|5550_还款金额|5553_当日已还金额|125_帐号类别|101_交易所名称|123_股东代码|5605_浮动盈亏|1213_保留信息| +*/ +#define REQUEST_XJHKLB 3246 // 现金还款,130=75 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_会话号|5256_客户代码|5257_版本号| +=============== +169_流水号|522_开仓日期|1176_平仓日期|130_买卖标志|131_委托类别|140_证券代码|141_证券名称|5547_负债金额|5555_尚欠金额|5550_还款金额|5553_当日已还金额|125_帐号类别|101_交易所名称|123_股东代码|5605_浮动盈亏|322_所需金额|1213_保留信息| +*/ +#define REQUEST_FZHYXXLB 3248 // 卖券还款,负债合约信息列表,130=76 + +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|5250_CPU|5251_HD|5252_LIP|5253_系统节点编号|5254_真实营业部代码|5255_客户姓名|5256_客户代码|5257_股东代码表|5258_GUID|5261_机器绑定信息|5262_客户权限|5259_认证编号| +=============== +140_证券代码|141_证券名称|201_可卖数量|546_保证金比例|125_帐号类别|100_交易所代码|1213_保留信息| +*/ +#define REQUEST_RQMCBDCX_ZRT 3410 // 转融通融券卖出标的查询,130=24 +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|5250_CPU|5251_HD|5252_LIP|5253_系统节点编号|5254_真实营业部代码|5255_客户姓名|5256_客户代码|5257_股东代码表|5258_GUID|5261_机器绑定信息|5262_客户权限|5259_认证编号| +=============== +522_开仓日期|759_合约编号|140_证券代码|141_证券名称|546_保证金比例|146_委托编号|145_委托价格|144_委托数量|5551_合约开仓 数量|5552_合约开仓金额|5553_合约开仓费用|5541_合约状态|10031_未还金额|10032_未还数量|5554_未还合约费用|5555_未还合约利息|10033_已还利息|10034_已还数量|10035_已还金额|5556_合约总利息|541_保证金|622_保留数量|5557_合约年利率|10036_归还截止日期|5559_了结日期|125_帐号类别|101_交易所名称|322_所需金额|50_(参数)操作数据|1233_句柄|1213_保留信息| +*/ +#define REQUEST_MQHQBDCX_ZRT 3458 // 转融通买券还券标的查询,130=34 +/* +120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1207_起始序号|5250_CPU|5251_HD|5252_LIP|5253_系统节点编号|5254_真实营业部代码|5255_客户姓名|5256_客户代码|5257_股东代码表|5258_GUID|5261_机器绑定信息|5262_客户权限|5259_认证编号| +=============== +522_开仓日期|759_合约编号|140_证券代码|141_证券名称|546_保证金比例|146_委托编号|145_委托价格|144_委托数量|5551_合约开仓 数量|5552_合约开仓金额|5553_合约开仓费用|5541_合约状态|10031_未还金额|10032_未还数量|5554_未还合约费用|5555_未还合约利息|10033_已还利息|10034_已还数量|10035_已还金额|5556_合约总利息|541_保证金|622_保留数量|5557_合约年利率|10036_归还截止日期|5559_了结日期|125_帐号类别|101_交易所名称|322_所需金额|50_(参数)操作数据|1233_句柄|1213_保留信息| +*/ +#define REQUEST_XQHQBDCX_ZRT 3462 // 转融通现券还券标的查询,130=36 + ////////////////////////////////////////////////////////////////////////// // 登录部分 @@ -335,9 +495,12 @@ ID|1218_客户权限|149_返回信息|220_客户权限代码|221_客户权限名 信息1|1210_认证方式|1204_MAC地址|1229_描述|1248_SESSION信息|295_信用交易提示信息 |275_个股期权交易标志|276_OTC交易标志|273_港股通交易标志|250_提示信息0|252_提示 信息2|1217_备注|1213_保留信息| + +120_产品账号|134_交易密码|121_产品账号|125_帐号类别|123_股东代码|1206_客户类别|1210_认证方式|1211_认证信息|122_客户名称|454_证件号码|455_移动电话|128_用户联系方式|129_用户EMAIL|188_上海股东|189_深圳股东|138_通讯密码|1117_银行代码|1118_银行 营业部|1119_银行股东代码登录市场|1234_柜台类别|1214_断线重联标志|1230_查询模式|1216_VIP标志|1235_机器信息|1243_受限模式|1248_SESSION信息|1257_重定向标志|1258_重定向信息|1292_手机机器信息|1297_登录输入参数|1244_机器特征码|1300_客户端内部版本|1301_版本字符串| +=============== +120_产品账号|122_客户名称|110_委托方式|411_开放式基金标识|1212_营业部ID|149_返回信息|1216_VIP标志|125_帐号类别|1224_非交易帐号标志|281_融资融券标识|220_客户权限代码|221_客户权限名称|1247_所需认证方式|1244_机器特征码|295_信用交易提示信息|1264_令牌|1227_是否匹配风险等级|1291_登录返回参数|450_开户类别|251_签署日期|276_OTC交易标志|252_可否转融通|253_签署途径|1233_句柄|1213_保留信息| */ -#define RESPONSE_101 101 -#define REQUEST_100 100 +#define REQUEST_100 100 // 不同的平台返回的不一样,其中 /* 120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|1117 _银行代码|1118_银行营业部|1119_银行股东代码登录市场|1234_柜台类别|138_通讯密码|1 @@ -346,7 +509,6 @@ _银行代码|1118_银行营业部|1119_银行股东代码登录市场|1234_柜 5250_客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用交易标识|5255_ 会话号|5256_客户代码|1213_保留信息| */ -#define RESPONSE_113 113 #define REQUEST_112 112 /* 120_客户号|134_交易密码|121_资金帐号|125_帐号类别|123_股东代码|110_委托方式|5250 @@ -355,8 +517,14 @@ _客户群组|5251_客户营业部|5252_硬盘序列号|5253_CPUID|5254_信用 =============== 120_客户号|281_融资融券标识|411_开放式基金标识|110_委托方式|1213_保留信息| */ -#define RESPONSE_149 149 #define REQUEST_148 148 +/* +120_产品账号|134_交易密码|121_产品账号|125_帐号类别|123_股东代码|110_委托方式|5250_交易资金帐号|5251_多资金帐号|5252_CPUID|5253_HDID|5254_信用股东列表|5255_子系统标识|5256_客户类型|5257_信用标识|5258_客户姓名|5259_GUID|5260_手机缓存| +=============== +120_产品账号|125_帐号类别|1224_非交易帐号标志|281_融资融券标识|1213_保留信息| +*/ +#define REQUEST_148 148 + /* */ diff --git a/include/Tdx/tdx_struct.h b/include/Tdx/tdx_struct.h index b556680..ab97bfa 100644 --- a/include/Tdx/tdx_struct.h +++ b/include/Tdx/tdx_struct.h @@ -3,6 +3,7 @@ #ifndef _TDX_STRUCT_H_ #define _TDX_STRUCT_H_ +#define COL_EACH_ROW (64) //每行多少例,相当重要 // 字段信息,通达信内部定义的,非自定义 struct FieldInfo_STRUCT @@ -22,24 +23,99 @@ struct Error_STRUCT int ErrType; int ErrCode; char ErrInfo[256]; + + void* Client; // 多账号 +}; + +// 请求 +// 响应,有两种类型 +// 一个请求只返回一行数据 +// 一个请求返回多行数据 +struct RequestResponse_STRUCT +{ + //请求类型 + int requestType; + int requestID; + // 多行内容 + char pContent[1024]; + // 请求大小 + int size; + + void* Client; // 多账号 + char khh[64]; + + // 表头 + FieldInfo_STRUCT** ppFieldInfo; + // 错误 + Error_STRUCT* pErr; + // 多行内容 + char** ppResults; + + void* pSend; + // API内部使用的字段,请不要动 + void* pUserData_Private; + // API外部使用的字段,用来方便开发 + void* pUserData_Public; + // API外部使用的字段,用来方便开发 + void* pUserData_Public2; }; // 委托 struct Order_STRUCT { + char KHH[32]; // 120_客户号 char ZJZH[32]; // 121_资金帐号 char GDDM[32]; // 123_股东代码 char ZQDM[32]; // 140_证券代码 int ZHLB; // 125_帐号类别 int RZRQBS; // 281_融资融券标识 double Price; // 145_委托价格 - long Qty; // 144_委托数量 + double Qty; // 144_委托数量 long MMBZ; // 130_买卖标志 long WTFS; // 166_委托方式 + int CZBZ; // 113_操作标志 char ZHLB_[2]; // 125_帐号类别 // 下完单后用来回填 char WTBH[32]; // 146_委托编号 + + int requestType; // 请求类型 + + void* Client; // 多账号 +}; + +struct CancelOrder_STRUCT +{ + char KHH[32]; // 120_客户号 + char ZJZH[32]; // 121_资金帐号 + char ZHLB[32]; // 125_帐号类别 + char GDDM[32]; // 123_股东代码 + char ZQDM[32]; // 140_证券代码 + char WTBH[32]; // 146_委托编号 + char JYSDM[32]; // 100_交易所代码 + char XWDM[32]; // 173_席位代码 + // 港股需要委托价格 + char WTJG[32]; // 145_委托价格 + char WTSL[32]; // 144_委托数量 + + void* Client; // 多账号 +}; + +struct ReqQueryData_STRUCT +{ + char KHH[32]; // 120_客户号 + char ZJZH[32]; // 121_资金帐号 + char GDDM[32]; // 123_股东代码 + char KSRQ[32]; + char ZZRQ[32]; + char ZQDM[32]; + int RZRQBS; // 281_融资融券标识 + + bool bAll; + + void* Client; // 多账号 + //请求类型 + int requestType; }; // 股东列表 @@ -53,21 +129,39 @@ struct GDLB_STRUCT char RZRQBS[32]; // 281_融资融券标识 char YMTZH[32]; // 5925_一码通账号 char BLXX[32]; // 1213_保留信息 + char JB[32]; // 1233_句柄 int ZHLB_; // 125_帐号类别 int RZRQBS_; // 281_融资融券标识 + + void* Client; // 多账号 +}; + +// 为了处理银河证券没有资金账号,只有句柄的问题 +// 149和101都会返回资金账号,但149不一定会出现 +struct REQ148_STRUCT +{ + char CPZH[32]; // 120_产品账号 + char ZHLB[32]; // 125_帐号类别 + char FJYZHBZ[32]; // 1224_非交易帐号标志 + char RZRQBS[32]; // 281_融资融券标识 + char BLXX[32]; // 1213_保留信息 + + void* Client; // 多账号 }; // 当日委托/历史委托=委托列表 struct WTLB_STRUCT { + char KHH[32]; // 120_客户号 + char ZJZH[32]; // 121_资金帐号 char WTRQ[32]; // 142_委托日期 char WTSJ[32]; // 143_委托时间 char GDDM[32]; // 123_股东代码 char ZQDM[32]; // 140_证券代码 char ZQMC[32]; // 141_证券名称 - char MMBZ[32]; // 130_买卖标志 - char WTLB[32]; // 131_委托类别 + char MMBZ[32]; // 130_买卖标志 *由于很多特别的指令都是3,只能想法解析中文 + char WTLB[32]; // 131_委托类别 * char JYSDM[32]; // 100_交易所代码 char WTJG[32]; // 145_委托价格 char WTSL[32]; // 144_委托数量 @@ -75,15 +169,23 @@ struct WTLB_STRUCT char CJSL[32]; // 152_成交数量 char CDSL[32]; // 162_撤单数量 char WTBH[32]; // 146_委托编号 - char BJFS[32]; // 194_报价方式 + char WTFS[32]; // 166_委托方式 *有些版本没有此字段,只能想法解析中文 + char BJFS[32]; // 194_报价方式 * char ZTSM[32]; // 147_状态说明 char DJZJ[32]; // 161_冻结资金 char BLXX[32]; // 1213_保留信息 + char JB[32]; // 1233_句柄 + + //char WTJE[32]; // 148_委托金额 + //char CJJE[32]; // 154_成交金额 + char ZHLB[32]; // 125_帐号类别 + int WTRQ_; int WTSJ_; - char MMBZ_; - char JYSDM_; + int MMBZ_; + int WTLB_; + int JYSDM_; double WTJG_; int WTSL_; double CJJG_; @@ -92,6 +194,13 @@ struct WTLB_STRUCT double DJZJ_; int ZTSM_; int BJFS_; + int WTFS_; + + //double WTJE_; + //double CJJE_; + int ZHLB_; + + void* Client; // 多账号 }; // 成交列表 @@ -118,8 +227,8 @@ struct CJLB_STRUCT int CJRQ_; int CJSJ_; - char MMBZ_; - char WTLB_; + int MMBZ_; + int WTLB_; double CJJG_; int CJSL_; double FSJE_; @@ -128,7 +237,9 @@ struct CJLB_STRUCT double YHS_; double GHF_; double CJF_; - char CDBZ_; + int CDBZ_; + + void* Client; // 多账号 }; @@ -150,6 +261,10 @@ struct GFLB_STRUCT char JYSDM[32]; // 100_交易所代码 char JYSMC[32]; // 101_交易所名称 char BLXX[32]; // 1213_保留信息 + char JB[32]; // 1233_句柄 + + char DQSL[32]; // 5712_当前数量 + char SJSL[32]; // 5508_实际数量 int ZQSL_; int KMSL_; @@ -157,6 +272,10 @@ struct GFLB_STRUCT double DQJ_; double ZXSZ_; double DJSL_; + double DQSL_; + double SJSL_; + + void* Client; // 多账号 }; // 资金余额 @@ -175,6 +294,8 @@ struct ZJYE_STRUCT double ZZC_; double KQZJ_; double ZXSZ_; + + void* Client; // 多账号 }; struct HQ_STRUCT @@ -246,6 +367,8 @@ struct HQ_STRUCT double ZXMCBDJW_; // 227_最小卖出变动价位 double ZTJG_; // 940_涨停价格 double DTJG_; // 941_跌停价格 + + void* Client; // 多账号 }; // @@ -253,13 +376,143 @@ struct HQ_STRUCT //// 以下的在整理完后要删除 // +// +//// 登录结果 +//struct DLJG_STRUCT +//{ +// char COL1[128]; +// char COL2[128]; +// char COL3[128]; +// +// void* Client; // 多账号 +//}; + +//////////////////////////////////////////////////////////////////////////// +// 打新相关结构体 -// 登录结果 -struct DLJG_STRUCT +// 新股配号查询 REQUEST_XGSG_XGPHCX 1116 +struct XGPHCX_STRUCT { - char COL1[128]; - char COL2[128]; - char COL3[128]; + char PHRQ[32]; // 170_配号日期 + char ZQDM[32]; // 140_证券代码 + char ZQMC[32]; // 141_证券名称 + char QSPH[32]; // 171_起始配号 + char PHSL[32]; // 172_配号数量 + char ZHLB[32]; // 125_帐号类别 + char BLXX[32]; // 1213_保留信息 + + int PHRQ_; + int QSPH_; + int PHSL_; + int ZHLB_; + + void* Client; // 多账号 +}; + +// 新股中签查询 REQUEST_XGSG_XGZQCX 1126 +struct XGZQCX_STRUCT +{ + char CJRQ[32]; // 150_成交日期 + char ZQDM[32]; // 140_证券代码 + char ZQMC[32]; // 141_证券名称 + char CJJG[32]; // 153_成交价格 + char ZQS[32]; // 174_中签数 + char ZHLB[32]; // 125_帐号类别 + char BLXX[32]; // 1213_保留信息 + + int CJRQ_; + int CJJG_; + int ZQS_; + int ZHLB_; + + void* Client; // 多账号 +}; + +// 可申购新股查询 REQUEST_XGSG_KSGXGCX 1156 +struct KSGXGCX_STRUCT +{ + char ZQDM[32]; // 140_证券代码 + char ZQMC[32]; // 141_证券名称 + char FXJG[32]; // 418_发行价格 + char ZDSL[32]; // 962_最低数量 + char ZGSL[32]; // 961_最高数量 + char WTSL[32]; // 144_委托数量 + char WTRQ[32]; // 142_委托日期 + char JYSDM[32]; // 100_交易所代码 + char JYSMC[32]; // 101_交易所名称 + char CZSJ[32]; // 50_(参数)操作数据 + char JB[32]; // 1233_句柄 + char BLXX[32]; // 1213_保留信息 + + char SGSX[32]; // 5905_申购上限 + char WTJG[32]; // 145_委托价格 + char ZHLB[32]; // 125_帐号类别 + + double FXJG_; + double ZDSL_; + double ZGSL_; + double WTSL_; + int WTRQ_; + int JYSDM_; + double SGSX_; + double WTJG_; + int ZHLB_; + + void* Client; // 多账号 +}; + +// 新股申购额度查询 REQUEST_XGSG_XGSGEDCX 1340 +struct XGSGEDCX_STRUCT +{ + char ZJZH[32]; // 121_资金帐号 + char CS[32]; // 1227_参数 + char ZHLB[32]; // 125_帐号类别 + char GDDM[32]; // 123_股东代码 + char JYSMC[32]; // 101_交易所名称 + char XGSGED[32]; // 5679_新股申购额度 + char KSGED[32]; // 5801_可申购额度,光大证券 + char CZSJ[32]; // 50_(参数)操作数据 + char JB[32]; // 1233_句柄 + char BLXX[32]; // 1213_保留信息 + + char SGED_961[32]; // 961_申购额度,在申万宏源中居然也是961 + char XGSGED_5564[32]; // 5564_新股申购额度 + char XGSGED_5718[32]; // 5718_新股申购额度 + char KHSZED_5759[32]; // 5759_客户市值额度 + char ZHED[32]; // 5772_账户额度 + + + double CS_; + double XGSGED_; + int ZHLB_; + double SGED_961_; + double XGSGED_5564_; + double XGSGED_5718_; + double KSGED_; + double ZHED_; + double KHSZED_5759_; + + void* Client; // 多账号 +}; + +// 新股申购待缴款查询 REQUEST_XGSG_XGSGDJKCX 1370 +struct XGSGDJKCX_STRUCT +{ + char ZQDM[32]; // 140_证券代码 + char ZQS[32]; // 174_中签数 + char FQSL[32]; // 98_放弃数量 + char ZQJE[32]; // 1088_中签金额 + char QKZJ[32]; // 1091_缺口资金 + char GDDM[32]; // 123_股东代码 + char ZHLB[32]; // 125_帐号类别 + char CZSJ[32]; // 50_(参数)操作数据 + char JB[32]; // 1233_句柄 + char BLXX[32]; // 1213_保留信息 + + double CS_; + double XGSGED_; + + void* Client; // 多账号 }; #endif diff --git a/include/Tdx/win32/TdxApi.License b/include/Tdx/win32/TdxApi.License new file mode 100644 index 0000000..5753f32 --- /dev/null +++ b/include/Tdx/win32/TdxApi.License @@ -0,0 +1,10 @@ + +[License] +ExpireDate=20170313 +Trial=5 +MachineID=".*" + +[User] +Account=".*" +UserName="" +Info="A0C58943F8AE:05000000000|*|" diff --git a/include/Tdx/win32/TdxApi.dll b/include/Tdx/win32/TdxApi.dll index 8dcc513..44eae97 100644 Binary files a/include/Tdx/win32/TdxApi.dll and b/include/Tdx/win32/TdxApi.dll differ diff --git a/include/Tdx/win32/TdxApi.lib b/include/Tdx/win32/TdxApi.lib index 6edd127..69faa9e 100644 Binary files a/include/Tdx/win32/TdxApi.lib and b/include/Tdx/win32/TdxApi.lib differ diff --git a/include/Tdx/win32/TdxApiDemo.exe b/include/Tdx/win32/TdxApiDemo.exe index 7153582..b52972a 100644 Binary files a/include/Tdx/win32/TdxApiDemo.exe and b/include/Tdx/win32/TdxApiDemo.exe differ diff --git a/include/Tdx/win32/TdxInjector.exe b/include/Tdx/win32/TdxInjector.exe index 66f2dc3..1c94a22 100644 Binary files a/include/Tdx/win32/TdxInjector.exe and b/include/Tdx/win32/TdxInjector.exe differ diff --git a/include/Tdx/win32/TdxSpoofer.dll b/include/Tdx/win32/TdxSpoofer.dll new file mode 100644 index 0000000..36d14b5 Binary files /dev/null and b/include/Tdx/win32/TdxSpoofer.dll differ diff --git a/include/Tdx/win32/login.ini b/include/Tdx/win32/login.ini index d14350c..4057ad7 100644 --- a/include/Tdx/win32/login.ini +++ b/include/Tdx/win32/login.ini @@ -3,4 +3,6 @@ TdxPath=D:\new_hbzq_qq\ LuaFile=D:\new_hbzq_qq\Login.lua [LOGIN] Account=05000000000 -Password=123456 \ No newline at end of file +Password=123456 +Code= +ZJZH= \ No newline at end of file diff --git "a/include/Tdx/win32/\345\256\242\346\210\267\345\256\232\345\210\266\347\211\210\351\200\232\350\276\276\344\277\241\346\216\245\345\217\243\345\260\201\350\243\205_\344\275\277\347\224\250\346\211\213\345\206\214.doc" "b/include/Tdx/win32/\345\256\242\346\210\267\345\256\232\345\210\266\347\211\210\351\200\232\350\276\276\344\277\241\346\216\245\345\217\243\345\260\201\350\243\205_\344\275\277\347\224\250\346\211\213\345\206\214.doc" new file mode 100644 index 0000000..4647ef7 Binary files /dev/null and "b/include/Tdx/win32/\345\256\242\346\210\267\345\256\232\345\210\266\347\211\210\351\200\232\350\276\276\344\277\241\346\216\245\345\217\243\345\260\201\350\243\205_\344\275\277\347\224\250\346\211\213\345\206\214.doc" differ diff --git a/include/UFX/data_def.h b/include/UFX/data_def.h new file mode 100644 index 0000000..812e313 --- /dev/null +++ b/include/UFX/data_def.h @@ -0,0 +1,147 @@ +#ifndef DATA_DEF_H_ +#define DATA_DEF_H_ + +//33100 (ڲṹ->ģ) +struct CMarketInfo_UFX +{ + char quote_type; //(0-ͨ1-) + int quote_length; //ݳȣӵ3ֶοʼһֶμ㳤ȣ + int update_time; //ʱ(eg:144510500,144510500) + int quote_index; // + char futu_exch_type[5]; // + char commodity_type[7]; //Ʒ + char contract_code[31]; //Լ + double pre_settlement_price; //ս + double pre_close_price; //̼ + double pre_open_interest; //տ + double pre_delta; //ʵ + double futu_open_price; //̼ + double futu_last_price; //¼۸ + double buy_high_price; // + double buy_high_amount; // + double sale_low_price; //ۼ۸ + double sale_low_amount; // + double futu_high_price; //߼ + double futu_low_price; //ͼ + double uplimited_price; //ͣ + double downlimited_price; //ͣ + double average_price; // + double change_direction; // + double business_amount; //ɽ + double open_interest; //ܳ + double business_balance; //ɽ + double futu_close_price; //̼ + double settlement_price; // + int actionday; //ǰ(yyyymmdd) +}; + +//33101 ίлر +struct COrderRspInfo_UFX +{ + char entrust_no[10]; //ίк + char futures_account[13]; //ױ + char futu_exch_type[4]; //F1-֣F2-F3Ϻ-F4н + char contract_code[31]; //Լ + char entrust_bs; //ʶ(1- 2-) + char entrust_direction; //ƽʶ(1-2-ƽ4-ƽ֣Ϊ) + char hedge_type; //ױʶ(0-Ͷ1-ױ2-) + char fund_account[19]; //ʽ˻ + char futu_report_no[22]; //ص + char firm_no[22]; //Ա + char operator_no[19]; //Ա + int client_group; //ͻ + double entrust_amount; //ί + double business_total_amount; //ɽ + double cacel_amount; // + double entrust_price; //ίм۸ + char entrust_status; //ί״̬ + int branch_no; //Ӫҵ + int batch_no; //ί + char futu_entrust_type; //ί + int amount_per_hand; //Լ + char forceclose_reason; //ǿƽԭ + char init_date[9]; // + char curr_time[9]; //ǰʱ + char confirm_no[21]; // + char entrust_occasion[33]; //ίг + double entrust_price2; //ί(ί۸) + char futu_entrust_prop[4]; //ڻί + char arbitrage_code[31]; //ί + char entrust_reference[33]; //ί + char error_message[33]; //˵ + char position_str[33]; //λ + //int request_id; // + //int session_id; //Ự +}; + +//33101 ɽر +struct CRealRspInfo_UFX +{ + char entrust_no[10]; //ίк + char futures_account[13]; //ױ + char futu_exch_type[5]; // + char business_no[10]; //ɽ + char contract_code[31]; //Լ + char entrust_bs; //ʶ(1- 2-) + char entrust_direction; //ƽʶ(1-2-ƽ3-ƽ Ϊ) + double business_price; //ɽ۸ + double business_amount; //ɽ + char hedge_type; //ױʶ(0-Ͷ1-ױ2-) + char fund_account[19]; //ʽ˻ + char futu_report_no[22]; //ص + char firm_no[22]; //Ա + char operator_no[18]; //Ա + int client_group; //ͻ + double entrust_amount; //ί + double business_total_amount; //ɽ + double cacel_amount; // + double entrust_price; //ίм۸ + char entrust_status; //ί״̬ + int branch_no; //Ӫҵ + int batch_no; //ί + char futu_entrust_type; //ί + int amount_per_hand; //Լ + char forceclose_reason; //ǿƽԭ + char init_date[9]; // + char business_time[9]; //ɽʱ + char confirm_no[21]; // + char entrust_occasion[33]; //ίг + double entrust_price2; //ί(ί۸) + char futu_entrust_prop[4]; //ڻί + char arbitrage_code[31]; //ί + char entrust_reference[33]; //ί + char position_str[33]; //λ + //int request_id; //(ʱ) + //int session_id; //Ự(ʱ) +}; + +//33102 (ڲṹ->ģ) +struct CArgMarketInfo_UFX +{ + char arbicontract_id[31]; //Լ + char futu_exch_type[5]; // + char first_code[31]; //һ + char second_code[31]; //ڶ + char weave_type; //1-SPD, 2 -IPS + double buy_price; // + double buy_amount; // + double buy_total_amount; //ȫ + double sale_price; //ۼ۸ + double sale_amount; // + double sale_total_amount; //ȫ + double futu_high_price; //߼ + double futu_low_price; //ͼ + double uplimited_price; //ͣ۸ + double downlimited_price; //ͣ۸ +}; + +//33105 ״̬֪ͨ +struct CExchangeStatus_UFX +{ + char futu_exch_type[5]; //F1-֣F2-F3Ϻ-F4? + char exch_status; //״̬0ӶϿ,1ǰ, 2ϱ + char entrade_flag; //Ƿɽף0ɽף1ɽף +}; + +#endif //DATA_DEF_H_ + diff --git a/include/UFX/t2sdk_interface.h b/include/UFX/t2sdk_interface.h new file mode 100644 index 0000000..eea68e5 --- /dev/null +++ b/include/UFX/t2sdk_interface.h @@ -0,0 +1,1432 @@ +/** @file +* T2_SDKͷļ +* @author T2С +* @author ӹɷ޹˾ +* @version 1.0.0.2 +* @date 20090327 +*/ + +#include +#include + +#ifndef _T2SDK_INTERFACE_H +# define _T2SDK_INTERFACE_H + +#ifdef _WIN32 + #if !defined( FUNCTION_CALL_MODE ) + #define FUNCTION_CALL_MODE __stdcall + #endif +#else + #define FUNCTION_CALL_MODE +#endif + +struct IKnown +{ + virtual unsigned long FUNCTION_CALL_MODE QueryInterface(const char *iid, IKnown **ppv) = 0; + + virtual unsigned long FUNCTION_CALL_MODE AddRef() = 0; + + virtual unsigned long FUNCTION_CALL_MODE Release() = 0; +}; + + +#include + +#ifdef _WIN32 +typedef unsigned int uint32; +#else +#include +#if defined(__linux__) +#include +#endif +typedef uint32_t uint32; +#endif + +///ESBȣΪɼַܰʵָո񡢷ֺ; +#define IDENTITY_NAME_LENGTH 32 +///ʵռλ +#define ID_LENGTH 4 +///ڵȫ,ʱʹchar sName[ID_STR_LEN+1] +#define ID_STR_LEN (IDENTITY_NAME_LENGTH + ID_LENGTH + 1) + + +// ӿ󳤶,ʱʹchar sName[PLUGINID_LENGTH+1] +#define PLUGINID_LENGTH 256 +// ʵ󳤶,ʱʹchar sName[PLUGIN_NAME_LENGTH+1] +#define PLUGIN_NAME_LENGTH (PLUGINID_LENGTH+ID_LENGTH+1) +// 󳤶.ʱʹchar sName[SVR_NAME_LENGTH+1] +#define SVR_NAME_LENGTH 256 +// ʵ󳤶.ʱʹchar sName[PLUGINID_NAME_LENGTH+1] +#define SVRINSTANCE_NAME_LENGTH (SVR_NAME_LENGTH+ID_LENGTH+1) +//ҵϢ + + +// +#define REQUEST_PACKET 0 +//Ӧ +#define ANSWER_PACKET 1 +//20110302 xuxp ·ϢĽṹ嶨 +typedef struct tagRouteInfo +{ + char ospfName[ID_STR_LEN+1]; + char nbrName[ID_STR_LEN+1]; + char svrName[SVRINSTANCE_NAME_LENGTH+1]; + char pluginID[PLUGIN_NAME_LENGTH+1]; + int connectID; + int memberNO; + + tagRouteInfo() + { + memset(this,0,sizeof(tagRouteInfo)); + } +}Route_Info; + + +//20101228 xuxp Ϊ˷ͺͷضϢӵĽṹĶ +typedef struct tagRequestData +{ + int sequeceNo; + int issueType; + void* lpKeyInfo; + int keyInfoLen; + void* lpFileHead; + int fileHeadLen; + int packetType;//20100111 xuxp ¼ӵİ + Route_Info routeInfo;//20110302 xuxp ·Ϣ +}REQ_DATA, *LPREQ_DATA; +typedef struct tagRespondData +{ + int functionID; + int returnCode; + int errorNo; + char* errorInfo; + int issueType; + void* lpKeyInfo; + int keyInfoLen; + Route_Info sendInfo;//20110302 xuxp ӦӷϢ +}RET_DATA, *LPRET_DATA; + + +///ӿ +struct IF2ResultSet : public IKnown +{ + + ///ȡֶ + /**@return ֶ. + */ + virtual int FUNCTION_CALL_MODE GetColCount()=0; + + ///ȡֶ + /** @param column:ֶ(0Ϊ) + * @return ֶ ±Խ NULL + */ + virtual const char * FUNCTION_CALL_MODE GetColName(int column)=0; + + //ȡֶ + /** @param column:ֶ(0Ϊ) + * @return:泣;±Խ -1 + */ + virtual char FUNCTION_CALL_MODE GetColType(int column)=0; + + + ///ȡֶСλ + /** @param column:ֶ(0Ϊ) + * @return int ֶСλ ±Խ -1 + */ + virtual int FUNCTION_CALL_MODE GetColScale(int column)=0; + + //ȡֶݵ. + /** @param column:ֶ(0Ϊ) + * @return int ֶο ±Խ -1 + */ + virtual int FUNCTION_CALL_MODE GetColWidth(int column) = 0; + + ///ȡֶӦֶ + /**@param columnName: ֶ + *@return ֶ. ڷ-1 + */ + virtual int FUNCTION_CALL_MODE FindColIndex(const char * columnName)=0; + + // + //ֶ(0Ϊ)ȡֵֶ(ַ) + /**@param column:ֶ(0Ϊ) + *@return ֵֶַ,±Խ緵NULL + */ + virtual const char * FUNCTION_CALL_MODE GetStrByIndex(int column)=0; + + //ֶȡֵֶ(ַ) + /**@param columnName: ֶ + *@return ֵֶַ,ڷNULL + */ + virtual const char * FUNCTION_CALL_MODE GetStr(const char * columnName)=0; + + //ֶ(0Ϊ)ȡֵֶ + /**@param column:ֶ(0Ϊ) + *@return ֵֶַ,±Խ緵'\0'. + */ + virtual char FUNCTION_CALL_MODE GetCharByIndex(int column)=0; + + //ֶȡֵֶ + /**@param columnName: ֶ + *@return ֵֶַ,ڷ'\0' + */ + virtual char FUNCTION_CALL_MODE GetChar(const char * columnName)=0; + + //ֶţȡֵֶ + /**@param column:ֶ(0Ϊ) + *@return doubleֵֶ,±Խ緵0 + */ + virtual double FUNCTION_CALL_MODE GetDoubleByIndex( int column)=0; + + ///ֶȡֵֶ + /**@param columnName:ֶ + *@return doubleֵֶ,ڷ0 + */ + virtual double FUNCTION_CALL_MODE GetDouble(const char * columnName)=0; + + ///ֶţȡֵֶ + /**@param column:ֶ(0Ϊ) + *@return intֵֶ,±Խ緵0 + */ + virtual int FUNCTION_CALL_MODE GetIntByIndex(int column)=0; + + ///ֶȡֵֶ + /**@param columnName:ֶ + *@return intֵֶ,ڷ0 + */ + virtual int FUNCTION_CALL_MODE GetInt(const char * columnName)=0; + + ///ֶŻֵֶ, + /**@param column: ֶ(0Ϊ) + *@param lpRawLen: [out]ݳ + *@return : ׵ַ + */ + virtual void * FUNCTION_CALL_MODE GetRawByIndex(int column,int * lpRawLen) = 0; + + ///ֶȡֵֶ + /**@param columnName:ֶ + *@param lpRawLen: [out]ݳ + *@return : ׵ַ + */ + virtual void * FUNCTION_CALL_MODE GetRaw(const char * columnName,int * lpRawLen) = 0; + + + ///һȡֵֶǷΪNULL + /**@return 0 ǣ 1 + */ + virtual int FUNCTION_CALL_MODE WasNull()=0; + + ///ȡһ¼ + virtual void FUNCTION_CALL_MODE Next()=0; + + ///жǷΪβ + /**@return 1 ǣ0 ; + */ + virtual int FUNCTION_CALL_MODE IsEOF()=0; + + ///жǷΪ + /**@return 1 ǣ0 ; + */ + virtual int FUNCTION_CALL_MODE IsEmpty()=0; + + virtual void * FUNCTION_CALL_MODE Destroy() = 0; +}; + +struct IF2UnPacker; + +///ӿ(һж칹) +/**ִ: + * + * 0׼(ѡ, иò, IF2Packerڲڴ滺) SetBuffer(),ɵṩ,BeginPack()֮ǰ׼; + * + * 1ʼ: BeginPack(),λ; + * + * 2һ + * + *(a)ֶбAddField() + * + *(b)սά˳ֶΣ¼ֶݣAddStr() {AddInt(), AddDouble(), AddRaw()} + * + * 3ýķ(ѡ, 򷵻Ϊ0) SetReturnCode() + * + * 4һ(ѡ) NewDataSet()˴ͬʱ˸ýķ룻 + * + * 5ο2ʵһ(ѡ) + * + * 6EndPack(),ظûᵼ¼ս; + * + * 7ȡ(Сݳ) + * ҲֱӽUnPack()ؽӿ + * + *ʹע:IF2Packerʹõڴ滺ɵ߸գ + * ķ룬ֻڰʽ汾0x21ʱЧ + */ +struct IF2Packer : public IKnown +{ + ///ʼ(ʹõߵĻ) + /** һʹôʱʹñúû(ݳȱΪiDataLen) + *@param char * pBuf ַ + *@param int iBufSize ռ + *@param int iDataLen ݳȣݼֻ֮V1.0ʽİЧ + */ + virtual void FUNCTION_CALL_MODE SetBuffer(void * pBuf,int iBufSize,int iDataLen=0 )=0; + + ///λ¿ʼһ(ֶ¼Ϊ00) + /** + * ܣʼѰ(ظʹеĻռ) + *@return + */ + virtual void FUNCTION_CALL_MODE BeginPack(void)=0; + + ///ʼһ + /**ڴ򵥽İʱԲñ,ȡĬֵ + *@param const char *szDatasetName 0x20Ҫָ + *@param int iReturnCode 0x20ҪΪÿֵָ + */ + virtual int FUNCTION_CALL_MODE NewDataset(const char *szDatasetName, int iReturnCode = 0)=0; + + /** + * ܣֶ + * + *ִдҪ: NewDataset()Reset(),SetBuffer()֮,ֶΰ˳; + * + *@param szFieldNameֶ + *@param cFieldType ֶ:IFCַSַR + *@param iFieldWidth ֶοȣռֽ + *@param iFieldScale ֶξ,cFieldType='F'ʱСλ(ȱʡΪ4λС) + *@return ʾʧܣΪĿǰij + */ + virtual int FUNCTION_CALL_MODE AddField(const char *szFieldName,char cFieldType ='S',int iFieldWidth=255,int iFieldScale=4)=0; + + /** + * ܣַ + * ִдҪ:ֶ֮,ֶΰ˳; + *@param szValueַ + *@return ʾʧܣΪĿǰij + */ + virtual int FUNCTION_CALL_MODE AddStr(const char *szValue)=0; + + /** + * ܣ + *@param iValue + *@return ʾʧܣΪĿǰij + */ + virtual int FUNCTION_CALL_MODE AddInt(int iValue)=0; + + /** + * ܣӸ + *@param fValue + *@return ʾʧܣΪĿǰij + */ + virtual int FUNCTION_CALL_MODE AddDouble(double fValue)=0; + + /** + * ܣһַ + *@param cValueַ + *@return ʾʧܣΪĿǰij + */ + virtual int FUNCTION_CALL_MODE AddChar(char cValue)=0; + + /** + * ܣһ + *@param void * lpBuff + *@param int iLen ݳ + *@return ʾʧܣΪĿǰij + */ + virtual int FUNCTION_CALL_MODE AddRaw(void * lpBuff,int iLen)=0; + + /// + virtual void FUNCTION_CALL_MODE EndPack()=0; + + /** + * ܣȡָ + *@return ָ + */ + virtual void * FUNCTION_CALL_MODE GetPackBuf(void) = 0; + + /** + * ܣȡ + *@return + */ + virtual int FUNCTION_CALL_MODE GetPackLen(void) = 0; + + /** + * ܣȡС + *@return С + */ + virtual int FUNCTION_CALL_MODE GetPackBufSize(void) = 0; + + /** + * ܣȡʽ汾 + *@return 汾 + */ + virtual int FUNCTION_CALL_MODE GetVersion(void) = 0; + + ///ýķ(0x20Ҫ)Ҫ + /**ȡȱʡֵ0ããEndPack()֮ǰ + *@return 汾 + */ + virtual void FUNCTION_CALL_MODE SetReturnCode(unsigned long dwRetCode) = 0; + + /**ֱӷصǰĽӿ,EndPack()֮ܵ,ڴͷʱӦĽʵҲͷ + *@return ӿڣ˽ӿڲܵ destroy()ͷ + */ + virtual IF2UnPacker * FUNCTION_CALL_MODE UnPack(void) = 0; + + /** + * + */ + virtual void FUNCTION_CALL_MODE FreeMem(void* lpBuf) = 0; + + /** + * + */ + virtual void FUNCTION_CALL_MODE ClearValue() = 0; + + + //20110302 xuxp һӿںݵһ + ///λ¿ʼһ(ֶ¼Ϊ00) + /** + * ܣʼѰ(ظʹеĻռ) + *@return + */ + virtual void FUNCTION_CALL_MODE BeginPackEx(char* szName = NULL) = 0; + + //20110324 dongpf һӿںλǰ + ///λǰ(ֶ¼Ϊ00)Ӱ + /** + * ܣλǰ + *@return + */ + virtual void FUNCTION_CALL_MODE ClearDataSet() = 0; +}; + +///ӿ +struct IF2UnPacker : public IF2ResultSet +{ + /**ȡʽ汾 + *@return 汾 + */ + virtual int FUNCTION_CALL_MODE GetVersion(void) = 0; + + /**ȡݳ + *@return 0 ʾɹ Ϊʧ + */ + virtual int FUNCTION_CALL_MODE Open(void * lpBuffer,unsigned int iLen) = 0; + + ///ȡ(0x20ϰ汾֧) + virtual int FUNCTION_CALL_MODE GetDatasetCount()=0; + + ///õǰ(0x20ϰ汾֧) + /** + *@param int nIndex + *@return int 0ʾɹΪʧ + */ + virtual int FUNCTION_CALL_MODE SetCurrentDatasetByIndex(int nIndex)=0; + + ///õǰ (0x20ϰ汾֧) + /** + *@param const char *szDatasetName + *@return int 0 ʾɹΪʧ + */ + virtual int FUNCTION_CALL_MODE SetCurrentDataset(const char *szDatasetName)=0; + + /** ȡָ + *@return ָ + */ + virtual void * FUNCTION_CALL_MODE GetPackBuf(void) = 0; + + /** ȡݳ + *@return ݳ + */ + virtual unsigned int FUNCTION_CALL_MODE GetPackLen(void) = 0; + + /**ȡݼ¼,20051207Ժ汾֧ + *@return ¼ + */ + virtual unsigned int FUNCTION_CALL_MODE GetRowCount(void) = 0; +}; + +///Ӷ CConnectionInterface IJöCConfigInterface +/** +* ļء浽ļд +*/ +class CConfigInterface: public IKnown +{ +public: + /** + * ļ + * @param szFileName ļʽiniοʾ + * @return 0ʾɹʧ + */ + virtual int FUNCTION_CALL_MODE Load(const char *szFileName) = 0; + + /** + * 浽ļ + * @param szFileName ļ + * @return 0ʾɹʧ + */ + virtual int FUNCTION_CALL_MODE Save(const char *szFileName) = 0; + + /** + * ȡֵַ + * @param szSection + * @param szEntry + * @param szDefault ȱʡֵ + * @return ֵַûҵʱszDefault + */ + virtual const char * FUNCTION_CALL_MODE GetString(const char *szSection, const char *szEntry, const char *szDefault) = 0; + + /** + * ȡֵ + * @param szSection + * @param szEntry + * @param iDefault ȱʡֵ + * @return ֵûҵʱiDefault + */ + virtual int FUNCTION_CALL_MODE GetInt(const char *szSection, const char *szEntry, int iDefault) = 0; + + /** + * ֵַ + * @param szSection + * @param szEntry + * @param szValue ֵ + * @return 0ʾɹʧ + */ + virtual int FUNCTION_CALL_MODE SetString(const char *szSection, const char *szEntry, const char *szValue) = 0; + + /** + * ֵ + * @param szSection + * @param szEntry + * @param iValue ֵ + * @return 0ʾɹʧ + */ + virtual int FUNCTION_CALL_MODE SetInt(const char *szSection, const char *szEntry, int iValue) = 0; +}; + + +typedef struct tagBizRouteInfo +{ + char ospfName[ID_STR_LEN+1];//·Ŀڵм + char nbrName[ID_STR_LEN+1];//мڵھ + char svrName[SVRINSTANCE_NAME_LENGTH+1];//мĽ + char pluginID[PLUGIN_NAME_LENGTH+1];//м + int connectID;//Ӻ + int memberNO;//Ա + + tagBizRouteInfo() + { + memset(this,0,sizeof(tagBizRouteInfo)); + } +}BIZROUTE_INFO; + + +struct IBizMessage : IKnown +{ + //ùܺ + virtual void FUNCTION_CALL_MODE SetFunction(const int nFUnctionNo) = 0; + //ȡܺ + virtual int FUNCTION_CALL_MODE GetFunction() = 0; + + //ð + virtual void FUNCTION_CALL_MODE SetPacketType(const int nPacketType) = 0; + //ȡ + virtual int FUNCTION_CALL_MODE GetPacketType() = 0; + + //Ӫҵ + virtual void FUNCTION_CALL_MODE SetBranchNo(const int nBranchNo) = 0; + //ȡӪҵ + virtual int FUNCTION_CALL_MODE GetBranchNo() = 0; + + //ϵͳ + virtual void FUNCTION_CALL_MODE SetSystemNo(const int nSystemNo) = 0; + //ȡϵͳ + virtual int FUNCTION_CALL_MODE GetSystemNo() = 0; + + //ϵͳ + virtual void FUNCTION_CALL_MODE SetSubSystemNo(const int nSubSystemNo) = 0; + //ȡϵͳ + virtual int FUNCTION_CALL_MODE GetSubSystemNo() = 0; + + //÷߱ + virtual void FUNCTION_CALL_MODE SetSenderId(const int nSenderId) = 0; + //ȡ߱ + virtual int FUNCTION_CALL_MODE GetSenderId() = 0; + + //ð + virtual void FUNCTION_CALL_MODE SetPacketId(const int nPacketId) = 0; + //ȡ + virtual int FUNCTION_CALL_MODE GetPacketId() = 0; + + //Ŀĵ· + virtual void FUNCTION_CALL_MODE SetTargetInfo(const BIZROUTE_INFO targetInfo) = 0; + //ȡĿĵ· + virtual void FUNCTION_CALL_MODE GetTargetInfo(BIZROUTE_INFO& targetInfo) = 0; + + //÷· + virtual void FUNCTION_CALL_MODE SetSendInfo(const BIZROUTE_INFO sendInfo) = 0; + //ȡ· + virtual void FUNCTION_CALL_MODE GetSendInfo(BIZROUTE_INFO& sendInfo) = 0; + + //ô + virtual void FUNCTION_CALL_MODE SetErrorNo(const int nErrorNo) = 0; + //ȡ + virtual int FUNCTION_CALL_MODE GetErrorNo() = 0; + + //ôϢ + virtual void FUNCTION_CALL_MODE SetErrorInfo(const char* strErrorInfo) = 0; + //ȡϢ + virtual const char* FUNCTION_CALL_MODE GetErrorInfo() = 0; + + //÷ + virtual void FUNCTION_CALL_MODE SetReturnCode(const int nReturnCode) = 0; + //ȡ + virtual int FUNCTION_CALL_MODE GetReturnCode() = 0; + + //ҵ + virtual void FUNCTION_CALL_MODE SetContent(void* lpContent,int iLen) = 0; + //ȡҵ + virtual const void* FUNCTION_CALL_MODE GetContent(int& iLen) = 0; + + //½ӿϢ1.0Ķ + //ö + virtual void FUNCTION_CALL_MODE SetIssueType(const int nIssueType) = 0; + //ȡ + virtual int FUNCTION_CALL_MODE GetIssueType() = 0; + + // + virtual void FUNCTION_CALL_MODE SetSequeceNo(const int nSequeceNo) = 0; + //ȡ + virtual int FUNCTION_CALL_MODE GetSequeceNo() = 0; + + //ùؼֶϢ + virtual void FUNCTION_CALL_MODE SetKeyInfo(void* lpKeyData,int iLen) = 0; + //ȡؼֶϢ + virtual const void* FUNCTION_CALL_MODE GetKeyInfo(int& iLen) = 0; + + //øݣʱԭ + virtual void FUNCTION_CALL_MODE SetAppData(const void* lpAppdata,int nAppLen) = 0; + //ȡݣʱԭ + virtual const void* FUNCTION_CALL_MODE GetAppData(int& nAppLen) = 0; + + //תӦ + virtual int FUNCTION_CALL_MODE ChangeReq2AnsMessage() = 0; + + //ȡ + virtual void* FUNCTION_CALL_MODE GetBuff(int& nBuffLen) = 0; + // + virtual int FUNCTION_CALL_MODE SetBuff(const void* lpBuff,int nBuffLen) = 0; +}; + +#define IDENTITY_NAME_LENGTH 32 /**< ͻֳ */ +#define MAX_MACADDRESS_LEN 18 /**< MAC ַ */ +#define MAX_RAND_LEN 4 /**< */ + +/** ͻʶ */ +#define MAX_BIZNAME_LEN \ + IDENTITY_NAME_LENGTH+1+MAX_MACADDRESS_LEN+1+MAX_RAND_LEN+2 + +#define INIT_RECVQ_LEN 256 /**< նгʼ */ +#define STEP_RECVQ_LEN 512 /**< նչ */ +#define SIMPLIFIED_CHINESE 0 /**< Ϣ: */ +#define ENGLISH 1 /**< Ϣ:Ӣ */ +#define MAX_FILTERFIELD_LEN 63 /**< ֶγ */ + +/** ɿȼ */ +enum ReliableLevel +{ + LEVEL_DOBEST = 0, /**< Ϊ */ + LEVEL_DOBEST_BYSEQ = 1, /**< */ + LEVEL_MEM = 2, /**< ڴ */ + LEVEL_FILE = 3, /**< ļ */ + LEVEL_SYSTEM = 4 /**< ϵͳ */ +}; + +/** + * ӿ + */ +class CFilterInterface:public IKnown +{ +public: + /** + * ±ȡ + * @param index Ӧű + * @return ضӦ±֣򷵻NULL. + */ + virtual char* FUNCTION_CALL_MODE GetFilterNameByIndex(int index) = 0; + + /** + * ±ȡֵ + * @param index Ӧű + * @return ضӦ±ֵ򷵻NULL. + */ + virtual char* FUNCTION_CALL_MODE GetFilterValueByIndex(int index)= 0; + + /** + * ݹֻȡֵ + * @param fileName ӦĹ + * @return ضӦĹֵֵ򷵻NULL. + */ + virtual char* FUNCTION_CALL_MODE GetFilterValue(char* fileName)= 0; + + /** + * ȡĸ + * @return ضӦĸûз0 + */ + virtual int FUNCTION_CALL_MODE GetCount() = 0; + + /** + * ùݹֵֺ + * @param filterName ӦĹ + * @param filterValue ӦĹֵֵ + */ + virtual void FUNCTION_CALL_MODE SetFilter(char* filterName,char* filterValue) =0; +}; + +/** + * IJӿ + */ +class CSubscribeParamInterface:public IKnown +{ +public: + + /** + * + * @param szName Ӧ + */ + virtual void FUNCTION_CALL_MODE SetTopicName(char* szName) =0; + + /** + * ø + * @param lpData ݵ׵ַ + * @param iLen ݵij + */ + virtual void FUNCTION_CALL_MODE SetAppData(void* lpData,int iLen)=0; + + /** + * ӹ + * @param filterName + * @param filterValue ֵ + */ + virtual void FUNCTION_CALL_MODE SetFilter(char* filterName,char* filterValue)=0; + + /** + * ӷֶ + * @param filedName Ҫӵķֶ + */ + virtual void FUNCTION_CALL_MODE SetReturnFiled(char* filedName)=0; + + /** + * Ƿȱ־ + * @param bFromNow trueʾҪ֮ǰݣҲDzȱfalseʾҪȱ + */ + virtual void FUNCTION_CALL_MODE SetFromNow(bool bFromNow)=0; + + /** + * øǶı־ + * @param bReplace trueʾǶģȡ֮ǰжģֻǰĶģfalseʾ׷Ӷ + */ + virtual void FUNCTION_CALL_MODE SetReplace(bool bReplace)=0; + + /** + * ÷ͼ + * @param nSendInterval λ + */ + virtual void FUNCTION_CALL_MODE SetSendInterval(int nSendInterval)=0; + + /** + * ȡ + * @return Ϣ + */ + virtual char* FUNCTION_CALL_MODE GetTopicName() =0; + + /** + * ȡ + * @param iLen Σʾݵij + * @return ظ׵ַûзNULL + */ + virtual void* FUNCTION_CALL_MODE GetAppData(int *iLen) =0; + + /** + * ȡӦĹֶε + * @param index Ӧű + * @return ضӦ±֣򷵻NULL. + */ + virtual char* FUNCTION_CALL_MODE GetFilterNameByIndex(int index) = 0; + + /** + * ±ȡֵ + * @param index Ӧű + * @return ضӦ±ֵ򷵻NULL. + */ + virtual char* FUNCTION_CALL_MODE GetFilterValueByIndex(int index)= 0; + + /** + * ݹֻȡֵ + * @param fileName ӦĹ + * @return ضӦĹֵֵ򷵻NULL. + */ + virtual char* FUNCTION_CALL_MODE GetFilterValue(char* fileName)= 0; + + /** + * ȡĸ + * @return ضӦĸûз0 + */ + virtual int FUNCTION_CALL_MODE GetFilterCount() = 0; + + /** + * ȡֶ + * @return ضӦķֶϢ + */ + virtual char* FUNCTION_CALL_MODE GetReturnFiled()=0; + + /** + * ȡǷȱı־ + * @return ضӦIJȱ־ + */ + virtual bool FUNCTION_CALL_MODE GetFromNow()=0 ; + + /** + * ȡǷ񸲸Ƕĵı־ + * @return ضӦĸǶı־ + */ + virtual bool FUNCTION_CALL_MODE GetReplace() =0; + + /** + * ȡӦķƵ + * @return ضӦķͼ + */ + virtual int FUNCTION_CALL_MODE GetSendInterval()=0; +}; + +class CSubscribeInterface; + +/** + * @brief Ļصӿڷصݶ壬˶Ҫҵ֮⣬Ҫص + */ +typedef struct tagSubscribeRecvData +{ + char* lpFilterData; /**< ֶεͷָ룬ý */ + int iFilterDataLen; /**< ֶεݳ */ + char* lpAppData; /**< ݵͷָ */ + int iAppDataLen; /**< ݵij */ + char szTopicName[260]; /**< */ + + /** + * tagSubscribeRecvData 캯 + */ + tagSubscribeRecvData() + { + memset(this,0,sizeof(tagSubscribeRecvData)); + } +}SUBSCRIBE_RECVDATA, *LPSUBSCRIBE_RECVDATA; + +/** + * ĻصӿڣϲӦͨӿڣƹϢ + */ +class CSubCallbackInterface: public IKnown +{ +public: + + /** + * յϢĻص + * @param lpSub صĶָ + * @param subscribeIndex ϢӦĶıʶʶSubscribeTopicķ + * @param lpData ϢĶָ룬һϢҵ + * @param nLength ݵij + * @param lpRecvData ϢֶηأҪ˸ݣϢ֣ϸοǰṹ嶨 + * @return + */ + virtual void FUNCTION_CALL_MODE OnReceived(CSubscribeInterface *lpSub,int subscribeIndex, const void *lpData, int nLength,LPSUBSCRIBE_RECVDATA lpRecvData) = 0; + + /** + * յ޳Ϣصһӵ˲Ե»صӿ,ص治ҪȡģײѾȡģֻһ֪ͨӿ + * @param lpSub صĶָ + * @param subscribeIndex ϢӦĶıʶʶSubscribeTopicķ + * @param TickMsgInfo ˵ĴϢҪǰظĶλϢ + * @return + */ + virtual void FUNCTION_CALL_MODE OnRecvTickMsg(CSubscribeInterface *lpSub,int subscribeIndex,const char* TickMsgInfo) = 0; +}; + + +/** + * ĽӿڵĶ + */ +class CSubscribeInterface: public IKnown +{ +public: + + /** + * + * @param lpSubscribeParamInter 涨ĶIJṹ + * @param uiTimeout ʱʱ + * @param lppBizUnPack ҵУʱʧܷصҵϢijɹûзأҪReleaseͷ + ҵУĴϢд£ + IF2UnPacker* lpBizUnPack =NULL; + SubscribeTopic(...,&lpBizUnPack); + ݷֵʧܵľж lpBizUnPack DzNULL. + Ϣȡ֮,ͷ + lpBizUnPack->Release(); + * @param lpBizPack ҵУҪӵҵֶԼֵûо͸ݹΪҵУֶ + * @return ֵ0ʾǰijɹĶıʶҪסʶͶ֮ӳϵʶҪȡĺͽϢĻص. + * ֵݴŻȡϢ. + */ + virtual int FUNCTION_CALL_MODE SubscribeTopic(CSubscribeParamInterface* lpSubscribeParamInter ,unsigned int uiTimeout,IF2UnPacker** lppBizUnPack=NULL,IF2Packer* lpBizPack=NULL) = 0; + + /** + * ȡ + * @param subscribeIndex ϢӦĶıʶʶSubscribeTopicķ + * @return 0ʾȡijɹֵݴŻȡϢ. + */ + virtual int FUNCTION_CALL_MODE CancelSubscribeTopic(int subscribeIndex) = 0; + + + /** + * ȡ + * @param topicName + * @param lpFilterInterface ӦĹ + * @return 0ʾȡijɹֵݴŻȡϢ. + */ + virtual int FUNCTION_CALL_MODE CancelSubscribeTopicEx(char* topicName,CFilterInterface* lpFilterInterface) = 0; + + + + /** + * ȡǰĽӿѾĵԼϢ + * @param lpPack 洫Ĵ + * @note packerֶ + - SubcribeIndex + - IsBornTopic + - TopicName + - TopicNo + - FilterRaw + - Appdata + - SendInterval + - ReturnFileds + - isReplace + - isFromNow + - Stutas + - QueueCount + */ + virtual void FUNCTION_CALL_MODE GetSubcribeTopic(IF2Packer* lpPack)=0; + + /** + * ȡַ + * @param lpPort ķ˿ڣΪNULL + * @return طַ + */ + virtual const char * FUNCTION_CALL_MODE GetServerAddress(int *lpPort) = 0; +}; + +/** + * ӿ + */ +class CPublishInterface: public IKnown +{ +public: + + /** + * ҵʽݷӿ + * @param topicName ֣֪־ʹNULL + * @param lpUnPacker + * @param iTimeOut ʱʱ + * @param lppBizUnPack ҵУʱʧܷصҵϢɹûзأҪReleaseͷ + ҵУĴϢд£ + IF2UnPacker* lpBizUnPack =NULL; + PubMsgByPacker(...,&lpBizUnPack); + ݷֵʧܵľж lpBizUnPack DzNULL. + Ϣȡ֮,ͷ + lpBizUnPack->Release(); + * @param bAddTimeStamp Ƿʱϵܲ + * @return 0ʾɹֵݴŻȡϢ. + */ + virtual int FUNCTION_CALL_MODE PubMsgByPacker(char* topicName ,IF2UnPacker* lpUnPacker,int iTimeOut=-1, + IF2UnPacker** lppBizUnPack=NULL,bool bAddTimeStamp=false) = 0; + + /** + * ҵʽݷӿڣһƸʽķ + * @param topicName ֣֪־ʹNULL + * @param lpFilterInterface ҪϲԼָĬûй + * @param lpData + * @param nLength ݳ + * @param iTimeOut ʱʱ + * @param lppBizUnPack ҵУʱʧܷصҵϢɹûзأҪReleaseͷ + ҵУĴϢд£ + IF2UnPacker* lpBizUnPack =NULL; + PubMsgByPacker(...,&lpBizUnPack); + ݷֵʧܵľж lpBizUnPack DzNULL. + Ϣȡ֮,ͷ + lpBizUnPack->Release(); + * @param bAddTimeStamp Ƿʱϵܲ + * @return 0ʾɹֵݴŻȡϢ. + */ + virtual int FUNCTION_CALL_MODE PubMsg(char* topicName, CFilterInterface* lpFilterInterface, const void *lpData, int nLength,int iTimeOut=-1, + IF2UnPacker** lppBizUnPack=NULL,bool bAddTimeStamp=false) = 0; + + /** + * صǰķ + * @param topicName + * @return 0ʾûжӦ⣬ֵʾɹ + */ + virtual uint32 FUNCTION_CALL_MODE GetMsgNoByTopicName(char* topicName)=0; + + /** + * ȡַ + * @param lpPort ķ˿ڣΪNULL + * @return طַ + */ + virtual const char * FUNCTION_CALL_MODE GetServerAddress(int *lpPort) = 0; +}; + +class CConnectionInterface; + +///Ӷ CConnectionInterface ҪĻصӿڶ +/** +* ӳɹӶϿɡյݵ¼ +*/ +class CCallbackInterface: public IKnown +{ +public: + /** + * ׽ӳɹ + * @param lpConnection ¼Ӷ + */ + virtual void FUNCTION_CALL_MODE OnConnect(CConnectionInterface *lpConnection) = 0; + + /** + * ɰȫ + * @param lpConnection ¼Ӷ + */ + virtual void FUNCTION_CALL_MODE OnSafeConnect(CConnectionInterface *lpConnection) = 0; + + /** + * ע + * @param lpConnection ¼Ӷ + */ + virtual void FUNCTION_CALL_MODE OnRegister(CConnectionInterface *lpConnection) = 0; + + /** + * ӱϿ + * @param lpConnection ¼Ӷ + */ + virtual void FUNCTION_CALL_MODE OnClose(CConnectionInterface *lpConnection) = 0; + + /** + * + * @param lpConnection ¼Ӷ + * @param hSend ; + * @param reserved1 ֶ + * @param reserved2 ֶ + * @param nQueuingData Ͷʣʹ߿ôֵƷ͵ٶȣСijֵʱз + * @see Send() + */ + virtual void FUNCTION_CALL_MODE OnSent(CConnectionInterface *lpConnection, int hSend, void *reserved1, void *reserved2, int nQueuingData) = 0; + + virtual void FUNCTION_CALL_MODE Reserved1(void *a, void *b, void *c, void *d) = 0; + + virtual void FUNCTION_CALL_MODE Reserved2(void *a, void *b, void *c, void *d) = 0; + + virtual int FUNCTION_CALL_MODE Reserved3() = 0; + + virtual void FUNCTION_CALL_MODE Reserved4() = 0; + + virtual void FUNCTION_CALL_MODE Reserved5() = 0; + + virtual void FUNCTION_CALL_MODE Reserved6() = 0; + + virtual void FUNCTION_CALL_MODE Reserved7() = 0; + + /** + * յSendBiz첽͵Ӧ + * @param lpConnection ¼Ӷ + * @param hSend ; + * @param lpUnPackerOrStr ָָߴϢ + * @param nResult հ + * nResult0ʾҵݽճɹҵɹlpUnPackerOrStrָһʱӦȽָתΪIF2UnPacker * + * nResult1ʾҵݽճɹҵʧˣlpUnPackerOrStrָһʱӦȽָתΪIF2UnPacker * + * nResult2ʾյҵϢlpUnPackerOrStrָһɶַϢ + * nResult3ʾҵʧܡlpUnPackerOrStrָNULL + */ + virtual void FUNCTION_CALL_MODE OnReceivedBiz(CConnectionInterface *lpConnection, int hSend, const void *lpUnPackerOrStr, int nResult) = 0; + + /** + * յSendBiz첽͵Ӧ + * @param lpConnection ¼Ӷ + * @param hSend ; + * @param lpRetData ҪصӦݣҪȡ + * @param lpUnPackerOrStr ָָߴϢ + * @param nResult հ + * nResult0ʾҵݽճɹҵɹlpUnpackerOrStrָһʱӦȽָתΪIF2UnPacker * + * nResult1ʾҵݽճɹҵʧˣlpUnpackerOrStrָһʱӦȽָתΪIF2UnPacker * + * nResult2ʾյҵϢlpUnpackerOrStrָһɶַϢ + * nResult3ʾҵʧܡlpUnpackerOrStrָNULL + */ + virtual void FUNCTION_CALL_MODE OnReceivedBizEx(CConnectionInterface *lpConnection, int hSend, LPRET_DATA lpRetData, const void *lpUnpackerOrStr, int nResult) = 0; + //20130624 xuxp صBizMessageӿ + /** + * յʱָReplyCallbackѡӦûжӦ + * @param lpConnection ¼Ӷ + * @param hSend ; + * @param lpMsg ҵϢָ + */ + virtual void FUNCTION_CALL_MODE OnReceivedBizMsg(CConnectionInterface *lpConnection, int hSend, IBizMessage* lpMsg) = 0; + + + +}; + +///T2_SDKӶӿ +/** +* ӡϿ͡յ +*/ +class CConnectionInterface: public IKnown +{ +public: + ///״̬ + enum ConnectionStatus + { + Disconnected = 0x0000, /**< δ */ + Connecting = 0x0001, /**< socket */ + Connected = 0x0002, /**< socket */ + SafeConnecting = 0x0004, /**< ڽȫ */ + SafeConnected = 0x0008, /**< ѽȫ */ + Registering = 0x0010, /**< ע */ + Registered = 0x0020, /**< ע */ + Rejected = 0x0040 /**< ܾر */ + }; + + ///ѡϣ0ʾճʱʱɾIDԿٴεRecvBizԽգ + enum RecvFlags + { + JustRemoveHandle = 0x0001 /**< ճʱʱpacket_idɾ */ + }; + + /** + * ʼӶ + * @param lpCallback ص + * @return 0ʾɹʾʧܣͨGetErrorMsgԻȡϸϢ + * ӦòҪκλص÷NULLԶصͶ + */ + virtual int FUNCTION_CALL_MODE Create(CCallbackInterface *lpCallback) = 0; + + /** + * ʼ/ע + * @param uiTimeout ʱʱ䣬λ룬0ʾȴʹôӷʱòã + * @return 0ʾɹʾʧܣͨGetErrorMsgԻȡϸϢ + */ + virtual int FUNCTION_CALL_MODE Connect(unsigned int uiTimeout) = 0; + + /** + * Ͽ + * @return 0ʾɹʾʧܣͨGetErrorMsgԻȡϸϢ + */ + virtual int FUNCTION_CALL_MODE Close() = 0; + + virtual int FUNCTION_CALL_MODE Reserved1() = 0; + + virtual int FUNCTION_CALL_MODE Reserved2() = 0; + + virtual int FUNCTION_CALL_MODE Reserved3() = 0; + + virtual int FUNCTION_CALL_MODE Reserved4() = 0; + + virtual int FUNCTION_CALL_MODE Reserved5() = 0; + + virtual int FUNCTION_CALL_MODE Reserved6() = 0; + + /** + * ȡַ + * @param lpPort ķ˿ڣΪNULL + * @return طַ + */ + virtual const char * FUNCTION_CALL_MODE GetServerAddress(int *lpPort) = 0; + + /** + * ȡ״̬ + * @return ״̬ + */ + virtual int FUNCTION_CALL_MODE GetStatus() = 0; + + /** + * ȡأʹ߿ͬʱʵͬʱӲͬķӵʱԼؾʹĸ + * @return طأǸԽʾԽæʾʧܣͨGetErrorMsgԻȡϸϢ + */ + virtual int FUNCTION_CALL_MODE GetServerLoad() = 0; + + /** + * ȡӦĴϢĿǰּ֧ĺӢģ֧ԿͨӶerrormsg + * @param nErrorCode + * @return شϢ + */ + virtual const char * FUNCTION_CALL_MODE GetErrorMsg(int nErrorCode) = 0; + + /** + * ȡӴţ޷עʱȿͨConnectķֵȡţ + * ҲͨñȡţȻøôŵGetErrorMsgɻȡɶĴϢ + * @return Ӵ + */ + virtual int FUNCTION_CALL_MODE GetConnectError() = 0; + + /** + * ҵ + * @param iFunID ܺ + * @param lpPacker ָ + * @param nAsy 0ʾͬʾ첽 + * @param iSystemNo iSystemNo > 0ϵͳ + * @param nCompressID ҵѹѹ㷨IDĿǰֻ֧ID = 1ѹ㷨 + * ID = 0ʾѹע⣬ѹֻSDK飬ǷѹȡڰʵʴС + * ͬ͵İͨRecvBizգ첽͵İյӦԶصOnReceivedBiz + * @return ط;ʾʧܣͨGetErrorMsgԻȡϸϢ + */ + virtual int FUNCTION_CALL_MODE SendBiz(int iFunID, IF2Packer *lpPacker, int nAsy = 0, int iSystemNo = 0, int nCompressID = 1) = 0; + + /** + * ҵ + * @param hSend ;SendBizijɹֵ + * @param lppUnPackerOrStr ֵ0ʾҵݽճɹҵɹ*lppUnPackerOrStrָһʱӦȽָתΪIF2UnPacker * + * ֵ1ʾҵݽճɹҵʧˣ*lppUnPackerOrStrָһʱӦȽָתΪIF2UnPacker * + * ֵ2ʾյҵϢ*lppUnPackerOrStrָһɶַϢ + * ֵ3ʾҵʧܡ*lppUnPackerOrStrԭָݲᱻı䡣 + * @param uiTimeout ʱʱ䣬λ롣 + * @param uiFlag ѡ0ʾճʱԿɼRecvBizգ + * JustRemoveHandleʾճʱ󣬰hSendɾ + * @return С0ʾRecvBizʧܣͨGetErrorMsgԻȡϸϢ + * ע⣡ⲿָָĽڴSDKڲⲿͷţ + */ + virtual int FUNCTION_CALL_MODE RecvBiz(int hSend, void **lppUnPackerOrStr, unsigned uiTimeout = 1000, unsigned uiFlag = 0) = 0; + + //20101228 xuxp ͺͽܵӿںڶĺ + /** + * ҵ + * @param iFunID ܺ + * @param lpPacker ָ + * @param svrName ָмĽڵ + * @param nAsy 0ʾͬʾ첽 + * @param iSystemNo iSystemNo > 0ϵͳ + * @param nCompressID ҵѹѹ㷨IDĿǰֻ֧ID = 1ѹ㷨 + * ID = 0ʾѹע⣬ѹֻSDK飬ǷѹȡڰʵʴС + * ͬ͵İͨRecvBizգ첽͵İյӦԶصOnReceivedBiz + * @param branchNo Ӫҵš + * @param lpRequest ݣݽṹ嶨帳ֵ + * @return ط;ʾʧܣͨGetErrorMsgԻȡϸϢ + */ + virtual int FUNCTION_CALL_MODE SendBizEx(int iFunID, IF2Packer *lpPacker,char* svrName, int nAsy = 0, int iSystemNo = 0, int nCompressID = 1,int branchNo=0,LPREQ_DATA lpRequest=NULL) = 0; + + /** + * ҵ + * @param hSend ;SendBizijɹֵ + * @param lppUnPackerOrStr ֵ0ʾҵݽճɹҵɹ*lppUnPackerOrStrָһʱӦȽָתΪIF2UnPacker * + * ֵ1ʾҵݽճɹҵʧˣ*lppUnPackerOrStrָһʱӦȽָתΪIF2UnPacker * + * ֵ2ʾյҵϢ*lppUnPackerOrStrָһɶַϢ + * ֵ3ʾҵʧܡ*lppUnPackerOrStrԭָݲᱻı䡣 + * @param lpRetData ҪصӦݣҪȡ + * @param uiTimeout ʱʱ䣬λ룬0ʾȴ + * @param uiFlag ѡ0ʾճʱԿɼRecvBizգ + * JustRemoveHandleʾճʱ󣬰hSendɾ + * @return С0ʾRecvBizʧܣͨGetErrorMsgԻȡϸϢ + * ע⣡ⲿָָĽڴSDKڲⲿͷţ + * ע⣡ⲿָָLPRET_DATAڴSDKڲⲿͷţ + */ + virtual int FUNCTION_CALL_MODE RecvBizEx(int hSend, void **lppUnpackerOrStr, LPRET_DATA* lpRetData, unsigned uiTimeout = 1000, unsigned uiFlag = 0) = 0; + + + //20101228 xuxp Create֤صµOnReceivedBizExĽӿ + /** + * ʼӶ + * @param lpCallback ص + * @return 0ʾɹʾʧܣͨGetErrorMsgԻȡϸϢ + * ӦòҪκλص÷NULLԶصͶ + */ + virtual int FUNCTION_CALL_MODE CreateEx(CCallbackInterface *lpCallback) = 0; + + + //20120111 dongpf GetRealAddressȡԼipַͶ˿ + /** + * ȡipַͶ˿ + * @return ȡipַͶ˿ڣʽipַ+˿ + */ + virtual const char* FUNCTION_CALL_MODE GetRealAddress() = 0; + + + virtual int FUNCTION_CALL_MODE Reserved8() = 0; + virtual int FUNCTION_CALL_MODE Reserved9() = 0; + + //20130527 xuxp GetSelfAddressȡԼصIPͶ˿ + /** + * ȡipַͶ˿ + * @return ȡipַͶ˿ڣʽipַ+˿ + */ + virtual const char* FUNCTION_CALL_MODE GetSelfAddress() = 0; + + //20130529 xuxp GetSelfMacȡԼʹõMAC + /** + * ȡMACַ + * @return MACĵַַʽơD067E5556D83,мûзָ + */ + virtual const char* FUNCTION_CALL_MODE GetSelfMac() = 0; + + //20130609 xuxp ķӿ + ///////////////////////////////////ӶķĽӿ/////////////////////////////////////// + + /** + * һ + * @param lpCallback صӿ + * @param SubScribeName ֣ඩߵֱ벻һͬ.󳤶32ֽ + * @param iTimeOut ʱʱ + * @param iInitRecvQLen ʼնеij + * @param iStepRecvQLen ܶеչ + * @return ضĽӿʵһỰӿڶӦһص. + */ + virtual CSubscribeInterface* FUNCTION_CALL_MODE NewSubscriber(CSubCallbackInterface *lpCallback,char* SubScribeName,int iTimeOut, + int iInitRecvQLen=INIT_RECVQ_LEN,int iStepRecvQLen=STEP_RECVQ_LEN) = 0; + + /** + * ȡ + * @param msgCount ػϢĸ + * @param iTimeOut һγʼʱijʱʱ + * @param bResetNo Ƿ + * @return طͽӿʵһѾnewˣֱӷضӦָ + */ + virtual CPublishInterface* FUNCTION_CALL_MODE GetPublisher(int msgCount,int iTimeOut,bool bResetNo = false) = 0; + + + + + /** + * ȡ˵Ϣ + * @param byForce ǷǿƴӺ̨ȡ + * @param iTimeOut ʱʱ + * @return ɹͷϢ + * @note Ҫreleaseӿڽͷ. + * @note packerֶ + * - TopicName + * - TopicNo + * - ReliableLevel + * - IssuePriority + * - MsgLifetime + * - Stutas + * - TickStrategy + * - BusinessVerify + * - Local + * - FilterField1 + * - FilterField2 + * - FilterField3 + * - FilterField4 + * - FilterField5 + * - FilterField6 + * - SubscribeStr + * - PublishStr + */ + virtual IF2UnPacker* FUNCTION_CALL_MODE GetTopic(bool byForce,int iTimeOut) = 0; + + /** + * ȡķ + */ + virtual const char* FUNCTION_CALL_MODE GetMCLastError() = 0; + //////////////////////////////////////////////////////////////////////////////// + + //20130624 xuxp ӽӿӿڣΪ˵Ľӿڣͻ˿ҲƼʹ + ///////////////////////////////////µһײӿ/////////////////////////////////////// + /** + * ʼӶ + * @param lpCallback ص + * @return 0ʾɹʾʧܣͨGetErrorMsgԻȡϸϢ + * ӦòҪκλص÷NULLԶصͶ + */ + virtual int FUNCTION_CALL_MODE Create2BizMsg(CCallbackInterface *lpCallback) = 0; + + /** + * ҵ + * @param lpMsg ҵϢӿָ + * @param nAsy 0ʾͬʾ첽 + * ͬ͵İͨRecvBizMsgգ첽͵İյӦԶصOnReceivedBizMsg + * @return ط;ʾʧܣͨGetErrorMsgԻȡϸϢ + */ + virtual int FUNCTION_CALL_MODE SendBizMsg(IBizMessage* lpMsg,int nAsy = 0) = 0; + + /** + * + * @param hSend ; + * @param lpMsg յҵϢָĵַ + * @param uiTimeout ʱʱ䣬λ룬0ʾȴ + * @param uiFlag ѡ0ʾճʱԿɼReceiveգ + * JustRemoveHandleʾճʱʱpacket_idɾԺյ첽ķʽյ + * @return 0ʾɹʾʧܣͨGetErrorMsgԻȡϸϢ + */ + virtual int FUNCTION_CALL_MODE RecvBizMsg(int hSend, IBizMessage** lpMsg, unsigned uiTimeout = 1000, unsigned uiFlag = 0) = 0; + //////////////////////////////////////////////////////////////////////////////// +}; + +extern "C" +{ + /** + * ȡT2_SDKİ汾 + * @return ǰT2_SDKİ汾ţĿǰ汾Ϊ0x01000002ʾ1.0.0.2 + */ + int FUNCTION_CALL_MODE GetVersionInfo(); + + /** + * ȡһʵCConfigInterfaceӿڵָ + * @return ʵCConfigInterfaceӿڵָ + */ +CConfigInterface* FUNCTION_CALL_MODE NewConfig(); + + /** + * ȡһʵCConnectionInterfaceӿڵָ + * @param CConfigInterface ʵCConfigInterfaceӿڵָ + * @returnʵCConnectionInterfaceӿڵָ + */ +CConnectionInterface* FUNCTION_CALL_MODE NewConnection(CConfigInterface *lpConfig); + +/** +* @param int iVersion ҵʽ汾(ȡֵ:1 ִ,ֵ 0x20) +* Ƽʹ0x20 +* @return IPacker * ӿָ +*/ +IF2Packer * FUNCTION_CALL_MODE NewPacker(int iVersion); + +/** +* @param void * lpBuffer ҪݣARͨŰͷ +* @param unsigned int iLen ݳ +* @return IUnPacker * ӿָ +*/ +IF2UnPacker * FUNCTION_CALL_MODE NewUnPacker(void * lpBuffer, unsigned int iLen); + +/** +* @param char *EncodePass ɢнַȲ16'\0' +* @param const char* Password Ĵɢе +* @param int nReserve Ĭֵ +* @return char * ɢнַͬEncodePass +*/ +char * FUNCTION_CALL_MODE Encode(char *EncodePass, const char* Password, int nReserve = 0 ); + + +/** +*һṩļܺм +* @param const char* pIn Ĵַܵ +* @param const char* pOut ȺʹַСһⲿ +* @return +*/ +int FUNCTION_CALL_MODE EncodeEx(const char *pIn, char *pOut); + + +/** +* һӿָ +* @return NULLʾʧ. +*/ +CFilterInterface* FUNCTION_CALL_MODE NewFilter(); + +/** +* һԽӿָ +* @return NULLʾʧ. +*/ +CSubscribeParamInterface* FUNCTION_CALL_MODE NewSubscribeParam(); + +//20130625 xuxp ҵϢ +IBizMessage* FUNCTION_CALL_MODE NewBizMessage(); + +} + +#endif diff --git a/include/UFX/win32/c20150708.pfx b/include/UFX/win32/c20150708.pfx new file mode 100644 index 0000000..af9de51 Binary files /dev/null and b/include/UFX/win32/c20150708.pfx differ diff --git a/include/UFX/win32/license_hundsun.dat b/include/UFX/win32/license_hundsun.dat new file mode 100644 index 0000000..5511843 Binary files /dev/null and b/include/UFX/win32/license_hundsun.dat differ diff --git a/include/UFX/win32/t2sdk.dll b/include/UFX/win32/t2sdk.dll new file mode 100644 index 0000000..362a715 Binary files /dev/null and b/include/UFX/win32/t2sdk.dll differ diff --git a/include/UFX/win32/t2sdk.ini b/include/UFX/win32/t2sdk.ini new file mode 100644 index 0000000..9bedbec --- /dev/null +++ b/include/UFX/win32/t2sdk.ini @@ -0,0 +1,47 @@ +[t2sdk] +;Ҫ̨޸serversIP¹̨֤ļlicense_file֤ļ޸license_pwd +servers=120.55.176.113:9349 +license_file=license_hundsun.dat +license_pwd=888888 +;ĬϣҪ޸ĻաT2SDK ⲿĵ޸Ļӣ +;login_nameÿͻ˵¼֣ʵӣ +login_name=asyn_send +lan=1033 +send_queue_size=100 +init_recv_buf_size=512 +init_send_buf_size=512 +send_queue_size=1000 +;Ƿnagle㷨nagle㷨רTCP/IPӵ; +;enable_nagle=1 +errormsg=errormsg.ini +;ǷԶԶ֮Ͽᴥonclose +;auto_reconnect=1 +;Ϊ־ļã1˵־ܣwritedataȽÿԼ¼ͨt2зհɵdatļʹеĹ߽нߣLogDecryTool.exe +;if_error_log=1 +;if_sendRecv_log=1 +;writedata=1 +;ͻ˺ͷ˵ʱ䣬һ㲻 +;heartbeat_time = 15 + +[proxy] +;Ĭ +proxy_type= +ip=127.0.0.1 +port= +user_name=guest +password=888888 + +[safe] +;Ŀǰֵ֧İȫģʽУ +;1noneģ:ֻҪ޸safe_ssl=noneĬϣ +;2sslܣҪ޸safe_level=ssl,Ҫcert_filecert_pwdΪַ֤ +safe_level=none +client_id=123456 +comm_pwd=888888 +cert_file=c20150708.pfx +cert_pwd=111111 + +[ufx] +;߽ķ滷Ҫվר˺ţ +fund_account=100100005 +password=111111 \ No newline at end of file diff --git a/include/UFX/win32/t2sdk.lib b/include/UFX/win32/t2sdk.lib new file mode 100644 index 0000000..62ed24d Binary files /dev/null and b/include/UFX/win32/t2sdk.lib differ diff --git a/include/Wind/WAPIWrapperCpp.h b/include/Wind/WAPIWrapperCpp.h new file mode 100644 index 0000000..8e225ee --- /dev/null +++ b/include/Wind/WAPIWrapperCpp.h @@ -0,0 +1,245 @@ +#ifndef _WAPIWRAPPERCPP_H +#define _WAPIWRAPPERCPP_H + +#include +#include + +#ifdef WAPIWRAPPERCPP_EXPORTS +#define WAPIWRAPPERCPP_EXP __declspec(dllexport) +#else +#define WAPIWRAPPERCPP_EXP __declspec(dllimport) +#endif + +//ؼδע +const LONG noRegErr = -1; + +enum ErrMsgLang //Ϣ +{ + eENG = 0, ///< Ӣ + eCHN, ///< +}; + +class WAPIWRAPPERCPP_EXP WindData +{ +public: + VARIANT data; ///< + VARIANT codes; ///< Codeб + VARIANT fields; ///< ָб + VARIANT times; ///< ʱб + LONG errorCode; ///< +public: + + WindData(); + ~WindData(); + + VOID InitWindData(); + VOID ClearWindData(); + + //ȡϢ + LPCWSTR GetErrorMsg() const; + + //ת(Ҫdelete) + static WCHAR* DateToString(DATE date, LPCWSTR strFormat = L"%Y-%m-%d"); + static VOID FreeString(WCHAR*& pStr); + + ////////////////////////////////////////////////////////////////////////// + //ʹ + + INT GetCodesLength() const; + INT GetFieldsLength() const; + INT GetTimesLength() const; + + LPCWSTR GetCodeByIndex(int index) const; + LPCWSTR GetFieldsByIndex(int index) const; + BOOL GetTimeByIndex(int index, WCHAR timeBuffer[], int& length) const; + DATE GetTimeByIndex(int index) const; + + //ȡݲѯӿOneData + BOOL GetDataItem(int timeIndex, int codesIndex, int fieldsIndex, VARIANT& outItem) const; + + //ȡб + const DATE* GetTDaysInfo(LONG& lDateCount) const; + + ////////////////////////////////////////////////////////////////////////// + //ʹ + + INT GetRecordCount() const; + + //ȡ׽ӿOneData + BOOL GetTradeItem(int recordIndex, int fieldsIndex, VARIANT& outItem) const; + + //ȡ¼ID + LONG GetLogonID() const; + + //ȡOrderId + LONG GetOrderRequestID() const; + + //ȡOrderNumber + LPCWSTR GetOrderNumber(int recordIndex = 0) const; +}; + +// ص +typedef LONG (WINAPI *WsqCallBack)(ULONGLONG reqId, const WindData &windData); + +typedef LONG (WINAPI *TradeCallBack)(LONG LogonID, const WindData &windData); + +// Ǵ WAPIWrapperCpp.dll +class WAPIWRAPPERCPP_EXP CWAPIWrapperCpp { +public: + + // + ////////////////////////////////////////////////////////////////////////// + //Windӿ + static LONG start(LPCWSTR options = NULL, LPCWSTR options2 = NULL, LONG timeout = 5000); + + //Windӿֹ + static LONG stop(); + + //ж״̬ + static LONG isconnected(); + + // requestId Ϊ0 ȡ󣻷ֻȡIDŵ + static VOID cancelRequest(ULONGLONG requestId); + + //ȡ + static VOID cancelAllRequest(); + + //ȡӦĴϢ + static BOOL getErrorMsg(LONG errCode, ErrMsgLang lang, WCHAR msg[], int& /*inout*/msgLength); + + ////////////////////////////////////////////////////////////////////////// + + //ݺ + ////////////////////////////////////////////////////////////////////////// + //ֵwsd + static LONG wsd(WindData& outWindData, LPCWSTR windCodes, LPCWSTR fields, LPCWSTR startTime = NULL, LPCWSTR endTime = NULL, LPCWSTR options = NULL); + + //ֵwssʷ + static LONG wss(WindData& outWindData, LPCWSTR windCodes, LPCWSTR fields, LPCWSTR options = NULL); + + //ֵwsi÷ + static LONG wsi(WindData& outWindData, LPCWSTR windCodes, LPCWSTR fields, LPCWSTR startTime, LPCWSTR endTime, LPCWSTR options = NULL); + + //ֵwst + static LONG wst(WindData& outWindData, LPCWSTR windCodes, LPCWSTR fields, LPCWSTR startTime, LPCWSTR endTime, LPCWSTR options = NULL); + + //ֵwsqʵʱ + //ǶģʽȡһԿ + static LONG wsq(WindData& outWindData, LPCWSTR windCodes, LPCWSTR fields, LPCWSTR options = NULL); + + //ģʽʵʱݣͨص + static LONG wsq(ULONGLONG &reqId, LPCWSTR windCodes, LPCWSTR fields, WsqCallBack callBack, LPCWSTR options = NULL, BOOL updateAllFields = FALSE); + + //ֵtdqʵʱ + //ģʽtdʵʱݣͨص + static LONG tdq(ULONGLONG &reqId, LPCWSTR windCodes, LPCWSTR fields, WsqCallBack callBack, LPCWSTR options = NULL, BOOL updateAllFields = FALSE); + + //ֵbbqʵʱ + //ǶģʽȡһԿ + static LONG bbq(WindData& outWindData, LPCWSTR windCodes, LPCWSTR fields, LPCWSTR options = NULL); + + //ģʽʵʱݣͨص + static LONG bbq(ULONGLONG &reqId, LPCWSTR windCodes, LPCWSTR fields, WsqCallBack callBack, LPCWSTR options = NULL); + + //ֵwsetָݼ + static LONG wset(WindData& outWindData, LPCWSTR reportName, LPCWSTR options = NULL); + + //ֵedbþ + static LONG edb(WindData& outWindData, LPCWSTR windCodes, LPCWSTR startTime = NULL, LPCWSTR endTime = NULL, LPCWSTR options = NULL); + + //ϱ + static LONG wpf(WindData& outWindData, LPCWSTR portfolioName, LPCWSTR viewName, LPCWSTR options = NULL); + + //ϴ + static LONG wupf(WindData& outWindData, LPCWSTR portfolioName, LPCWSTR tradeDate, LPCWSTR windCodes, LPCWSTR quantity, LPCWSTR costPrice, LPCWSTR options = NULL); + + //֤ɸѡ + static LONG weqs(WindData& outWindData, LPCWSTR planName, LPCWSTR options = NULL); + + //աայк + static LONG tdays(WindData& outWindData, LPCWSTR startTime, LPCWSTR endTime, LPCWSTR options = NULL); + + //աայƫƼ + static LONG tdaysoffset(DATE& outDate, LPCWSTR startTime, LONG offset, LPCWSTR options = NULL); + + //աայ + static LONG tdayscount(LONG& outCount, LPCWSTR startTime, LPCWSTR endTime, LPCWSTR options = NULL); + ////////////////////////////////////////////////////////////////////////// + + //׺ + ////////////////////////////////////////////////////////////////////////// + //˺ŵ½ + static LONG tlogon(WindData& outWindData, LPCWSTR brokerID, LPCWSTR departmentID, LPCWSTR accountID, LPCWSTR password, LPCWSTR accountType, LPCWSTR options = NULL,TradeCallBack callBack=0); + + //˺ŵdz, 0:dzȫѵ¼˺ + static LONG tlogout(INT longId=0); + + //µ + static LONG torder(WindData& outWindData, LPCWSTR windCodes, LPCWSTR tradeSide, LPCWSTR orderPrice, LPCWSTR orderVolume, LPCWSTR options = NULL); + static LONG torder(LONG& reqId, LPCWSTR windCodes, LPCWSTR tradeSide, DOUBLE orderPrice, LONG orderVolume, LPCWSTR options = NULL, WCHAR** pErrosMsg = NULL); + + //ȡ + // + static LONG tcovered(WindData& outWindData, LPCWSTR windCodes, LPCWSTR tradeSide, LPCWSTR orderVolume, LPCWSTR options = NULL); + static LONG tcovered(LONG& reqId, LPCWSTR windCodes, LPCWSTR tradeSide, LONG orderVolume, LPCWSTR options = NULL, WCHAR** pErrosMsg = NULL); + + + //ѯ + static LONG tquery(WindData& outWindData, LPCWSTR qryCode, LPCWSTR options = NULL); + + // + static LONG tcancel(LPCWSTR orderNumber, LPCWSTR options = NULL); + ////////////////////////////////////////////////////////////////////////// + + //ز⺯ + ////////////////////////////////////////////////////////////////////////// + //ز⿪ʼ + static LONG bktstart(WindData& outWindData, LPCWSTR strategyName, LPCWSTR startDate, LPCWSTR endDate, LPCWSTR options = NULL); + + //زѯ + static LONG bktquery(WindData& outWindData, LPCWSTR qrycode, LPCWSTR qrytime, LPCWSTR options = NULL); + + //زµ + static LONG bktorder(WindData& outWindData, LPCWSTR tradeTime, LPCWSTR securityCode, LPCWSTR tradeSide, LPCWSTR tradeVol, LPCWSTR options = NULL); + + //ز + static LONG bktend(WindData& outWindData, LPCWSTR options); + + //鿴ز״̬ + static LONG bktstatus(WindData& outWindData, LPCWSTR options); + + //زҪ + static LONG bktsummary(WindData& outWindData, LPCWSTR bktID, LPCWSTR view, LPCWSTR options); + + //زɾ + static LONG bktdelete(WindData& outWindData, LPCWSTR bktID, LPCWSTR options); + + //زб + static LONG bktstrategy(WindData& outWindData, LPCWSTR options); + + ////////////////////////////////////////////////////////////////////////// + //appӦ + /** + * @brief AppȨ֤ + * @param WindData & outWindData: + * @param LPCTSTR appKey: appӴվȡΨһ֤Id + * @param LPCTSTR appSecret:appԿ + * @param LPCTSTR options: + * @return LONG: ɹ\ + */ + static LONG wappAuth(WindData& outWindData, LPCTSTR appKey, LPCTSTR appSecret, LPCTSTR options); + + /** + * @brief Appʹ½ͨѶ + * @param WindData & outWindData: + * @param LPCTSTR type_id: communication type,include:message_put; message_get; app_version; app_fps; app_data_get; app_data_put + * @param LPCTSTR message: communication content + * @param LPCTSTR options: + * @return LONG: ɹ\ + */ + static LONG wappMessage(WindData& outWindData, LPCTSTR type_id, LPCTSTR message, LPCTSTR options); + + ////////////////////////////////////////////////////////////////////////// +}; + +#endif diff --git a/include/Wind/win32/WAPIWrapperCpp.dll b/include/Wind/win32/WAPIWrapperCpp.dll new file mode 100644 index 0000000..03d2f70 Binary files /dev/null and b/include/Wind/win32/WAPIWrapperCpp.dll differ diff --git a/include/Wind/win32/WAPIWrapperCpp.lib b/include/Wind/win32/WAPIWrapperCpp.lib new file mode 100644 index 0000000..a358956 Binary files /dev/null and b/include/Wind/win32/WAPIWrapperCpp.lib differ diff --git a/include/Wind/win64/WAPIWrapperCpp.dll b/include/Wind/win64/WAPIWrapperCpp.dll new file mode 100644 index 0000000..d8402f4 Binary files /dev/null and b/include/Wind/win64/WAPIWrapperCpp.dll differ diff --git a/include/Wind/win64/WAPIWrapperCpp.lib b/include/Wind/win64/WAPIWrapperCpp.lib new file mode 100644 index 0000000..999e02f Binary files /dev/null and b/include/Wind/win64/WAPIWrapperCpp.lib differ diff --git a/include/XApiC.def b/include/XApiC.def index 52240c9..f03781f 100644 --- a/include/XApiC.def +++ b/include/XApiC.def @@ -5,7 +5,7 @@ EXPORTS X_GetFunction @3 X_FreeLib @4 - X_GetApiType @5 + X_GetApiTypes @5 X_GetApiVersion @6 X_GetApiName @7 @@ -13,16 +13,16 @@ EXPORTS X_Register @9 X_Connect @10 X_Disconnect @11 - X_Subscribe @12 + + X_Subscribe @12 X_Unsubscribe @13 X_SubscribeQuote @14 X_UnsubscribeQuote @15 - X_ReqQryInstrument @16 - X_ReqQryInvestorPosition @17 - X_ReqQryTradingAccount @18 - X_SendOrder @19 - X_CancelOrder @20 - X_SendQuote @21 - X_CancelQuote @22 \ No newline at end of file + X_ReqQuery @16 + + X_SendOrder @17 + X_CancelOrder @18 + X_SendQuote @19 + X_CancelQuote @20 \ No newline at end of file diff --git a/include/XApiC.h b/include/XApiC.h index 3e8426e..a8c2b26 100644 --- a/include/XApiC.h +++ b/include/XApiC.h @@ -1,40 +1,49 @@ #pragma once -#include "../include/ApiStruct.h" +#include "CrossPlatform.h" +#include "ApiStruct.h" +#include "QueueEnum.h" #ifdef __cplusplus extern "C" { #endif -void* X_LoadLib(char* libPath); -char* X_GetLastError(); -void* X_GetFunction(void* lib, char* ProcName = "XRequest"); + typedef void* (__stdcall *fnOnResponse) (char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void* X_LoadLib(const char* libPath); +const char* X_GetLastError(); +void* X_GetFunction(void* lib, const char* ProcName = "XRequest"); void X_FreeLib(void* lib); -ApiType X_GetApiType(void* pFun); -char* X_GetApiVersion(void* pFun); -char* X_GetApiName(void* pFun); +ApiType X_GetApiTypes(void* pFun); +const char* X_GetApiVersion(void* pFun); +const char* X_GetApiName(void* pFun); void* X_Create(void* pFun); -void X_Register(void* pFun, void* pApi, void* pCallback, void* pClass); +void X_Register(void* pFun, void* pApi, fnOnResponse pCallback, void* pClass); -void X_Connect(void* pFun, void* pApi, char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count); +void X_Connect(void* pFun, void* pApi, const char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count); void X_Disconnect(void* pFun, void* pApi); -void X_Subscribe(void* pFun, void* pApi, char* szInstrument, char* szExchange); -void X_Unsubscribe(void* pFun, void* pApi, char* szInstrument, char* szExchange); -void X_SubscribeQuote(void* pFun, void* pApi, char* szInstrument, char* szExchange); -void X_UnsubscribeQuote(void* pFun, void* pApi, char* szInstrument, char* szExchange); +void X_Subscribe(void* pFun, void* pApi, const char* szInstrument, const char* szExchange); +void X_Unsubscribe(void* pFun, void* pApi, const char* szInstrument, const char* szExchange); +void X_SubscribeQuote(void* pFun, void* pApi, const char* szInstrument, const char* szExchange); +void X_UnsubscribeQuote(void* pFun, void* pApi, const char* szInstrument, const char* szExchange); -void X_ReqQryInstrument(void* pFun, void* pApi, char* szInstrument, char* szExchange); -void X_ReqQryInvestorPosition(void* pFun, void* pApi, char* szInstrument, char* szExchange); -void X_ReqQryTradingAccount(void* pFun, void* pApi); +void X_ReqQuery(void* pFun, void* pApi, QueryType type, ReqQueryField* query); -void X_SendOrder(void* pFun, void* pApi, OrderField* pOrder, OrderIDType* pInOut, int count); -void X_CancelOrder(void* pFun, void* pApi, OrderIDType* pIn, OrderIDType* pOut, int count); +const char* X_SendOrder(void* pFun, void* pApi, OrderField* pOrder, int count, char* pOut); +const char* X_CancelOrder(void* pFun, void* pApi, OrderIDType* pIn, int count, char* pOut); -void X_SendQuote(void* pFun, void* pApi, QuoteField* pQuote, OrderIDType* pAskOut, OrderIDType* pBidOut, int count); -void X_CancelQuote(void* pFun, void* pApi, OrderIDType* pIn, OrderIDType* pOut, int count); +const char* X_SendQuote(void* pFun, void* pApi, QuoteField* pQuote, int count, char* pOut); +const char* X_CancelQuote(void* pFun, void* pApi, OrderIDType* pIn, int count, char* pOut); #ifdef __cplusplus } diff --git a/include/XApiCpp.h b/include/XApiCpp.h index f7578d6..03fe857 100644 --- a/include/XApiCpp.h +++ b/include/XApiCpp.h @@ -5,9 +5,10 @@ #pragma once #endif // _MSC_VER > 1000 -#include "../include/CrossPlatform.h" +#include "CrossPlatform.h" -#include "../include/ApiStruct.h" +#include "ApiStruct.h" +#include "QueueEnum.h" class CXApi; @@ -16,21 +17,27 @@ class CXSpi public: virtual void OnConnectionStatus(CXApi* pApi, ConnectionStatus status, RspUserLoginField* pUserLogin, int size1){}; virtual void OnRtnError(CXApi* pApi, ErrorField* pError){}; + virtual void OnLog(CXApi* pApi, LogField* pLog) {}; virtual void OnRtnDepthMarketDataN(CXApi* pApi, DepthMarketDataNField* pMarketData){}; - virtual void OnRtnQuoteRequest(CXApi* pApi, QuoteRequestField* pQuoteRequest){}; + virtual void OnRspQryInstrument(CXApi* pApi, InstrumentField* pInstrument, int size1, bool bIsLast) {}; + virtual void OnRspQryTradingAccount(CXApi* pApi, AccountField* pAccount, int size1, bool bIsLast) {}; + virtual void OnRspQryInvestorPosition(CXApi* pApi, PositionField* pPosition, int size1, bool bIsLast) {}; + virtual void OnRspQrySettlementInfo(CXApi* pApi, SettlementInfoField* pSettlementInfo, int size1, bool bIsLast) {}; - virtual void OnRspQryInstrument(CXApi* pApi, InstrumentField* pInstrument, int size1, bool bIsLast){}; - virtual void OnRspQryTradingAccount(CXApi* pApi, AccountField* pAccount, int size1, bool bIsLast){}; - virtual void OnRspQryInvestorPosition(CXApi* pApi, PositionField* pPosition, int size1, bool bIsLast){}; - virtual void OnRspQrySettlementInfo(CXApi* pApi, SettlementInfoField* pSettlementInfo, int size1, bool bIsLast){}; - virtual void OnRspQryInvestor(CXApi* pApi, InvestorField* pInvestor, int size1, bool bIsLast){}; - virtual void OnRtnOrder(CXApi* pApi, OrderField* pOrder){}; - virtual void OnRtnTrade(CXApi* pApi, TradeField* pTrade){}; - virtual void OnRtnQuote(CXApi* pApi, QuoteField* pQuote){}; + virtual void OnRspQryOrder(CXApi* pApi, OrderField* pOrder, int size1, bool bIsLast) {}; + virtual void OnRspQryTrade(CXApi* pApi, TradeField* pTrade, int size1, bool bIsLast) {}; + virtual void OnRspQryQuote(CXApi* pApi, QuoteField* pQuote, int size1, bool bIsLast) {}; + + virtual void OnRtnOrder(CXApi* pApi, OrderField* pOrder) {}; + virtual void OnRtnTrade(CXApi* pApi, TradeField* pTrade) {}; + virtual void OnRtnQuote(CXApi* pApi, QuoteField* pQuote) {}; - virtual void OnRspQryHistoricalTicks(CXApi* pApi, TickField* pTicks, int size1, HistoricalDataRequestField* pRequest, int size2, bool bIsLast){}; - virtual void OnRspQryHistoricalBars(CXApi* pApi, BarField* pBars, int size1, HistoricalDataRequestField* pRequest, int size2, bool bIsLast){}; + virtual void OnRtnQuoteRequest(CXApi* pApi, QuoteRequestField* pQuoteRequest){}; + virtual void OnRspQryHistoricalTicks(CXApi* pApi, TickField* pTicks, int size1, HistoricalDataRequestField* pRequest, int size2, bool bIsLast) {}; + virtual void OnRspQryHistoricalBars(CXApi* pApi, BarField* pBars, int size1, HistoricalDataRequestField* pRequest, int size2, bool bIsLast) {}; + virtual void OnRspQryInvestor(CXApi* pApi, InvestorField* pInvestor, int size1, bool bIsLast){}; + virtual void OnRtnInstrumentStatus(CXApi* pApi, InstrumentStatusField* pInstrumentStatus) {}; virtual bool OnFilterSubscribe(CXApi* pApi, ExchangeType exchange, int instrument_part1, int instrument_part2, int instrument_part3, char* pInstrument){ return true; }; }; @@ -38,34 +45,32 @@ class CXSpi class DLL_PUBLIC CXApi { public: - static CXApi* CreateApi(char* libPath); + static CXApi* CreateApi(const char* libPath); virtual bool Init() = 0; - virtual char* GetLastError() = 0; + virtual const char* GetLastError() = 0; - virtual ApiType GetApiType() = 0; - virtual char* GetApiVersion() = 0; - virtual char* GetApiName() = 0; + virtual ApiType GetApiTypes() = 0; + virtual const char* GetApiVersion() = 0; + virtual const char* GetApiName() = 0; virtual void RegisterSpi(CXSpi *pSpi) = 0; - virtual void Connect(char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count) = 0; + virtual void Connect(const char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count) = 0; virtual void Disconnect() = 0; - virtual void Subscribe(char* szInstrument, char* szExchange) = 0; - virtual void Unsubscribe(char* szInstrument, char* szExchange) = 0; + virtual void Subscribe(const char* szInstrument, const char* szExchange) = 0; + virtual void Unsubscribe(const char* szInstrument, const char* szExchange) = 0; - virtual void ReqQryInstrument(char* szInstrument, char* szExchange) = 0; - virtual void ReqQryInvestorPosition(char* szInstrument, char* szExchange) = 0; - virtual void ReqQryTradingAccount() = 0; + virtual void ReqQuery(QueryType type, ReqQueryField* query) = 0; - virtual void SendOrder(OrderField* pOrder, OrderIDType* pInOut, int count) = 0; - virtual void CancelOrder(OrderIDType* pIn, OrderIDType* pOut, int count) = 0; + virtual const char* SendOrder(OrderField* pOrder, int count, char* pOut) = 0; + virtual const char* CancelOrder(OrderIDType* pIn, int count, char* pOut) = 0; - virtual void SendQuote(QuoteField* pQuote, OrderIDType* pAskOut, OrderIDType* pBidOut, int count) = 0; - virtual void CancelQuote(OrderIDType* pIn, OrderIDType* pOut, int count) = 0; + virtual const char* SendQuote(QuoteField* pQuote, int count, char* pOut) = 0; + virtual const char* CancelQuote(OrderIDType* pIn, int count, char* pOut) = 0; protected: CXApi(); - ~CXApi(){}; + ~CXApi(); }; #endif diff --git a/include/XTP/changelist.txt b/include/XTP/changelist.txt new file mode 100644 index 0000000..1dc18f9 --- /dev/null +++ b/include/XTP/changelist.txt @@ -0,0 +1,116 @@ +version 1.1.18.13 +1޸QuoteAPIlinuxʹUDPӻcrashbug + +version 1.1.18.12 +1QuoteAPI޸ı󣬽exchage_idΪΪexchange_id +2޸ͷļ룬GB2312ΪUTF-8 + +version 1.1.18.9 +1TradeAPIȨҵ֧֣business_type = XTP_BUSINESS_TYPE_OPTION +2ѯֲֽṹXTPQueryStkPositionRspֶΣֲַposition_directionȨԼexecutable_optionlockable_positionȨexecutable_underlyinglocked_positionusable_locked_position +3TradeAPIѯȨԼӿOnQueryOptionAuctionInfo() +4XTP_SIDE_TYPEint32öͱΪuint8͵öֵ +5ṹXTPOrderInsertInfoXTPOrderInfoXTPTradeReportƽʶֶposition_effectȨҵͨƱҵposition_effect = XTP_POSITION_EFFECT_INIT +6XTP_PRICE_TYPEöֵȨ޼걨FOK XTP_PRICE_LIMIT_OR_CANCEL +7ѯʽṹXTPQueryAssetRspֶΣı֤frozen_marginȨʽfrozen_exec_cashȨfrozen_exec_fee渶ʽpay_laterԤ渶ʽpreadva_payorig_banlanceǰbanlancedeposit_withdrawսʽtrade_nettingʽʲcaptial_assetǿʽforce_freeze_amountȡʽpreferred_amount +8QuoteAPIȨ֧֣ԭеĵĺ +9QuoteAPIȫгĺУexchage_idûԽегȫˣexchage_id = XTP_EXCHANGE_UNKNOWN ʾȫгģԭеȫгĺֹ֧Ʊ +10QuoteAPIȨȫг鶩/ȡĺSubscribeAllOptionMarketData()/UnSubscribeAllOptionMarketData() +11QuoteAPIȨȫг鶩/ȡĺSubscribeAllOptionOrderBook()/UnSubscribeAllOptionOrderBook() +12QuoteAPIȨȫг鶩/ȡĺSubscribeAllOptionTickByTick()/UnSubscribeAllOptionTickByTick() + +version 1.1.16.20 +1ȥsodium +2޸ijЩ£޷ȡmacַcrashbug +3޸apiʹUDPʱڶʱᵼbug +4mac osϵͳ֧ + +version 1.1.16.13 +1޸ʹwin32汾Ŀвѯѯѯƥbug + +version 1.1.16.9 +1QuoteAPIUDPӷʽ +2QuoteAPIȫġȫ˶ӿ +3QuoteAPI֧OrderBooklevel2plusġ˶ +4QuoteAPI֧ί/ɽĶġ˶ +5QuoteAPIѯԼ¼۽ӿ +6QuoteSPIԭOnMarketData()ص +7QuoteSPIúһһеOnDepthMarketData()ص +8QuoteAPI޸ĬϻеĴСӿSetUDPBufferSize()λΪMBĬϴСΪ64MBɸΪ64MBСĻ棩 +9TradeAPI¹깺ȲѯӿQueryIPOQuotaInfo() +10TradeAPI¹깺ϢбѯӿQueryIPOInfoList() +11TradeAPIصӿsession_id +12TradeAPIQuoteAPIⳬʱʱýӿSetHeartBeatInterval() + +version 1.1.16.1 +1TradeAPIѯETF嵥ӿQueryETF +2TradeAPIѯETFƱӿQueryETFTickerBasket +3TradeAPI֧ETFҵbusiness_type = XTP_BUSINESS_TYPE_ETF side = XTP_SIDE_PURCHASEXTP_SIDE_REDEMPTION +4ѯʽرṹXTPQueryAssetRspӲֶ +5ѯֲֻرĽṹXTPQueryStkPositionRsp˲ֶ + +version 1.1.15.101 +1TradeAPIּҵbusiness_type = XTP_BUSINESS_TYPE_STRUCTURED_FUND_PURCHASE_REDEMPTIONside = XTP_SIDE_PURCHASEXTP_SIDE_REDEMPTION +2TradeAPIֺּϲҵbusiness_type = XTP_BUSINESS_TYPE_STRUCTURED_FUND_SPLIT_MERGEside = XTP_SIDE_SPLITXTP_SIDE_MERGE +3TradeAPIּѯQueryStructuredFund +4TradeAPIͻʽ𻮲ܽӿFundTransfer +5TradeAPIѯͻʽ𻮲ӿQueryFundTransfer + +version 1.1.14.1 +1XTP_BUSINESS_TYPE ҵ +2XTPϵͳ֧عҵ +3XTP_TICKER_TYPE֤ȯXTP_TICKER_TYPE_BONDծȯ + +version 1.1.13.10 +1ṹXTPQuoteStaticInfoһֶΣ + ///С䶯λ + double price_tick; + +version 1.1.13.8 +1ṹXTPQueryAssetRsp1ֶΣ + ///Ԥ۵ʽ𣨰ƱʱԤ۵Ľʽ+Ԥѣ + double withholding_amount; + +version 1.1.13.3 +1ṹXTPOrderInsertInfoXTPOrderInfoXTPTradeReportbusiness_typeֶ +2ṹXTPMarketDataStructвֶint32_tΪint64_t +3¹깺ҵ +4order_client_idֶΣȥ + +version 1.1.12.7 +1޸linuxʹ·߶̴߳־Ŀ¼³core dumpbug +2apiCreateӿӵ־ +3޸Release()³bug + +version 1.1.10.0 +1XTPQuoteAPIѯпɽ׺Լӿ +2ȥõݽṹͺ궨壺 + XTP_TICKER_LEN + XTP_TICKER_NAME_LEN + XTP_TICKERNAME_LEN + + XTP_API_TICKER_LEN + XTP_API_TICKER_NAME_LEN + + TXTPTickerType + TXTPTickerNameType + ͳһɣ + XTP_TICKER_LEN + XTP_TICKER_NAME_LEN + +version 1.1.8.2 +1û¼ûߣûߣʱûµ¼ʱܻᶪʧϢbug + +version 1.1.8.0 + (1) ޸ͨѶЭ + +version 1.1.7.2 +1Ŀ¼һǰ־ļ +2·ʱԴ· +3SetSoftwareKey()ӿڣkeyΪͻ뿪ʱ +4SetSoftwareCode()ӿ +5ȡmacַӲкʱǿԵ¼ʧ + +version 1.1.6.2 +1GetApiLastErrorӿڵķֵ int32_t Ϊ XTPRI* +2ѯֲӦӿ market ֶ \ No newline at end of file diff --git a/include/XTP/linux64/libxtpquoteapi.so b/include/XTP/linux64/libxtpquoteapi.so new file mode 100644 index 0000000..19f0ed6 Binary files /dev/null and b/include/XTP/linux64/libxtpquoteapi.so differ diff --git a/include/XTP/linux64/libxtptraderapi.so b/include/XTP/linux64/libxtptraderapi.so new file mode 100644 index 0000000..1090591 Binary files /dev/null and b/include/XTP/linux64/libxtptraderapi.so differ diff --git a/include/XTP/macosx/libxtpquoteapi.dylib b/include/XTP/macosx/libxtpquoteapi.dylib new file mode 100644 index 0000000..1c6daa1 Binary files /dev/null and b/include/XTP/macosx/libxtpquoteapi.dylib differ diff --git a/include/XTP/macosx/libxtptraderapi.dylib b/include/XTP/macosx/libxtptraderapi.dylib new file mode 100644 index 0000000..0b1e4fa Binary files /dev/null and b/include/XTP/macosx/libxtptraderapi.dylib differ diff --git a/include/XTP/win32/xtpquoteapi.dll b/include/XTP/win32/xtpquoteapi.dll new file mode 100644 index 0000000..a52fa9f Binary files /dev/null and b/include/XTP/win32/xtpquoteapi.dll differ diff --git a/include/XTP/win32/xtpquoteapi.lib b/include/XTP/win32/xtpquoteapi.lib new file mode 100644 index 0000000..6d8ba4a Binary files /dev/null and b/include/XTP/win32/xtpquoteapi.lib differ diff --git a/include/XTP/win32/xtptraderapi.dll b/include/XTP/win32/xtptraderapi.dll new file mode 100644 index 0000000..b795a67 Binary files /dev/null and b/include/XTP/win32/xtptraderapi.dll differ diff --git a/include/XTP/win32/xtptraderapi.lib b/include/XTP/win32/xtptraderapi.lib new file mode 100644 index 0000000..f6a782b Binary files /dev/null and b/include/XTP/win32/xtptraderapi.lib differ diff --git a/include/XTP/win64/xtpquoteapi.dll b/include/XTP/win64/xtpquoteapi.dll new file mode 100644 index 0000000..b2fb4dd Binary files /dev/null and b/include/XTP/win64/xtpquoteapi.dll differ diff --git a/include/XTP/win64/xtpquoteapi.lib b/include/XTP/win64/xtpquoteapi.lib new file mode 100644 index 0000000..3b964e0 Binary files /dev/null and b/include/XTP/win64/xtpquoteapi.lib differ diff --git a/include/XTP/win64/xtptraderapi.dll b/include/XTP/win64/xtptraderapi.dll new file mode 100644 index 0000000..750f6be Binary files /dev/null and b/include/XTP/win64/xtptraderapi.dll differ diff --git a/include/XTP/win64/xtptraderapi.lib b/include/XTP/win64/xtptraderapi.lib new file mode 100644 index 0000000..6eb64ce Binary files /dev/null and b/include/XTP/win64/xtptraderapi.lib differ diff --git a/include/XTP/xoms_api_fund_struct.h b/include/XTP/xoms_api_fund_struct.h new file mode 100644 index 0000000..7b0168a --- /dev/null +++ b/include/XTP/xoms_api_fund_struct.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////// +///@author 中泰证券股份有限公司 +///@file xoms_api_fund_struct.h +///@brief 定义资金划拨相关结构体类型 +///////////////////////////////////////////////////////////////////////// +#ifndef XOMS_API_FUND_STRUCT_H_ +#define XOMS_API_FUND_STRUCT_H_ + +#include "xtp_api_data_type.h" +#include "xoms_api_struct.h" +#include "xtp_api_struct_common.h" + +#pragma pack(8) + +#define XTP_ACCOUNT_PASSWORD_LEN 64 + +///////////////////////////////////////////////////////////////////////// +///用户资金请求 +///////////////////////////////////////////////////////////////////////// +struct XTPFundTransferReq +{ + ///资金内转编号,无需用户填写,类似于xtp_id + uint64_t serial_id; + ///资金账户代码 + char fund_account[XTP_ACCOUNT_NAME_LEN]; + ///资金账户密码 + char password[XTP_ACCOUNT_PASSWORD_LEN]; + ///金额 + double amount; + ///内转类型 + XTP_FUND_TRANSFER_TYPE transfer_type; + +}; + +///////////////////////////////////////////////////////////////////////// +///用户资金划转请求的响应-复用资金通知结构体 +///////////////////////////////////////////////////////////////////////// +typedef struct XTPFundTransferNotice XTPFundTransferAck ; + +#pragma pack() + +#endif \ No newline at end of file diff --git a/include/XTP/xoms_api_struct.h b/include/XTP/xoms_api_struct.h new file mode 100644 index 0000000..9519634 --- /dev/null +++ b/include/XTP/xoms_api_struct.h @@ -0,0 +1,543 @@ +///////////////////////////////////////////////////////////////////////// +///@author 中泰证券股份有限公司 +///@file xoms_api_struct.h +///@brief 定义交易类相关数据结构 +///////////////////////////////////////////////////////////////////////// +#ifndef _XOMS_API_STRUCT_H_ +#define _XOMS_API_STRUCT_H_ + +#include "xtp_api_data_type.h" +#include "stddef.h" + +#pragma pack(8) + +//=====================客户端接口定义================================= +///新订单请求 +struct XTPOrderInsertInfo +{ + ///XTP系统订单ID,无需用户填写,在XTP系统中唯一 + uint64_t order_xtp_id; + ///报单引用,由客户自定义 + uint32_t order_client_id; + ///合约代码 客户端请求不带空格,以'\0'结尾 + char ticker[XTP_TICKER_LEN]; + ///交易市场 + XTP_MARKET_TYPE market; + ///价格 + double price; + ///止损价(保留字段) + double stop_price; + ///数量(股票单位为股,逆回购单位为张) + int64_t quantity; + ///报单价格 + XTP_PRICE_TYPE price_type; + union{ + uint32_t u32; + struct { + ///买卖方向 + XTP_SIDE_TYPE side; + ///开平标志 + XTP_POSITION_EFFECT_TYPE position_effect; + ///预留字段1 + uint8_t reserved1; + ///预留字段2 + uint8_t reserved2; + }; + }; + ///业务类型 + XTP_BUSINESS_TYPE business_type; + }; + + +///撤单失败响应消息 +struct XTPOrderCancelInfo +{ + ///撤单XTPID + uint64_t order_cancel_xtp_id; + ///原始订单XTPID + uint64_t order_xtp_id; +}; + + +///报单响应结构体 +struct XTPOrderInfo +{ + ///XTP系统订单ID,在XTP系统中唯一 + uint64_t order_xtp_id; + ///报单引用,用户自定义 + uint32_t order_client_id; + ///报单操作引用,用户自定义(暂未使用) + uint32_t order_cancel_client_id; + ///撤单在XTP系统中的id,在XTP系统中唯一 + uint64_t order_cancel_xtp_id; + ///合约代码 + char ticker[XTP_TICKER_LEN]; + ///交易市场 + XTP_MARKET_TYPE market; + ///价格 + double price; + ///数量,此订单的报单数量 + int64_t quantity; + ///报单价格条件 + XTP_PRICE_TYPE price_type; + union{ + uint32_t u32; + struct { + ///买卖方向 + XTP_SIDE_TYPE side; + ///开平标志 + XTP_POSITION_EFFECT_TYPE position_effect; + ///预留字段1 + uint8_t reserved1; + ///预留字段2 + uint8_t reserved2; + }; + }; + ///业务类型 + XTP_BUSINESS_TYPE business_type; + ///今成交数量,为此订单累计成交数量 + int64_t qty_traded; + ///剩余数量,当撤单成功时,表示撤单数量 + int64_t qty_left; + ///委托时间,格式为YYYYMMDDHHMMSSsss + int64_t insert_time; + ///最后修改时间,格式为YYYYMMDDHHMMSSsss + int64_t update_time; + ///撤销时间,格式为YYYYMMDDHHMMSSsss + int64_t cancel_time; + ///成交金额,为此订单的成交总金额 + double trade_amount; + ///本地报单编号 OMS生成的单号,不等同于order_xtp_id,为服务器传到报盘的单号 + char order_local_id[XTP_LOCAL_ORDER_LEN]; + ///报单状态,订单响应中没有部分成交状态的推送,在查询订单结果中,会有部分成交状态 + XTP_ORDER_STATUS_TYPE order_status; + ///报单提交状态,OMS内部使用,用户无需关心 + XTP_ORDER_SUBMIT_STATUS_TYPE order_submit_status; + ///报单类型 + TXTPOrderTypeType order_type; +}; + + + +///报单成交结构体 +struct XTPTradeReport +{ + ///XTP系统订单ID,此成交回报相关的订单ID,在XTP系统中唯一 + uint64_t order_xtp_id; + ///报单引用 + uint32_t order_client_id; + ///合约代码 + char ticker[XTP_TICKER_LEN]; + ///交易市场 + XTP_MARKET_TYPE market; + ///订单号,引入XTPID后,该字段实际和order_xtp_id重复。接口中暂时保留。 + uint64_t local_order_id; + ///成交编号,深交所唯一,上交所每笔交易唯一,当发现2笔成交回报拥有相同的exec_id,则可以认为此笔交易自成交 + char exec_id[XTP_EXEC_ID_LEN]; + ///价格,此次成交的价格 + double price; + ///数量,此次成交的数量,不是累计数量 + int64_t quantity; + ///成交时间,格式为YYYYMMDDHHMMSSsss + int64_t trade_time; + ///成交金额,此次成交的总金额 = price*quantity + double trade_amount; + ///成交序号 --回报记录号,每个交易所唯一,report_index+market字段可以组成唯一标识表示成交回报 + uint64_t report_index; + ///报单编号 --交易所单号,上交所为空,深交所有此字段 + char order_exch_id[XTP_ORDER_EXCH_LEN]; + ///成交类型 --成交回报中的执行类型 + TXTPTradeTypeType trade_type; + union{ + uint32_t u32; + struct { + ///买卖方向 + XTP_SIDE_TYPE side; + ///开平标志 + XTP_POSITION_EFFECT_TYPE position_effect; + ///预留字段1 + uint8_t reserved1; + ///预留字段2 + uint8_t reserved2; + }; + }; + ///业务类型 + XTP_BUSINESS_TYPE business_type; + ///交易所交易员代码 + char branch_pbu[XTP_BRANCH_PBU_LEN]; +}; + + +////////////////////////////////////////////////////////////////////////// +///报单查询 +////////////////////////////////////////////////////////////////////////// +///报单查询请求-条件查询 +struct XTPQueryOrderReq +{ + ///证券代码,可以为空,如果为空,则默认查询时间段内的所有成交回报 + char ticker[XTP_TICKER_LEN]; + ///格式为YYYYMMDDHHMMSSsss,为0则默认当前交易日0点 + int64_t begin_time; + ///格式为YYYYMMDDHHMMSSsss,为0则默认当前时间 + int64_t end_time; +}; + +///报单查询响应结构体 +typedef struct XTPOrderInfo XTPQueryOrderRsp; + + +////////////////////////////////////////////////////////////////////////// +///成交回报查询 +////////////////////////////////////////////////////////////////////////// +///查询成交报告请求-根据执行编号查询(保留字段) +struct XTPQueryReportByExecIdReq +{ + ///XTP订单系统ID + uint64_t order_xtp_id; + ///成交执行编号 + char exec_id[XTP_EXEC_ID_LEN]; +}; + +///查询成交回报请求-查询条件 +struct XTPQueryTraderReq +{ + ///证券代码,可以为空,如果为空,则默认查询时间段内的所有成交回报 + char ticker[XTP_TICKER_LEN]; + ///开始时间,格式为YYYYMMDDHHMMSSsss,为0则默认当前交易日0点 + int64_t begin_time; + ///结束时间,格式为YYYYMMDDHHMMSSsss,为0则默认当前时间 + int64_t end_time; +}; + +///成交回报查询响应结构体 +typedef struct XTPTradeReport XTPQueryTradeRsp; + + + +////////////////////////////////////////////////////////////////////////// +///账户资金查询响应结构体 +////////////////////////////////////////////////////////////////////////// +struct XTPQueryAssetRsp +{ + ///总资产(=可用资金 + 证券资产(目前为0)+ 预扣的资金) + double total_asset; + ///可用资金 + double buying_power; + ///证券资产(保留字段,目前为0) + double security_asset; + ///累计买入成交证券占用资金 + double fund_buy_amount; + ///累计买入成交交易费用 + double fund_buy_fee; + ///累计卖出成交证券所得资金 + double fund_sell_amount; + ///累计卖出成交交易费用 + double fund_sell_fee; + ///XTP系统预扣的资金(包括购买卖股票时预扣的交易资金+预扣手续费) + double withholding_amount; + ///账户类型 + XTP_ACCOUNT_TYPE account_type; + + ///冻结的保证金 + double frozen_margin; + ///行权冻结资金 + double frozen_exec_cash; + ///行权费用 + double frozen_exec_fee; + ///垫付资金 + double pay_later; + ///预垫付资金 + double preadva_pay; + ///昨日余额 + double orig_banlance; + ///当前余额 + double banlance; + ///当天出入金 + double deposit_withdraw; + ///当日交易资金轧差 + double trade_netting; + ///资金资产 + double captial_asset; + + ///强锁资金 + double force_freeze_amount; + ///可取资金 + double preferred_amount; + + ///(保留字段) + uint64_t unknown[43 - 12]; +}; + + + +////////////////////////////////////////////////////////////////////////// +///查询股票持仓情况 +////////////////////////////////////////////////////////////////////////// +struct XTPQueryStkPositionRsp +{ + ///证券代码 + char ticker[XTP_TICKER_LEN]; + ///证券名称 + char ticker_name[XTP_TICKER_NAME_LEN]; + ///交易市场 + XTP_MARKET_TYPE market; + ///总持仓 + int64_t total_qty; + ///可卖持仓 + int64_t sellable_qty; + ///持仓成本 + double avg_price; + ///浮动盈亏(保留字段) + double unrealized_pnl; + ///昨日持仓 + int64_t yesterday_position; + ///今日申购赎回数量(申购和赎回数量不可能同时存在,因此可以共用一个字段) + int64_t purchase_redeemable_qty; + + /// 持仓方向 + XTP_POSITION_DIRECTION_TYPE position_direction; + ///保留字段1 + uint32_t reserved1; + /// 可行权合约 + int64_t executable_option; + /// 可锁定标的 + int64_t lockable_position; + /// 可行权标的 + int64_t executable_underlying; + /// 已锁定标的 + int64_t locked_position; + /// 可用已锁定标的 + int64_t usable_locked_position; + + + ///(保留字段) + uint64_t unknown[50 - 6]; +}; + + +///////////////////////////////////////////////////////////////////////// +///资金内转流水通知 +///////////////////////////////////////////////////////////////////////// +struct XTPFundTransferNotice +{ + ///资金内转编号 + uint64_t serial_id; + ///内转类型 + XTP_FUND_TRANSFER_TYPE transfer_type; + ///金额 + double amount; + ///操作结果 + XTP_FUND_OPER_STATUS oper_status; + ///操作时间 + uint64_t transfer_time; +}; + + + +///////////////////////////////////////////////////////////////////////// +///资金内转流水查询请求与响应 +///////////////////////////////////////////////////////////////////////// +struct XTPQueryFundTransferLogReq { + ///资金内转编号 + uint64_t serial_id; + +}; + +///////////////////////////////////////////////////////////////////////// +///资金内转流水记录结构体 +///////////////////////////////////////////////////////////////////////// +typedef struct XTPFundTransferNotice XTPFundTransferLog; + +////////////////////////////////////////////////////////////////////////// +///查询分级基金信息结构体 +////////////////////////////////////////////////////////////////////////// +struct XTPQueryStructuredFundInfoReq +{ + XTP_EXCHANGE_TYPE exchange_id; ///<交易所代码,不可为空 + char sf_ticker[XTP_TICKER_LEN]; ///<分级基金母基金代码,可以为空,如果为空,则默认查询所有的分级基金 +}; + +////////////////////////////////////////////////////////////////////////// +///查询分级基金信息响应结构体 +////////////////////////////////////////////////////////////////////////// +struct XTPStructuredFundInfo +{ + XTP_EXCHANGE_TYPE exchange_id; ///<交易所代码 + char sf_ticker[XTP_TICKER_LEN]; ///<分级基金母基金代码 + char sf_ticker_name[XTP_TICKER_NAME_LEN]; ///<分级基金母基金名称 + char ticker[XTP_TICKER_LEN]; ///<分级基金子基金代码 + char ticker_name[XTP_TICKER_NAME_LEN]; ///<分级基金子基金名称 + XTP_SPLIT_MERGE_STATUS split_merge_status; ///<基金允许拆分合并状态 + uint32_t ratio; ///<拆分合并比例 + uint32_t min_split_qty;///<最小拆分数量 + uint32_t min_merge_qty; ///<最小合并数量 + double net_price;///<基金净值 +}; + + +////////////////////////////////////////////////////////////////////////// +///查询股票ETF合约基本情况--请求结构体, +///请求参数为多条件参数:1,不填则返回所有市场的ETF合约信息。 +/// 2,只填写market,返回该交易市场下结果 +/// 3,填写market及ticker参数,只返回该etf信息。 +////////////////////////////////////////////////////////////////////////// +struct XTPQueryETFBaseReq +{ + ///交易市场 + XTP_MARKET_TYPE market; + ///ETF买卖代码 + char ticker[XTP_TICKER_LEN]; +}; + +////////////////////////////////////////////////////////////////////////// +///查询股票ETF合约基本情况--响应结构体 +////////////////////////////////////////////////////////////////////////// +typedef struct XTPQueryETFBaseRsp +{ + XTP_MARKET_TYPE market; ///<交易市场 + char etf[XTP_TICKER_LEN]; /// +#include "xtp_api_data_type.h" + +#pragma pack(8) + +///指定的合约 +typedef struct XTPSpecificTickerStruct +{ + ///交易所代码 + XTP_EXCHANGE_TYPE exchange_id; + ///合约代码(不包含交易所信息)例如"600000",不带空格,以'\0'结尾 + char ticker[XTP_TICKER_LEN]; +} XTPST; + +///股票、基金、债券等额外数据 +struct XTPMarketDataStockExData { + ///委托买入总量(SH,SZ) + int64_t total_bid_qty; + ///委托卖出总量(SH,SZ) + int64_t total_ask_qty; + ///加权平均委买价格(SH,SZ) + double ma_bid_price; + ///加权平均委卖价格(SH,SZ) + double ma_ask_price; + ///债券加权平均委买价格(SH) + double ma_bond_bid_price; + ///债券加权平均委卖价格(SH) + double ma_bond_ask_price; + ///债券到期收益率(SH) + double yield_to_maturity; + ///基金实时参考净值(SH,SZ) + double iopv; + ///ETF申购笔数(SH) + int32_t etf_buy_count; + ///ETF赎回笔数(SH) + int32_t etf_sell_count; + ///ETF申购数量(SH) + double etf_buy_qty; + ///ETF申购金额(SH) + double etf_buy_money; + ///ETF赎回数量(SH) + double etf_sell_qty; + ///ETF赎回金额(SH) + double etf_sell_money; + ///权证执行的总数量(SH) + double total_warrant_exec_qty; + ///权证跌停价格(元)(SH) + double warrant_lower_price; + ///权证涨停价格(元)(SH) + double warrant_upper_price; + ///买入撤单笔数(SH) + int32_t cancel_buy_count; + ///卖出撤单笔数(SH) + int32_t cancel_sell_count; + ///买入撤单数量(SH) + double cancel_buy_qty; + ///卖出撤单数量(SH) + double cancel_sell_qty; + ///买入撤单金额(SH) + double cancel_buy_money; + ///卖出撤单金额(SH) + double cancel_sell_money; + ///买入总笔数(SH) + int64_t total_buy_count; + ///卖出总笔数(SH) + int64_t total_sell_count; + ///买入委托成交最大等待时间(SH) + int32_t duration_after_buy; + ///卖出委托成交最大等待时间(SH) + int32_t duration_after_sell; + ///买方委托价位数(SH) + int32_t num_bid_orders; + ///卖方委托价位数(SH) + int32_t num_ask_orders; + + ///基金T-1日净值(SZ) + double pre_iopv; + ///预留 + int64_t r1; + ///预留 + int64_t r2; +}; + +// 期权额外数据 +struct XTPMarketDataOptionExData { + ///波段性中断参考价(SH) + double auction_price; + ///波段性中断集合竞价虚拟匹配量(SH) + int64_t auction_qty; + ///最近询价时间(SH) + int64_t last_enquiry_time; +}; + +enum XTP_MARKETDATA_TYPE { + XTP_MARKETDATA_ACTUAL = 0, // 现货(股票/基金/债券等) + XTP_MARKETDATA_OPTION = 1, // 期权 +}; + +///行情 +typedef struct XTPMarketDataStruct +{ + // 代码 + ///交易所代码 + XTP_EXCHANGE_TYPE exchange_id; + ///合约代码(不包含交易所信息),不带空格,以'\0'结尾 + char ticker[XTP_TICKER_LEN]; + + // 价格 + ///最新价 + double last_price; + ///昨收盘 + double pre_close_price; + ///今开盘 + double open_price; + ///最高价 + double high_price; + ///最低价 + double low_price; + ///今收盘 + double close_price; + + // 期权数据 + ///昨日持仓量(张)(目前未填写) + int64_t pre_total_long_positon; + ///持仓量(张) + int64_t total_long_positon; + ///昨日结算价 + double pre_settl_price; + ///今日结算价 + double settl_price; + + // 涨跌停 + ///涨停价 + double upper_limit_price; + ///跌停价 + double lower_limit_price; + ///预留 + double pre_delta; + ///预留 + double curr_delta; + + /// 时间类,格式为YYYYMMDDHHMMSSsss + int64_t data_time; + + // 量额数据 + ///数量,为总成交量(单位股,与交易所一致) + int64_t qty; + ///成交金额,为总成交金额(单位元,与交易所一致) + double turnover; + ///当日均价=(turnover/qty) + double avg_price; + + // 买卖盘 + ///十档申买价 + double bid[10]; + ///十档申卖价 + double ask[10]; + ///十档申买量 + int64_t bid_qty[10]; + ///十档申卖量 + int64_t ask_qty[10]; + + // 额外数据 + ///成交笔数 + int64_t trades_count; + ///当前交易状态说明 + char ticker_status[8]; + ///数据 + union { + XTPMarketDataStockExData stk; + XTPMarketDataOptionExData opt; + } ; + ///决定了union是哪种数据类型 + XTP_MARKETDATA_TYPE data_type; + ///预留 + int32_t r4; +} XTPMD; + + +///股票行情静态信息 +typedef struct XTPQuoteStaticInfo { + ///交易所代码 + XTP_EXCHANGE_TYPE exchange_id; + ///合约代码(不包含交易所信息),不带空格,以'\0'结尾 + char ticker[XTP_TICKER_LEN]; + /// 合约名称 + char ticker_name[XTP_TICKER_NAME_LEN]; + /// 合约类型 + XTP_TICKER_TYPE ticker_type; + ///昨收盘 + double pre_close_price; + ///涨停板价 + double upper_limit_price; + ///跌停板价 + double lower_limit_price; + ///最小变动价位 + double price_tick; + /// 合约最小交易量(买) + int32_t buy_qty_unit; + /// 合约最小交易量(卖) + int32_t sell_qty_unit; +} XTPQSI; + + +///定单薄 +typedef struct OrderBookStruct { + ///交易所代码 + XTP_EXCHANGE_TYPE exchange_id; + ///合约代码(不包含交易所信息),不带空格,以'\0'结尾 + char ticker[XTP_TICKER_LEN]; + + ///最新价 + double last_price; + ///数量,为总成交量 + int64_t qty; + ///成交金额,为总成交金额 + double turnover; + ///成交笔数 + int64_t trades_count; + + // 买卖盘 + ///十档申买价 + double bid[10]; + ///十档申卖价 + double ask[10]; + ///十档申买量 + int64_t bid_qty[10]; + ///十档申卖量 + int64_t ask_qty[10]; + /// 时间类 + int64_t data_time; +} XTPOB; + +////////////////////////////////// 逐笔数据 + + +///逐笔委托(仅适用深交所) +struct XTPTickByTickEntrust { + ///频道代码 + int32_t channel_no; + ///委托序号(在同一个channel_no内唯一,从1开始连续) + int64_t seq; + ///委托价格 + double price; + ///委托数量 + int64_t qty; + ///'1':买; '2':卖; 'G':借入; 'F':出借 + char side; + ///订单类别: '1': 市价; '2': 限价; 'U': 本方最优 + char ord_type; +}; + +///逐笔成交 +struct XTPTickByTickTrade { + ///频道代码 + int32_t channel_no; + ///委托序号(在同一个channel_no内唯一,从1开始连续) + int64_t seq; + ///成交价格 + double price; + ///成交量 + int64_t qty; + ///成交金额(仅适用上交所) + double money; + ///买方订单号 + int64_t bid_no; + ///卖方订单号 + int64_t ask_no; + /// SH: 内外盘标识('B':主动买; 'S':主动卖; 'N':未知) + /// SZ: 成交标识('4':撤; 'F':成交) + char trade_flag; +}; + +///逐笔数据信息 +typedef struct XTPTickByTickStruct { + ///交易所代码 + XTP_EXCHANGE_TYPE exchange_id; + ///合约代码(不包含交易所信息),不带空格,以'\0'结尾 + char ticker[XTP_TICKER_LEN]; + ///预留 + int64_t seq; + ///委托时间 or 成交时间 + int64_t data_time; + ///委托 or 成交 + XTP_TBT_TYPE type; + + union { + XTPTickByTickEntrust entrust; + XTPTickByTickTrade trade; + }; +} XTPTBT; + + +///供查询的最新信息 +typedef struct XTPTickerPriceInfo { + ///交易所代码 + XTP_EXCHANGE_TYPE exchange_id; + ///合约代码(不包含交易所信息),不带空格,以'\0'结尾 + char ticker[XTP_TICKER_LEN]; + ///最新价 + double last_price; +} XTPTPI; + +#pragma pack() + +#endif diff --git a/include/XTP/xtp_api_data_type.h b/include/XTP/xtp_api_data_type.h new file mode 100644 index 0000000..406d1e7 --- /dev/null +++ b/include/XTP/xtp_api_data_type.h @@ -0,0 +1,374 @@ +///////////////////////////////////////////////////////////////////////// +///@author 中泰证券股份有限公司 +///@file xtp_api_data_type.h +///@brief 定义兼容数据基本类型 +///////////////////////////////////////////////////////////////////////// +#ifndef _XTP_API_DATA_TYPE_H_ +#define _XTP_API_DATA_TYPE_H_ + +#pragma pack(8) + +/// 存放版本号的字符串长度 +#define XTP_VERSION_LEN 16 +/// 版本号类型 +typedef char XTPVersionType[XTP_VERSION_LEN]; +/// 可交易日字符串长度 +#define XTP_TRADING_DAY_LEN 9 +/// 存放证券代码的字符串长度 +#define XTP_TICKER_LEN 16 +/// 存放证券名称的字符串长度 +#define XTP_TICKER_NAME_LEN 64 +/// 本地报单编号的字符串长度 +#define XTP_LOCAL_ORDER_LEN 11 +/// 交易所单号的字符串长度 +#define XTP_ORDER_EXCH_LEN 17 +/// 成交执行编号的字符串长度 +#define XTP_EXEC_ID_LEN 18 +/// 交易所交易员代码字符串长度 +#define XTP_BRANCH_PBU_LEN 7 +/// 用户资金账户的字符串长度 +#define XTP_ACCOUNT_NAME_LEN 16 + +///////////////////////////////////////////////////////////////////////// +///@brief XTP_LOG_LEVEL是日志输出级别类型 +///////////////////////////////////////////////////////////////////////// +typedef enum XTP_LOG_LEVEL { + XTP_LOG_LEVEL_FATAL, ///<严重错误级别 + XTP_LOG_LEVEL_ERROR, ///<错误级别 + XTP_LOG_LEVEL_WARNING, ///<警告级别 + XTP_LOG_LEVEL_INFO, /// +#endif + +#include "xtp_api_data_type.h" + +#pragma pack(8) + +///错误信息的字符串长度 +#define XTP_ERR_MSG_LEN 124 +///响应信息 +typedef struct XTPRspInfoStruct +{ + ///错误代码 + int32_t error_id; + ///错误信息 + char error_msg[XTP_ERR_MSG_LEN]; +} XTPRI; + +#pragma pack() + +#endif // !_XTP_API_STRUCT_COMMON_H_ diff --git a/include/XTP/xtp_quote_api.h b/include/XTP/xtp_quote_api.h new file mode 100644 index 0000000..1124f65 --- /dev/null +++ b/include/XTP/xtp_quote_api.h @@ -0,0 +1,424 @@ +///////////////////////////////////////////////////////////////////////// +///@author 中泰证券股份有限公司 +///@file xtp_quote_api.h +///@brief 定义行情订阅客户端接口 +///////////////////////////////////////////////////////////////////////// + +#ifndef _XTP_QUOTE_API_H_ +#define _XTP_QUOTE_API_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "xtp_api_struct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_MD_API_EXPORT +#define MD_API_EXPORT __declspec(dllexport) +#else +#define MD_API_EXPORT __declspec(dllimport) +#endif +#else +#define MD_API_EXPORT +#endif + +/*! +* \class XTP::API::QuoteSpi +* +* \brief 行情回调类 +* +* \author 中泰证券股份有限公司 +* \date 十月 2015 +*/ +namespace XTP { + namespace API { + class QuoteSpi + { + public: + + ///当客户端与行情后台通信连接断开时,该方法被调用。 + ///@param reason 错误原因,请与错误代码表对应 + ///@remark api不会自动重连,当断线发生时,请用户自行选择后续操作。可以在此函数中调用Login重新登录。注意用户重新登录后,需要重新订阅行情 + virtual void OnDisconnected(int reason) {}; + + + ///错误应答 + ///@param error_info 当服务器响应发生错误时的具体的错误代码和错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 此函数只有在服务器发生错误时才会调用,一般无需用户处理 + virtual void OnError(XTPRI *error_info) {}; + + ///订阅行情应答,包括股票、指数和期权 + ///@param ticker 详细的合约订阅情况 + ///@param error_info 订阅合约发生错误时的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param is_last 是否此次订阅的最后一个应答,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 每条订阅的合约均对应一条订阅应答,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnSubMarketData(XTPST *ticker, XTPRI *error_info, bool is_last) {}; + + ///退订行情应答,包括股票、指数和期权 + ///@param ticker 详细的合约取消订阅情况 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param is_last 是否此次取消订阅的最后一个应答,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 每条取消订阅的合约均对应一条取消订阅应答,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnUnSubMarketData(XTPST *ticker, XTPRI *error_info, bool is_last) {}; + + ///深度行情通知,包含买一卖一队列 + ///@param market_data 行情数据 + ///@param bid1_qty 买一队列数据 + ///@param bid1_count 买一队列的有效委托笔数 + ///@param max_bid1_count 买一队列总委托笔数 + ///@param ask1_qty 卖一队列数据 + ///@param ask1_count 卖一队列的有效委托笔数 + ///@param max_ask1_count 卖一队列总委托笔数 + ///@remark 需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnDepthMarketData(XTPMD *market_data, int64_t bid1_qty[], int32_t bid1_count, int32_t max_bid1_count, int64_t ask1_qty[], int32_t ask1_count, int32_t max_ask1_count) {}; + + ///订阅行情订单簿应答,包括股票、指数和期权 + ///@param ticker 详细的合约订阅情况 + ///@param error_info 订阅合约发生错误时的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param is_last 是否此次订阅的最后一个应答,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 每条订阅的合约均对应一条订阅应答,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnSubOrderBook(XTPST *ticker, XTPRI *error_info, bool is_last) {}; + + ///退订行情订单簿应答,包括股票、指数和期权 + ///@param ticker 详细的合约取消订阅情况 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param is_last 是否此次取消订阅的最后一个应答,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 每条取消订阅的合约均对应一条取消订阅应答,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnUnSubOrderBook(XTPST *ticker, XTPRI *error_info, bool is_last) {}; + + ///行情订单簿通知,包括股票、指数和期权 + ///@param order_book 行情订单簿数据,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnOrderBook(XTPOB *order_book) {}; + + ///订阅逐笔行情应答,包括股票、指数和期权 + ///@param ticker 详细的合约订阅情况 + ///@param error_info 订阅合约发生错误时的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param is_last 是否此次订阅的最后一个应答,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 每条订阅的合约均对应一条订阅应答,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnSubTickByTick(XTPST *ticker, XTPRI *error_info, bool is_last) {}; + + ///退订逐笔行情应答,包括股票、指数和期权 + ///@param ticker 详细的合约取消订阅情况 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param is_last 是否此次取消订阅的最后一个应答,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 每条取消订阅的合约均对应一条取消订阅应答,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnUnSubTickByTick(XTPST *ticker, XTPRI *error_info, bool is_last) {}; + + ///逐笔行情通知,包括股票、指数和期权 + ///@param tbt_data 逐笔行情数据,包括逐笔委托和逐笔成交,此为共用结构体,需要根据type来区分是逐笔委托还是逐笔成交,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnTickByTick(XTPTBT *tbt_data) {}; + + ///订阅全市场的股票行情应答 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnSubscribeAllMarketData(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///退订全市场的股票行情应答 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnUnSubscribeAllMarketData(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///订阅全市场的股票行情订单簿应答 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnSubscribeAllOrderBook(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///退订全市场的股票行情订单簿应答 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnUnSubscribeAllOrderBook(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///订阅全市场的股票逐笔行情应答 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnSubscribeAllTickByTick(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///退订全市场的股票逐笔行情应答 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnUnSubscribeAllTickByTick(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + + ///查询可交易合约的应答 + ///@param ticker_info 可交易合约信息 + ///@param error_info 查询可交易合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param is_last 是否此次查询可交易合约的最后一个应答,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + virtual void OnQueryAllTickers(XTPQSI* ticker_info, XTPRI *error_info, bool is_last) {}; + + ///查询合约的最新价格信息应答 + ///@param ticker_info 合约的最新价格信息 + ///@param error_info 查询合约的最新价格信息时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param is_last 是否此次查询的最后一个应答,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + virtual void OnQueryTickersPriceInfo(XTPTPI* ticker_info, XTPRI *error_info, bool is_last) {}; + + ///订阅全市场的期权行情应答 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnSubscribeAllOptionMarketData(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///退订全市场的期权行情应答 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnUnSubscribeAllOptionMarketData(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///订阅全市场的期权行情订单簿应答 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnSubscribeAllOptionOrderBook(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///退订全市场的期权行情订单簿应答 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnUnSubscribeAllOptionOrderBook(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///订阅全市场的期权逐笔行情应答 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnSubscribeAllOptionTickByTick(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + + ///退订全市场的期权逐笔行情应答 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@param error_info 取消订阅合约时发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 需要快速返回 + virtual void OnUnSubscribeAllOptionTickByTick(XTP_EXCHANGE_TYPE exchange_id, XTPRI *error_info) {}; + }; + } +} + +#ifndef WINDOWS +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif +#endif + +/*! +* \class XTP::API::QuoteApi +* +* \brief 行情订阅接口类 +* +* \author 中泰证券股份有限公司 +* \date 十月 2015 +*/ +namespace XTP { + namespace API { + class MD_API_EXPORT QuoteApi + { + public: + ///创建QuoteApi + ///@param client_id (必须输入)用于区分同一用户的不同客户端,由用户自定义 + ///@param save_file_path (必须输入)存贮订阅信息文件的目录,请设定一个有可写权限的真实存在的路径 + ///@param log_level 日志输出级别 + ///@return 创建出的UserApi + ///@remark 如果一个账户需要在多个客户端登录,请使用不同的client_id,系统允许一个账户同时登录多个客户端,但是对于同一账户,相同的client_id只能保持一个session连接,后面的登录在前一个session存续期间,无法连接 + static QuoteApi *CreateQuoteApi(uint8_t client_id, const char *save_file_path, XTP_LOG_LEVEL log_level=XTP_LOG_LEVEL_DEBUG); + + ///删除接口对象本身 + ///@remark 不再使用本接口对象时,调用该函数删除接口对象 + virtual void Release() = 0; + + + ///获取当前交易日 + ///@return 获取到的交易日 + ///@remark 只有登录成功后,才能得到正确的交易日 + virtual const char *GetTradingDay() = 0; + + ///获取API的发行版本号 + ///@return 返回api发行版本号 + virtual const char* GetApiVersion() = 0; + + ///获取API的系统错误 + ///@return 返回的错误信息,可以在Login、Logout、订阅、取消订阅失败时调用,获取失败的原因 + ///@remark 可以在调用api接口失败时调用,例如login失败时 + virtual XTPRI *GetApiLastError() = 0; + + ///设置采用UDP方式连接时的接收缓冲区大小 + ///@remark 需要在Login之前调用,默认大小和最小设置均为64MB。此缓存大小单位为MB,请输入2的次方数,例如128MB请输入128。 + virtual void SetUDPBufferSize(uint32_t buff_size) = 0; + + + ///注册回调接口 + ///@param spi 派生自回调接口类的实例,请在登录之前设定 + virtual void RegisterSpi(QuoteSpi *spi) = 0; + + ///设置心跳检测时间间隔,单位为秒 + ///@param interval 心跳检测时间间隔,单位为秒 + ///@remark 此函数必须在Login之前调用 + virtual void SetHeartBeatInterval(uint32_t interval) = 0; + + ///订阅行情,包括股票、指数和期权。 + ///@return 订阅接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param ticker 合约ID数组,注意合约代码必须以'\0'结尾,不包含空格 + ///@param count 要订阅/退订行情的合约个数 + ///@param exchange_id 交易所代码 + ///@remark 可以一次性订阅同一证券交易所的多个合约,无论用户因为何种问题需要重新登录行情服务器,都需要重新订阅行情 + virtual int SubscribeMarketData(char *ticker[], int count, XTP_EXCHANGE_TYPE exchange_id) = 0; + + ///退订行情,包括股票、指数和期权。 + ///@return 取消订阅接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param ticker 合约ID数组,注意合约代码必须以'\0'结尾,不包含空格 + ///@param count 要订阅/退订行情的合约个数 + ///@param exchange_id 交易所代码 + ///@remark 可以一次性取消订阅同一证券交易所的多个合约,需要与订阅行情接口配套使用 + virtual int UnSubscribeMarketData(char *ticker[], int count, XTP_EXCHANGE_TYPE exchange_id) = 0; + + ///订阅行情订单簿,包括股票、指数和期权。 + ///@return 订阅行情订单簿接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param ticker 合约ID数组,注意合约代码必须以'\0'结尾,不包含空格 + ///@param count 要订阅/退订行情订单簿的合约个数 + ///@param exchange_id 交易所代码 + ///@remark 可以一次性订阅同一证券交易所的多个合约,无论用户因为何种问题需要重新登录行情服务器,都需要重新订阅行情(仅支持深交所) + virtual int SubscribeOrderBook(char *ticker[], int count, XTP_EXCHANGE_TYPE exchange_id) = 0; + + ///退订行情订单簿,包括股票、指数和期权。 + ///@return 取消订阅行情订单簿接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param ticker 合约ID数组,注意合约代码必须以'\0'结尾,不包含空格 + ///@param count 要订阅/退订行情订单簿的合约个数 + ///@param exchange_id 交易所代码 + ///@remark 可以一次性取消订阅同一证券交易所的多个合约,需要与订阅行情订单簿接口配套使用 + virtual int UnSubscribeOrderBook(char *ticker[], int count, XTP_EXCHANGE_TYPE exchange_id) = 0; + + ///订阅逐笔行情,包括股票、指数和期权。 + ///@return 订阅逐笔行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param ticker 合约ID数组,注意合约代码必须以'\0'结尾,不包含空格 + ///@param count 要订阅/退订行情订单簿的合约个数 + ///@param exchange_id 交易所代码 + ///@remark 可以一次性订阅同一证券交易所的多个合约,无论用户因为何种问题需要重新登录行情服务器,都需要重新订阅行情 + virtual int SubscribeTickByTick(char *ticker[], int count, XTP_EXCHANGE_TYPE exchange_id) = 0; + + ///退订逐笔行情,包括股票、指数和期权。 + ///@return 取消订阅逐笔行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param ticker 合约ID数组,注意合约代码必须以'\0'结尾,不包含空格 + ///@param count 要订阅/退订行情订单簿的合约个数 + ///@param exchange_id 交易所代码 + ///@remark 可以一次性取消订阅同一证券交易所的多个合约,需要与订阅逐笔行情接口配套使用 + virtual int UnSubscribeTickByTick(char *ticker[], int count, XTP_EXCHANGE_TYPE exchange_id) = 0; + + ///订阅全市场的股票行情 + ///@return 订阅全市场行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与全市场退订行情接口配套使用 + virtual int SubscribeAllMarketData(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///退订全市场的股票行情 + ///@return 退订全市场行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与订阅全市场行情接口配套使用 + virtual int UnSubscribeAllMarketData(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///订阅全市场的股票行情订单簿 + ///@return 订阅全市场行情订单簿接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与全市场退订行情订单簿接口配套使用 + virtual int SubscribeAllOrderBook(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///退订全市场的股票行情订单簿 + ///@return 退订全市场行情订单簿接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与订阅全市场行情订单簿接口配套使用 + virtual int UnSubscribeAllOrderBook(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///订阅全市场的股票逐笔行情 + ///@return 订阅全市场逐笔行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与全市场退订逐笔行情接口配套使用 + virtual int SubscribeAllTickByTick(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///退订全市场的股票逐笔行情 + ///@return 退订全市场逐笔行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与订阅全市场逐笔行情接口配套使用 + virtual int UnSubscribeAllTickByTick(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///用户登录请求 + ///@return 登录是否成功,“0”表示登录成功,“-1”表示连接服务器出错,此时用户可以调用GetApiLastError()来获取错误代码,“-2”表示已存在连接,不允许重复登录,如果需要重连,请先logout,“-3”表示输入有错误 + ///@param ip 服务器ip地址,类似“127.0.0.1” + ///@param port 服务器端口号 + ///@param user 登陆用户名 + ///@param password 登陆密码 + ///@param sock_type “1”代表TCP,“2”代表UDP + ///@remark 此函数为同步阻塞式,不需要异步等待登录成功,当函数返回即可进行后续操作,此api只能有一个连接 + virtual int Login(const char* ip, int port, const char* user, const char* password, XTP_PROTOCOL_TYPE sock_type) = 0; + + + ///登出请求 + ///@return 登出是否成功,“0”表示登出成功,非“0”表示登出出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@remark 此函数为同步阻塞式,不需要异步等待登出,当函数返回即可进行后续操作 + virtual int Logout() = 0; + + ///获取当前交易日可交易合约 + ///@return 查询是否成功,“0”表示查询成功,非“0”表示查询不成功 + ///@param exchange_id 交易所代码 + virtual int QueryAllTickers(XTP_EXCHANGE_TYPE exchange_id) = 0; + + ///获取合约的最新价格信息 + ///@return 查询是否成功,“0”表示查询成功,非“0”表示查询不成功 + ///@param exchange_id 交易所代码 + virtual int QueryTickersPriceInfo(char *ticker[], int count, XTP_EXCHANGE_TYPE exchange_id) = 0; + + ///获取所有合约的最新价格信息 + ///@return 查询是否成功,“0”表示查询成功,非“0”表示查询不成功 + virtual int QueryAllTickersPriceInfo() = 0; + + ///订阅全市场的期权行情 + ///@return 订阅全市期权场行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与全市场退订期权行情接口配套使用 + virtual int SubscribeAllOptionMarketData(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///退订全市场的期权行情 + ///@return 退订全市场期权行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与订阅全市场期权行情接口配套使用 + virtual int UnSubscribeAllOptionMarketData(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///订阅全市场的期权行情订单簿 + ///@return 订阅全市场期权行情订单簿接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与全市场退订期权行情订单簿接口配套使用 + virtual int SubscribeAllOptionOrderBook(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///退订全市场的期权行情订单簿 + ///@return 退订全市场期权行情订单簿接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与订阅全市场期权行情订单簿接口配套使用 + virtual int UnSubscribeAllOptionOrderBook(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///订阅全市场的期权逐笔行情 + ///@return 订阅全市场期权逐笔行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前全订阅的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与全市场退订期权逐笔行情接口配套使用 + virtual int SubscribeAllOptionTickByTick(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + ///退订全市场的期权逐笔行情 + ///@return 退订全市场期权逐笔行情接口调用是否成功,“0”表示接口调用成功,非“0”表示接口调用出错 + ///@param exchange_id 表示当前退订的市场,如果为XTP_EXCHANGE_UNKNOWN,表示沪深全市场,XTP_EXCHANGE_SH表示为上海全市场,XTP_EXCHANGE_SZ表示为深圳全市场 + ///@remark 需要与订阅全市场期权逐笔行情接口配套使用 + virtual int UnSubscribeAllOptionTickByTick(XTP_EXCHANGE_TYPE exchange_id = XTP_EXCHANGE_UNKNOWN) = 0; + + + protected: + ~QuoteApi() {}; + }; + } +} + +#ifndef WINDOWS +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif +#endif + + +#endif diff --git a/include/XTP/xtp_trader_api.h b/include/XTP/xtp_trader_api.h new file mode 100644 index 0000000..f44a90c --- /dev/null +++ b/include/XTP/xtp_trader_api.h @@ -0,0 +1,395 @@ +///////////////////////////////////////////////////////////////////////// +///@author 中泰证券股份有限公司 +///@file xtp_trader_api.h +///@brief 定义客户端交易接口 +///////////////////////////////////////////////////////////////////////// + +#ifndef _XTP_TRADER_API_H_ +#define _XTP_TRADER_API_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "xtp_api_struct.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_TRADER_API_EXPORT +#define TRADER_API_EXPORT __declspec(dllexport) +#else +#define TRADER_API_EXPORT __declspec(dllimport) +#endif +#else +#define TRADER_API_EXPORT +#endif + +/*! +* \class XTP::API::TraderSpi +* +* \brief 交易接口响应类 +* +* \author 中泰证券股份有限公司 +* \date 十月 2015 +*/ +namespace XTP { + namespace API { + + class TraderSpi + { + public: + + ///当客户端的某个连接与交易后台通信连接断开时,该方法被调用。 + ///@param reason 错误原因,请与错误代码表对应 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@remark 用户主动调用logout导致的断线,不会触发此函数。api不会自动重连,当断线发生时,请用户自行选择后续操作,可以在此函数中调用Login重新登录,并更新session_id,此时用户收到的数据跟断线之前是连续的 + virtual void OnDisconnected(uint64_t session_id, int reason) {}; + + ///错误应答 + ///@param error_info 当服务器响应发生错误时的具体的错误代码和错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 此函数只有在服务器发生错误时才会调用,一般无需用户处理 + virtual void OnError(XTPRI *error_info) {}; + + ///报单通知 + ///@param order_info 订单响应具体信息,用户可以通过order_info.order_xtp_id来管理订单,通过GetClientIDByXTPID() == client_id来过滤自己的订单,order_info.qty_left字段在订单为未成交、部成、全成、废单状态时,表示此订单还没有成交的数量,在部撤、全撤状态时,表示此订单被撤的数量。order_info.order_cancel_xtp_id为其所对应的撤单ID,不为0时表示此单被撤成功 + ///@param error_info 订单被拒绝或者发生错误时错误代码和错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 每次订单状态更新时,都会被调用,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线,在订单未成交、全部成交、全部撤单、部分撤单、已拒绝这些状态时会有响应,对于部分成交的情况,请由订单的成交回报来自行确认。所有登录了此用户的客户端都将收到此用户的订单响应 + virtual void OnOrderEvent(XTPOrderInfo *order_info, XTPRI *error_info, uint64_t session_id) {}; + + ///成交通知 + ///@param trade_info 成交回报的具体信息,用户可以通过trade_info.order_xtp_id来管理订单,通过GetClientIDByXTPID() == client_id来过滤自己的订单。对于上交所,exec_id可以唯一标识一笔成交。当发现2笔成交回报拥有相同的exec_id,则可以认为此笔交易自成交了。对于深交所,exec_id是唯一的,暂时无此判断机制。report_index+market字段可以组成唯一标识表示成交回报。 + ///@remark 订单有成交发生的时候,会被调用,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线。所有登录了此用户的客户端都将收到此用户的成交回报。相关订单为部成状态,需要用户通过成交回报的成交数量来确定,OnOrderEvent()不会推送部成状态。 + virtual void OnTradeEvent(XTPTradeReport *trade_info, uint64_t session_id) {}; + + ///撤单出错响应 + ///@param cancel_info 撤单具体信息,包括撤单的order_cancel_xtp_id和待撤单的order_xtp_id + ///@param error_info 撤单被拒绝或者发生错误时错误代码和错误信息,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 此响应只会在撤单发生错误时被回调 + virtual void OnCancelOrderError(XTPOrderCancelInfo *cancel_info, XTPRI *error_info, uint64_t session_id) {}; + + ///请求查询报单响应 + ///@param order_info 查询到的一个报单 + ///@param error_info 查询报单时发生错误时,返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 由于支持分时段查询,一个查询请求可能对应多个响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryOrder(XTPQueryOrderRsp *order_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///请求查询成交响应 + ///@param trade_info 查询到的一个成交回报 + ///@param error_info 查询成交回报发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 由于支持分时段查询,一个查询请求可能对应多个响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryTrade(XTPQueryTradeRsp *trade_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///请求查询投资者持仓响应 + ///@param position 查询到的一只股票的持仓情况 + ///@param error_info 查询账户持仓发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 由于用户可能持有多个股票,一个查询请求可能对应多个响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryPosition(XTPQueryStkPositionRsp *position, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///请求查询资金账户响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + ///@param asset 查询到的资金账户情况 + ///@param error_info 查询资金账户发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryAsset(XTPQueryAssetRsp *asset, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///请求查询分级基金信息响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + ///@param fund_info 查询到的分级基金情况 + ///@param error_info 查询分级基金发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryStructuredFund(XTPStructuredFundInfo *fund_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///请求查询资金划拨订单响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + ///@param fund_transfer_info 查询到的资金账户情况 + ///@param error_info 查询资金账户发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryFundTransfer(XTPFundTransferNotice *fund_transfer_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///资金划拨通知 + ///@param fund_transfer_info 资金划拨通知的具体信息,用户可以通过fund_transfer_info.serial_id来管理订单,通过GetClientIDByXTPID() == client_id来过滤自己的订单。 + ///@param error_info 资金划拨订单被拒绝或者发生错误时错误代码和错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@remark 当资金划拨订单有状态变化的时候,会被调用,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线。所有登录了此用户的客户端都将收到此用户的资金划拨通知。 + virtual void OnFundTransfer(XTPFundTransferNotice *fund_transfer_info, XTPRI *error_info, uint64_t session_id) {}; + + ///请求查询ETF清单文件的响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + ///@param etf_info 查询到的ETF清单文件情况 + ///@param error_info 查询ETF清单文件发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryETF(XTPQueryETFBaseRsp *etf_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///请求查询ETF股票篮的响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + ///@param etf_component_info 查询到的ETF合约的相关成分股信息 + ///@param error_info 查询ETF股票篮发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryETFBasket(XTPQueryETFComponentRsp *etf_component_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///请求查询今日新股申购信息列表的响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + ///@param ipo_info 查询到的今日新股申购的一只股票信息 + ///@param error_info 查询今日新股申购信息列表发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryIPOInfoList(XTPQueryIPOTickerRsp *ipo_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///请求查询用户新股申购额度信息的响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + ///@param quota_info 查询到的用户某个市场的今日新股申购额度信息 + ///@param error_info 查查询用户新股申购额度信息发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryIPOQuotaInfo(XTPQueryIPOQuotaRsp *quota_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + ///请求查询期权合约的响应,需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + ///@param option_info 查询到的期权合约情况 + ///@param error_info 查询期权合约发生错误时返回的错误信息,当error_info为空,或者error_info.error_id为0时,表明没有错误 + ///@param request_id 此消息响应函数对应的请求ID + ///@param is_last 此消息响应函数是否为request_id这条请求所对应的最后一个响应,当为最后一个的时候为true,如果为false,表示还有其他后续消息响应 + ///@remark 需要快速返回,否则会堵塞后续消息,当堵塞严重时,会触发断线 + virtual void OnQueryOptionAuctionInfo(XTPQueryOptionAuctionInfoRsp *option_info, XTPRI *error_info, int request_id, bool is_last, uint64_t session_id) {}; + + }; + } +} + +#ifndef WINDOWS +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif +#endif + +/*! +* \class XTP::API::TraderApi +* +* \brief 交易接口类 +* +* \author 中泰证券股份有限公司 +* \date 十月 2015 +*/ +namespace XTP { + namespace API { + + class TRADER_API_EXPORT TraderApi + { + public: + ///创建TraderApi + ///@param client_id (必须输入)客户端id,用于区分同一用户的不同客户端,由用户自定义 + ///@param save_file_path (必须输入)存贮订阅信息文件的目录,请设定一个真实存在的有可写权限的路径 + ///@param log_level 日志输出级别 + ///@return 创建出的UserApi + ///@remark 如果一个账户需要在多个客户端登录,请使用不同的client_id,系统允许一个账户同时登录多个客户端,但是对于同一账户,相同的client_id只能保持一个session连接,后面的登录在前一个session存续期间,无法连接。系统不支持过夜,请确保每天开盘前重新启动 + static TraderApi *CreateTraderApi(uint8_t client_id, const char *save_file_path, XTP_LOG_LEVEL log_level = XTP_LOG_LEVEL_DEBUG); + + ///删除接口对象本身 + ///@remark 不再使用本接口对象时,调用该函数删除接口对象 + virtual void Release() = 0; + + ///获取当前交易日 + ///@return 获取到的交易日 + ///@remark 只有登录成功后,才能得到正确的交易日 + virtual const char *GetTradingDay() = 0; + + ///注册回调接口 + ///@param spi 派生自回调接口类的实例,请在登录之前设定 + virtual void RegisterSpi(TraderSpi *spi) = 0; + + ///获取API的系统错误 + ///@return 返回的错误信息,可以在Login、InsertOrder、CancelOrder返回值为0时调用,获取失败的原因 + ///@remark 可以在调用api接口失败时调用,例如login失败时 + virtual XTPRI *GetApiLastError() = 0; + + ///获取API的发行版本号 + ///@return 返回api发行版本号 + virtual const char* GetApiVersion() = 0; + + ///通过报单在xtp系统中的ID获取下单的客户端id + ///@return 返回客户端id,可以用此方法过滤自己下的订单 + ///@param order_xtp_id 报单在xtp系统中的ID + ///@remark 由于系统允许同一用户在不同客户端上登录操作,每个客户端通过不同的client_id进行区分 + virtual uint8_t GetClientIDByXTPID(uint64_t order_xtp_id) = 0; + + ///通过报单在xtp系统中的ID获取相关资金账户名 + ///@return 返回资金账户名 + ///@param order_xtp_id 报单在xtp系统中的ID + ///@remark 只有资金账户登录成功后,才能得到正确的信息 + virtual const char* GetAccountByXTPID(uint64_t order_xtp_id) = 0; + + ///订阅公共流。 + ///@param resume_type 公共流(订单响应、成交回报)重传方式 + /// XTP_TERT_RESTART:从本交易日开始重传 + /// XTP_TERT_RESUME:(保留字段,此方式暂未支持)从上次收到的续传 + /// XTP_TERT_QUICK:只传送登录后公共流的内容 + ///@remark 该方法要在Login方法前调用。若不调用则不会收到公共流的数据。注意在用户断线后,如果不登出就login(),公共流订阅方式不会起作用。用户只会收到断线后的所有消息。如果先logout()再login(),那么公共流订阅方式会起作用,用户收到的数据会根据用户的选择方式而定。 + virtual void SubscribePublicTopic(XTP_TE_RESUME_TYPE resume_type) = 0; + + ///设置软件开发版本号 + ///@param version 用户开发软件版本号,非api发行版本号,长度不超过15位,以'\0'结尾 + ///@remark 此函数必须在Login之前调用,标识的是客户端版本号,而不是API的版本号,由用户自定义 + virtual void SetSoftwareVersion(const char* version) = 0; + + ///设置软件开发Key + ///@param key 用户开发软件Key,用户申请开户时给予,以'\0'结尾 + ///@remark 此函数必须在Login之前调用 + virtual void SetSoftwareKey(const char* key) = 0; + + ///设置心跳检测时间间隔,单位为秒 + ///@param interval 心跳检测时间间隔,单位为秒 + ///@remark 此函数必须在Login之前调用 + virtual void SetHeartBeatInterval(uint32_t interval) = 0; + + ///用户登录请求 + ///@return session_id表明此资金账号登录是否成功,“0”表示登录失败,可以调用GetApiLastError()来获取错误代码,非“0”表示登录成功,此时需要记录下这个返回值session_id,与登录的资金账户对应 + ///@param ip 服务器地址,类似“127.0.0.1” + ///@param port 服务器端口号 + ///@param user 登录用户名 + ///@param password 登录密码 + ///@param sock_type “1”代表TCP,“2”代表UDP,目前暂时只支持TCP + ///@remark 此函数为同步阻塞式,不需要异步等待登录成功,当函数返回即可进行后续操作,此api可支持多个账户连接,但是同一个账户同一个client_id只能有一个session连接,后面的登录在前一个session存续期间,无法连接 + virtual uint64_t Login(const char* ip, int port, const char* user, const char* password, XTP_PROTOCOL_TYPE sock_type) = 0; + + + ///登出请求 + ///@return 登出是否成功,“0”表示登出成功,“-1”表示登出失败 + ///@param session_id 资金账户对应的session_id,登录时得到 + virtual int Logout(uint64_t session_id) = 0; + + ///报单录入请求 + ///@return 报单在XTP系统中的ID,如果为‘0’表示报单发送失败,此时用户可以调用GetApiLastError()来获取错误代码,非“0”表示报单发送成功,用户需要记录下返回的order_xtp_id,它保证一个交易日内唯一,不同的交易日不保证唯一性 + ///@param order 报单录入信息,其中order.order_client_id字段是用户自定义字段,用户输入什么值,订单响应OnOrderEvent()返回时就会带回什么值,类似于备注,方便用户自己定位订单。当然,如果你什么都不填,也是可以的。order.order_xtp_id字段无需用户填写,order.ticker必须不带空格,以'\0'结尾 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@remark 交易所接收订单后,会在报单响应函数OnOrderEvent()中返回报单未成交的状态,之后所有的订单状态改变(除了部成状态)都会通过报单响应函数返回 + virtual uint64_t InsertOrder(XTPOrderInsertInfo *order, uint64_t session_id) = 0; + + ///报单操作请求 + ///@return 撤单在XTP系统中的ID,如果为‘0’表示撤单发送失败,此时用户可以调用GetApiLastError()来获取错误代码,非“0”表示撤单发送成功,用户需要记录下返回的order_cancel_xtp_id,它保证一个交易日内唯一,不同的交易日不保证唯一性 + ///@param order_xtp_id 需要撤销的委托单在XTP系统中的ID + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@remark 如果撤单成功,会在报单响应函数OnOrderEvent()里返回原单部撤或者全撤的消息,如果不成功,会在OnCancelOrderError()响应函数中返回错误原因 + virtual uint64_t CancelOrder(const uint64_t order_xtp_id, uint64_t session_id) = 0; + + ///根据报单ID请求查询报单 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param order_xtp_id 需要查询的报单在xtp系统中的ID,即InsertOrder()成功时返回的order_xtp_id + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + virtual int QueryOrderByXTPID(const uint64_t order_xtp_id, uint64_t session_id, int request_id) = 0; + + ///请求查询报单 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param query_param 需要查询的订单相关筛选条件,其中合约代码可以为空,则默认所有存在的合约代码,如果不为空,请不带空格,并以'\0'结尾,其中起始时间格式为YYYYMMDDHHMMSSsss,为0则默认当前交易日0点,结束时间格式为YYYYMMDDHHMMSSsss,为0则默认当前时间 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + ///@remark 该方法支持分时段查询,如果股票代码为空,则默认查询时间段内的所有报单,否则查询时间段内所有跟股票代码相关的报单,此函数查询出的结果可能对应多个查询结果响应 + virtual int QueryOrders(const XTPQueryOrderReq *query_param, uint64_t session_id, int request_id) = 0; + + ///根据委托编号请求查询相关成交 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param order_xtp_id 需要查询的委托编号,即InsertOrder()成功时返回的order_xtp_id + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + ///@remark 此函数查询出的结果可能对应多个查询结果响应 + virtual int QueryTradesByXTPID(const uint64_t order_xtp_id, uint64_t session_id, int request_id) = 0; + + ///请求查询已成交 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param query_param 需要查询的成交回报筛选条件,其中合约代码可以为空,则默认所有存在的合约代码,如果不为空,请不带空格,并以'\0'结尾,其中起始时间格式为YYYYMMDDHHMMSSsss,为0则默认当前交易日0点,结束时间格式为YYYYMMDDHHMMSSsss,为0则默认当前时间 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + ///@remark 该方法支持分时段查询,如果股票代码为空,则默认查询时间段内的所有成交回报,否则查询时间段内所有跟股票代码相关的成交回报,此函数查询出的结果可能对应多个查询结果响应 + virtual int QueryTrades(XTPQueryTraderReq *query_param, uint64_t session_id, int request_id) = 0; + + ///请求查询投资者持仓 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param ticker 需要查询的持仓合约代码,可以为空,如果不为空,请不带空格,并以'\0'结尾 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + ///@remark 该方法如果用户提供了合约代码,则会查询此合约的持仓信息,如果合约代码为空,则默认查询所有持仓信息 + virtual int QueryPosition(const char *ticker, uint64_t session_id, int request_id) = 0; + + ///请求查询资产 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + virtual int QueryAsset(uint64_t session_id, int request_id) = 0; + + ///请求查询分级基金 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param query_param 需要查询的分级基金筛选条件,其中母基金代码可以为空,则默认所有存在的母基金,如果不为空,请不带空格,并以'\0'结尾,其中交易市场不能为空 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + ///@remark 此函数查询出的结果可能对应多个查询结果响应 + virtual int QueryStructuredFund(XTPQueryStructuredFundInfoReq *query_param, uint64_t session_id, int request_id) = 0; + + ///资金划拨请求 + ///@return 资金划拨订单在XTP系统中的ID,如果为‘0’表示消息发送失败,此时用户可以调用GetApiLastError()来获取错误代码,非“0”表示消息发送成功,用户需要记录下返回的serial_id,它保证一个交易日内唯一,不同的交易日不保证唯一性 + ///@param session_id 资金账户对应的session_id,登录时得到 + virtual uint64_t FundTransfer(XTPFundTransferReq *fund_transfer, uint64_t session_id) = 0; + + ///请求查询资金划拨 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param query_param 需要查询的资金划拨订单筛选条件,其中serial_id可以为0,则默认所有资金划拨订单,如果不为0,则请求特定的资金划拨订单 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + virtual int QueryFundTransfer(XTPQueryFundTransferLogReq *query_param, uint64_t session_id, int request_id) = 0; + + ///请求查询ETF清单文件 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param query_param 需要查询的ETF清单文件的筛选条件,其中合约代码可以为空,则默认所有存在的ETF合约代码,market字段也可以为初始值,则默认所有市场的ETF合约 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + virtual int QueryETF(XTPQueryETFBaseReq *query_param, uint64_t session_id, int request_id) = 0; + + ///请求查询ETF股票篮 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param query_param 需要查询股票篮的的ETF合约,其中合约代码不可以为空,market字段也必须指定 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + virtual int QueryETFTickerBasket(XTPQueryETFComponentReq *query_param, uint64_t session_id, int request_id) = 0; + + ///请求查询今日新股申购信息列表 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + virtual int QueryIPOInfoList(uint64_t session_id, int request_id) = 0; + + ///请求查询用户新股申购额度信息 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + virtual int QueryIPOQuotaInfo(uint64_t session_id, int request_id) = 0; + + ///请求查询期权合约 + ///@return 查询是否成功,“0”表示成功,非“0”表示出错,此时用户可以调用GetApiLastError()来获取错误代码 + ///@param query_param 需要查询的期权合约的筛选条件,可以为NULL(为NULL表示查询所有的期权合约) + ///@param session_id 资金账户对应的session_id,登录时得到 + ///@param request_id 用于用户定位查询响应的ID,由用户自定义 + virtual int QueryOptionAuctionInfo(XTPQueryOptionAuctionInfoReq *query_param, uint64_t session_id, int request_id) = 0; + + + protected: + ~TraderApi() {}; + }; + + } +} + +#ifndef WINDOWS +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif +#endif + + +#endif diff --git a/include/cryptopp.zip b/include/cryptopp.zip new file mode 100644 index 0000000..177bec7 Binary files /dev/null and b/include/cryptopp.zip differ diff --git a/include/inirw.cpp b/include/inirw.cpp new file mode 100644 index 0000000..b364749 --- /dev/null +++ b/include/inirw.cpp @@ -0,0 +1,529 @@ +#include "stdafx.h" +#include +#include +#include +#include +#include "inirw.h" + +#define SIZE_LINE 1024 //每行最大长度 +#define SIZE_FILENAME 256 //文件名最大长度 + +#define min(x, y) (x <= y) ? x : y + +typedef enum _ELineType_ { + LINE_IDLE, //未处理行 + LINE_ERROR, //错误行 + LINE_EMPTY, //空白行或注释行 + LINE_SECTION, //节定义行 + LINE_VALUE //值定义行 +} ELineType ; + + +static char gFilename[SIZE_FILENAME]; +static char *gBuffer; +static int gBuflen; + +const char* GetBuffer() +{ + return gBuffer; +} +int GetBufferLen() +{ + return gBuflen; +} + + +//去除串首尾空格,原串被改写 +static char *StrStrip(char *s) +{ + size_t size; + char *p1, *p2; + + size = strlen(s); + if (!size) + return s; + + p2 = s + size - 1; + + while ((p2 >= s) && isspace((unsigned char)*p2)) + p2 --; + *(p2 + 1) = '\0'; + + p1 = s; + while (*p1 && isspace((unsigned char)*p1)) + p1 ++; + if (s != p1) + memmove(s, p1, p2 - p1 + 2); + return s; +} + + +//不区分大小写比较字符串 +static int StriCmp(const char *s1, const char *s2) +{ + int ch1, ch2; + do + { + ch1 = (unsigned char)*(s1++); + if ((ch1 >= 'A') && (ch1 <= 'Z')) + ch1 += 0x20; + + ch2 = (unsigned char)*(s2++); + if ((ch2 >= 'A') && (ch2 <= 'Z')) + ch2 += 0x20; + } while ( ch1 && (ch1 == ch2) ); + return(ch1 - ch2); +} + + +//取一行 +//输入:数据区(指针及长度) +//输出:行类型、有效内容串(去首尾空格)、注释首、注释尾、下一行首(行尾与下一行首间为换行符) +// 有效内容位置为[buf, rem1) +static int GetLine(char *buf, int buflen, char *content, char **rem1, char **rem2, char **nextline) +{ + char *cont1, *cont2; + int cntblank, cntCR, cntLF; //连续空格、换行符数量 + char isQuot1, isQuot2; //引号 + int i; + char *p; + + //首先断行断注释,支持如下换行符:\r、\n、\r\n、\n\r + cntblank = 0; + cntCR = cntLF = 0; + isQuot1 = isQuot2 = 0; + cont1 = *rem1 = 0; + content[0] = 0; + for (i = 0, p = buf; i < buflen; i ++, p ++) + { + if (*p == 0) { + p ++; + break; + } + //2个CR或LF,行结束 + if (cntCR == 2 || cntLF == 2) { + // 这个地方会导致两个LF时前一句读出来的"少一个 + //p --; //回溯1 + break; + } + //CR或LF各1个之后任意字符,行结束 + if (cntCR + cntLF >= 2) { + break; + } + //CR或LF之后出现其它字符,行结束 + if ((cntCR || cntLF) && *p != '\r' && *p != '\n') + break; + + switch (*p) { + case '\r': + cntCR ++; + break; + case '\n': + cntLF ++; + break; + case '\'': + if (!isQuot2) + isQuot1 = 1 - isQuot1; + break; + case '\"': + if (!isQuot1) + isQuot2 = 1 - isQuot2; + break; + case ';': + case '#': + if (isQuot1 || isQuot2) + break; + if (*rem1 == NULL) + *rem1 = p - cntblank; + break; + default: + if (isspace((unsigned char)*p)) { + cntblank ++; + } else { + cntblank = 0; + if ((*rem1 == NULL) && (cont1 == NULL)) + cont1 = p; + } + break; + } + } + + *nextline = p; + *rem2 = p - cntCR - cntLF; + if (*rem1 == NULL) + *rem1 = *rem2; + cont2 = *rem1 - cntblank; + + if (cont1 == NULL) { + cont1 = cont2; + return LINE_EMPTY; + } + + i = (int)(cont2 - cont1); + if (i >= SIZE_LINE) + return LINE_ERROR; + + //内容头尾已无空格 + memcpy(content, cont1, i); + content[i] = 0; + + if (content[0] == '[' && content[i - 1] == ']') + return LINE_SECTION; + if (strchr(content, '=') != NULL) + return LINE_VALUE; + + return LINE_ERROR; +} + + +//取一节section +//输入:节名称 +//输出:成功与否、节名称首、节名称尾、节内容首、节内容尾(含换行)、下一节首(节尾与下一节首间为空行或注释行) +static int FindSection(const char *section, char **sect1, char **sect2, char **cont1, char **cont2, char **nextsect) +{ + int type; + char content[SIZE_LINE]; + char *rem1, *rem2, *nextline = nullptr; + + char *p = nullptr; + char *empty = nullptr; + int uselen = 0; + char found = 0; + + if (gBuffer == NULL) { + return 0; + } + + while (gBuflen - uselen > 0) { + p = gBuffer + uselen; + type = GetLine(p, gBuflen - uselen, content, &rem1, &rem2, &nextline); + uselen += (int)(nextline - p); + + if (LINE_SECTION == type) { + if (found || section == NULL) break; //发现另一section + content[strlen(content) - 1] = 0; //去尾部] + StrStrip(content + 1); //去首尾空格 + if (StriCmp(content + 1, section) == 0) { + found = 1; + *sect1 = p; + *sect2 = rem1; + *cont1 = nextline; + } + empty = nextline; + } else + if (LINE_VALUE == type) { + if (!found && section == NULL) { + found = 1; + *sect1 = p; + *sect2 = p; + *cont1 = p; + } + empty = nextline; + } + } + + if (!found) return 0; + + *cont2 = empty; + *nextsect = nextline; + return 1; +} + + +//从一行取键、值 +//输入:内容串(将被改写) +//输出:键串、值串 +static void GetKeyValue(char *content, char **key, char **value) +{ + char *p; + + p = strchr(content, '='); + *p = 0; + StrStrip(content); + StrStrip(p + 1); + *key = content; + *value = p + 1; +} + + +//释放ini文件所占资源 +void iniFileFree() +{ + if (gBuffer != NULL) { + free(gBuffer); + gBuffer = 0; + gBuflen = 0; + } +} + + +//加载ini文件至内存 +int iniFileLoad(const char *filename) +{ + FILE *file; + int len; + + iniFileFree(); + if (strlen(filename) >= sizeof(gFilename)) + return 0; + strcpy(gFilename, filename); + + file = fopen(gFilename, "rb"); + if (file == NULL) + return 0; + + fseek(file, 0, SEEK_END); + len = ftell(file); + gBuffer = (char*)malloc(len); + if (gBuffer == NULL) { + fclose(file); + return 0; + } + + fseek(file, 0, SEEK_SET); + len = fread(gBuffer, 1, len, file); + fclose(file); + gBuflen = len; + return 1; +} + + +//读取值原始串 +static int iniGetValue(const char *section, const char *key, char *value, int maxlen, const char *defvalue) +{ + int type; + char content[SIZE_LINE]; + char *rem1, *rem2, *nextline; + char *key0, *value0; + + char *p; + int uselen = 0; + char found = 0; + + int len; + + if (gBuffer == NULL || key == NULL) { + if (value != NULL) + value[0] = 0; + return 0; + } + + while (gBuflen - uselen > 0) { + p = gBuffer + uselen; + type = GetLine(p, gBuflen - uselen, content, &rem1, &rem2, &nextline); + uselen += (int)(nextline - p); + + if (LINE_SECTION == type) { + if (found || section == NULL) break; //发现另一section + content[strlen(content) - 1] = 0; //去尾部] + StrStrip(content + 1); //去首尾空格 + if (StriCmp(content + 1, section) == 0) { + found = 1; + } + } else + if (LINE_VALUE == type) { + if (!found && section == NULL) { + found = 1; + } + if (!found) + continue; + GetKeyValue(content, &key0, &value0); + if (StriCmp(key0, key) == 0) { + len = strlen(value0); + if (len == 0) break; //空值视为无效 + if (value != NULL) { + len = min(len, maxlen - 1); + strncpy(value, value0, len); + value[len] = 0; + } + return 1; + } + } + } + + //未发现键值取缺省 + if (value != NULL) { + if (defvalue != NULL) { + len = min(strlen(defvalue), maxlen - 1); + strncpy(value, defvalue, len); + value[len] = 0; + } else { + value[0] = 0; + } + } + return 0; +} + + +//获取字符串,不带引号 +int iniGetString(const char *section, const char *key, char *value, int maxlen, const char *defvalue) +{ + int ret; + int len; + + ret = iniGetValue(section, key, value, maxlen, defvalue); + if (!ret) + return ret; + + //去首尾空格 + len = strlen(value); + if (value[0] == '\'' && value[len - 1] == '\'') { + value[len - 1] = 0; + memmove(value, value + 1, len - 1); + } else + if (value[0] == '\"' && value[len - 1] == '\"') { + value[len - 1] = 0; + memmove(value, value + 1, len - 1); + } + return ret; +} + + +//获取整数值 +int iniGetInt(const char *section, const char *key, int defvalue) +{ + char valstr[64]; + + if (iniGetString(section, key, valstr, sizeof(valstr), "")) + return (int)strtol(valstr, NULL, 0); + return defvalue; +} + + +//获取浮点数 +double iniGetDouble(const char *section, const char *key, double defvalue) +{ + char valstr[64]; + + if (iniGetString(section, key, valstr, sizeof(valstr), "")) + return (int)atof(valstr); + return defvalue; +} + + +//设置字符串:若value为NULL,则删除该key所在行,包括注释 +int iniSetString(const char *section, const char *key, const char *value, bool quote) +{ + FILE *file; + char *sect1, *sect2, *cont1, *cont2, *nextsect; + char *p; + int len, type; + char content[SIZE_LINE]; + char *key0, *value0; + char *rem1, *rem2, *nextline; + + // 注了就可以创建文件了 + //if (gBuffer == NULL) { + // return 0; + //} + + if (FindSection(section, §1, §2, &cont1, &cont2, &nextsect) == 0) + { + //未找到节 + + //value无效则返回 + if (value == NULL) + return 0; + + //在文件尾部添加 + file = fopen(gFilename, "ab"); + if (file == NULL) + return 0; + if (quote) + { + fprintf(file, "\n[%s]\n%s=\"%s\"\n", section, key, value); + } + else + { + fprintf(file, "\n[%s]\n%s=%s\n", section, key, value); + } + fclose(file); + iniFileLoad(gFilename); + return 1; + } + + //找到节,则节内查找key + p = cont1; + len = (int)(cont2 - cont1); + while (len > 0) { + type = GetLine(p, len, content, &rem1, &rem2, &nextline); + + if (LINE_VALUE == type) { + GetKeyValue(content, &key0, &value0); + if (StriCmp(key0, key) == 0) { + //找到key + file = fopen(gFilename, "wb"); + if (file == NULL) + return 0; + len = (int)(p - gBuffer); + fwrite(gBuffer, 1, len, file); //写入key之前部分 + if (value == NULL) { + //value无效,删除 + len = (int)(nextline - gBuffer); //整行连同注释一并删除 + } else { + //value有效,改写 + if (quote) + { + fprintf(file, "%s=\"%s\"", key, value); + } + else + { + fprintf(file, "%s=%s", key, value); + } + len = (int)(rem1 - gBuffer); //保留尾部原注释! + } + fwrite(gBuffer + len, 1, gBuflen - len, file); //写入key所在行含注释之后部分 + fclose(file); + iniFileLoad(gFilename); + return 1; + } + } + + len -= (int)(nextline - p); + p = nextline; + } + + //未找到key + + //value无效则返回 + if (value == NULL) + return 0; + + //在文件尾部添加 + file = fopen(gFilename, "wb"); + if (file == NULL) + return 0; + len = (int)(cont2 - gBuffer); + fwrite(gBuffer, 1, len, file); //写入key之前部分 + if (quote) + { + fprintf(file, "%s=\"%s\"\n", key, value); + } + else + { + fprintf(file, "%s=%s\n", key, value); + } + fwrite(gBuffer + len, 1, gBuflen - len, file); //写入key之后部分 + fclose(file); + iniFileLoad(gFilename); + return 1; +} + + +//设置整数值:base取值10、16、8,分别表示10、16、8进制,缺省为10进制 +int iniSetInt(const char *section, const char *key, int value, int base) +{ + char valstr[64]; + + switch (base) { + case 16: + sprintf(valstr, "0x%x", value); + return iniSetString(section, key, valstr, false); + case 8: + sprintf(valstr, "0%o", value); + return iniSetString(section, key, valstr, false); + default: //10 + sprintf(valstr, "%d", value); + return iniSetString(section, key, valstr, false); + } +} diff --git a/include/inirw.h b/include/inirw.h new file mode 100644 index 0000000..94503bf --- /dev/null +++ b/include/inirw.h @@ -0,0 +1,55 @@ +/** + * 文件:inirw.h + * 版本:1.0 + * 作者:taoyuanmin@gmail.com + * + * 说明:ini配置文件读写 + * 1、支持;和#注释符号,支持行尾注释。 + * 2、支持带引号'或"成对匹配的字符串,提取时自动去引号。引号中可带其它引号或;#注释符。 + * 3、支持无section或空section(名称为空)。 + * 4、支持10、16、8进制数,0x开头为16进制数,0开头为8进制。 + * 5、支持section、key或=号前后带空格。 + * 6、支持\n、\r、\r\n或\n\r换行格式。 + * 7、不区分section、key大小写,但写入时以新串为准,并保持其大小写。 + * 8、新增数据时,若section存在则在该节最后一个有效数据后添加,否则在文件尾部添加。 + * 9、支持指定key所在整行删除,即删除该键值,包括注释。 + * 10、可自动跳过格式错误行,修改时仍然保留。 + * 11、修改时保留原注释:包括整行注释、行尾注释(包括前面空格)。 + * 12、修改时保留原空行。以上三点主要是尽量保留原格式。 + */ + + +#ifndef _INI_RW_H_ +#define _INI_RW_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +//加载ini文件至内存 +int iniFileLoad(const char *filename); +//释放ini文件所占资源 +void iniFileFree(); + +//获取字符串,不带引号 +int iniGetString(const char *section, const char *key, char *value, int size, const char *defvalue); +//获取整数值 +int iniGetInt(const char *section, const char *key, int defvalue); +//获取浮点数 +double iniGetDouble(const char *section, const char *key, double defvalue); + +//设置字符串:若value为NULL,则删除该key所在行,包括注释 +int iniSetString(const char *section, const char *key, const char *value,bool quote = true); +//设置整数值:base取值10、16、8,分别表示10、16、8进制,缺省为10进制 +int iniSetInt(const char *section, const char *key, int value, int base); + +// 以下是用于加载字符串后用于别的用途,因为它所有的写入操作都是写文件 +// 不满足我需要给它添加字符串或加密的需求 +const char* GetBuffer(); +int GetBufferLen(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/QuantBox_Queue/ArrayLockFreeQueue.h b/include/queue/ArrayLockFreeQueue.h similarity index 96% rename from QuantBox_Queue/ArrayLockFreeQueue.h rename to include/queue/ArrayLockFreeQueue.h index 4ed39b1..9b8e69d 100644 --- a/QuantBox_Queue/ArrayLockFreeQueue.h +++ b/include/queue/ArrayLockFreeQueue.h @@ -4,7 +4,7 @@ #include #ifdef _WIN64 -#define QUEUE_INT LONG64 +#define QUEUE_INT int64_t #else #define QUEUE_INT unsigned long #endif diff --git a/QuantBox_Queue/ArrayLockFreeQueueImp.h b/include/queue/ArrayLockFreeQueueImp.h similarity index 99% rename from QuantBox_Queue/ArrayLockFreeQueueImp.h rename to include/queue/ArrayLockFreeQueueImp.h index 9493003..936a2cd 100644 --- a/QuantBox_Queue/ArrayLockFreeQueueImp.h +++ b/include/queue/ArrayLockFreeQueueImp.h @@ -11,9 +11,7 @@ ArrayLockFreeQueue::ArrayLockFreeQueue() : m_readIndex(0), m_maximumReadIndex(0) { - m_count = 0; - } template diff --git a/include/queue/MsgQueue.h b/include/queue/MsgQueue.h new file mode 100644 index 0000000..16b272c --- /dev/null +++ b/include/queue/MsgQueue.h @@ -0,0 +1,473 @@ +#pragma once + +#ifndef _QUEUE_H_ +#define _QUEUE_H_ + +#include "../CrossPlatform.h" +#include +#include +#include +#include +#include + +#include "ArrayLockFreeQueue.h" + +struct ResponeItem +{ + char type; // (RequestType) + + void* pApi1; // 执行者,不能delete + void* pApi2; // 源头,不能delete + + double double1; + double double2; + + void* ptr1; // 需要delete + int size1; + void* ptr2; // 需要delete + int size2; + void* ptr3; // 需要delete + int size3; + + bool bNeedDelete; // 是否需要删除 +}; + + +#ifdef __cplusplus +extern "C" { +#endif + + typedef void* (__stdcall *fnOnResponse) (char type, + void* pApi1, void* pApi2, + double double1, double double2, + void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); +#ifdef __cplusplus +} +#endif + + +using namespace std; + +#pragma warning(push) +#pragma warning(disable:4251) + +// 在队列dll中是导出函数 +// 在api dll中不是导出函数,是导入函数 + +class CMsgQueue +{ +public: + bool m_bDirectOutput; + FILE* m_infile; + FILE* m_outfile; + + CMsgQueue()//:m_queue(1024) + { + m_hThread = nullptr; + m_bRunning = false; + m_bDirectOutput = false; + + m_infile = nullptr; + m_outfile = nullptr; + + //回调函数地址指针 + m_fnOnResponse = nullptr; + } + virtual ~CMsgQueue() + { + if (m_infile) + { + fclose(m_infile); + m_infile = nullptr; + } + if (m_outfile) + { + fclose(m_outfile); + m_outfile = nullptr; + } + StopThread(); + Clear(); + } + + void SaveFileTo(const char* filename) + { + m_outfile = fopen(filename, "wb"); + } + +public: + //清空队列 + void Clear() + { + ResponeItem* pItem = nullptr; + //清空队列 + while (m_queue.try_dequeue(pItem)) + { + if (pItem->bNeedDelete) + { + delete[] pItem->ptr1; + delete[] pItem->ptr2; + delete[] pItem->ptr3; + } + delete pItem; + } + } + + unsigned long Size() + { + return m_queue.size(); + } + + void Save(FILE* outfile, ResponeItem* pItem) + { + if (outfile == nullptr) + return; + + if (pItem == nullptr) + return; + + int rc = fwrite(pItem, sizeof(ResponeItem), 1, outfile); + // 文件没有写进去 + if (rc == 0) + return; + if (pItem->size1 > 0) + { + fwrite(pItem->ptr1, sizeof(char), pItem->size1, outfile); + } + if (pItem->size2 > 0) + { + fwrite(pItem->ptr2, sizeof(char), pItem->size2, outfile); + } + if (pItem->size3 > 0) + { + fwrite(pItem->ptr3, sizeof(char), pItem->size3, outfile); + } + // 主要是为了保存数据,后期调试要用 + fflush(outfile); + } + + ResponeItem* Load(FILE* infile) + { + if (infile == nullptr) + return nullptr; + + ResponeItem* pItem = new ResponeItem(); + int rc = fread(pItem, sizeof(ResponeItem), 1, infile); + // 到文件结尾了 + if (rc == 0) + return nullptr; + if (pItem->size1 > 0) + { + char* ptr1 = new char[pItem->size1]; + fread(ptr1, sizeof(char), pItem->size1, infile); + pItem->ptr1 = ptr1; + } + if (pItem->size2 > 0) + { + char* ptr2 = new char[pItem->size2]; + fread(ptr2, sizeof(char), pItem->size2, infile); + pItem->ptr2 = ptr2; + } + if (pItem->size3 > 0) + { + char* ptr3 = new char[pItem->size3]; + fread(ptr3, sizeof(char), pItem->size3, infile); + pItem->ptr3 = ptr3; + } + return pItem; + } + + //可以由外部发起,顺序处理队列触发回调函数 + bool Process() + { + try + { + ResponeItem* pItem = nullptr; + if (m_queue.try_dequeue(pItem)) + { + Output(pItem); + if (pItem->bNeedDelete) + { + // 删除的是数组,目前是自己模块创建的自己删 + delete[] pItem->ptr1; + delete[] pItem->ptr2; + delete[] pItem->ptr3; + } + delete pItem; + return true; + } + return false; + } + catch (...) + { + return false; + } + } + + //由内部启动线程,内部主动调用Process触发回调 + void StartThread() + { + if (nullptr == m_hThread) + { + m_bRunning = true; + m_hThread = new thread(ProcessThread, this); + } + } + + void StopThread() + { + m_bRunning = false; + m_cv.notify_all(); + this_thread::sleep_for(chrono::milliseconds(10)); + lock_guard cl(m_mtx_del); + if (m_hThread) + { + // 这里很少有机会执行 + m_hThread->join(); + m_hThread = nullptr; + } + } + + //将外部的函数地址注册到队列 + void Register(fnOnResponse pCallback) + { + m_fnOnResponse = pCallback; + } + + void* new_block(int size) + { + // 下次改用内存池 + void* p = new char[size]; + if (p == nullptr) + return nullptr; + + memset(p, 0, size); + return p; + } + + void delete_block(void* p) + { + if (p != nullptr) + delete[] p; + } + + // 直接发送,不入队列 + void* Input_Output(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) + { + try + { + if (m_fnOnResponse) + return (*m_fnOnResponse)(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + } + catch (...) + { + m_fnOnResponse = nullptr; + } + return nullptr; + } + + // 对输入的数据做了一次复制,主要是为了解决转过来的指针可能失效的问题。 + // 比如说STL中的指针跨线程指向的地址就无效了。所以从map中取的OrderField等都是做了次复制 + void Input_Copy(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) + { + if (m_bDirectOutput) + { + Input_Output(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + delete_block(ptr1); + delete_block(ptr2); + delete_block(ptr3); + return; + } + ResponeItem* pItem = new ResponeItem; + memset(pItem, 0, sizeof(ResponeItem)); + pItem->bNeedDelete = true; + + pItem->type = type; + + pItem->pApi1 = pApi1; + pItem->pApi2 = pApi2; + + pItem->double1 = double1; + pItem->double2 = double2; + + if (ptr1 && size1) + { + pItem->size1 = size1; + pItem->ptr1 = new char[size1]; + memcpy(pItem->ptr1, ptr1, size1); + } + + if (ptr2 && size2) + { + pItem->size2 = size2; + pItem->ptr2 = new char[size2]; + memcpy(pItem->ptr2, ptr2, size2); + } + + if (ptr3 && size3) + { + pItem->size3 = size3; + pItem->ptr3 = new char[size3]; + memcpy(pItem->ptr3, ptr3, size3); + } + + Save(m_outfile, pItem); + m_queue.enqueue(pItem); + // 将Sleep改成用条件变量 + m_cv.notify_all(); + } + + // 对于过来的指针不做复制,直接使用 + // 由于是跨DLL进行操作,由另一个DLL创建的内存块交给此队列进行处理时delete可能实现有变化导致出错 + // 所以必须是由此DLL new出来的内存块交给另一DLL修改返回后,再由此DLL delete,所以提前用到new_block + void Input_NoCopy(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) + { + if (m_bDirectOutput) + { + Input_Output(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + delete_block(ptr1); + delete_block(ptr2); + delete_block(ptr3); + return; + } + ResponeItem* pItem = new ResponeItem; + //memset(pItem, 0, sizeof(ResponeItem)); + pItem->bNeedDelete = true; + + pItem->type = type; + + pItem->pApi1 = pApi1; + pItem->pApi2 = pApi2; + + pItem->double1 = double1; + pItem->double2 = double2; + + pItem->ptr1 = ptr1; + pItem->size1 = size1; + pItem->ptr2 = ptr2; + pItem->size2 = size2; + pItem->ptr3 = ptr3; + pItem->size3 = size3; + + Save(m_outfile, pItem); + m_queue.enqueue(pItem); + // 将Sleep改成用条件变量 + m_cv.notify_all(); + } + + // 不做拷贝也不做delete,这种必须由其它DLL进行delete + void Input_NoCopy_NoDelete(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) + { + if (m_bDirectOutput) + { + Input_Output(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + return; + } + ResponeItem* pItem = new ResponeItem; + //memset(pItem, 0, sizeof(ResponeItem)); + pItem->bNeedDelete = false; + + pItem->type = type; + + pItem->pApi1 = pApi1; + pItem->pApi2 = pApi2; + + pItem->double1 = double1; + pItem->double2 = double2; + + pItem->ptr1 = ptr1; + pItem->size1 = size1; + pItem->ptr2 = ptr2; + pItem->size2 = size2; + pItem->ptr3 = ptr3; + pItem->size3 = size3; + + Save(m_outfile, pItem); + m_queue.enqueue(pItem); + // 将Sleep改成用条件变量 + m_cv.notify_all(); + } + +protected: + virtual void RunInThread() + { + try + { + while (m_bRunning) + { + if (Process()) + { + } + else + { + // 空闲时等1ms,如果立即有事件过来就晚了1ms + //this_thread::sleep_for(chrono::milliseconds(1)); + + // 空闲时过来等1ms,没等到就回去再试 + // 如过正好等到了,就立即去试,应当会快一点吧? + + // wait_for的效果为何不是遇到事件后就立即返回?而是一定要等满时间?太奇怪了,这个地方可以改成seconds(10)就知道效果了 + unique_lock lck(m_mtx); + //m_cv.wait_for(lck, std::chrono::seconds(10), [this]{return m_bRunning == false; }); //这种写法会导致收到事件立即处理的功能失效 + m_cv.wait_for(lck, std::chrono::seconds(2)); + } + } + } + catch (...) + { + + } + + // 这句加了有效果吗? + // 加了后可能报以下错,但不当了 + /* + ************** Exception Text ************** + System.Runtime.InteropServices.SEHException(0x80004005) : External component has thrown an exception. + at XAPI.Proxy.XRequest(Byte type, IntPtr pApi1, IntPtr pApi2, Double double1, Double double2, IntPtr ptr1, Int32 size1, IntPtr ptr2, Int32 size2, IntPtr ptr3, Int32 size3) in D : \Users\Kan\Documents\GitHub\XAPI2\languages\CSharp\XAPI_CSharp\Proxy.cs:line 79 + */ + //m_hThread->detach(); + + + // 清理线程 + m_hThread = nullptr; + m_bRunning = false; + } + + virtual void Output(ResponeItem* pItem) + { + try + { + if (m_fnOnResponse) + (*m_fnOnResponse)(pItem->type, + pItem->pApi1, pItem->pApi2, + pItem->double1, pItem->double2, + pItem->ptr1, pItem->size1, pItem->ptr2, pItem->size2, pItem->ptr3, pItem->size3); + } + catch (...) + { + m_fnOnResponse = nullptr; + } + } + +private: + static void ProcessThread(CMsgQueue* lpParam) + { + if (lpParam) + lpParam->RunInThread(); + } +protected: + atomic_bool m_bRunning; + mutex m_mtx; + mutex m_mtx_del; + condition_variable m_cv; + thread* m_hThread; + +private: + ArrayLockFreeQueue m_queue; + + fnOnResponse m_fnOnResponse; + +}; + +#pragma warning(pop) + +#endif diff --git a/QuantBox_Queue/atom_opt.h b/include/queue/atom_opt.h similarity index 100% rename from QuantBox_Queue/atom_opt.h rename to include/queue/atom_opt.h diff --git a/include/rapidjson/allocators.h b/include/rapidjson/allocators.h new file mode 100644 index 0000000..98affe0 --- /dev/null +++ b/include/rapidjson/allocators.h @@ -0,0 +1,271 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ALLOCATORS_H_ +#define RAPIDJSON_ALLOCATORS_H_ + +#include "rapidjson.h" + +RAPIDJSON_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// Allocator + +/*! \class rapidjson::Allocator + \brief Concept for allocating, resizing and freeing memory block. + + Note that Malloc() and Realloc() are non-static but Free() is static. + + So if an allocator need to support Free(), it needs to put its pointer in + the header of memory block. + +\code +concept Allocator { + static const bool kNeedFree; //!< Whether this allocator needs to call Free(). + + // Allocate a memory block. + // \param size of the memory block in bytes. + // \returns pointer to the memory block. + void* Malloc(size_t size); + + // Resize a memory block. + // \param originalPtr The pointer to current memory block. Null pointer is permitted. + // \param originalSize The current size in bytes. (Design issue: since some allocator may not book-keep this, explicitly pass to it can save memory.) + // \param newSize the new size in bytes. + void* Realloc(void* originalPtr, size_t originalSize, size_t newSize); + + // Free a memory block. + // \param pointer to the memory block. Null pointer is permitted. + static void Free(void *ptr); +}; +\endcode +*/ + +/////////////////////////////////////////////////////////////////////////////// +// CrtAllocator + +//! C-runtime library allocator. +/*! This class is just wrapper for standard C library memory routines. + \note implements Allocator concept +*/ +class CrtAllocator { +public: + static const bool kNeedFree = true; + void* Malloc(size_t size) { + if (size) // behavior of malloc(0) is implementation defined. + return std::malloc(size); + else + return NULL; // standardize to returning NULL. + } + void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) { + (void)originalSize; + if (newSize == 0) { + std::free(originalPtr); + return NULL; + } + return std::realloc(originalPtr, newSize); + } + static void Free(void *ptr) { std::free(ptr); } +}; + +/////////////////////////////////////////////////////////////////////////////// +// MemoryPoolAllocator + +//! Default memory allocator used by the parser and DOM. +/*! This allocator allocate memory blocks from pre-allocated memory chunks. + + It does not free memory blocks. And Realloc() only allocate new memory. + + The memory chunks are allocated by BaseAllocator, which is CrtAllocator by default. + + User may also supply a buffer as the first chunk. + + If the user-buffer is full then additional chunks are allocated by BaseAllocator. + + The user-buffer is not deallocated by this allocator. + + \tparam BaseAllocator the allocator type for allocating memory chunks. Default is CrtAllocator. + \note implements Allocator concept +*/ +template +class MemoryPoolAllocator { +public: + static const bool kNeedFree = false; //!< Tell users that no need to call Free() with this allocator. (concept Allocator) + + //! Constructor with chunkSize. + /*! \param chunkSize The size of memory chunk. The default is kDefaultChunkSize. + \param baseAllocator The allocator for allocating memory chunks. + */ + MemoryPoolAllocator(size_t chunkSize = kDefaultChunkCapacity, BaseAllocator* baseAllocator = 0) : + chunkHead_(0), chunk_capacity_(chunkSize), userBuffer_(0), baseAllocator_(baseAllocator), ownBaseAllocator_(0) + { + } + + //! Constructor with user-supplied buffer. + /*! The user buffer will be used firstly. When it is full, memory pool allocates new chunk with chunk size. + + The user buffer will not be deallocated when this allocator is destructed. + + \param buffer User supplied buffer. + \param size Size of the buffer in bytes. It must at least larger than sizeof(ChunkHeader). + \param chunkSize The size of memory chunk. The default is kDefaultChunkSize. + \param baseAllocator The allocator for allocating memory chunks. + */ + MemoryPoolAllocator(void *buffer, size_t size, size_t chunkSize = kDefaultChunkCapacity, BaseAllocator* baseAllocator = 0) : + chunkHead_(0), chunk_capacity_(chunkSize), userBuffer_(buffer), baseAllocator_(baseAllocator), ownBaseAllocator_(0) + { + RAPIDJSON_ASSERT(buffer != 0); + RAPIDJSON_ASSERT(size > sizeof(ChunkHeader)); + chunkHead_ = reinterpret_cast(buffer); + chunkHead_->capacity = size - sizeof(ChunkHeader); + chunkHead_->size = 0; + chunkHead_->next = 0; + } + + //! Destructor. + /*! This deallocates all memory chunks, excluding the user-supplied buffer. + */ + ~MemoryPoolAllocator() { + Clear(); + RAPIDJSON_DELETE(ownBaseAllocator_); + } + + //! Deallocates all memory chunks, excluding the user-supplied buffer. + void Clear() { + while (chunkHead_ && chunkHead_ != userBuffer_) { + ChunkHeader* next = chunkHead_->next; + baseAllocator_->Free(chunkHead_); + chunkHead_ = next; + } + if (chunkHead_ && chunkHead_ == userBuffer_) + chunkHead_->size = 0; // Clear user buffer + } + + //! Computes the total capacity of allocated memory chunks. + /*! \return total capacity in bytes. + */ + size_t Capacity() const { + size_t capacity = 0; + for (ChunkHeader* c = chunkHead_; c != 0; c = c->next) + capacity += c->capacity; + return capacity; + } + + //! Computes the memory blocks allocated. + /*! \return total used bytes. + */ + size_t Size() const { + size_t size = 0; + for (ChunkHeader* c = chunkHead_; c != 0; c = c->next) + size += c->size; + return size; + } + + //! Allocates a memory block. (concept Allocator) + void* Malloc(size_t size) { + if (!size) + return NULL; + + size = RAPIDJSON_ALIGN(size); + if (chunkHead_ == 0 || chunkHead_->size + size > chunkHead_->capacity) + if (!AddChunk(chunk_capacity_ > size ? chunk_capacity_ : size)) + return NULL; + + void *buffer = reinterpret_cast(chunkHead_) + RAPIDJSON_ALIGN(sizeof(ChunkHeader)) + chunkHead_->size; + chunkHead_->size += size; + return buffer; + } + + //! Resizes a memory block (concept Allocator) + void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) { + if (originalPtr == 0) + return Malloc(newSize); + + if (newSize == 0) + return NULL; + + originalSize = RAPIDJSON_ALIGN(originalSize); + newSize = RAPIDJSON_ALIGN(newSize); + + // Do not shrink if new size is smaller than original + if (originalSize >= newSize) + return originalPtr; + + // Simply expand it if it is the last allocation and there is sufficient space + if (originalPtr == reinterpret_cast(chunkHead_) + RAPIDJSON_ALIGN(sizeof(ChunkHeader)) + chunkHead_->size - originalSize) { + size_t increment = static_cast(newSize - originalSize); + if (chunkHead_->size + increment <= chunkHead_->capacity) { + chunkHead_->size += increment; + return originalPtr; + } + } + + // Realloc process: allocate and copy memory, do not free original buffer. + if (void* newBuffer = Malloc(newSize)) { + if (originalSize) + std::memcpy(newBuffer, originalPtr, originalSize); + return newBuffer; + } + else + return NULL; + } + + //! Frees a memory block (concept Allocator) + static void Free(void *ptr) { (void)ptr; } // Do nothing + +private: + //! Copy constructor is not permitted. + MemoryPoolAllocator(const MemoryPoolAllocator& rhs) /* = delete */; + //! Copy assignment operator is not permitted. + MemoryPoolAllocator& operator=(const MemoryPoolAllocator& rhs) /* = delete */; + + //! Creates a new chunk. + /*! \param capacity Capacity of the chunk in bytes. + \return true if success. + */ + bool AddChunk(size_t capacity) { + if (!baseAllocator_) + ownBaseAllocator_ = baseAllocator_ = RAPIDJSON_NEW(BaseAllocator()); + if (ChunkHeader* chunk = reinterpret_cast(baseAllocator_->Malloc(RAPIDJSON_ALIGN(sizeof(ChunkHeader)) + capacity))) { + chunk->capacity = capacity; + chunk->size = 0; + chunk->next = chunkHead_; + chunkHead_ = chunk; + return true; + } + else + return false; + } + + static const int kDefaultChunkCapacity = 64 * 1024; //!< Default chunk capacity. + + //! Chunk header for perpending to each chunk. + /*! Chunks are stored as a singly linked list. + */ + struct ChunkHeader { + size_t capacity; //!< Capacity of the chunk in bytes (excluding the header itself). + size_t size; //!< Current size of allocated memory in bytes. + ChunkHeader *next; //!< Next chunk in the linked list. + }; + + ChunkHeader *chunkHead_; //!< Head of the chunk linked-list. Only the head chunk serves allocation. + size_t chunk_capacity_; //!< The minimum capacity of chunk when they are allocated. + void *userBuffer_; //!< User supplied buffer. + BaseAllocator* baseAllocator_; //!< base allocator for allocating memory chunks. + BaseAllocator* ownBaseAllocator_; //!< base allocator created by this object. +}; + +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_ENCODINGS_H_ diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h new file mode 100644 index 0000000..e3e20df --- /dev/null +++ b/include/rapidjson/document.h @@ -0,0 +1,2575 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_DOCUMENT_H_ +#define RAPIDJSON_DOCUMENT_H_ + +/*! \file document.h */ + +#include "reader.h" +#include "internal/meta.h" +#include "internal/strfunc.h" +#include "memorystream.h" +#include "encodedstream.h" +#include // placement new +#include + +RAPIDJSON_DIAG_PUSH +#ifdef _MSC_VER +RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant +RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible loss of data +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_OFF(padded) +RAPIDJSON_DIAG_OFF(switch-enum) +RAPIDJSON_DIAG_OFF(c++98-compat) +#endif + +#ifdef __GNUC__ +RAPIDJSON_DIAG_OFF(effc++) +#if __GNUC__ >= 6 +RAPIDJSON_DIAG_OFF(terminate) // ignore throwing RAPIDJSON_ASSERT in RAPIDJSON_NOEXCEPT functions +#endif +#endif // __GNUC__ + +#ifndef RAPIDJSON_NOMEMBERITERATORCLASS +#include // std::iterator, std::random_access_iterator_tag +#endif + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS +#include // std::move +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +// Forward declaration. +template +class GenericValue; + +template +class GenericDocument; + +//! Name-value pair in a JSON object value. +/*! + This class was internal to GenericValue. It used to be a inner struct. + But a compiler (IBM XL C/C++ for AIX) have reported to have problem with that so it moved as a namespace scope struct. + https://code.google.com/p/rapidjson/issues/detail?id=64 +*/ +template +struct GenericMember { + GenericValue name; //!< name of member (must be a string) + GenericValue value; //!< value of member. +}; + +/////////////////////////////////////////////////////////////////////////////// +// GenericMemberIterator + +#ifndef RAPIDJSON_NOMEMBERITERATORCLASS + +//! (Constant) member iterator for a JSON object value +/*! + \tparam Const Is this a constant iterator? + \tparam Encoding Encoding of the value. (Even non-string values need to have the same encoding in a document) + \tparam Allocator Allocator type for allocating memory of object, array and string. + + This class implements a Random Access Iterator for GenericMember elements + of a GenericValue, see ISO/IEC 14882:2003(E) C++ standard, 24.1 [lib.iterator.requirements]. + + \note This iterator implementation is mainly intended to avoid implicit + conversions from iterator values to \c NULL, + e.g. from GenericValue::FindMember. + + \note Define \c RAPIDJSON_NOMEMBERITERATORCLASS to fall back to a + pointer-based implementation, if your platform doesn't provide + the C++ header. + + \see GenericMember, GenericValue::MemberIterator, GenericValue::ConstMemberIterator + */ +template +class GenericMemberIterator + : public std::iterator >::Type> { + + friend class GenericValue; + template friend class GenericMemberIterator; + + typedef GenericMember PlainType; + typedef typename internal::MaybeAddConst::Type ValueType; + typedef std::iterator BaseType; + +public: + //! Iterator type itself + typedef GenericMemberIterator Iterator; + //! Constant iterator type + typedef GenericMemberIterator ConstIterator; + //! Non-constant iterator type + typedef GenericMemberIterator NonConstIterator; + + //! Pointer to (const) GenericMember + typedef typename BaseType::pointer Pointer; + //! Reference to (const) GenericMember + typedef typename BaseType::reference Reference; + //! Signed integer type (e.g. \c ptrdiff_t) + typedef typename BaseType::difference_type DifferenceType; + + //! Default constructor (singular value) + /*! Creates an iterator pointing to no element. + \note All operations, except for comparisons, are undefined on such values. + */ + GenericMemberIterator() : ptr_() {} + + //! Iterator conversions to more const + /*! + \param it (Non-const) iterator to copy from + + Allows the creation of an iterator from another GenericMemberIterator + that is "less const". Especially, creating a non-constant iterator + from a constant iterator are disabled: + \li const -> non-const (not ok) + \li const -> const (ok) + \li non-const -> const (ok) + \li non-const -> non-const (ok) + + \note If the \c Const template parameter is already \c false, this + constructor effectively defines a regular copy-constructor. + Otherwise, the copy constructor is implicitly defined. + */ + GenericMemberIterator(const NonConstIterator & it) : ptr_(it.ptr_) {} + Iterator& operator=(const NonConstIterator & it) { ptr_ = it.ptr_; return *this; } + + //! @name stepping + //@{ + Iterator& operator++(){ ++ptr_; return *this; } + Iterator& operator--(){ --ptr_; return *this; } + Iterator operator++(int){ Iterator old(*this); ++ptr_; return old; } + Iterator operator--(int){ Iterator old(*this); --ptr_; return old; } + //@} + + //! @name increment/decrement + //@{ + Iterator operator+(DifferenceType n) const { return Iterator(ptr_+n); } + Iterator operator-(DifferenceType n) const { return Iterator(ptr_-n); } + + Iterator& operator+=(DifferenceType n) { ptr_+=n; return *this; } + Iterator& operator-=(DifferenceType n) { ptr_-=n; return *this; } + //@} + + //! @name relations + //@{ + bool operator==(ConstIterator that) const { return ptr_ == that.ptr_; } + bool operator!=(ConstIterator that) const { return ptr_ != that.ptr_; } + bool operator<=(ConstIterator that) const { return ptr_ <= that.ptr_; } + bool operator>=(ConstIterator that) const { return ptr_ >= that.ptr_; } + bool operator< (ConstIterator that) const { return ptr_ < that.ptr_; } + bool operator> (ConstIterator that) const { return ptr_ > that.ptr_; } + //@} + + //! @name dereference + //@{ + Reference operator*() const { return *ptr_; } + Pointer operator->() const { return ptr_; } + Reference operator[](DifferenceType n) const { return ptr_[n]; } + //@} + + //! Distance + DifferenceType operator-(ConstIterator that) const { return ptr_-that.ptr_; } + +private: + //! Internal constructor from plain pointer + explicit GenericMemberIterator(Pointer p) : ptr_(p) {} + + Pointer ptr_; //!< raw pointer +}; + +#else // RAPIDJSON_NOMEMBERITERATORCLASS + +// class-based member iterator implementation disabled, use plain pointers + +template +struct GenericMemberIterator; + +//! non-const GenericMemberIterator +template +struct GenericMemberIterator { + //! use plain pointer as iterator type + typedef GenericMember* Iterator; +}; +//! const GenericMemberIterator +template +struct GenericMemberIterator { + //! use plain const pointer as iterator type + typedef const GenericMember* Iterator; +}; + +#endif // RAPIDJSON_NOMEMBERITERATORCLASS + +/////////////////////////////////////////////////////////////////////////////// +// GenericStringRef + +//! Reference to a constant string (not taking a copy) +/*! + \tparam CharType character type of the string + + This helper class is used to automatically infer constant string + references for string literals, especially from \c const \b (!) + character arrays. + + The main use is for creating JSON string values without copying the + source string via an \ref Allocator. This requires that the referenced + string pointers have a sufficient lifetime, which exceeds the lifetime + of the associated GenericValue. + + \b Example + \code + Value v("foo"); // ok, no need to copy & calculate length + const char foo[] = "foo"; + v.SetString(foo); // ok + + const char* bar = foo; + // Value x(bar); // not ok, can't rely on bar's lifetime + Value x(StringRef(bar)); // lifetime explicitly guaranteed by user + Value y(StringRef(bar, 3)); // ok, explicitly pass length + \endcode + + \see StringRef, GenericValue::SetString +*/ +template +struct GenericStringRef { + typedef CharType Ch; //!< character type of the string + + //! Create string reference from \c const character array +#ifndef __clang__ // -Wdocumentation + /*! + This constructor implicitly creates a constant string reference from + a \c const character array. It has better performance than + \ref StringRef(const CharType*) by inferring the string \ref length + from the array length, and also supports strings containing null + characters. + + \tparam N length of the string, automatically inferred + + \param str Constant character array, lifetime assumed to be longer + than the use of the string in e.g. a GenericValue + + \post \ref s == str + + \note Constant complexity. + \note There is a hidden, private overload to disallow references to + non-const character arrays to be created via this constructor. + By this, e.g. function-scope arrays used to be filled via + \c snprintf are excluded from consideration. + In such cases, the referenced string should be \b copied to the + GenericValue instead. + */ +#endif + template + GenericStringRef(const CharType (&str)[N]) RAPIDJSON_NOEXCEPT + : s(str), length(N-1) {} + + //! Explicitly create string reference from \c const character pointer +#ifndef __clang__ // -Wdocumentation + /*! + This constructor can be used to \b explicitly create a reference to + a constant string pointer. + + \see StringRef(const CharType*) + + \param str Constant character pointer, lifetime assumed to be longer + than the use of the string in e.g. a GenericValue + + \post \ref s == str + + \note There is a hidden, private overload to disallow references to + non-const character arrays to be created via this constructor. + By this, e.g. function-scope arrays used to be filled via + \c snprintf are excluded from consideration. + In such cases, the referenced string should be \b copied to the + GenericValue instead. + */ +#endif + explicit GenericStringRef(const CharType* str) + : s(str), length(internal::StrLen(str)){ RAPIDJSON_ASSERT(s != 0); } + + //! Create constant string reference from pointer and length +#ifndef __clang__ // -Wdocumentation + /*! \param str constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue + \param len length of the string, excluding the trailing NULL terminator + + \post \ref s == str && \ref length == len + \note Constant complexity. + */ +#endif + GenericStringRef(const CharType* str, SizeType len) + : s(str), length(len) { RAPIDJSON_ASSERT(s != 0); } + + GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {} + + GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; } + + //! implicit conversion to plain CharType pointer + operator const Ch *() const { return s; } + + const Ch* const s; //!< plain CharType pointer + const SizeType length; //!< length of the string (excluding the trailing NULL terminator) + +private: + //! Disallow construction from non-const array + template + GenericStringRef(CharType (&str)[N]) /* = delete */; +}; + +//! Mark a character pointer as constant string +/*! Mark a plain character pointer as a "string literal". This function + can be used to avoid copying a character string to be referenced as a + value in a JSON GenericValue object, if the string's lifetime is known + to be valid long enough. + \tparam CharType Character type of the string + \param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue + \return GenericStringRef string reference object + \relatesalso GenericStringRef + + \see GenericValue::GenericValue(StringRefType), GenericValue::operator=(StringRefType), GenericValue::SetString(StringRefType), GenericValue::PushBack(StringRefType, Allocator&), GenericValue::AddMember +*/ +template +inline GenericStringRef StringRef(const CharType* str) { + return GenericStringRef(str, internal::StrLen(str)); +} + +//! Mark a character pointer as constant string +/*! Mark a plain character pointer as a "string literal". This function + can be used to avoid copying a character string to be referenced as a + value in a JSON GenericValue object, if the string's lifetime is known + to be valid long enough. + + This version has better performance with supplied length, and also + supports string containing null characters. + + \tparam CharType character type of the string + \param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue + \param length The length of source string. + \return GenericStringRef string reference object + \relatesalso GenericStringRef +*/ +template +inline GenericStringRef StringRef(const CharType* str, size_t length) { + return GenericStringRef(str, SizeType(length)); +} + +#if RAPIDJSON_HAS_STDSTRING +//! Mark a string object as constant string +/*! Mark a string object (e.g. \c std::string) as a "string literal". + This function can be used to avoid copying a string to be referenced as a + value in a JSON GenericValue object, if the string's lifetime is known + to be valid long enough. + + \tparam CharType character type of the string + \param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue + \return GenericStringRef string reference object + \relatesalso GenericStringRef + \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING. +*/ +template +inline GenericStringRef StringRef(const std::basic_string& str) { + return GenericStringRef(str.data(), SizeType(str.size())); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +// GenericValue type traits +namespace internal { + +template +struct IsGenericValueImpl : FalseType {}; + +// select candidates according to nested encoding and allocator types +template struct IsGenericValueImpl::Type, typename Void::Type> + : IsBaseOf, T>::Type {}; + +// helper to match arbitrary GenericValue instantiations, including derived classes +template struct IsGenericValue : IsGenericValueImpl::Type {}; + +} // namespace internal + +/////////////////////////////////////////////////////////////////////////////// +// TypeHelper + +namespace internal { + +template +struct TypeHelper {}; + +template +struct TypeHelper { + static bool Is(const ValueType& v) { return v.IsBool(); } + static bool Get(const ValueType& v) { return v.GetBool(); } + static ValueType& Set(ValueType& v, bool data) { return v.SetBool(data); } + static ValueType& Set(ValueType& v, bool data, typename ValueType::AllocatorType&) { return v.SetBool(data); } +}; + +template +struct TypeHelper { + static bool Is(const ValueType& v) { return v.IsInt(); } + static int Get(const ValueType& v) { return v.GetInt(); } + static ValueType& Set(ValueType& v, int data) { return v.SetInt(data); } + static ValueType& Set(ValueType& v, int data, typename ValueType::AllocatorType&) { return v.SetInt(data); } +}; + +template +struct TypeHelper { + static bool Is(const ValueType& v) { return v.IsUint(); } + static unsigned Get(const ValueType& v) { return v.GetUint(); } + static ValueType& Set(ValueType& v, unsigned data) { return v.SetUint(data); } + static ValueType& Set(ValueType& v, unsigned data, typename ValueType::AllocatorType&) { return v.SetUint(data); } +}; + +template +struct TypeHelper { + static bool Is(const ValueType& v) { return v.IsInt64(); } + static int64_t Get(const ValueType& v) { return v.GetInt64(); } + static ValueType& Set(ValueType& v, int64_t data) { return v.SetInt64(data); } + static ValueType& Set(ValueType& v, int64_t data, typename ValueType::AllocatorType&) { return v.SetInt64(data); } +}; + +template +struct TypeHelper { + static bool Is(const ValueType& v) { return v.IsUint64(); } + static uint64_t Get(const ValueType& v) { return v.GetUint64(); } + static ValueType& Set(ValueType& v, uint64_t data) { return v.SetUint64(data); } + static ValueType& Set(ValueType& v, uint64_t data, typename ValueType::AllocatorType&) { return v.SetUint64(data); } +}; + +template +struct TypeHelper { + static bool Is(const ValueType& v) { return v.IsDouble(); } + static double Get(const ValueType& v) { return v.GetDouble(); } + static ValueType& Set(ValueType& v, double data) { return v.SetDouble(data); } + static ValueType& Set(ValueType& v, double data, typename ValueType::AllocatorType&) { return v.SetDouble(data); } +}; + +template +struct TypeHelper { + static bool Is(const ValueType& v) { return v.IsFloat(); } + static float Get(const ValueType& v) { return v.GetFloat(); } + static ValueType& Set(ValueType& v, float data) { return v.SetFloat(data); } + static ValueType& Set(ValueType& v, float data, typename ValueType::AllocatorType&) { return v.SetFloat(data); } +}; + +template +struct TypeHelper { + typedef const typename ValueType::Ch* StringType; + static bool Is(const ValueType& v) { return v.IsString(); } + static StringType Get(const ValueType& v) { return v.GetString(); } + static ValueType& Set(ValueType& v, const StringType data) { return v.SetString(typename ValueType::StringRefType(data)); } + static ValueType& Set(ValueType& v, const StringType data, typename ValueType::AllocatorType& a) { return v.SetString(data, a); } +}; + +#if RAPIDJSON_HAS_STDSTRING +template +struct TypeHelper > { + typedef std::basic_string StringType; + static bool Is(const ValueType& v) { return v.IsString(); } + static StringType Get(const ValueType& v) { return StringType(v.GetString(), v.GetStringLength()); } + static ValueType& Set(ValueType& v, const StringType& data, typename ValueType::AllocatorType& a) { return v.SetString(data, a); } +}; +#endif + +template +struct TypeHelper { + typedef typename ValueType::Array ArrayType; + static bool Is(const ValueType& v) { return v.IsArray(); } + static ArrayType Get(ValueType& v) { return v.GetArray(); } + static ValueType& Set(ValueType& v, ArrayType data) { return v = data; } + static ValueType& Set(ValueType& v, ArrayType data, typename ValueType::AllocatorType&) { return v = data; } +}; + +template +struct TypeHelper { + typedef typename ValueType::ConstArray ArrayType; + static bool Is(const ValueType& v) { return v.IsArray(); } + static ArrayType Get(const ValueType& v) { return v.GetArray(); } +}; + +template +struct TypeHelper { + typedef typename ValueType::Object ObjectType; + static bool Is(const ValueType& v) { return v.IsObject(); } + static ObjectType Get(ValueType& v) { return v.GetObject(); } + static ValueType& Set(ValueType& v, ObjectType data) { return v = data; } + static ValueType& Set(ValueType& v, ObjectType data, typename ValueType::AllocatorType&) { v = data; } +}; + +template +struct TypeHelper { + typedef typename ValueType::ConstObject ObjectType; + static bool Is(const ValueType& v) { return v.IsObject(); } + static ObjectType Get(const ValueType& v) { return v.GetObject(); } +}; + +} // namespace internal + +// Forward declarations +template class GenericArray; +template class GenericObject; + +/////////////////////////////////////////////////////////////////////////////// +// GenericValue + +//! Represents a JSON value. Use Value for UTF8 encoding and default allocator. +/*! + A JSON value can be one of 7 types. This class is a variant type supporting + these types. + + Use the Value if UTF8 and default allocator + + \tparam Encoding Encoding of the value. (Even non-string values need to have the same encoding in a document) + \tparam Allocator Allocator type for allocating memory of object, array and string. +*/ +template > +class GenericValue { +public: + //! Name-value pair in an object. + typedef GenericMember Member; + typedef Encoding EncodingType; //!< Encoding type from template parameter. + typedef Allocator AllocatorType; //!< Allocator type from template parameter. + typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding. + typedef GenericStringRef StringRefType; //!< Reference to a constant string + typedef typename GenericMemberIterator::Iterator MemberIterator; //!< Member iterator for iterating in object. + typedef typename GenericMemberIterator::Iterator ConstMemberIterator; //!< Constant member iterator for iterating in object. + typedef GenericValue* ValueIterator; //!< Value iterator for iterating in array. + typedef const GenericValue* ConstValueIterator; //!< Constant value iterator for iterating in array. + typedef GenericValue ValueType; //!< Value type of itself. + typedef GenericArray Array; + typedef GenericArray ConstArray; + typedef GenericObject Object; + typedef GenericObject ConstObject; + + //!@name Constructors and destructor. + //@{ + + //! Default constructor creates a null value. + GenericValue() RAPIDJSON_NOEXCEPT : data_() { data_.f.flags = kNullFlag; } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + //! Move constructor in C++11 + GenericValue(GenericValue&& rhs) RAPIDJSON_NOEXCEPT : data_(rhs.data_) { + rhs.data_.f.flags = kNullFlag; // give up contents + } +#endif + +private: + //! Copy constructor is not permitted. + GenericValue(const GenericValue& rhs); + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + //! Moving from a GenericDocument is not permitted. + template + GenericValue(GenericDocument&& rhs); + + //! Move assignment from a GenericDocument is not permitted. + template + GenericValue& operator=(GenericDocument&& rhs); +#endif + +public: + + //! Constructor with JSON value type. + /*! This creates a Value of specified type with default content. + \param type Type of the value. + \note Default content for number is zero. + */ + explicit GenericValue(Type type) RAPIDJSON_NOEXCEPT : data_() { + static const uint16_t defaultFlags[7] = { + kNullFlag, kFalseFlag, kTrueFlag, kObjectFlag, kArrayFlag, kShortStringFlag, + kNumberAnyFlag + }; + RAPIDJSON_ASSERT(type <= kNumberType); + data_.f.flags = defaultFlags[type]; + + // Use ShortString to store empty string. + if (type == kStringType) + data_.ss.SetLength(0); + } + + //! Explicit copy constructor (with allocator) + /*! Creates a copy of a Value by using the given Allocator + \tparam SourceAllocator allocator of \c rhs + \param rhs Value to copy from (read-only) + \param allocator Allocator for allocating copied elements and buffers. Commonly use GenericDocument::GetAllocator(). + \see CopyFrom() + */ + template< typename SourceAllocator > + GenericValue(const GenericValue& rhs, Allocator & allocator); + + //! Constructor for boolean value. + /*! \param b Boolean value + \note This constructor is limited to \em real boolean values and rejects + implicitly converted types like arbitrary pointers. Use an explicit cast + to \c bool, if you want to construct a boolean JSON value in such cases. + */ +#ifndef RAPIDJSON_DOXYGEN_RUNNING // hide SFINAE from Doxygen + template + explicit GenericValue(T b, RAPIDJSON_ENABLEIF((internal::IsSame))) RAPIDJSON_NOEXCEPT // See #472 +#else + explicit GenericValue(bool b) RAPIDJSON_NOEXCEPT +#endif + : data_() { + // safe-guard against failing SFINAE + RAPIDJSON_STATIC_ASSERT((internal::IsSame::Value)); + data_.f.flags = b ? kTrueFlag : kFalseFlag; + } + + //! Constructor for int value. + explicit GenericValue(int i) RAPIDJSON_NOEXCEPT : data_() { + data_.n.i64 = i; + data_.f.flags = (i >= 0) ? (kNumberIntFlag | kUintFlag | kUint64Flag) : kNumberIntFlag; + } + + //! Constructor for unsigned value. + explicit GenericValue(unsigned u) RAPIDJSON_NOEXCEPT : data_() { + data_.n.u64 = u; + data_.f.flags = (u & 0x80000000) ? kNumberUintFlag : (kNumberUintFlag | kIntFlag | kInt64Flag); + } + + //! Constructor for int64_t value. + explicit GenericValue(int64_t i64) RAPIDJSON_NOEXCEPT : data_() { + data_.n.i64 = i64; + data_.f.flags = kNumberInt64Flag; + if (i64 >= 0) { + data_.f.flags |= kNumberUint64Flag; + if (!(static_cast(i64) & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x00000000))) + data_.f.flags |= kUintFlag; + if (!(static_cast(i64) & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000))) + data_.f.flags |= kIntFlag; + } + else if (i64 >= static_cast(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000))) + data_.f.flags |= kIntFlag; + } + + //! Constructor for uint64_t value. + explicit GenericValue(uint64_t u64) RAPIDJSON_NOEXCEPT : data_() { + data_.n.u64 = u64; + data_.f.flags = kNumberUint64Flag; + if (!(u64 & RAPIDJSON_UINT64_C2(0x80000000, 0x00000000))) + data_.f.flags |= kInt64Flag; + if (!(u64 & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x00000000))) + data_.f.flags |= kUintFlag; + if (!(u64 & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000))) + data_.f.flags |= kIntFlag; + } + + //! Constructor for double value. + explicit GenericValue(double d) RAPIDJSON_NOEXCEPT : data_() { data_.n.d = d; data_.f.flags = kNumberDoubleFlag; } + + //! Constructor for constant string (i.e. do not make a copy of string) + GenericValue(const Ch* s, SizeType length) RAPIDJSON_NOEXCEPT : data_() { SetStringRaw(StringRef(s, length)); } + + //! Constructor for constant string (i.e. do not make a copy of string) + explicit GenericValue(StringRefType s) RAPIDJSON_NOEXCEPT : data_() { SetStringRaw(s); } + + //! Constructor for copy-string (i.e. do make a copy of string) + GenericValue(const Ch* s, SizeType length, Allocator& allocator) : data_() { SetStringRaw(StringRef(s, length), allocator); } + + //! Constructor for copy-string (i.e. do make a copy of string) + GenericValue(const Ch*s, Allocator& allocator) : data_() { SetStringRaw(StringRef(s), allocator); } + +#if RAPIDJSON_HAS_STDSTRING + //! Constructor for copy-string from a string object (i.e. do make a copy of string) + /*! \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING. + */ + GenericValue(const std::basic_string& s, Allocator& allocator) : data_() { SetStringRaw(StringRef(s), allocator); } +#endif + + //! Constructor for Array. + /*! + \param a An array obtained by \c GetArray(). + \note \c Array is always pass-by-value. + \note the source array is moved into this value and the sourec array becomes empty. + */ + GenericValue(Array a) RAPIDJSON_NOEXCEPT : data_(a.value_.data_) { + a.value_.data_ = Data(); + a.value_.data_.f.flags = kArrayFlag; + } + + //! Constructor for Object. + /*! + \param o An object obtained by \c GetObject(). + \note \c Object is always pass-by-value. + \note the source object is moved into this value and the sourec object becomes empty. + */ + GenericValue(Object o) RAPIDJSON_NOEXCEPT : data_(o.value_.data_) { + o.value_.data_ = Data(); + o.value_.data_.f.flags = kObjectFlag; + } + + //! Destructor. + /*! Need to destruct elements of array, members of object, or copy-string. + */ + ~GenericValue() { + if (Allocator::kNeedFree) { // Shortcut by Allocator's trait + switch(data_.f.flags) { + case kArrayFlag: + { + GenericValue* e = GetElementsPointer(); + for (GenericValue* v = e; v != e + data_.a.size; ++v) + v->~GenericValue(); + Allocator::Free(e); + } + break; + + case kObjectFlag: + for (MemberIterator m = MemberBegin(); m != MemberEnd(); ++m) + m->~Member(); + Allocator::Free(GetMembersPointer()); + break; + + case kCopyStringFlag: + Allocator::Free(const_cast(GetStringPointer())); + break; + + default: + break; // Do nothing for other types. + } + } + } + + //@} + + //!@name Assignment operators + //@{ + + //! Assignment with move semantics. + /*! \param rhs Source of the assignment. It will become a null value after assignment. + */ + GenericValue& operator=(GenericValue& rhs) RAPIDJSON_NOEXCEPT { + RAPIDJSON_ASSERT(this != &rhs); + this->~GenericValue(); + RawAssign(rhs); + return *this; + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + //! Move assignment in C++11 + GenericValue& operator=(GenericValue&& rhs) RAPIDJSON_NOEXCEPT { + return *this = rhs.Move(); + } +#endif + + //! Assignment of constant string reference (no copy) + /*! \param str Constant string reference to be assigned + \note This overload is needed to avoid clashes with the generic primitive type assignment overload below. + \see GenericStringRef, operator=(T) + */ + GenericValue& operator=(StringRefType str) RAPIDJSON_NOEXCEPT { + GenericValue s(str); + return *this = s; + } + + //! Assignment with primitive types. + /*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t + \param value The value to be assigned. + + \note The source type \c T explicitly disallows all pointer types, + especially (\c const) \ref Ch*. This helps avoiding implicitly + referencing character strings with insufficient lifetime, use + \ref SetString(const Ch*, Allocator&) (for copying) or + \ref StringRef() (to explicitly mark the pointer as constant) instead. + All other pointer types would implicitly convert to \c bool, + use \ref SetBool() instead. + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::IsPointer), (GenericValue&)) + operator=(T value) { + GenericValue v(value); + return *this = v; + } + + //! Deep-copy assignment from Value + /*! Assigns a \b copy of the Value to the current Value object + \tparam SourceAllocator Allocator type of \c rhs + \param rhs Value to copy from (read-only) + \param allocator Allocator to use for copying + */ + template + GenericValue& CopyFrom(const GenericValue& rhs, Allocator& allocator) { + RAPIDJSON_ASSERT(static_cast(this) != static_cast(&rhs)); + this->~GenericValue(); + new (this) GenericValue(rhs, allocator); + return *this; + } + + //! Exchange the contents of this value with those of other. + /*! + \param other Another value. + \note Constant complexity. + */ + GenericValue& Swap(GenericValue& other) RAPIDJSON_NOEXCEPT { + GenericValue temp; + temp.RawAssign(*this); + RawAssign(other); + other.RawAssign(temp); + return *this; + } + + //! free-standing swap function helper + /*! + Helper function to enable support for common swap implementation pattern based on \c std::swap: + \code + void swap(MyClass& a, MyClass& b) { + using std::swap; + swap(a.value, b.value); + // ... + } + \endcode + \see Swap() + */ + friend inline void swap(GenericValue& a, GenericValue& b) RAPIDJSON_NOEXCEPT { a.Swap(b); } + + //! Prepare Value for move semantics + /*! \return *this */ + GenericValue& Move() RAPIDJSON_NOEXCEPT { return *this; } + //@} + + //!@name Equal-to and not-equal-to operators + //@{ + //! Equal-to operator + /*! + \note If an object contains duplicated named member, comparing equality with any object is always \c false. + \note Linear time complexity (number of all values in the subtree and total lengths of all strings). + */ + template + bool operator==(const GenericValue& rhs) const { + typedef GenericValue RhsType; + if (GetType() != rhs.GetType()) + return false; + + switch (GetType()) { + case kObjectType: // Warning: O(n^2) inner-loop + if (data_.o.size != rhs.data_.o.size) + return false; + for (ConstMemberIterator lhsMemberItr = MemberBegin(); lhsMemberItr != MemberEnd(); ++lhsMemberItr) { + typename RhsType::ConstMemberIterator rhsMemberItr = rhs.FindMember(lhsMemberItr->name); + if (rhsMemberItr == rhs.MemberEnd() || lhsMemberItr->value != rhsMemberItr->value) + return false; + } + return true; + + case kArrayType: + if (data_.a.size != rhs.data_.a.size) + return false; + for (SizeType i = 0; i < data_.a.size; i++) + if ((*this)[i] != rhs[i]) + return false; + return true; + + case kStringType: + return StringEqual(rhs); + + case kNumberType: + if (IsDouble() || rhs.IsDouble()) { + double a = GetDouble(); // May convert from integer to double. + double b = rhs.GetDouble(); // Ditto + return a >= b && a <= b; // Prevent -Wfloat-equal + } + else + return data_.n.u64 == rhs.data_.n.u64; + + default: + return true; + } + } + + //! Equal-to operator with const C-string pointer + bool operator==(const Ch* rhs) const { return *this == GenericValue(StringRef(rhs)); } + +#if RAPIDJSON_HAS_STDSTRING + //! Equal-to operator with string object + /*! \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING. + */ + bool operator==(const std::basic_string& rhs) const { return *this == GenericValue(StringRef(rhs)); } +#endif + + //! Equal-to operator with primitive types + /*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t, \c double, \c true, \c false + */ + template RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr,internal::IsGenericValue >), (bool)) operator==(const T& rhs) const { return *this == GenericValue(rhs); } + + //! Not-equal-to operator + /*! \return !(*this == rhs) + */ + template + bool operator!=(const GenericValue& rhs) const { return !(*this == rhs); } + + //! Not-equal-to operator with const C-string pointer + bool operator!=(const Ch* rhs) const { return !(*this == rhs); } + + //! Not-equal-to operator with arbitrary types + /*! \return !(*this == rhs) + */ + template RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue), (bool)) operator!=(const T& rhs) const { return !(*this == rhs); } + + //! Equal-to operator with arbitrary types (symmetric version) + /*! \return (rhs == lhs) + */ + template friend RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue), (bool)) operator==(const T& lhs, const GenericValue& rhs) { return rhs == lhs; } + + //! Not-Equal-to operator with arbitrary types (symmetric version) + /*! \return !(rhs == lhs) + */ + template friend RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue), (bool)) operator!=(const T& lhs, const GenericValue& rhs) { return !(rhs == lhs); } + //@} + + //!@name Type + //@{ + + Type GetType() const { return static_cast(data_.f.flags & kTypeMask); } + bool IsNull() const { return data_.f.flags == kNullFlag; } + bool IsFalse() const { return data_.f.flags == kFalseFlag; } + bool IsTrue() const { return data_.f.flags == kTrueFlag; } + bool IsBool() const { return (data_.f.flags & kBoolFlag) != 0; } + bool IsObject() const { return data_.f.flags == kObjectFlag; } + bool IsArray() const { return data_.f.flags == kArrayFlag; } + bool IsNumber() const { return (data_.f.flags & kNumberFlag) != 0; } + bool IsInt() const { return (data_.f.flags & kIntFlag) != 0; } + bool IsUint() const { return (data_.f.flags & kUintFlag) != 0; } + bool IsInt64() const { return (data_.f.flags & kInt64Flag) != 0; } + bool IsUint64() const { return (data_.f.flags & kUint64Flag) != 0; } + bool IsDouble() const { return (data_.f.flags & kDoubleFlag) != 0; } + bool IsString() const { return (data_.f.flags & kStringFlag) != 0; } + + // Checks whether a number can be losslessly converted to a double. + bool IsLosslessDouble() const { + if (!IsNumber()) return false; + if (IsUint64()) { + uint64_t u = GetUint64(); + volatile double d = static_cast(u); + return (d >= 0.0) + && (d < static_cast(std::numeric_limits::max())) + && (u == static_cast(d)); + } + if (IsInt64()) { + int64_t i = GetInt64(); + volatile double d = static_cast(i); + return (d >= static_cast(std::numeric_limits::min())) + && (d < static_cast(std::numeric_limits::max())) + && (i == static_cast(d)); + } + return true; // double, int, uint are always lossless + } + + // Checks whether a number is a float (possible lossy). + bool IsFloat() const { + if ((data_.f.flags & kDoubleFlag) == 0) + return false; + double d = GetDouble(); + return d >= -3.4028234e38 && d <= 3.4028234e38; + } + // Checks whether a number can be losslessly converted to a float. + bool IsLosslessFloat() const { + if (!IsNumber()) return false; + double a = GetDouble(); + if (a < static_cast(-std::numeric_limits::max()) + || a > static_cast(std::numeric_limits::max())) + return false; + double b = static_cast(static_cast(a)); + return a >= b && a <= b; // Prevent -Wfloat-equal + } + + //@} + + //!@name Null + //@{ + + GenericValue& SetNull() { this->~GenericValue(); new (this) GenericValue(); return *this; } + + //@} + + //!@name Bool + //@{ + + bool GetBool() const { RAPIDJSON_ASSERT(IsBool()); return data_.f.flags == kTrueFlag; } + //!< Set boolean value + /*! \post IsBool() == true */ + GenericValue& SetBool(bool b) { this->~GenericValue(); new (this) GenericValue(b); return *this; } + + //@} + + //!@name Object + //@{ + + //! Set this value as an empty object. + /*! \post IsObject() == true */ + GenericValue& SetObject() { this->~GenericValue(); new (this) GenericValue(kObjectType); return *this; } + + //! Get the number of members in the object. + SizeType MemberCount() const { RAPIDJSON_ASSERT(IsObject()); return data_.o.size; } + + //! Check whether the object is empty. + bool ObjectEmpty() const { RAPIDJSON_ASSERT(IsObject()); return data_.o.size == 0; } + + //! Get a value from an object associated with the name. + /*! \pre IsObject() == true + \tparam T Either \c Ch or \c const \c Ch (template used for disambiguation with \ref operator[](SizeType)) + \note In version 0.1x, if the member is not found, this function returns a null value. This makes issue 7. + Since 0.2, if the name is not correct, it will assert. + If user is unsure whether a member exists, user should use HasMember() first. + A better approach is to use FindMember(). + \note Linear time complexity. + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::NotExpr::Type, Ch> >),(GenericValue&)) operator[](T* name) { + GenericValue n(StringRef(name)); + return (*this)[n]; + } + template + RAPIDJSON_DISABLEIF_RETURN((internal::NotExpr::Type, Ch> >),(const GenericValue&)) operator[](T* name) const { return const_cast(*this)[name]; } + + //! Get a value from an object associated with the name. + /*! \pre IsObject() == true + \tparam SourceAllocator Allocator of the \c name value + + \note Compared to \ref operator[](T*), this version is faster because it does not need a StrLen(). + And it can also handle strings with embedded null characters. + + \note Linear time complexity. + */ + template + GenericValue& operator[](const GenericValue& name) { + MemberIterator member = FindMember(name); + if (member != MemberEnd()) + return member->value; + else { + RAPIDJSON_ASSERT(false); // see above note + + // This will generate -Wexit-time-destructors in clang + // static GenericValue NullValue; + // return NullValue; + + // Use static buffer and placement-new to prevent destruction + static char buffer[sizeof(GenericValue)]; + return *new (buffer) GenericValue(); + } + } + template + const GenericValue& operator[](const GenericValue& name) const { return const_cast(*this)[name]; } + +#if RAPIDJSON_HAS_STDSTRING + //! Get a value from an object associated with name (string object). + GenericValue& operator[](const std::basic_string& name) { return (*this)[GenericValue(StringRef(name))]; } + const GenericValue& operator[](const std::basic_string& name) const { return (*this)[GenericValue(StringRef(name))]; } +#endif + + //! Const member iterator + /*! \pre IsObject() == true */ + ConstMemberIterator MemberBegin() const { RAPIDJSON_ASSERT(IsObject()); return ConstMemberIterator(GetMembersPointer()); } + //! Const \em past-the-end member iterator + /*! \pre IsObject() == true */ + ConstMemberIterator MemberEnd() const { RAPIDJSON_ASSERT(IsObject()); return ConstMemberIterator(GetMembersPointer() + data_.o.size); } + //! Member iterator + /*! \pre IsObject() == true */ + MemberIterator MemberBegin() { RAPIDJSON_ASSERT(IsObject()); return MemberIterator(GetMembersPointer()); } + //! \em Past-the-end member iterator + /*! \pre IsObject() == true */ + MemberIterator MemberEnd() { RAPIDJSON_ASSERT(IsObject()); return MemberIterator(GetMembersPointer() + data_.o.size); } + + //! Check whether a member exists in the object. + /*! + \param name Member name to be searched. + \pre IsObject() == true + \return Whether a member with that name exists. + \note It is better to use FindMember() directly if you need the obtain the value as well. + \note Linear time complexity. + */ + bool HasMember(const Ch* name) const { return FindMember(name) != MemberEnd(); } + +#if RAPIDJSON_HAS_STDSTRING + //! Check whether a member exists in the object with string object. + /*! + \param name Member name to be searched. + \pre IsObject() == true + \return Whether a member with that name exists. + \note It is better to use FindMember() directly if you need the obtain the value as well. + \note Linear time complexity. + */ + bool HasMember(const std::basic_string& name) const { return FindMember(name) != MemberEnd(); } +#endif + + //! Check whether a member exists in the object with GenericValue name. + /*! + This version is faster because it does not need a StrLen(). It can also handle string with null character. + \param name Member name to be searched. + \pre IsObject() == true + \return Whether a member with that name exists. + \note It is better to use FindMember() directly if you need the obtain the value as well. + \note Linear time complexity. + */ + template + bool HasMember(const GenericValue& name) const { return FindMember(name) != MemberEnd(); } + + //! Find member by name. + /*! + \param name Member name to be searched. + \pre IsObject() == true + \return Iterator to member, if it exists. + Otherwise returns \ref MemberEnd(). + + \note Earlier versions of Rapidjson returned a \c NULL pointer, in case + the requested member doesn't exist. For consistency with e.g. + \c std::map, this has been changed to MemberEnd() now. + \note Linear time complexity. + */ + MemberIterator FindMember(const Ch* name) { + GenericValue n(StringRef(name)); + return FindMember(n); + } + + ConstMemberIterator FindMember(const Ch* name) const { return const_cast(*this).FindMember(name); } + + //! Find member by name. + /*! + This version is faster because it does not need a StrLen(). It can also handle string with null character. + \param name Member name to be searched. + \pre IsObject() == true + \return Iterator to member, if it exists. + Otherwise returns \ref MemberEnd(). + + \note Earlier versions of Rapidjson returned a \c NULL pointer, in case + the requested member doesn't exist. For consistency with e.g. + \c std::map, this has been changed to MemberEnd() now. + \note Linear time complexity. + */ + template + MemberIterator FindMember(const GenericValue& name) { + RAPIDJSON_ASSERT(IsObject()); + RAPIDJSON_ASSERT(name.IsString()); + MemberIterator member = MemberBegin(); + for ( ; member != MemberEnd(); ++member) + if (name.StringEqual(member->name)) + break; + return member; + } + template ConstMemberIterator FindMember(const GenericValue& name) const { return const_cast(*this).FindMember(name); } + +#if RAPIDJSON_HAS_STDSTRING + //! Find member by string object name. + /*! + \param name Member name to be searched. + \pre IsObject() == true + \return Iterator to member, if it exists. + Otherwise returns \ref MemberEnd(). + */ + MemberIterator FindMember(const std::basic_string& name) { return FindMember(GenericValue(StringRef(name))); } + ConstMemberIterator FindMember(const std::basic_string& name) const { return FindMember(GenericValue(StringRef(name))); } +#endif + + //! Add a member (name-value pair) to the object. + /*! \param name A string value as name of member. + \param value Value of any type. + \param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \note The ownership of \c name and \c value will be transferred to this object on success. + \pre IsObject() && name.IsString() + \post name.IsNull() && value.IsNull() + \note Amortized Constant time complexity. + */ + GenericValue& AddMember(GenericValue& name, GenericValue& value, Allocator& allocator) { + RAPIDJSON_ASSERT(IsObject()); + RAPIDJSON_ASSERT(name.IsString()); + + ObjectData& o = data_.o; + if (o.size >= o.capacity) { + if (o.capacity == 0) { + o.capacity = kDefaultObjectCapacity; + SetMembersPointer(reinterpret_cast(allocator.Malloc(o.capacity * sizeof(Member)))); + } + else { + SizeType oldCapacity = o.capacity; + o.capacity += (oldCapacity + 1) / 2; // grow by factor 1.5 + SetMembersPointer(reinterpret_cast(allocator.Realloc(GetMembersPointer(), oldCapacity * sizeof(Member), o.capacity * sizeof(Member)))); + } + } + Member* members = GetMembersPointer(); + members[o.size].name.RawAssign(name); + members[o.size].value.RawAssign(value); + o.size++; + return *this; + } + + //! Add a constant string value as member (name-value pair) to the object. + /*! \param name A string value as name of member. + \param value constant string reference as value of member. + \param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \pre IsObject() + \note This overload is needed to avoid clashes with the generic primitive type AddMember(GenericValue&,T,Allocator&) overload below. + \note Amortized Constant time complexity. + */ + GenericValue& AddMember(GenericValue& name, StringRefType value, Allocator& allocator) { + GenericValue v(value); + return AddMember(name, v, allocator); + } + +#if RAPIDJSON_HAS_STDSTRING + //! Add a string object as member (name-value pair) to the object. + /*! \param name A string value as name of member. + \param value constant string reference as value of member. + \param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \pre IsObject() + \note This overload is needed to avoid clashes with the generic primitive type AddMember(GenericValue&,T,Allocator&) overload below. + \note Amortized Constant time complexity. + */ + GenericValue& AddMember(GenericValue& name, std::basic_string& value, Allocator& allocator) { + GenericValue v(value, allocator); + return AddMember(name, v, allocator); + } +#endif + + //! Add any primitive value as member (name-value pair) to the object. + /*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t + \param name A string value as name of member. + \param value Value of primitive type \c T as value of member + \param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \pre IsObject() + + \note The source type \c T explicitly disallows all pointer types, + especially (\c const) \ref Ch*. This helps avoiding implicitly + referencing character strings with insufficient lifetime, use + \ref AddMember(StringRefType, GenericValue&, Allocator&) or \ref + AddMember(StringRefType, StringRefType, Allocator&). + All other pointer types would implicitly convert to \c bool, + use an explicit cast instead, if needed. + \note Amortized Constant time complexity. + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (GenericValue&)) + AddMember(GenericValue& name, T value, Allocator& allocator) { + GenericValue v(value); + return AddMember(name, v, allocator); + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + GenericValue& AddMember(GenericValue&& name, GenericValue&& value, Allocator& allocator) { + return AddMember(name, value, allocator); + } + GenericValue& AddMember(GenericValue&& name, GenericValue& value, Allocator& allocator) { + return AddMember(name, value, allocator); + } + GenericValue& AddMember(GenericValue& name, GenericValue&& value, Allocator& allocator) { + return AddMember(name, value, allocator); + } + GenericValue& AddMember(StringRefType name, GenericValue&& value, Allocator& allocator) { + GenericValue n(name); + return AddMember(n, value, allocator); + } +#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS + + + //! Add a member (name-value pair) to the object. + /*! \param name A constant string reference as name of member. + \param value Value of any type. + \param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \note The ownership of \c value will be transferred to this object on success. + \pre IsObject() + \post value.IsNull() + \note Amortized Constant time complexity. + */ + GenericValue& AddMember(StringRefType name, GenericValue& value, Allocator& allocator) { + GenericValue n(name); + return AddMember(n, value, allocator); + } + + //! Add a constant string value as member (name-value pair) to the object. + /*! \param name A constant string reference as name of member. + \param value constant string reference as value of member. + \param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \pre IsObject() + \note This overload is needed to avoid clashes with the generic primitive type AddMember(StringRefType,T,Allocator&) overload below. + \note Amortized Constant time complexity. + */ + GenericValue& AddMember(StringRefType name, StringRefType value, Allocator& allocator) { + GenericValue v(value); + return AddMember(name, v, allocator); + } + + //! Add any primitive value as member (name-value pair) to the object. + /*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t + \param name A constant string reference as name of member. + \param value Value of primitive type \c T as value of member + \param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \pre IsObject() + + \note The source type \c T explicitly disallows all pointer types, + especially (\c const) \ref Ch*. This helps avoiding implicitly + referencing character strings with insufficient lifetime, use + \ref AddMember(StringRefType, GenericValue&, Allocator&) or \ref + AddMember(StringRefType, StringRefType, Allocator&). + All other pointer types would implicitly convert to \c bool, + use an explicit cast instead, if needed. + \note Amortized Constant time complexity. + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (GenericValue&)) + AddMember(StringRefType name, T value, Allocator& allocator) { + GenericValue n(name); + return AddMember(n, value, allocator); + } + + //! Remove all members in the object. + /*! This function do not deallocate memory in the object, i.e. the capacity is unchanged. + \note Linear time complexity. + */ + void RemoveAllMembers() { + RAPIDJSON_ASSERT(IsObject()); + for (MemberIterator m = MemberBegin(); m != MemberEnd(); ++m) + m->~Member(); + data_.o.size = 0; + } + + //! Remove a member in object by its name. + /*! \param name Name of member to be removed. + \return Whether the member existed. + \note This function may reorder the object members. Use \ref + EraseMember(ConstMemberIterator) if you need to preserve the + relative order of the remaining members. + \note Linear time complexity. + */ + bool RemoveMember(const Ch* name) { + GenericValue n(StringRef(name)); + return RemoveMember(n); + } + +#if RAPIDJSON_HAS_STDSTRING + bool RemoveMember(const std::basic_string& name) { return RemoveMember(GenericValue(StringRef(name))); } +#endif + + template + bool RemoveMember(const GenericValue& name) { + MemberIterator m = FindMember(name); + if (m != MemberEnd()) { + RemoveMember(m); + return true; + } + else + return false; + } + + //! Remove a member in object by iterator. + /*! \param m member iterator (obtained by FindMember() or MemberBegin()). + \return the new iterator after removal. + \note This function may reorder the object members. Use \ref + EraseMember(ConstMemberIterator) if you need to preserve the + relative order of the remaining members. + \note Constant time complexity. + */ + MemberIterator RemoveMember(MemberIterator m) { + RAPIDJSON_ASSERT(IsObject()); + RAPIDJSON_ASSERT(data_.o.size > 0); + RAPIDJSON_ASSERT(GetMembersPointer() != 0); + RAPIDJSON_ASSERT(m >= MemberBegin() && m < MemberEnd()); + + MemberIterator last(GetMembersPointer() + (data_.o.size - 1)); + if (data_.o.size > 1 && m != last) + *m = *last; // Move the last one to this place + else + m->~Member(); // Only one left, just destroy + --data_.o.size; + return m; + } + + //! Remove a member from an object by iterator. + /*! \param pos iterator to the member to remove + \pre IsObject() == true && \ref MemberBegin() <= \c pos < \ref MemberEnd() + \return Iterator following the removed element. + If the iterator \c pos refers to the last element, the \ref MemberEnd() iterator is returned. + \note This function preserves the relative order of the remaining object + members. If you do not need this, use the more efficient \ref RemoveMember(MemberIterator). + \note Linear time complexity. + */ + MemberIterator EraseMember(ConstMemberIterator pos) { + return EraseMember(pos, pos +1); + } + + //! Remove members in the range [first, last) from an object. + /*! \param first iterator to the first member to remove + \param last iterator following the last member to remove + \pre IsObject() == true && \ref MemberBegin() <= \c first <= \c last <= \ref MemberEnd() + \return Iterator following the last removed element. + \note This function preserves the relative order of the remaining object + members. + \note Linear time complexity. + */ + MemberIterator EraseMember(ConstMemberIterator first, ConstMemberIterator last) { + RAPIDJSON_ASSERT(IsObject()); + RAPIDJSON_ASSERT(data_.o.size > 0); + RAPIDJSON_ASSERT(GetMembersPointer() != 0); + RAPIDJSON_ASSERT(first >= MemberBegin()); + RAPIDJSON_ASSERT(first <= last); + RAPIDJSON_ASSERT(last <= MemberEnd()); + + MemberIterator pos = MemberBegin() + (first - MemberBegin()); + for (MemberIterator itr = pos; itr != last; ++itr) + itr->~Member(); + std::memmove(&*pos, &*last, static_cast(MemberEnd() - last) * sizeof(Member)); + data_.o.size -= static_cast(last - first); + return pos; + } + + //! Erase a member in object by its name. + /*! \param name Name of member to be removed. + \return Whether the member existed. + \note Linear time complexity. + */ + bool EraseMember(const Ch* name) { + GenericValue n(StringRef(name)); + return EraseMember(n); + } + +#if RAPIDJSON_HAS_STDSTRING + bool EraseMember(const std::basic_string& name) { return EraseMember(GenericValue(StringRef(name))); } +#endif + + template + bool EraseMember(const GenericValue& name) { + MemberIterator m = FindMember(name); + if (m != MemberEnd()) { + EraseMember(m); + return true; + } + else + return false; + } + + Object GetObject() { RAPIDJSON_ASSERT(IsObject()); return Object(*this); } + ConstObject GetObject() const { RAPIDJSON_ASSERT(IsObject()); return ConstObject(*this); } + + //@} + + //!@name Array + //@{ + + //! Set this value as an empty array. + /*! \post IsArray == true */ + GenericValue& SetArray() { this->~GenericValue(); new (this) GenericValue(kArrayType); return *this; } + + //! Get the number of elements in array. + SizeType Size() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.size; } + + //! Get the capacity of array. + SizeType Capacity() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.capacity; } + + //! Check whether the array is empty. + bool Empty() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.size == 0; } + + //! Remove all elements in the array. + /*! This function do not deallocate memory in the array, i.e. the capacity is unchanged. + \note Linear time complexity. + */ + void Clear() { + RAPIDJSON_ASSERT(IsArray()); + GenericValue* e = GetElementsPointer(); + for (GenericValue* v = e; v != e + data_.a.size; ++v) + v->~GenericValue(); + data_.a.size = 0; + } + + //! Get an element from array by index. + /*! \pre IsArray() == true + \param index Zero-based index of element. + \see operator[](T*) + */ + GenericValue& operator[](SizeType index) { + RAPIDJSON_ASSERT(IsArray()); + RAPIDJSON_ASSERT(index < data_.a.size); + return GetElementsPointer()[index]; + } + const GenericValue& operator[](SizeType index) const { return const_cast(*this)[index]; } + + //! Element iterator + /*! \pre IsArray() == true */ + ValueIterator Begin() { RAPIDJSON_ASSERT(IsArray()); return GetElementsPointer(); } + //! \em Past-the-end element iterator + /*! \pre IsArray() == true */ + ValueIterator End() { RAPIDJSON_ASSERT(IsArray()); return GetElementsPointer() + data_.a.size; } + //! Constant element iterator + /*! \pre IsArray() == true */ + ConstValueIterator Begin() const { return const_cast(*this).Begin(); } + //! Constant \em past-the-end element iterator + /*! \pre IsArray() == true */ + ConstValueIterator End() const { return const_cast(*this).End(); } + + //! Request the array to have enough capacity to store elements. + /*! \param newCapacity The capacity that the array at least need to have. + \param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \note Linear time complexity. + */ + GenericValue& Reserve(SizeType newCapacity, Allocator &allocator) { + RAPIDJSON_ASSERT(IsArray()); + if (newCapacity > data_.a.capacity) { + SetElementsPointer(reinterpret_cast(allocator.Realloc(GetElementsPointer(), data_.a.capacity * sizeof(GenericValue), newCapacity * sizeof(GenericValue)))); + data_.a.capacity = newCapacity; + } + return *this; + } + + //! Append a GenericValue at the end of the array. + /*! \param value Value to be appended. + \param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator(). + \pre IsArray() == true + \post value.IsNull() == true + \return The value itself for fluent API. + \note The ownership of \c value will be transferred to this array on success. + \note If the number of elements to be appended is known, calls Reserve() once first may be more efficient. + \note Amortized constant time complexity. + */ + GenericValue& PushBack(GenericValue& value, Allocator& allocator) { + RAPIDJSON_ASSERT(IsArray()); + if (data_.a.size >= data_.a.capacity) + Reserve(data_.a.capacity == 0 ? kDefaultArrayCapacity : (data_.a.capacity + (data_.a.capacity + 1) / 2), allocator); + GetElementsPointer()[data_.a.size++].RawAssign(value); + return *this; + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + GenericValue& PushBack(GenericValue&& value, Allocator& allocator) { + return PushBack(value, allocator); + } +#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS + + //! Append a constant string reference at the end of the array. + /*! \param value Constant string reference to be appended. + \param allocator Allocator for reallocating memory. It must be the same one used previously. Commonly use GenericDocument::GetAllocator(). + \pre IsArray() == true + \return The value itself for fluent API. + \note If the number of elements to be appended is known, calls Reserve() once first may be more efficient. + \note Amortized constant time complexity. + \see GenericStringRef + */ + GenericValue& PushBack(StringRefType value, Allocator& allocator) { + return (*this).template PushBack(value, allocator); + } + + //! Append a primitive value at the end of the array. + /*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t + \param value Value of primitive type T to be appended. + \param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator(). + \pre IsArray() == true + \return The value itself for fluent API. + \note If the number of elements to be appended is known, calls Reserve() once first may be more efficient. + + \note The source type \c T explicitly disallows all pointer types, + especially (\c const) \ref Ch*. This helps avoiding implicitly + referencing character strings with insufficient lifetime, use + \ref PushBack(GenericValue&, Allocator&) or \ref + PushBack(StringRefType, Allocator&). + All other pointer types would implicitly convert to \c bool, + use an explicit cast instead, if needed. + \note Amortized constant time complexity. + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (GenericValue&)) + PushBack(T value, Allocator& allocator) { + GenericValue v(value); + return PushBack(v, allocator); + } + + //! Remove the last element in the array. + /*! + \note Constant time complexity. + */ + GenericValue& PopBack() { + RAPIDJSON_ASSERT(IsArray()); + RAPIDJSON_ASSERT(!Empty()); + GetElementsPointer()[--data_.a.size].~GenericValue(); + return *this; + } + + //! Remove an element of array by iterator. + /*! + \param pos iterator to the element to remove + \pre IsArray() == true && \ref Begin() <= \c pos < \ref End() + \return Iterator following the removed element. If the iterator pos refers to the last element, the End() iterator is returned. + \note Linear time complexity. + */ + ValueIterator Erase(ConstValueIterator pos) { + return Erase(pos, pos + 1); + } + + //! Remove elements in the range [first, last) of the array. + /*! + \param first iterator to the first element to remove + \param last iterator following the last element to remove + \pre IsArray() == true && \ref Begin() <= \c first <= \c last <= \ref End() + \return Iterator following the last removed element. + \note Linear time complexity. + */ + ValueIterator Erase(ConstValueIterator first, ConstValueIterator last) { + RAPIDJSON_ASSERT(IsArray()); + RAPIDJSON_ASSERT(data_.a.size > 0); + RAPIDJSON_ASSERT(GetElementsPointer() != 0); + RAPIDJSON_ASSERT(first >= Begin()); + RAPIDJSON_ASSERT(first <= last); + RAPIDJSON_ASSERT(last <= End()); + ValueIterator pos = Begin() + (first - Begin()); + for (ValueIterator itr = pos; itr != last; ++itr) + itr->~GenericValue(); + std::memmove(pos, last, static_cast(End() - last) * sizeof(GenericValue)); + data_.a.size -= static_cast(last - first); + return pos; + } + + Array GetArray() { RAPIDJSON_ASSERT(IsArray()); return Array(*this); } + ConstArray GetArray() const { RAPIDJSON_ASSERT(IsArray()); return ConstArray(*this); } + + //@} + + //!@name Number + //@{ + + int GetInt() const { RAPIDJSON_ASSERT(data_.f.flags & kIntFlag); return data_.n.i.i; } + unsigned GetUint() const { RAPIDJSON_ASSERT(data_.f.flags & kUintFlag); return data_.n.u.u; } + int64_t GetInt64() const { RAPIDJSON_ASSERT(data_.f.flags & kInt64Flag); return data_.n.i64; } + uint64_t GetUint64() const { RAPIDJSON_ASSERT(data_.f.flags & kUint64Flag); return data_.n.u64; } + + //! Get the value as double type. + /*! \note If the value is 64-bit integer type, it may lose precision. Use \c IsLosslessDouble() to check whether the converison is lossless. + */ + double GetDouble() const { + RAPIDJSON_ASSERT(IsNumber()); + if ((data_.f.flags & kDoubleFlag) != 0) return data_.n.d; // exact type, no conversion. + if ((data_.f.flags & kIntFlag) != 0) return data_.n.i.i; // int -> double + if ((data_.f.flags & kUintFlag) != 0) return data_.n.u.u; // unsigned -> double + if ((data_.f.flags & kInt64Flag) != 0) return static_cast(data_.n.i64); // int64_t -> double (may lose precision) + RAPIDJSON_ASSERT((data_.f.flags & kUint64Flag) != 0); return static_cast(data_.n.u64); // uint64_t -> double (may lose precision) + } + + //! Get the value as float type. + /*! \note If the value is 64-bit integer type, it may lose precision. Use \c IsLosslessFloat() to check whether the converison is lossless. + */ + float GetFloat() const { + return static_cast(GetDouble()); + } + + GenericValue& SetInt(int i) { this->~GenericValue(); new (this) GenericValue(i); return *this; } + GenericValue& SetUint(unsigned u) { this->~GenericValue(); new (this) GenericValue(u); return *this; } + GenericValue& SetInt64(int64_t i64) { this->~GenericValue(); new (this) GenericValue(i64); return *this; } + GenericValue& SetUint64(uint64_t u64) { this->~GenericValue(); new (this) GenericValue(u64); return *this; } + GenericValue& SetDouble(double d) { this->~GenericValue(); new (this) GenericValue(d); return *this; } + GenericValue& SetFloat(float f) { this->~GenericValue(); new (this) GenericValue(f); return *this; } + + //@} + + //!@name String + //@{ + + const Ch* GetString() const { RAPIDJSON_ASSERT(IsString()); return (data_.f.flags & kInlineStrFlag) ? data_.ss.str : GetStringPointer(); } + + //! Get the length of string. + /*! Since rapidjson permits "\\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength(). + */ + SizeType GetStringLength() const { RAPIDJSON_ASSERT(IsString()); return ((data_.f.flags & kInlineStrFlag) ? (data_.ss.GetLength()) : data_.s.length); } + + //! Set this value as a string without copying source string. + /*! This version has better performance with supplied length, and also support string containing null character. + \param s source string pointer. + \param length The length of source string, excluding the trailing null terminator. + \return The value itself for fluent API. + \post IsString() == true && GetString() == s && GetStringLength() == length + \see SetString(StringRefType) + */ + GenericValue& SetString(const Ch* s, SizeType length) { return SetString(StringRef(s, length)); } + + //! Set this value as a string without copying source string. + /*! \param s source string reference + \return The value itself for fluent API. + \post IsString() == true && GetString() == s && GetStringLength() == s.length + */ + GenericValue& SetString(StringRefType s) { this->~GenericValue(); SetStringRaw(s); return *this; } + + //! Set this value as a string by copying from source string. + /*! This version has better performance with supplied length, and also support string containing null character. + \param s source string. + \param length The length of source string, excluding the trailing null terminator. + \param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \post IsString() == true && GetString() != s && strcmp(GetString(),s) == 0 && GetStringLength() == length + */ + GenericValue& SetString(const Ch* s, SizeType length, Allocator& allocator) { this->~GenericValue(); SetStringRaw(StringRef(s, length), allocator); return *this; } + + //! Set this value as a string by copying from source string. + /*! \param s source string. + \param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \post IsString() == true && GetString() != s && strcmp(GetString(),s) == 0 && GetStringLength() == length + */ + GenericValue& SetString(const Ch* s, Allocator& allocator) { return SetString(s, internal::StrLen(s), allocator); } + +#if RAPIDJSON_HAS_STDSTRING + //! Set this value as a string by copying from source string. + /*! \param s source string. + \param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator(). + \return The value itself for fluent API. + \post IsString() == true && GetString() != s.data() && strcmp(GetString(),s.data() == 0 && GetStringLength() == s.size() + \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING. + */ + GenericValue& SetString(const std::basic_string& s, Allocator& allocator) { return SetString(s.data(), SizeType(s.size()), allocator); } +#endif + + //@} + + //!@name Array + //@{ + + //! Templated version for checking whether this value is type T. + /*! + \tparam T Either \c bool, \c int, \c unsigned, \c int64_t, \c uint64_t, \c double, \c float, \c const \c char*, \c std::basic_string + */ + template + bool Is() const { return internal::TypeHelper::Is(*this); } + + template + T Get() const { return internal::TypeHelper::Get(*this); } + + template + T Get() { return internal::TypeHelper::Get(*this); } + + template + ValueType& Set(const T& data) { return internal::TypeHelper::Set(*this, data); } + + template + ValueType& Set(const T& data, AllocatorType& allocator) { return internal::TypeHelper::Set(*this, data, allocator); } + + //@} + + //! Generate events of this value to a Handler. + /*! This function adopts the GoF visitor pattern. + Typical usage is to output this JSON value as JSON text via Writer, which is a Handler. + It can also be used to deep clone this value via GenericDocument, which is also a Handler. + \tparam Handler type of handler. + \param handler An object implementing concept Handler. + */ + template + bool Accept(Handler& handler) const { + switch(GetType()) { + case kNullType: return handler.Null(); + case kFalseType: return handler.Bool(false); + case kTrueType: return handler.Bool(true); + + case kObjectType: + if (RAPIDJSON_UNLIKELY(!handler.StartObject())) + return false; + for (ConstMemberIterator m = MemberBegin(); m != MemberEnd(); ++m) { + RAPIDJSON_ASSERT(m->name.IsString()); // User may change the type of name by MemberIterator. + if (RAPIDJSON_UNLIKELY(!handler.Key(m->name.GetString(), m->name.GetStringLength(), (m->name.data_.f.flags & kCopyFlag) != 0))) + return false; + if (RAPIDJSON_UNLIKELY(!m->value.Accept(handler))) + return false; + } + return handler.EndObject(data_.o.size); + + case kArrayType: + if (RAPIDJSON_UNLIKELY(!handler.StartArray())) + return false; + for (const GenericValue* v = Begin(); v != End(); ++v) + if (RAPIDJSON_UNLIKELY(!v->Accept(handler))) + return false; + return handler.EndArray(data_.a.size); + + case kStringType: + return handler.String(GetString(), GetStringLength(), (data_.f.flags & kCopyFlag) != 0); + + default: + RAPIDJSON_ASSERT(GetType() == kNumberType); + if (IsDouble()) return handler.Double(data_.n.d); + else if (IsInt()) return handler.Int(data_.n.i.i); + else if (IsUint()) return handler.Uint(data_.n.u.u); + else if (IsInt64()) return handler.Int64(data_.n.i64); + else return handler.Uint64(data_.n.u64); + } + } + +private: + template friend class GenericValue; + template friend class GenericDocument; + + enum { + kBoolFlag = 0x0008, + kNumberFlag = 0x0010, + kIntFlag = 0x0020, + kUintFlag = 0x0040, + kInt64Flag = 0x0080, + kUint64Flag = 0x0100, + kDoubleFlag = 0x0200, + kStringFlag = 0x0400, + kCopyFlag = 0x0800, + kInlineStrFlag = 0x1000, + + // Initial flags of different types. + kNullFlag = kNullType, + kTrueFlag = kTrueType | kBoolFlag, + kFalseFlag = kFalseType | kBoolFlag, + kNumberIntFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag, + kNumberUintFlag = kNumberType | kNumberFlag | kUintFlag | kUint64Flag | kInt64Flag, + kNumberInt64Flag = kNumberType | kNumberFlag | kInt64Flag, + kNumberUint64Flag = kNumberType | kNumberFlag | kUint64Flag, + kNumberDoubleFlag = kNumberType | kNumberFlag | kDoubleFlag, + kNumberAnyFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag | kUintFlag | kUint64Flag | kDoubleFlag, + kConstStringFlag = kStringType | kStringFlag, + kCopyStringFlag = kStringType | kStringFlag | kCopyFlag, + kShortStringFlag = kStringType | kStringFlag | kCopyFlag | kInlineStrFlag, + kObjectFlag = kObjectType, + kArrayFlag = kArrayType, + + kTypeMask = 0x07 + }; + + static const SizeType kDefaultArrayCapacity = 16; + static const SizeType kDefaultObjectCapacity = 16; + + struct Flag { +#if RAPIDJSON_48BITPOINTER_OPTIMIZATION + char payload[sizeof(SizeType) * 2 + 6]; // 2 x SizeType + lower 48-bit pointer +#elif RAPIDJSON_64BIT + char payload[sizeof(SizeType) * 2 + sizeof(void*) + 6]; // 6 padding bytes +#else + char payload[sizeof(SizeType) * 2 + sizeof(void*) + 2]; // 2 padding bytes +#endif + uint16_t flags; + }; + + struct String { + SizeType length; + SizeType hashcode; //!< reserved + const Ch* str; + }; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode + + // implementation detail: ShortString can represent zero-terminated strings up to MaxSize chars + // (excluding the terminating zero) and store a value to determine the length of the contained + // string in the last character str[LenPos] by storing "MaxSize - length" there. If the string + // to store has the maximal length of MaxSize then str[LenPos] will be 0 and therefore act as + // the string terminator as well. For getting the string length back from that value just use + // "MaxSize - str[LenPos]". + // This allows to store 13-chars strings in 32-bit mode, 21-chars strings in 64-bit mode, + // 13-chars strings for RAPIDJSON_48BITPOINTER_OPTIMIZATION=1 inline (for `UTF8`-encoded strings). + struct ShortString { + enum { MaxChars = sizeof(static_cast(0)->payload) / sizeof(Ch), MaxSize = MaxChars - 1, LenPos = MaxSize }; + Ch str[MaxChars]; + + inline static bool Usable(SizeType len) { return (MaxSize >= len); } + inline void SetLength(SizeType len) { str[LenPos] = static_cast(MaxSize - len); } + inline SizeType GetLength() const { return static_cast(MaxSize - str[LenPos]); } + }; // at most as many bytes as "String" above => 12 bytes in 32-bit mode, 16 bytes in 64-bit mode + + // By using proper binary layout, retrieval of different integer types do not need conversions. + union Number { +#if RAPIDJSON_ENDIAN == RAPIDJSON_LITTLEENDIAN + struct I { + int i; + char padding[4]; + }i; + struct U { + unsigned u; + char padding2[4]; + }u; +#else + struct I { + char padding[4]; + int i; + }i; + struct U { + char padding2[4]; + unsigned u; + }u; +#endif + int64_t i64; + uint64_t u64; + double d; + }; // 8 bytes + + struct ObjectData { + SizeType size; + SizeType capacity; + Member* members; + }; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode + + struct ArrayData { + SizeType size; + SizeType capacity; + GenericValue* elements; + }; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode + + union Data { + String s; + ShortString ss; + Number n; + ObjectData o; + ArrayData a; + Flag f; + }; // 16 bytes in 32-bit mode, 24 bytes in 64-bit mode, 16 bytes in 64-bit with RAPIDJSON_48BITPOINTER_OPTIMIZATION + + RAPIDJSON_FORCEINLINE const Ch* GetStringPointer() const { return RAPIDJSON_GETPOINTER(Ch, data_.s.str); } + RAPIDJSON_FORCEINLINE const Ch* SetStringPointer(const Ch* str) { return RAPIDJSON_SETPOINTER(Ch, data_.s.str, str); } + RAPIDJSON_FORCEINLINE GenericValue* GetElementsPointer() const { return RAPIDJSON_GETPOINTER(GenericValue, data_.a.elements); } + RAPIDJSON_FORCEINLINE GenericValue* SetElementsPointer(GenericValue* elements) { return RAPIDJSON_SETPOINTER(GenericValue, data_.a.elements, elements); } + RAPIDJSON_FORCEINLINE Member* GetMembersPointer() const { return RAPIDJSON_GETPOINTER(Member, data_.o.members); } + RAPIDJSON_FORCEINLINE Member* SetMembersPointer(Member* members) { return RAPIDJSON_SETPOINTER(Member, data_.o.members, members); } + + // Initialize this value as array with initial data, without calling destructor. + void SetArrayRaw(GenericValue* values, SizeType count, Allocator& allocator) { + data_.f.flags = kArrayFlag; + if (count) { + GenericValue* e = static_cast(allocator.Malloc(count * sizeof(GenericValue))); + SetElementsPointer(e); + std::memcpy(e, values, count * sizeof(GenericValue)); + } + else + SetElementsPointer(0); + data_.a.size = data_.a.capacity = count; + } + + //! Initialize this value as object with initial data, without calling destructor. + void SetObjectRaw(Member* members, SizeType count, Allocator& allocator) { + data_.f.flags = kObjectFlag; + if (count) { + Member* m = static_cast(allocator.Malloc(count * sizeof(Member))); + SetMembersPointer(m); + std::memcpy(m, members, count * sizeof(Member)); + } + else + SetMembersPointer(0); + data_.o.size = data_.o.capacity = count; + } + + //! Initialize this value as constant string, without calling destructor. + void SetStringRaw(StringRefType s) RAPIDJSON_NOEXCEPT { + data_.f.flags = kConstStringFlag; + SetStringPointer(s); + data_.s.length = s.length; + } + + //! Initialize this value as copy string with initial data, without calling destructor. + void SetStringRaw(StringRefType s, Allocator& allocator) { + Ch* str = 0; + if (ShortString::Usable(s.length)) { + data_.f.flags = kShortStringFlag; + data_.ss.SetLength(s.length); + str = data_.ss.str; + } else { + data_.f.flags = kCopyStringFlag; + data_.s.length = s.length; + str = static_cast(allocator.Malloc((s.length + 1) * sizeof(Ch))); + SetStringPointer(str); + } + std::memcpy(str, s, s.length * sizeof(Ch)); + str[s.length] = '\0'; + } + + //! Assignment without calling destructor + void RawAssign(GenericValue& rhs) RAPIDJSON_NOEXCEPT { + data_ = rhs.data_; + // data_.f.flags = rhs.data_.f.flags; + rhs.data_.f.flags = kNullFlag; + } + + template + bool StringEqual(const GenericValue& rhs) const { + RAPIDJSON_ASSERT(IsString()); + RAPIDJSON_ASSERT(rhs.IsString()); + + const SizeType len1 = GetStringLength(); + const SizeType len2 = rhs.GetStringLength(); + if(len1 != len2) { return false; } + + const Ch* const str1 = GetString(); + const Ch* const str2 = rhs.GetString(); + if(str1 == str2) { return true; } // fast path for constant string + + return (std::memcmp(str1, str2, sizeof(Ch) * len1) == 0); + } + + Data data_; +}; + +//! GenericValue with UTF8 encoding +typedef GenericValue > Value; + +/////////////////////////////////////////////////////////////////////////////// +// GenericDocument + +//! A document for parsing JSON text as DOM. +/*! + \note implements Handler concept + \tparam Encoding Encoding for both parsing and string storage. + \tparam Allocator Allocator for allocating memory for the DOM + \tparam StackAllocator Allocator for allocating memory for stack during parsing. + \warning Although GenericDocument inherits from GenericValue, the API does \b not provide any virtual functions, especially no virtual destructor. To avoid memory leaks, do not \c delete a GenericDocument object via a pointer to a GenericValue. +*/ +template , typename StackAllocator = CrtAllocator> +class GenericDocument : public GenericValue { +public: + typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding. + typedef GenericValue ValueType; //!< Value type of the document. + typedef Allocator AllocatorType; //!< Allocator type from template parameter. + + //! Constructor + /*! Creates an empty document of specified type. + \param type Mandatory type of object to create. + \param allocator Optional allocator for allocating memory. + \param stackCapacity Optional initial capacity of stack in bytes. + \param stackAllocator Optional allocator for allocating memory for stack. + */ + explicit GenericDocument(Type type, Allocator* allocator = 0, size_t stackCapacity = kDefaultStackCapacity, StackAllocator* stackAllocator = 0) : + GenericValue(type), allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_() + { + if (!allocator_) + ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); + } + + //! Constructor + /*! Creates an empty document which type is Null. + \param allocator Optional allocator for allocating memory. + \param stackCapacity Optional initial capacity of stack in bytes. + \param stackAllocator Optional allocator for allocating memory for stack. + */ + GenericDocument(Allocator* allocator = 0, size_t stackCapacity = kDefaultStackCapacity, StackAllocator* stackAllocator = 0) : + allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_() + { + if (!allocator_) + ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + //! Move constructor in C++11 + GenericDocument(GenericDocument&& rhs) RAPIDJSON_NOEXCEPT + : ValueType(std::forward(rhs)), // explicit cast to avoid prohibited move from Document + allocator_(rhs.allocator_), + ownAllocator_(rhs.ownAllocator_), + stack_(std::move(rhs.stack_)), + parseResult_(rhs.parseResult_) + { + rhs.allocator_ = 0; + rhs.ownAllocator_ = 0; + rhs.parseResult_ = ParseResult(); + } +#endif + + ~GenericDocument() { + Destroy(); + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + //! Move assignment in C++11 + GenericDocument& operator=(GenericDocument&& rhs) RAPIDJSON_NOEXCEPT + { + // The cast to ValueType is necessary here, because otherwise it would + // attempt to call GenericValue's templated assignment operator. + ValueType::operator=(std::forward(rhs)); + + // Calling the destructor here would prematurely call stack_'s destructor + Destroy(); + + allocator_ = rhs.allocator_; + ownAllocator_ = rhs.ownAllocator_; + stack_ = std::move(rhs.stack_); + parseResult_ = rhs.parseResult_; + + rhs.allocator_ = 0; + rhs.ownAllocator_ = 0; + rhs.parseResult_ = ParseResult(); + + return *this; + } +#endif + + //! Exchange the contents of this document with those of another. + /*! + \param rhs Another document. + \note Constant complexity. + \see GenericValue::Swap + */ + GenericDocument& Swap(GenericDocument& rhs) RAPIDJSON_NOEXCEPT { + ValueType::Swap(rhs); + stack_.Swap(rhs.stack_); + internal::Swap(allocator_, rhs.allocator_); + internal::Swap(ownAllocator_, rhs.ownAllocator_); + internal::Swap(parseResult_, rhs.parseResult_); + return *this; + } + + //! free-standing swap function helper + /*! + Helper function to enable support for common swap implementation pattern based on \c std::swap: + \code + void swap(MyClass& a, MyClass& b) { + using std::swap; + swap(a.doc, b.doc); + // ... + } + \endcode + \see Swap() + */ + friend inline void swap(GenericDocument& a, GenericDocument& b) RAPIDJSON_NOEXCEPT { a.Swap(b); } + + //! Populate this document by a generator which produces SAX events. + /*! \tparam Generator A functor with bool f(Handler) prototype. + \param g Generator functor which sends SAX events to the parameter. + \return The document itself for fluent API. + */ + template + GenericDocument& Populate(Generator& g) { + ClearStackOnExit scope(*this); + if (g(*this)) { + RAPIDJSON_ASSERT(stack_.GetSize() == sizeof(ValueType)); // Got one and only one root object + ValueType::operator=(*stack_.template Pop(1));// Move value from stack to document + } + return *this; + } + + //!@name Parse from stream + //!@{ + + //! Parse JSON text from an input stream (with Encoding conversion) + /*! \tparam parseFlags Combination of \ref ParseFlag. + \tparam SourceEncoding Encoding of input stream + \tparam InputStream Type of input stream, implementing Stream concept + \param is Input stream to be parsed. + \return The document itself for fluent API. + */ + template + GenericDocument& ParseStream(InputStream& is) { + GenericReader reader( + stack_.HasAllocator() ? &stack_.GetAllocator() : 0); + ClearStackOnExit scope(*this); + parseResult_ = reader.template Parse(is, *this); + if (parseResult_) { + RAPIDJSON_ASSERT(stack_.GetSize() == sizeof(ValueType)); // Got one and only one root object + ValueType::operator=(*stack_.template Pop(1));// Move value from stack to document + } + return *this; + } + + //! Parse JSON text from an input stream + /*! \tparam parseFlags Combination of \ref ParseFlag. + \tparam InputStream Type of input stream, implementing Stream concept + \param is Input stream to be parsed. + \return The document itself for fluent API. + */ + template + GenericDocument& ParseStream(InputStream& is) { + return ParseStream(is); + } + + //! Parse JSON text from an input stream (with \ref kParseDefaultFlags) + /*! \tparam InputStream Type of input stream, implementing Stream concept + \param is Input stream to be parsed. + \return The document itself for fluent API. + */ + template + GenericDocument& ParseStream(InputStream& is) { + return ParseStream(is); + } + //!@} + + //!@name Parse in-place from mutable string + //!@{ + + //! Parse JSON text from a mutable string + /*! \tparam parseFlags Combination of \ref ParseFlag. + \param str Mutable zero-terminated string to be parsed. + \return The document itself for fluent API. + */ + template + GenericDocument& ParseInsitu(Ch* str) { + GenericInsituStringStream s(str); + return ParseStream(s); + } + + //! Parse JSON text from a mutable string (with \ref kParseDefaultFlags) + /*! \param str Mutable zero-terminated string to be parsed. + \return The document itself for fluent API. + */ + GenericDocument& ParseInsitu(Ch* str) { + return ParseInsitu(str); + } + //!@} + + //!@name Parse from read-only string + //!@{ + + //! Parse JSON text from a read-only string (with Encoding conversion) + /*! \tparam parseFlags Combination of \ref ParseFlag (must not contain \ref kParseInsituFlag). + \tparam SourceEncoding Transcoding from input Encoding + \param str Read-only zero-terminated string to be parsed. + */ + template + GenericDocument& Parse(const typename SourceEncoding::Ch* str) { + RAPIDJSON_ASSERT(!(parseFlags & kParseInsituFlag)); + GenericStringStream s(str); + return ParseStream(s); + } + + //! Parse JSON text from a read-only string + /*! \tparam parseFlags Combination of \ref ParseFlag (must not contain \ref kParseInsituFlag). + \param str Read-only zero-terminated string to be parsed. + */ + template + GenericDocument& Parse(const Ch* str) { + return Parse(str); + } + + //! Parse JSON text from a read-only string (with \ref kParseDefaultFlags) + /*! \param str Read-only zero-terminated string to be parsed. + */ + GenericDocument& Parse(const Ch* str) { + return Parse(str); + } + + template + GenericDocument& Parse(const typename SourceEncoding::Ch* str, size_t length) { + RAPIDJSON_ASSERT(!(parseFlags & kParseInsituFlag)); + MemoryStream ms(static_cast(str), length * sizeof(typename SourceEncoding::Ch)); + EncodedInputStream is(ms); + ParseStream(is); + return *this; + } + + template + GenericDocument& Parse(const Ch* str, size_t length) { + return Parse(str, length); + } + + GenericDocument& Parse(const Ch* str, size_t length) { + return Parse(str, length); + } + +#if RAPIDJSON_HAS_STDSTRING + template + GenericDocument& Parse(const std::basic_string& str) { + // c_str() is constant complexity according to standard. Should be faster than Parse(const char*, size_t) + return Parse(str.c_str()); + } + + template + GenericDocument& Parse(const std::basic_string& str) { + return Parse(str.c_str()); + } + + GenericDocument& Parse(const std::basic_string& str) { + return Parse(str); + } +#endif // RAPIDJSON_HAS_STDSTRING + + //!@} + + //!@name Handling parse errors + //!@{ + + //! Whether a parse error has occured in the last parsing. + bool HasParseError() const { return parseResult_.IsError(); } + + //! Get the \ref ParseErrorCode of last parsing. + ParseErrorCode GetParseError() const { return parseResult_.Code(); } + + //! Get the position of last parsing error in input, 0 otherwise. + size_t GetErrorOffset() const { return parseResult_.Offset(); } + + //! Implicit conversion to get the last parse result +#ifndef __clang // -Wdocumentation + /*! \return \ref ParseResult of the last parse operation + + \code + Document doc; + ParseResult ok = doc.Parse(json); + if (!ok) + printf( "JSON parse error: %s (%u)\n", GetParseError_En(ok.Code()), ok.Offset()); + \endcode + */ +#endif + operator ParseResult() const { return parseResult_; } + //!@} + + //! Get the allocator of this document. + Allocator& GetAllocator() { + RAPIDJSON_ASSERT(allocator_); + return *allocator_; + } + + //! Get the capacity of stack in bytes. + size_t GetStackCapacity() const { return stack_.GetCapacity(); } + +private: + // clear stack on any exit from ParseStream, e.g. due to exception + struct ClearStackOnExit { + explicit ClearStackOnExit(GenericDocument& d) : d_(d) {} + ~ClearStackOnExit() { d_.ClearStack(); } + private: + ClearStackOnExit(const ClearStackOnExit&); + ClearStackOnExit& operator=(const ClearStackOnExit&); + GenericDocument& d_; + }; + + // callers of the following private Handler functions + // template friend class GenericReader; // for parsing + template friend class GenericValue; // for deep copying + +public: + // Implementation of Handler + bool Null() { new (stack_.template Push()) ValueType(); return true; } + bool Bool(bool b) { new (stack_.template Push()) ValueType(b); return true; } + bool Int(int i) { new (stack_.template Push()) ValueType(i); return true; } + bool Uint(unsigned i) { new (stack_.template Push()) ValueType(i); return true; } + bool Int64(int64_t i) { new (stack_.template Push()) ValueType(i); return true; } + bool Uint64(uint64_t i) { new (stack_.template Push()) ValueType(i); return true; } + bool Double(double d) { new (stack_.template Push()) ValueType(d); return true; } + + bool RawNumber(const Ch* str, SizeType length, bool copy) { + if (copy) + new (stack_.template Push()) ValueType(str, length, GetAllocator()); + else + new (stack_.template Push()) ValueType(str, length); + return true; + } + + bool String(const Ch* str, SizeType length, bool copy) { + if (copy) + new (stack_.template Push()) ValueType(str, length, GetAllocator()); + else + new (stack_.template Push()) ValueType(str, length); + return true; + } + + bool StartObject() { new (stack_.template Push()) ValueType(kObjectType); return true; } + + bool Key(const Ch* str, SizeType length, bool copy) { return String(str, length, copy); } + + bool EndObject(SizeType memberCount) { + typename ValueType::Member* members = stack_.template Pop(memberCount); + stack_.template Top()->SetObjectRaw(members, memberCount, GetAllocator()); + return true; + } + + bool StartArray() { new (stack_.template Push()) ValueType(kArrayType); return true; } + + bool EndArray(SizeType elementCount) { + ValueType* elements = stack_.template Pop(elementCount); + stack_.template Top()->SetArrayRaw(elements, elementCount, GetAllocator()); + return true; + } + +private: + //! Prohibit copying + GenericDocument(const GenericDocument&); + //! Prohibit assignment + GenericDocument& operator=(const GenericDocument&); + + void ClearStack() { + if (Allocator::kNeedFree) + while (stack_.GetSize() > 0) // Here assumes all elements in stack array are GenericValue (Member is actually 2 GenericValue objects) + (stack_.template Pop(1))->~ValueType(); + else + stack_.Clear(); + stack_.ShrinkToFit(); + } + + void Destroy() { + RAPIDJSON_DELETE(ownAllocator_); + } + + static const size_t kDefaultStackCapacity = 1024; + Allocator* allocator_; + Allocator* ownAllocator_; + internal::Stack stack_; + ParseResult parseResult_; +}; + +//! GenericDocument with UTF8 encoding +typedef GenericDocument > Document; + +// defined here due to the dependency on GenericDocument +template +template +inline +GenericValue::GenericValue(const GenericValue& rhs, Allocator& allocator) +{ + switch (rhs.GetType()) { + case kObjectType: + case kArrayType: { // perform deep copy via SAX Handler + GenericDocument d(&allocator); + rhs.Accept(d); + RawAssign(*d.stack_.template Pop(1)); + } + break; + case kStringType: + if (rhs.data_.f.flags == kConstStringFlag) { + data_.f.flags = rhs.data_.f.flags; + data_ = *reinterpret_cast(&rhs.data_); + } else { + SetStringRaw(StringRef(rhs.GetString(), rhs.GetStringLength()), allocator); + } + break; + default: + data_.f.flags = rhs.data_.f.flags; + data_ = *reinterpret_cast(&rhs.data_); + break; + } +} + +//! Helper class for accessing Value of array type. +/*! + Instance of this helper class is obtained by \c GenericValue::GetArray(). + In addition to all APIs for array type, it provides range-based for loop if \c RAPIDJSON_HAS_CXX11_RANGE_FOR=1. +*/ +template +class GenericArray { +public: + typedef GenericArray ConstArray; + typedef GenericArray Array; + typedef ValueT PlainType; + typedef typename internal::MaybeAddConst::Type ValueType; + typedef ValueType* ValueIterator; // This may be const or non-const iterator + typedef const ValueT* ConstValueIterator; + typedef typename ValueType::AllocatorType AllocatorType; + typedef typename ValueType::StringRefType StringRefType; + + template + friend class GenericValue; + + GenericArray(const GenericArray& rhs) : value_(rhs.value_) {} + GenericArray& operator=(const GenericArray& rhs) { value_ = rhs.value_; return *this; } + ~GenericArray() {} + + SizeType Size() const { return value_.Size(); } + SizeType Capacity() const { return value_.Capacity(); } + bool Empty() const { return value_.Empty(); } + void Clear() const { value_.Clear(); } + ValueType& operator[](SizeType index) const { return value_[index]; } + ValueIterator Begin() const { return value_.Begin(); } + ValueIterator End() const { return value_.End(); } + GenericArray Reserve(SizeType newCapacity, AllocatorType &allocator) const { value_.Reserve(newCapacity, allocator); return *this; } + GenericArray PushBack(ValueType& value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; } +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + GenericArray PushBack(ValueType&& value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; } +#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS + GenericArray PushBack(StringRefType value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; } + template RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (const GenericArray&)) PushBack(T value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; } + GenericArray PopBack() const { value_.PopBack(); return *this; } + ValueIterator Erase(ConstValueIterator pos) const { return value_.Erase(pos); } + ValueIterator Erase(ConstValueIterator first, ConstValueIterator last) const { return value_.Erase(first, last); } + +#if RAPIDJSON_HAS_CXX11_RANGE_FOR + ValueIterator begin() const { return value_.Begin(); } + ValueIterator end() const { return value_.End(); } +#endif + +private: + GenericArray(); + GenericArray(ValueType& value) : value_(value) {} + ValueType& value_; +}; + +//! Helper class for accessing Value of object type. +/*! + Instance of this helper class is obtained by \c GenericValue::GetObject(). + In addition to all APIs for array type, it provides range-based for loop if \c RAPIDJSON_HAS_CXX11_RANGE_FOR=1. +*/ +template +class GenericObject { +public: + typedef GenericObject ConstObject; + typedef GenericObject Object; + typedef ValueT PlainType; + typedef typename internal::MaybeAddConst::Type ValueType; + typedef GenericMemberIterator MemberIterator; // This may be const or non-const iterator + typedef GenericMemberIterator ConstMemberIterator; + typedef typename ValueType::AllocatorType AllocatorType; + typedef typename ValueType::StringRefType StringRefType; + typedef typename ValueType::EncodingType EncodingType; + typedef typename ValueType::Ch Ch; + + template + friend class GenericValue; + + GenericObject(const GenericObject& rhs) : value_(rhs.value_) {} + GenericObject& operator=(const GenericObject& rhs) { value_ = rhs.value_; return *this; } + ~GenericObject() {} + + SizeType MemberCount() const { return value_.MemberCount(); } + bool ObjectEmpty() const { return value_.ObjectEmpty(); } + template ValueType& operator[](T* name) const { return value_[name]; } + template ValueType& operator[](const GenericValue& name) const { return value_[name]; } +#if RAPIDJSON_HAS_STDSTRING + ValueType& operator[](const std::basic_string& name) const { return value_[name]; } +#endif + MemberIterator MemberBegin() const { return value_.MemberBegin(); } + MemberIterator MemberEnd() const { return value_.MemberEnd(); } + bool HasMember(const Ch* name) const { return value_.HasMember(name); } +#if RAPIDJSON_HAS_STDSTRING + bool HasMember(const std::basic_string& name) const { return value_.HasMember(name); } +#endif + template bool HasMember(const GenericValue& name) const { return value_.HasMember(name); } + MemberIterator FindMember(const Ch* name) const { return value_.FindMember(name); } + template MemberIterator FindMember(const GenericValue& name) const { return value_.FindMember(name); } +#if RAPIDJSON_HAS_STDSTRING + MemberIterator FindMember(const std::basic_string& name) const { return value_.FindMember(name); } +#endif + GenericObject AddMember(ValueType& name, ValueType& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } + GenericObject AddMember(ValueType& name, StringRefType value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } +#if RAPIDJSON_HAS_STDSTRING + GenericObject AddMember(ValueType& name, std::basic_string& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } +#endif + template RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (ValueType&)) AddMember(ValueType& name, T value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + GenericObject AddMember(ValueType&& name, ValueType&& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } + GenericObject AddMember(ValueType&& name, ValueType& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } + GenericObject AddMember(ValueType& name, ValueType&& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } + GenericObject AddMember(StringRefType name, ValueType&& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } +#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS + GenericObject AddMember(StringRefType name, ValueType& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } + GenericObject AddMember(StringRefType name, StringRefType value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } + template RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (GenericObject)) AddMember(StringRefType name, T value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; } + void RemoveAllMembers() { return value_.RemoveAllMembers(); } + bool RemoveMember(const Ch* name) const { return value_.RemoveMember(name); } +#if RAPIDJSON_HAS_STDSTRING + bool RemoveMember(const std::basic_string& name) const { return value_.RemoveMember(name); } +#endif + template bool RemoveMember(const GenericValue& name) const { return value_.RemoveMember(name); } + MemberIterator RemoveMember(MemberIterator m) const { return value_.RemoveMember(m); } + MemberIterator EraseMember(ConstMemberIterator pos) const { return value_.EraseMember(pos); } + MemberIterator EraseMember(ConstMemberIterator first, ConstMemberIterator last) const { return value_.EraseMember(first, last); } + bool EraseMember(const Ch* name) const { return value_.EraseMember(name); } +#if RAPIDJSON_HAS_STDSTRING + bool EraseMember(const std::basic_string& name) const { return EraseMember(ValueType(StringRef(name))); } +#endif + template bool EraseMember(const GenericValue& name) const { return value_.EraseMember(name); } + +#if RAPIDJSON_HAS_CXX11_RANGE_FOR + MemberIterator begin() const { return value_.MemberBegin(); } + MemberIterator end() const { return value_.MemberEnd(); } +#endif + +private: + GenericObject(); + GenericObject(ValueType& value) : value_(value) {} + ValueType& value_; +}; + +RAPIDJSON_NAMESPACE_END +RAPIDJSON_DIAG_POP + +#endif // RAPIDJSON_DOCUMENT_H_ diff --git a/include/rapidjson/encodedstream.h b/include/rapidjson/encodedstream.h new file mode 100644 index 0000000..1450683 --- /dev/null +++ b/include/rapidjson/encodedstream.h @@ -0,0 +1,299 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ENCODEDSTREAM_H_ +#define RAPIDJSON_ENCODEDSTREAM_H_ + +#include "stream.h" +#include "memorystream.h" + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! Input byte stream wrapper with a statically bound encoding. +/*! + \tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE. + \tparam InputByteStream Type of input byte stream. For example, FileReadStream. +*/ +template +class EncodedInputStream { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); +public: + typedef typename Encoding::Ch Ch; + + EncodedInputStream(InputByteStream& is) : is_(is) { + current_ = Encoding::TakeBOM(is_); + } + + Ch Peek() const { return current_; } + Ch Take() { Ch c = current_; current_ = Encoding::Take(is_); return c; } + size_t Tell() const { return is_.Tell(); } + + // Not implemented + void Put(Ch) { RAPIDJSON_ASSERT(false); } + void Flush() { RAPIDJSON_ASSERT(false); } + Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } + +private: + EncodedInputStream(const EncodedInputStream&); + EncodedInputStream& operator=(const EncodedInputStream&); + + InputByteStream& is_; + Ch current_; +}; + +//! Specialized for UTF8 MemoryStream. +template <> +class EncodedInputStream, MemoryStream> { +public: + typedef UTF8<>::Ch Ch; + + EncodedInputStream(MemoryStream& is) : is_(is) { + if (static_cast(is_.Peek()) == 0xEFu) is_.Take(); + if (static_cast(is_.Peek()) == 0xBBu) is_.Take(); + if (static_cast(is_.Peek()) == 0xBFu) is_.Take(); + } + Ch Peek() const { return is_.Peek(); } + Ch Take() { return is_.Take(); } + size_t Tell() const { return is_.Tell(); } + + // Not implemented + void Put(Ch) {} + void Flush() {} + Ch* PutBegin() { return 0; } + size_t PutEnd(Ch*) { return 0; } + + MemoryStream& is_; + +private: + EncodedInputStream(const EncodedInputStream&); + EncodedInputStream& operator=(const EncodedInputStream&); +}; + +//! Output byte stream wrapper with statically bound encoding. +/*! + \tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE. + \tparam OutputByteStream Type of input byte stream. For example, FileWriteStream. +*/ +template +class EncodedOutputStream { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); +public: + typedef typename Encoding::Ch Ch; + + EncodedOutputStream(OutputByteStream& os, bool putBOM = true) : os_(os) { + if (putBOM) + Encoding::PutBOM(os_); + } + + void Put(Ch c) { Encoding::Put(os_, c); } + void Flush() { os_.Flush(); } + + // Not implemented + Ch Peek() const { RAPIDJSON_ASSERT(false); return 0;} + Ch Take() { RAPIDJSON_ASSERT(false); return 0;} + size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; } + Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } + +private: + EncodedOutputStream(const EncodedOutputStream&); + EncodedOutputStream& operator=(const EncodedOutputStream&); + + OutputByteStream& os_; +}; + +#define RAPIDJSON_ENCODINGS_FUNC(x) UTF8::x, UTF16LE::x, UTF16BE::x, UTF32LE::x, UTF32BE::x + +//! Input stream wrapper with dynamically bound encoding and automatic encoding detection. +/*! + \tparam CharType Type of character for reading. + \tparam InputByteStream type of input byte stream to be wrapped. +*/ +template +class AutoUTFInputStream { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); +public: + typedef CharType Ch; + + //! Constructor. + /*! + \param is input stream to be wrapped. + \param type UTF encoding type if it is not detected from the stream. + */ + AutoUTFInputStream(InputByteStream& is, UTFType type = kUTF8) : is_(&is), type_(type), hasBOM_(false) { + RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE); + DetectType(); + static const TakeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Take) }; + takeFunc_ = f[type_]; + current_ = takeFunc_(*is_); + } + + UTFType GetType() const { return type_; } + bool HasBOM() const { return hasBOM_; } + + Ch Peek() const { return current_; } + Ch Take() { Ch c = current_; current_ = takeFunc_(*is_); return c; } + size_t Tell() const { return is_->Tell(); } + + // Not implemented + void Put(Ch) { RAPIDJSON_ASSERT(false); } + void Flush() { RAPIDJSON_ASSERT(false); } + Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } + +private: + AutoUTFInputStream(const AutoUTFInputStream&); + AutoUTFInputStream& operator=(const AutoUTFInputStream&); + + // Detect encoding type with BOM or RFC 4627 + void DetectType() { + // BOM (Byte Order Mark): + // 00 00 FE FF UTF-32BE + // FF FE 00 00 UTF-32LE + // FE FF UTF-16BE + // FF FE UTF-16LE + // EF BB BF UTF-8 + + const unsigned char* c = reinterpret_cast(is_->Peek4()); + if (!c) + return; + + unsigned bom = static_cast(c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24)); + hasBOM_ = false; + if (bom == 0xFFFE0000) { type_ = kUTF32BE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); } + else if (bom == 0x0000FEFF) { type_ = kUTF32LE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); } + else if ((bom & 0xFFFF) == 0xFFFE) { type_ = kUTF16BE; hasBOM_ = true; is_->Take(); is_->Take(); } + else if ((bom & 0xFFFF) == 0xFEFF) { type_ = kUTF16LE; hasBOM_ = true; is_->Take(); is_->Take(); } + else if ((bom & 0xFFFFFF) == 0xBFBBEF) { type_ = kUTF8; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); } + + // RFC 4627: Section 3 + // "Since the first two characters of a JSON text will always be ASCII + // characters [RFC0020], it is possible to determine whether an octet + // stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking + // at the pattern of nulls in the first four octets." + // 00 00 00 xx UTF-32BE + // 00 xx 00 xx UTF-16BE + // xx 00 00 00 UTF-32LE + // xx 00 xx 00 UTF-16LE + // xx xx xx xx UTF-8 + + if (!hasBOM_) { + unsigned pattern = (c[0] ? 1 : 0) | (c[1] ? 2 : 0) | (c[2] ? 4 : 0) | (c[3] ? 8 : 0); + switch (pattern) { + case 0x08: type_ = kUTF32BE; break; + case 0x0A: type_ = kUTF16BE; break; + case 0x01: type_ = kUTF32LE; break; + case 0x05: type_ = kUTF16LE; break; + case 0x0F: type_ = kUTF8; break; + default: break; // Use type defined by user. + } + } + + // Runtime check whether the size of character type is sufficient. It only perform checks with assertion. + if (type_ == kUTF16LE || type_ == kUTF16BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 2); + if (type_ == kUTF32LE || type_ == kUTF32BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 4); + } + + typedef Ch (*TakeFunc)(InputByteStream& is); + InputByteStream* is_; + UTFType type_; + Ch current_; + TakeFunc takeFunc_; + bool hasBOM_; +}; + +//! Output stream wrapper with dynamically bound encoding and automatic encoding detection. +/*! + \tparam CharType Type of character for writing. + \tparam OutputByteStream type of output byte stream to be wrapped. +*/ +template +class AutoUTFOutputStream { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); +public: + typedef CharType Ch; + + //! Constructor. + /*! + \param os output stream to be wrapped. + \param type UTF encoding type. + \param putBOM Whether to write BOM at the beginning of the stream. + */ + AutoUTFOutputStream(OutputByteStream& os, UTFType type, bool putBOM) : os_(&os), type_(type) { + RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE); + + // Runtime check whether the size of character type is sufficient. It only perform checks with assertion. + if (type_ == kUTF16LE || type_ == kUTF16BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 2); + if (type_ == kUTF32LE || type_ == kUTF32BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 4); + + static const PutFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Put) }; + putFunc_ = f[type_]; + + if (putBOM) + PutBOM(); + } + + UTFType GetType() const { return type_; } + + void Put(Ch c) { putFunc_(*os_, c); } + void Flush() { os_->Flush(); } + + // Not implemented + Ch Peek() const { RAPIDJSON_ASSERT(false); return 0;} + Ch Take() { RAPIDJSON_ASSERT(false); return 0;} + size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; } + Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } + +private: + AutoUTFOutputStream(const AutoUTFOutputStream&); + AutoUTFOutputStream& operator=(const AutoUTFOutputStream&); + + void PutBOM() { + typedef void (*PutBOMFunc)(OutputByteStream&); + static const PutBOMFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(PutBOM) }; + f[type_](*os_); + } + + typedef void (*PutFunc)(OutputByteStream&, Ch); + + OutputByteStream* os_; + UTFType type_; + PutFunc putFunc_; +}; + +#undef RAPIDJSON_ENCODINGS_FUNC + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#ifdef __GNUC__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_FILESTREAM_H_ diff --git a/include/rapidjson/encodings.h b/include/rapidjson/encodings.h new file mode 100644 index 0000000..baa7c2b --- /dev/null +++ b/include/rapidjson/encodings.h @@ -0,0 +1,716 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ENCODINGS_H_ +#define RAPIDJSON_ENCODINGS_H_ + +#include "rapidjson.h" + +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4244) // conversion from 'type1' to 'type2', possible loss of data +RAPIDJSON_DIAG_OFF(4702) // unreachable code +#elif defined(__GNUC__) +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +RAPIDJSON_DIAG_OFF(overflow) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// Encoding + +/*! \class rapidjson::Encoding + \brief Concept for encoding of Unicode characters. + +\code +concept Encoding { + typename Ch; //! Type of character. A "character" is actually a code unit in unicode's definition. + + enum { supportUnicode = 1 }; // or 0 if not supporting unicode + + //! \brief Encode a Unicode codepoint to an output stream. + //! \param os Output stream. + //! \param codepoint An unicode codepoint, ranging from 0x0 to 0x10FFFF inclusively. + template + static void Encode(OutputStream& os, unsigned codepoint); + + //! \brief Decode a Unicode codepoint from an input stream. + //! \param is Input stream. + //! \param codepoint Output of the unicode codepoint. + //! \return true if a valid codepoint can be decoded from the stream. + template + static bool Decode(InputStream& is, unsigned* codepoint); + + //! \brief Validate one Unicode codepoint from an encoded stream. + //! \param is Input stream to obtain codepoint. + //! \param os Output for copying one codepoint. + //! \return true if it is valid. + //! \note This function just validating and copying the codepoint without actually decode it. + template + static bool Validate(InputStream& is, OutputStream& os); + + // The following functions are deal with byte streams. + + //! Take a character from input byte stream, skip BOM if exist. + template + static CharType TakeBOM(InputByteStream& is); + + //! Take a character from input byte stream. + template + static Ch Take(InputByteStream& is); + + //! Put BOM to output byte stream. + template + static void PutBOM(OutputByteStream& os); + + //! Put a character to output byte stream. + template + static void Put(OutputByteStream& os, Ch c); +}; +\endcode +*/ + +/////////////////////////////////////////////////////////////////////////////// +// UTF8 + +//! UTF-8 encoding. +/*! http://en.wikipedia.org/wiki/UTF-8 + http://tools.ietf.org/html/rfc3629 + \tparam CharType Code unit for storing 8-bit UTF-8 data. Default is char. + \note implements Encoding concept +*/ +template +struct UTF8 { + typedef CharType Ch; + + enum { supportUnicode = 1 }; + + template + static void Encode(OutputStream& os, unsigned codepoint) { + if (codepoint <= 0x7F) + os.Put(static_cast(codepoint & 0xFF)); + else if (codepoint <= 0x7FF) { + os.Put(static_cast(0xC0 | ((codepoint >> 6) & 0xFF))); + os.Put(static_cast(0x80 | ((codepoint & 0x3F)))); + } + else if (codepoint <= 0xFFFF) { + os.Put(static_cast(0xE0 | ((codepoint >> 12) & 0xFF))); + os.Put(static_cast(0x80 | ((codepoint >> 6) & 0x3F))); + os.Put(static_cast(0x80 | (codepoint & 0x3F))); + } + else { + RAPIDJSON_ASSERT(codepoint <= 0x10FFFF); + os.Put(static_cast(0xF0 | ((codepoint >> 18) & 0xFF))); + os.Put(static_cast(0x80 | ((codepoint >> 12) & 0x3F))); + os.Put(static_cast(0x80 | ((codepoint >> 6) & 0x3F))); + os.Put(static_cast(0x80 | (codepoint & 0x3F))); + } + } + + template + static void EncodeUnsafe(OutputStream& os, unsigned codepoint) { + if (codepoint <= 0x7F) + PutUnsafe(os, static_cast(codepoint & 0xFF)); + else if (codepoint <= 0x7FF) { + PutUnsafe(os, static_cast(0xC0 | ((codepoint >> 6) & 0xFF))); + PutUnsafe(os, static_cast(0x80 | ((codepoint & 0x3F)))); + } + else if (codepoint <= 0xFFFF) { + PutUnsafe(os, static_cast(0xE0 | ((codepoint >> 12) & 0xFF))); + PutUnsafe(os, static_cast(0x80 | ((codepoint >> 6) & 0x3F))); + PutUnsafe(os, static_cast(0x80 | (codepoint & 0x3F))); + } + else { + RAPIDJSON_ASSERT(codepoint <= 0x10FFFF); + PutUnsafe(os, static_cast(0xF0 | ((codepoint >> 18) & 0xFF))); + PutUnsafe(os, static_cast(0x80 | ((codepoint >> 12) & 0x3F))); + PutUnsafe(os, static_cast(0x80 | ((codepoint >> 6) & 0x3F))); + PutUnsafe(os, static_cast(0x80 | (codepoint & 0x3F))); + } + } + + template + static bool Decode(InputStream& is, unsigned* codepoint) { +#define COPY() c = is.Take(); *codepoint = (*codepoint << 6) | (static_cast(c) & 0x3Fu) +#define TRANS(mask) result &= ((GetRange(static_cast(c)) & mask) != 0) +#define TAIL() COPY(); TRANS(0x70) + typename InputStream::Ch c = is.Take(); + if (!(c & 0x80)) { + *codepoint = static_cast(c); + return true; + } + + unsigned char type = GetRange(static_cast(c)); + if (type >= 32) { + *codepoint = 0; + } else { + *codepoint = (0xFF >> type) & static_cast(c); + } + bool result = true; + switch (type) { + case 2: TAIL(); return result; + case 3: TAIL(); TAIL(); return result; + case 4: COPY(); TRANS(0x50); TAIL(); return result; + case 5: COPY(); TRANS(0x10); TAIL(); TAIL(); return result; + case 6: TAIL(); TAIL(); TAIL(); return result; + case 10: COPY(); TRANS(0x20); TAIL(); return result; + case 11: COPY(); TRANS(0x60); TAIL(); TAIL(); return result; + default: return false; + } +#undef COPY +#undef TRANS +#undef TAIL + } + + template + static bool Validate(InputStream& is, OutputStream& os) { +#define COPY() os.Put(c = is.Take()) +#define TRANS(mask) result &= ((GetRange(static_cast(c)) & mask) != 0) +#define TAIL() COPY(); TRANS(0x70) + Ch c; + COPY(); + if (!(c & 0x80)) + return true; + + bool result = true; + switch (GetRange(static_cast(c))) { + case 2: TAIL(); return result; + case 3: TAIL(); TAIL(); return result; + case 4: COPY(); TRANS(0x50); TAIL(); return result; + case 5: COPY(); TRANS(0x10); TAIL(); TAIL(); return result; + case 6: TAIL(); TAIL(); TAIL(); return result; + case 10: COPY(); TRANS(0x20); TAIL(); return result; + case 11: COPY(); TRANS(0x60); TAIL(); TAIL(); return result; + default: return false; + } +#undef COPY +#undef TRANS +#undef TAIL + } + + static unsigned char GetRange(unsigned char c) { + // Referring to DFA of http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ + // With new mapping 1 -> 0x10, 7 -> 0x20, 9 -> 0x40, such that AND operation can test multiple types. + static const unsigned char type[] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8, + }; + return type[c]; + } + + template + static CharType TakeBOM(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + typename InputByteStream::Ch c = Take(is); + if (static_cast(c) != 0xEFu) return c; + c = is.Take(); + if (static_cast(c) != 0xBBu) return c; + c = is.Take(); + if (static_cast(c) != 0xBFu) return c; + c = is.Take(); + return c; + } + + template + static Ch Take(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + return static_cast(is.Take()); + } + + template + static void PutBOM(OutputByteStream& os) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast(0xEFu)); + os.Put(static_cast(0xBBu)); + os.Put(static_cast(0xBFu)); + } + + template + static void Put(OutputByteStream& os, Ch c) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast(c)); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// UTF16 + +//! UTF-16 encoding. +/*! http://en.wikipedia.org/wiki/UTF-16 + http://tools.ietf.org/html/rfc2781 + \tparam CharType Type for storing 16-bit UTF-16 data. Default is wchar_t. C++11 may use char16_t instead. + \note implements Encoding concept + + \note For in-memory access, no need to concern endianness. The code units and code points are represented by CPU's endianness. + For streaming, use UTF16LE and UTF16BE, which handle endianness. +*/ +template +struct UTF16 { + typedef CharType Ch; + RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >= 2); + + enum { supportUnicode = 1 }; + + template + static void Encode(OutputStream& os, unsigned codepoint) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 2); + if (codepoint <= 0xFFFF) { + RAPIDJSON_ASSERT(codepoint < 0xD800 || codepoint > 0xDFFF); // Code point itself cannot be surrogate pair + os.Put(static_cast(codepoint)); + } + else { + RAPIDJSON_ASSERT(codepoint <= 0x10FFFF); + unsigned v = codepoint - 0x10000; + os.Put(static_cast((v >> 10) | 0xD800)); + os.Put((v & 0x3FF) | 0xDC00); + } + } + + + template + static void EncodeUnsafe(OutputStream& os, unsigned codepoint) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 2); + if (codepoint <= 0xFFFF) { + RAPIDJSON_ASSERT(codepoint < 0xD800 || codepoint > 0xDFFF); // Code point itself cannot be surrogate pair + PutUnsafe(os, static_cast(codepoint)); + } + else { + RAPIDJSON_ASSERT(codepoint <= 0x10FFFF); + unsigned v = codepoint - 0x10000; + PutUnsafe(os, static_cast((v >> 10) | 0xD800)); + PutUnsafe(os, (v & 0x3FF) | 0xDC00); + } + } + + template + static bool Decode(InputStream& is, unsigned* codepoint) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 2); + typename InputStream::Ch c = is.Take(); + if (c < 0xD800 || c > 0xDFFF) { + *codepoint = static_cast(c); + return true; + } + else if (c <= 0xDBFF) { + *codepoint = (static_cast(c) & 0x3FF) << 10; + c = is.Take(); + *codepoint |= (static_cast(c) & 0x3FF); + *codepoint += 0x10000; + return c >= 0xDC00 && c <= 0xDFFF; + } + return false; + } + + template + static bool Validate(InputStream& is, OutputStream& os) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 2); + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 2); + typename InputStream::Ch c; + os.Put(static_cast(c = is.Take())); + if (c < 0xD800 || c > 0xDFFF) + return true; + else if (c <= 0xDBFF) { + os.Put(c = is.Take()); + return c >= 0xDC00 && c <= 0xDFFF; + } + return false; + } +}; + +//! UTF-16 little endian encoding. +template +struct UTF16LE : UTF16 { + template + static CharType TakeBOM(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + CharType c = Take(is); + return static_cast(c) == 0xFEFFu ? Take(is) : c; + } + + template + static CharType Take(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + unsigned c = static_cast(is.Take()); + c |= static_cast(static_cast(is.Take())) << 8; + return static_cast(c); + } + + template + static void PutBOM(OutputByteStream& os) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast(0xFFu)); + os.Put(static_cast(0xFEu)); + } + + template + static void Put(OutputByteStream& os, CharType c) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast(static_cast(c) & 0xFFu)); + os.Put(static_cast((static_cast(c) >> 8) & 0xFFu)); + } +}; + +//! UTF-16 big endian encoding. +template +struct UTF16BE : UTF16 { + template + static CharType TakeBOM(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + CharType c = Take(is); + return static_cast(c) == 0xFEFFu ? Take(is) : c; + } + + template + static CharType Take(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + unsigned c = static_cast(static_cast(is.Take())) << 8; + c |= static_cast(is.Take()); + return static_cast(c); + } + + template + static void PutBOM(OutputByteStream& os) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast(0xFEu)); + os.Put(static_cast(0xFFu)); + } + + template + static void Put(OutputByteStream& os, CharType c) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast((static_cast(c) >> 8) & 0xFFu)); + os.Put(static_cast(static_cast(c) & 0xFFu)); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// UTF32 + +//! UTF-32 encoding. +/*! http://en.wikipedia.org/wiki/UTF-32 + \tparam CharType Type for storing 32-bit UTF-32 data. Default is unsigned. C++11 may use char32_t instead. + \note implements Encoding concept + + \note For in-memory access, no need to concern endianness. The code units and code points are represented by CPU's endianness. + For streaming, use UTF32LE and UTF32BE, which handle endianness. +*/ +template +struct UTF32 { + typedef CharType Ch; + RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >= 4); + + enum { supportUnicode = 1 }; + + template + static void Encode(OutputStream& os, unsigned codepoint) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 4); + RAPIDJSON_ASSERT(codepoint <= 0x10FFFF); + os.Put(codepoint); + } + + template + static void EncodeUnsafe(OutputStream& os, unsigned codepoint) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 4); + RAPIDJSON_ASSERT(codepoint <= 0x10FFFF); + PutUnsafe(os, codepoint); + } + + template + static bool Decode(InputStream& is, unsigned* codepoint) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 4); + Ch c = is.Take(); + *codepoint = c; + return c <= 0x10FFFF; + } + + template + static bool Validate(InputStream& is, OutputStream& os) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 4); + Ch c; + os.Put(c = is.Take()); + return c <= 0x10FFFF; + } +}; + +//! UTF-32 little endian enocoding. +template +struct UTF32LE : UTF32 { + template + static CharType TakeBOM(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + CharType c = Take(is); + return static_cast(c) == 0x0000FEFFu ? Take(is) : c; + } + + template + static CharType Take(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + unsigned c = static_cast(is.Take()); + c |= static_cast(static_cast(is.Take())) << 8; + c |= static_cast(static_cast(is.Take())) << 16; + c |= static_cast(static_cast(is.Take())) << 24; + return static_cast(c); + } + + template + static void PutBOM(OutputByteStream& os) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast(0xFFu)); + os.Put(static_cast(0xFEu)); + os.Put(static_cast(0x00u)); + os.Put(static_cast(0x00u)); + } + + template + static void Put(OutputByteStream& os, CharType c) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast(c & 0xFFu)); + os.Put(static_cast((c >> 8) & 0xFFu)); + os.Put(static_cast((c >> 16) & 0xFFu)); + os.Put(static_cast((c >> 24) & 0xFFu)); + } +}; + +//! UTF-32 big endian encoding. +template +struct UTF32BE : UTF32 { + template + static CharType TakeBOM(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + CharType c = Take(is); + return static_cast(c) == 0x0000FEFFu ? Take(is) : c; + } + + template + static CharType Take(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + unsigned c = static_cast(static_cast(is.Take())) << 24; + c |= static_cast(static_cast(is.Take())) << 16; + c |= static_cast(static_cast(is.Take())) << 8; + c |= static_cast(static_cast(is.Take())); + return static_cast(c); + } + + template + static void PutBOM(OutputByteStream& os) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast(0x00u)); + os.Put(static_cast(0x00u)); + os.Put(static_cast(0xFEu)); + os.Put(static_cast(0xFFu)); + } + + template + static void Put(OutputByteStream& os, CharType c) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast((c >> 24) & 0xFFu)); + os.Put(static_cast((c >> 16) & 0xFFu)); + os.Put(static_cast((c >> 8) & 0xFFu)); + os.Put(static_cast(c & 0xFFu)); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// ASCII + +//! ASCII encoding. +/*! http://en.wikipedia.org/wiki/ASCII + \tparam CharType Code unit for storing 7-bit ASCII data. Default is char. + \note implements Encoding concept +*/ +template +struct ASCII { + typedef CharType Ch; + + enum { supportUnicode = 0 }; + + template + static void Encode(OutputStream& os, unsigned codepoint) { + RAPIDJSON_ASSERT(codepoint <= 0x7F); + os.Put(static_cast(codepoint & 0xFF)); + } + + template + static void EncodeUnsafe(OutputStream& os, unsigned codepoint) { + RAPIDJSON_ASSERT(codepoint <= 0x7F); + PutUnsafe(os, static_cast(codepoint & 0xFF)); + } + + template + static bool Decode(InputStream& is, unsigned* codepoint) { + uint8_t c = static_cast(is.Take()); + *codepoint = c; + return c <= 0X7F; + } + + template + static bool Validate(InputStream& is, OutputStream& os) { + uint8_t c = static_cast(is.Take()); + os.Put(static_cast(c)); + return c <= 0x7F; + } + + template + static CharType TakeBOM(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + uint8_t c = static_cast(Take(is)); + return static_cast(c); + } + + template + static Ch Take(InputByteStream& is) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1); + return static_cast(is.Take()); + } + + template + static void PutBOM(OutputByteStream& os) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + (void)os; + } + + template + static void Put(OutputByteStream& os, Ch c) { + RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1); + os.Put(static_cast(c)); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// AutoUTF + +//! Runtime-specified UTF encoding type of a stream. +enum UTFType { + kUTF8 = 0, //!< UTF-8. + kUTF16LE = 1, //!< UTF-16 little endian. + kUTF16BE = 2, //!< UTF-16 big endian. + kUTF32LE = 3, //!< UTF-32 little endian. + kUTF32BE = 4 //!< UTF-32 big endian. +}; + +//! Dynamically select encoding according to stream's runtime-specified UTF encoding type. +/*! \note This class can be used with AutoUTFInputtStream and AutoUTFOutputStream, which provides GetType(). +*/ +template +struct AutoUTF { + typedef CharType Ch; + + enum { supportUnicode = 1 }; + +#define RAPIDJSON_ENCODINGS_FUNC(x) UTF8::x, UTF16LE::x, UTF16BE::x, UTF32LE::x, UTF32BE::x + + template + RAPIDJSON_FORCEINLINE static void Encode(OutputStream& os, unsigned codepoint) { + typedef void (*EncodeFunc)(OutputStream&, unsigned); + static const EncodeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Encode) }; + (*f[os.GetType()])(os, codepoint); + } + + template + RAPIDJSON_FORCEINLINE static void EncodeUnsafe(OutputStream& os, unsigned codepoint) { + typedef void (*EncodeFunc)(OutputStream&, unsigned); + static const EncodeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(EncodeUnsafe) }; + (*f[os.GetType()])(os, codepoint); + } + + template + RAPIDJSON_FORCEINLINE static bool Decode(InputStream& is, unsigned* codepoint) { + typedef bool (*DecodeFunc)(InputStream&, unsigned*); + static const DecodeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Decode) }; + return (*f[is.GetType()])(is, codepoint); + } + + template + RAPIDJSON_FORCEINLINE static bool Validate(InputStream& is, OutputStream& os) { + typedef bool (*ValidateFunc)(InputStream&, OutputStream&); + static const ValidateFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Validate) }; + return (*f[is.GetType()])(is, os); + } + +#undef RAPIDJSON_ENCODINGS_FUNC +}; + +/////////////////////////////////////////////////////////////////////////////// +// Transcoder + +//! Encoding conversion. +template +struct Transcoder { + //! Take one Unicode codepoint from source encoding, convert it to target encoding and put it to the output stream. + template + RAPIDJSON_FORCEINLINE static bool Transcode(InputStream& is, OutputStream& os) { + unsigned codepoint; + if (!SourceEncoding::Decode(is, &codepoint)) + return false; + TargetEncoding::Encode(os, codepoint); + return true; + } + + template + RAPIDJSON_FORCEINLINE static bool TranscodeUnsafe(InputStream& is, OutputStream& os) { + unsigned codepoint; + if (!SourceEncoding::Decode(is, &codepoint)) + return false; + TargetEncoding::EncodeUnsafe(os, codepoint); + return true; + } + + //! Validate one Unicode codepoint from an encoded stream. + template + RAPIDJSON_FORCEINLINE static bool Validate(InputStream& is, OutputStream& os) { + return Transcode(is, os); // Since source/target encoding is different, must transcode. + } +}; + +// Forward declaration. +template +inline void PutUnsafe(Stream& stream, typename Stream::Ch c); + +//! Specialization of Transcoder with same source and target encoding. +template +struct Transcoder { + template + RAPIDJSON_FORCEINLINE static bool Transcode(InputStream& is, OutputStream& os) { + os.Put(is.Take()); // Just copy one code unit. This semantic is different from primary template class. + return true; + } + + template + RAPIDJSON_FORCEINLINE static bool TranscodeUnsafe(InputStream& is, OutputStream& os) { + PutUnsafe(os, is.Take()); // Just copy one code unit. This semantic is different from primary template class. + return true; + } + + template + RAPIDJSON_FORCEINLINE static bool Validate(InputStream& is, OutputStream& os) { + return Encoding::Validate(is, os); // source/target encoding are the same + } +}; + +RAPIDJSON_NAMESPACE_END + +#if defined(__GNUC__) || defined(_MSC_VER) +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_ENCODINGS_H_ diff --git a/include/rapidjson/error/en.h b/include/rapidjson/error/en.h new file mode 100644 index 0000000..2db838b --- /dev/null +++ b/include/rapidjson/error/en.h @@ -0,0 +1,74 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ERROR_EN_H_ +#define RAPIDJSON_ERROR_EN_H_ + +#include "error.h" + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(switch-enum) +RAPIDJSON_DIAG_OFF(covered-switch-default) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! Maps error code of parsing into error message. +/*! + \ingroup RAPIDJSON_ERRORS + \param parseErrorCode Error code obtained in parsing. + \return the error message. + \note User can make a copy of this function for localization. + Using switch-case is safer for future modification of error codes. +*/ +inline const RAPIDJSON_ERROR_CHARTYPE* GetParseError_En(ParseErrorCode parseErrorCode) { + switch (parseErrorCode) { + case kParseErrorNone: return RAPIDJSON_ERROR_STRING("No error."); + + case kParseErrorDocumentEmpty: return RAPIDJSON_ERROR_STRING("The document is empty."); + case kParseErrorDocumentRootNotSingular: return RAPIDJSON_ERROR_STRING("The document root must not be followed by other values."); + + case kParseErrorValueInvalid: return RAPIDJSON_ERROR_STRING("Invalid value."); + + case kParseErrorObjectMissName: return RAPIDJSON_ERROR_STRING("Missing a name for object member."); + case kParseErrorObjectMissColon: return RAPIDJSON_ERROR_STRING("Missing a colon after a name of object member."); + case kParseErrorObjectMissCommaOrCurlyBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or '}' after an object member."); + + case kParseErrorArrayMissCommaOrSquareBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or ']' after an array element."); + + case kParseErrorStringUnicodeEscapeInvalidHex: return RAPIDJSON_ERROR_STRING("Incorrect hex digit after \\u escape in string."); + case kParseErrorStringUnicodeSurrogateInvalid: return RAPIDJSON_ERROR_STRING("The surrogate pair in string is invalid."); + case kParseErrorStringEscapeInvalid: return RAPIDJSON_ERROR_STRING("Invalid escape character in string."); + case kParseErrorStringMissQuotationMark: return RAPIDJSON_ERROR_STRING("Missing a closing quotation mark in string."); + case kParseErrorStringInvalidEncoding: return RAPIDJSON_ERROR_STRING("Invalid encoding in string."); + + case kParseErrorNumberTooBig: return RAPIDJSON_ERROR_STRING("Number too big to be stored in double."); + case kParseErrorNumberMissFraction: return RAPIDJSON_ERROR_STRING("Miss fraction part in number."); + case kParseErrorNumberMissExponent: return RAPIDJSON_ERROR_STRING("Miss exponent in number."); + + case kParseErrorTermination: return RAPIDJSON_ERROR_STRING("Terminate parsing due to Handler error."); + case kParseErrorUnspecificSyntaxError: return RAPIDJSON_ERROR_STRING("Unspecific syntax error."); + + default: return RAPIDJSON_ERROR_STRING("Unknown error."); + } +} + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_ERROR_EN_H_ diff --git a/include/rapidjson/error/error.h b/include/rapidjson/error/error.h new file mode 100644 index 0000000..95cb31a --- /dev/null +++ b/include/rapidjson/error/error.h @@ -0,0 +1,155 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ERROR_ERROR_H_ +#define RAPIDJSON_ERROR_ERROR_H_ + +#include "../rapidjson.h" + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +#endif + +/*! \file error.h */ + +/*! \defgroup RAPIDJSON_ERRORS RapidJSON error handling */ + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_ERROR_CHARTYPE + +//! Character type of error messages. +/*! \ingroup RAPIDJSON_ERRORS + The default character type is \c char. + On Windows, user can define this macro as \c TCHAR for supporting both + unicode/non-unicode settings. +*/ +#ifndef RAPIDJSON_ERROR_CHARTYPE +#define RAPIDJSON_ERROR_CHARTYPE char +#endif + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_ERROR_STRING + +//! Macro for converting string literial to \ref RAPIDJSON_ERROR_CHARTYPE[]. +/*! \ingroup RAPIDJSON_ERRORS + By default this conversion macro does nothing. + On Windows, user can define this macro as \c _T(x) for supporting both + unicode/non-unicode settings. +*/ +#ifndef RAPIDJSON_ERROR_STRING +#define RAPIDJSON_ERROR_STRING(x) x +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// ParseErrorCode + +//! Error code of parsing. +/*! \ingroup RAPIDJSON_ERRORS + \see GenericReader::Parse, GenericReader::GetParseErrorCode +*/ +enum ParseErrorCode { + kParseErrorNone = 0, //!< No error. + + kParseErrorDocumentEmpty, //!< The document is empty. + kParseErrorDocumentRootNotSingular, //!< The document root must not follow by other values. + + kParseErrorValueInvalid, //!< Invalid value. + + kParseErrorObjectMissName, //!< Missing a name for object member. + kParseErrorObjectMissColon, //!< Missing a colon after a name of object member. + kParseErrorObjectMissCommaOrCurlyBracket, //!< Missing a comma or '}' after an object member. + + kParseErrorArrayMissCommaOrSquareBracket, //!< Missing a comma or ']' after an array element. + + kParseErrorStringUnicodeEscapeInvalidHex, //!< Incorrect hex digit after \\u escape in string. + kParseErrorStringUnicodeSurrogateInvalid, //!< The surrogate pair in string is invalid. + kParseErrorStringEscapeInvalid, //!< Invalid escape character in string. + kParseErrorStringMissQuotationMark, //!< Missing a closing quotation mark in string. + kParseErrorStringInvalidEncoding, //!< Invalid encoding in string. + + kParseErrorNumberTooBig, //!< Number too big to be stored in double. + kParseErrorNumberMissFraction, //!< Miss fraction part in number. + kParseErrorNumberMissExponent, //!< Miss exponent in number. + + kParseErrorTermination, //!< Parsing was terminated. + kParseErrorUnspecificSyntaxError //!< Unspecific syntax error. +}; + +//! Result of parsing (wraps ParseErrorCode) +/*! + \ingroup RAPIDJSON_ERRORS + \code + Document doc; + ParseResult ok = doc.Parse("[42]"); + if (!ok) { + fprintf(stderr, "JSON parse error: %s (%u)", + GetParseError_En(ok.Code()), ok.Offset()); + exit(EXIT_FAILURE); + } + \endcode + \see GenericReader::Parse, GenericDocument::Parse +*/ +struct ParseResult { +public: + //! Default constructor, no error. + ParseResult() : code_(kParseErrorNone), offset_(0) {} + //! Constructor to set an error. + ParseResult(ParseErrorCode code, size_t offset) : code_(code), offset_(offset) {} + + //! Get the error code. + ParseErrorCode Code() const { return code_; } + //! Get the error offset, if \ref IsError(), 0 otherwise. + size_t Offset() const { return offset_; } + + //! Conversion to \c bool, returns \c true, iff !\ref IsError(). + operator bool() const { return !IsError(); } + //! Whether the result is an error. + bool IsError() const { return code_ != kParseErrorNone; } + + bool operator==(const ParseResult& that) const { return code_ == that.code_; } + bool operator==(ParseErrorCode code) const { return code_ == code; } + friend bool operator==(ParseErrorCode code, const ParseResult & err) { return code == err.code_; } + + //! Reset error code. + void Clear() { Set(kParseErrorNone); } + //! Update error code and offset. + void Set(ParseErrorCode code, size_t offset = 0) { code_ = code; offset_ = offset; } + +private: + ParseErrorCode code_; + size_t offset_; +}; + +//! Function pointer type of GetParseError(). +/*! \ingroup RAPIDJSON_ERRORS + + This is the prototype for \c GetParseError_X(), where \c X is a locale. + User can dynamically change locale in runtime, e.g.: +\code + GetParseErrorFunc GetParseError = GetParseError_En; // or whatever + const RAPIDJSON_ERROR_CHARTYPE* s = GetParseError(document.GetParseErrorCode()); +\endcode +*/ +typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetParseErrorFunc)(ParseErrorCode); + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_ERROR_ERROR_H_ diff --git a/include/rapidjson/filereadstream.h b/include/rapidjson/filereadstream.h new file mode 100644 index 0000000..b56ea13 --- /dev/null +++ b/include/rapidjson/filereadstream.h @@ -0,0 +1,99 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_FILEREADSTREAM_H_ +#define RAPIDJSON_FILEREADSTREAM_H_ + +#include "stream.h" +#include + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +RAPIDJSON_DIAG_OFF(unreachable-code) +RAPIDJSON_DIAG_OFF(missing-noreturn) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! File byte stream for input using fread(). +/*! + \note implements Stream concept +*/ +class FileReadStream { +public: + typedef char Ch; //!< Character type (byte). + + //! Constructor. + /*! + \param fp File pointer opened for read. + \param buffer user-supplied buffer. + \param bufferSize size of buffer in bytes. Must >=4 bytes. + */ + FileReadStream(std::FILE* fp, char* buffer, size_t bufferSize) : fp_(fp), buffer_(buffer), bufferSize_(bufferSize), bufferLast_(0), current_(buffer_), readCount_(0), count_(0), eof_(false) { + RAPIDJSON_ASSERT(fp_ != 0); + RAPIDJSON_ASSERT(bufferSize >= 4); + Read(); + } + + Ch Peek() const { return *current_; } + Ch Take() { Ch c = *current_; Read(); return c; } + size_t Tell() const { return count_ + static_cast(current_ - buffer_); } + + // Not implemented + void Put(Ch) { RAPIDJSON_ASSERT(false); } + void Flush() { RAPIDJSON_ASSERT(false); } + Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } + + // For encoding detection only. + const Ch* Peek4() const { + return (current_ + 4 <= bufferLast_) ? current_ : 0; + } + +private: + void Read() { + if (current_ < bufferLast_) + ++current_; + else if (!eof_) { + count_ += readCount_; + readCount_ = fread(buffer_, 1, bufferSize_, fp_); + bufferLast_ = buffer_ + readCount_ - 1; + current_ = buffer_; + + if (readCount_ < bufferSize_) { + buffer_[readCount_] = '\0'; + ++bufferLast_; + eof_ = true; + } + } + } + + std::FILE* fp_; + Ch *buffer_; + size_t bufferSize_; + Ch *bufferLast_; + Ch *current_; + size_t readCount_; + size_t count_; //!< Number of characters read + bool eof_; +}; + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_FILESTREAM_H_ diff --git a/include/rapidjson/filewritestream.h b/include/rapidjson/filewritestream.h new file mode 100644 index 0000000..6378dd6 --- /dev/null +++ b/include/rapidjson/filewritestream.h @@ -0,0 +1,104 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_FILEWRITESTREAM_H_ +#define RAPIDJSON_FILEWRITESTREAM_H_ + +#include "stream.h" +#include + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(unreachable-code) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! Wrapper of C file stream for input using fread(). +/*! + \note implements Stream concept +*/ +class FileWriteStream { +public: + typedef char Ch; //!< Character type. Only support char. + + FileWriteStream(std::FILE* fp, char* buffer, size_t bufferSize) : fp_(fp), buffer_(buffer), bufferEnd_(buffer + bufferSize), current_(buffer_) { + RAPIDJSON_ASSERT(fp_ != 0); + } + + void Put(char c) { + if (current_ >= bufferEnd_) + Flush(); + + *current_++ = c; + } + + void PutN(char c, size_t n) { + size_t avail = static_cast(bufferEnd_ - current_); + while (n > avail) { + std::memset(current_, c, avail); + current_ += avail; + Flush(); + n -= avail; + avail = static_cast(bufferEnd_ - current_); + } + + if (n > 0) { + std::memset(current_, c, n); + current_ += n; + } + } + + void Flush() { + if (current_ != buffer_) { + size_t result = fwrite(buffer_, 1, static_cast(current_ - buffer_), fp_); + if (result < static_cast(current_ - buffer_)) { + // failure deliberately ignored at this time + // added to avoid warn_unused_result build errors + } + current_ = buffer_; + } + } + + // Not implemented + char Peek() const { RAPIDJSON_ASSERT(false); return 0; } + char Take() { RAPIDJSON_ASSERT(false); return 0; } + size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; } + char* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + size_t PutEnd(char*) { RAPIDJSON_ASSERT(false); return 0; } + +private: + // Prohibit copy constructor & assignment operator. + FileWriteStream(const FileWriteStream&); + FileWriteStream& operator=(const FileWriteStream&); + + std::FILE* fp_; + char *buffer_; + char *bufferEnd_; + char *current_; +}; + +//! Implement specialized version of PutN() with memset() for better performance. +template<> +inline void PutN(FileWriteStream& stream, char c, size_t n) { + stream.PutN(c, n); +} + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_FILESTREAM_H_ diff --git a/include/rapidjson/fwd.h b/include/rapidjson/fwd.h new file mode 100644 index 0000000..e8104e8 --- /dev/null +++ b/include/rapidjson/fwd.h @@ -0,0 +1,151 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_FWD_H_ +#define RAPIDJSON_FWD_H_ + +#include "rapidjson.h" + +RAPIDJSON_NAMESPACE_BEGIN + +// encodings.h + +template struct UTF8; +template struct UTF16; +template struct UTF16BE; +template struct UTF16LE; +template struct UTF32; +template struct UTF32BE; +template struct UTF32LE; +template struct ASCII; +template struct AutoUTF; + +template +struct Transcoder; + +// allocators.h + +class CrtAllocator; + +template +class MemoryPoolAllocator; + +// stream.h + +template +struct GenericStringStream; + +typedef GenericStringStream > StringStream; + +template +struct GenericInsituStringStream; + +typedef GenericInsituStringStream > InsituStringStream; + +// stringbuffer.h + +template +class GenericStringBuffer; + +typedef GenericStringBuffer, CrtAllocator> StringBuffer; + +// filereadstream.h + +class FileReadStream; + +// filewritestream.h + +class FileWriteStream; + +// memorybuffer.h + +template +struct GenericMemoryBuffer; + +typedef GenericMemoryBuffer MemoryBuffer; + +// memorystream.h + +struct MemoryStream; + +// reader.h + +template +struct BaseReaderHandler; + +template +class GenericReader; + +typedef GenericReader, UTF8, CrtAllocator> Reader; + +// writer.h + +template +class Writer; + +// prettywriter.h + +template +class PrettyWriter; + +// document.h + +template +struct GenericMember; + +template +class GenericMemberIterator; + +template +struct GenericStringRef; + +template +class GenericValue; + +typedef GenericValue, MemoryPoolAllocator > Value; + +template +class GenericDocument; + +typedef GenericDocument, MemoryPoolAllocator, CrtAllocator> Document; + +// pointer.h + +template +class GenericPointer; + +typedef GenericPointer Pointer; + +// schema.h + +template +class IGenericRemoteSchemaDocumentProvider; + +template +class GenericSchemaDocument; + +typedef GenericSchemaDocument SchemaDocument; +typedef IGenericRemoteSchemaDocumentProvider IRemoteSchemaDocumentProvider; + +template < + typename SchemaDocumentType, + typename OutputHandler, + typename StateAllocator> +class GenericSchemaValidator; + +typedef GenericSchemaValidator, void>, CrtAllocator> SchemaValidator; + +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_RAPIDJSONFWD_H_ diff --git a/include/rapidjson/internal/biginteger.h b/include/rapidjson/internal/biginteger.h new file mode 100644 index 0000000..9d3e88c --- /dev/null +++ b/include/rapidjson/internal/biginteger.h @@ -0,0 +1,290 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_BIGINTEGER_H_ +#define RAPIDJSON_BIGINTEGER_H_ + +#include "../rapidjson.h" + +#if defined(_MSC_VER) && defined(_M_AMD64) +#include // for _umul128 +#pragma intrinsic(_umul128) +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +class BigInteger { +public: + typedef uint64_t Type; + + BigInteger(const BigInteger& rhs) : count_(rhs.count_) { + std::memcpy(digits_, rhs.digits_, count_ * sizeof(Type)); + } + + explicit BigInteger(uint64_t u) : count_(1) { + digits_[0] = u; + } + + BigInteger(const char* decimals, size_t length) : count_(1) { + RAPIDJSON_ASSERT(length > 0); + digits_[0] = 0; + size_t i = 0; + const size_t kMaxDigitPerIteration = 19; // 2^64 = 18446744073709551616 > 10^19 + while (length >= kMaxDigitPerIteration) { + AppendDecimal64(decimals + i, decimals + i + kMaxDigitPerIteration); + length -= kMaxDigitPerIteration; + i += kMaxDigitPerIteration; + } + + if (length > 0) + AppendDecimal64(decimals + i, decimals + i + length); + } + + BigInteger& operator=(const BigInteger &rhs) + { + if (this != &rhs) { + count_ = rhs.count_; + std::memcpy(digits_, rhs.digits_, count_ * sizeof(Type)); + } + return *this; + } + + BigInteger& operator=(uint64_t u) { + digits_[0] = u; + count_ = 1; + return *this; + } + + BigInteger& operator+=(uint64_t u) { + Type backup = digits_[0]; + digits_[0] += u; + for (size_t i = 0; i < count_ - 1; i++) { + if (digits_[i] >= backup) + return *this; // no carry + backup = digits_[i + 1]; + digits_[i + 1] += 1; + } + + // Last carry + if (digits_[count_ - 1] < backup) + PushBack(1); + + return *this; + } + + BigInteger& operator*=(uint64_t u) { + if (u == 0) return *this = 0; + if (u == 1) return *this; + if (*this == 1) return *this = u; + + uint64_t k = 0; + for (size_t i = 0; i < count_; i++) { + uint64_t hi; + digits_[i] = MulAdd64(digits_[i], u, k, &hi); + k = hi; + } + + if (k > 0) + PushBack(k); + + return *this; + } + + BigInteger& operator*=(uint32_t u) { + if (u == 0) return *this = 0; + if (u == 1) return *this; + if (*this == 1) return *this = u; + + uint64_t k = 0; + for (size_t i = 0; i < count_; i++) { + const uint64_t c = digits_[i] >> 32; + const uint64_t d = digits_[i] & 0xFFFFFFFF; + const uint64_t uc = u * c; + const uint64_t ud = u * d; + const uint64_t p0 = ud + k; + const uint64_t p1 = uc + (p0 >> 32); + digits_[i] = (p0 & 0xFFFFFFFF) | (p1 << 32); + k = p1 >> 32; + } + + if (k > 0) + PushBack(k); + + return *this; + } + + BigInteger& operator<<=(size_t shift) { + if (IsZero() || shift == 0) return *this; + + size_t offset = shift / kTypeBit; + size_t interShift = shift % kTypeBit; + RAPIDJSON_ASSERT(count_ + offset <= kCapacity); + + if (interShift == 0) { + std::memmove(&digits_[count_ - 1 + offset], &digits_[count_ - 1], count_ * sizeof(Type)); + count_ += offset; + } + else { + digits_[count_] = 0; + for (size_t i = count_; i > 0; i--) + digits_[i + offset] = (digits_[i] << interShift) | (digits_[i - 1] >> (kTypeBit - interShift)); + digits_[offset] = digits_[0] << interShift; + count_ += offset; + if (digits_[count_]) + count_++; + } + + std::memset(digits_, 0, offset * sizeof(Type)); + + return *this; + } + + bool operator==(const BigInteger& rhs) const { + return count_ == rhs.count_ && std::memcmp(digits_, rhs.digits_, count_ * sizeof(Type)) == 0; + } + + bool operator==(const Type rhs) const { + return count_ == 1 && digits_[0] == rhs; + } + + BigInteger& MultiplyPow5(unsigned exp) { + static const uint32_t kPow5[12] = { + 5, + 5 * 5, + 5 * 5 * 5, + 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 + }; + if (exp == 0) return *this; + for (; exp >= 27; exp -= 27) *this *= RAPIDJSON_UINT64_C2(0X6765C793, 0XFA10079D); // 5^27 + for (; exp >= 13; exp -= 13) *this *= static_cast(1220703125u); // 5^13 + if (exp > 0) *this *= kPow5[exp - 1]; + return *this; + } + + // Compute absolute difference of this and rhs. + // Assume this != rhs + bool Difference(const BigInteger& rhs, BigInteger* out) const { + int cmp = Compare(rhs); + RAPIDJSON_ASSERT(cmp != 0); + const BigInteger *a, *b; // Makes a > b + bool ret; + if (cmp < 0) { a = &rhs; b = this; ret = true; } + else { a = this; b = &rhs; ret = false; } + + Type borrow = 0; + for (size_t i = 0; i < a->count_; i++) { + Type d = a->digits_[i] - borrow; + if (i < b->count_) + d -= b->digits_[i]; + borrow = (d > a->digits_[i]) ? 1 : 0; + out->digits_[i] = d; + if (d != 0) + out->count_ = i + 1; + } + + return ret; + } + + int Compare(const BigInteger& rhs) const { + if (count_ != rhs.count_) + return count_ < rhs.count_ ? -1 : 1; + + for (size_t i = count_; i-- > 0;) + if (digits_[i] != rhs.digits_[i]) + return digits_[i] < rhs.digits_[i] ? -1 : 1; + + return 0; + } + + size_t GetCount() const { return count_; } + Type GetDigit(size_t index) const { RAPIDJSON_ASSERT(index < count_); return digits_[index]; } + bool IsZero() const { return count_ == 1 && digits_[0] == 0; } + +private: + void AppendDecimal64(const char* begin, const char* end) { + uint64_t u = ParseUint64(begin, end); + if (IsZero()) + *this = u; + else { + unsigned exp = static_cast(end - begin); + (MultiplyPow5(exp) <<= exp) += u; // *this = *this * 10^exp + u + } + } + + void PushBack(Type digit) { + RAPIDJSON_ASSERT(count_ < kCapacity); + digits_[count_++] = digit; + } + + static uint64_t ParseUint64(const char* begin, const char* end) { + uint64_t r = 0; + for (const char* p = begin; p != end; ++p) { + RAPIDJSON_ASSERT(*p >= '0' && *p <= '9'); + r = r * 10u + static_cast(*p - '0'); + } + return r; + } + + // Assume a * b + k < 2^128 + static uint64_t MulAdd64(uint64_t a, uint64_t b, uint64_t k, uint64_t* outHigh) { +#if defined(_MSC_VER) && defined(_M_AMD64) + uint64_t low = _umul128(a, b, outHigh) + k; + if (low < k) + (*outHigh)++; + return low; +#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) + __extension__ typedef unsigned __int128 uint128; + uint128 p = static_cast(a) * static_cast(b); + p += k; + *outHigh = static_cast(p >> 64); + return static_cast(p); +#else + const uint64_t a0 = a & 0xFFFFFFFF, a1 = a >> 32, b0 = b & 0xFFFFFFFF, b1 = b >> 32; + uint64_t x0 = a0 * b0, x1 = a0 * b1, x2 = a1 * b0, x3 = a1 * b1; + x1 += (x0 >> 32); // can't give carry + x1 += x2; + if (x1 < x2) + x3 += (static_cast(1) << 32); + uint64_t lo = (x1 << 32) + (x0 & 0xFFFFFFFF); + uint64_t hi = x3 + (x1 >> 32); + + lo += k; + if (lo < k) + hi++; + *outHigh = hi; + return lo; +#endif + } + + static const size_t kBitCount = 3328; // 64bit * 54 > 10^1000 + static const size_t kCapacity = kBitCount / sizeof(Type); + static const size_t kTypeBit = sizeof(Type) * 8; + + Type digits_[kCapacity]; + size_t count_; +}; + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_BIGINTEGER_H_ diff --git a/include/rapidjson/internal/diyfp.h b/include/rapidjson/internal/diyfp.h new file mode 100644 index 0000000..c9fefdc --- /dev/null +++ b/include/rapidjson/internal/diyfp.h @@ -0,0 +1,258 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +// This is a C++ header-only implementation of Grisu2 algorithm from the publication: +// Loitsch, Florian. "Printing floating-point numbers quickly and accurately with +// integers." ACM Sigplan Notices 45.6 (2010): 233-243. + +#ifndef RAPIDJSON_DIYFP_H_ +#define RAPIDJSON_DIYFP_H_ + +#include "../rapidjson.h" + +#if defined(_MSC_VER) && defined(_M_AMD64) +#include +#pragma intrinsic(_BitScanReverse64) +#pragma intrinsic(_umul128) +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +#endif + +struct DiyFp { + DiyFp() : f(), e() {} + + DiyFp(uint64_t fp, int exp) : f(fp), e(exp) {} + + explicit DiyFp(double d) { + union { + double d; + uint64_t u64; + } u = { d }; + + int biased_e = static_cast((u.u64 & kDpExponentMask) >> kDpSignificandSize); + uint64_t significand = (u.u64 & kDpSignificandMask); + if (biased_e != 0) { + f = significand + kDpHiddenBit; + e = biased_e - kDpExponentBias; + } + else { + f = significand; + e = kDpMinExponent + 1; + } + } + + DiyFp operator-(const DiyFp& rhs) const { + return DiyFp(f - rhs.f, e); + } + + DiyFp operator*(const DiyFp& rhs) const { +#if defined(_MSC_VER) && defined(_M_AMD64) + uint64_t h; + uint64_t l = _umul128(f, rhs.f, &h); + if (l & (uint64_t(1) << 63)) // rounding + h++; + return DiyFp(h, e + rhs.e + 64); +#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) + __extension__ typedef unsigned __int128 uint128; + uint128 p = static_cast(f) * static_cast(rhs.f); + uint64_t h = static_cast(p >> 64); + uint64_t l = static_cast(p); + if (l & (uint64_t(1) << 63)) // rounding + h++; + return DiyFp(h, e + rhs.e + 64); +#else + const uint64_t M32 = 0xFFFFFFFF; + const uint64_t a = f >> 32; + const uint64_t b = f & M32; + const uint64_t c = rhs.f >> 32; + const uint64_t d = rhs.f & M32; + const uint64_t ac = a * c; + const uint64_t bc = b * c; + const uint64_t ad = a * d; + const uint64_t bd = b * d; + uint64_t tmp = (bd >> 32) + (ad & M32) + (bc & M32); + tmp += 1U << 31; /// mult_round + return DiyFp(ac + (ad >> 32) + (bc >> 32) + (tmp >> 32), e + rhs.e + 64); +#endif + } + + DiyFp Normalize() const { +#if defined(_MSC_VER) && defined(_M_AMD64) + unsigned long index; + _BitScanReverse64(&index, f); + return DiyFp(f << (63 - index), e - (63 - index)); +#elif defined(__GNUC__) && __GNUC__ >= 4 + int s = __builtin_clzll(f); + return DiyFp(f << s, e - s); +#else + DiyFp res = *this; + while (!(res.f & (static_cast(1) << 63))) { + res.f <<= 1; + res.e--; + } + return res; +#endif + } + + DiyFp NormalizeBoundary() const { + DiyFp res = *this; + while (!(res.f & (kDpHiddenBit << 1))) { + res.f <<= 1; + res.e--; + } + res.f <<= (kDiySignificandSize - kDpSignificandSize - 2); + res.e = res.e - (kDiySignificandSize - kDpSignificandSize - 2); + return res; + } + + void NormalizedBoundaries(DiyFp* minus, DiyFp* plus) const { + DiyFp pl = DiyFp((f << 1) + 1, e - 1).NormalizeBoundary(); + DiyFp mi = (f == kDpHiddenBit) ? DiyFp((f << 2) - 1, e - 2) : DiyFp((f << 1) - 1, e - 1); + mi.f <<= mi.e - pl.e; + mi.e = pl.e; + *plus = pl; + *minus = mi; + } + + double ToDouble() const { + union { + double d; + uint64_t u64; + }u; + const uint64_t be = (e == kDpDenormalExponent && (f & kDpHiddenBit) == 0) ? 0 : + static_cast(e + kDpExponentBias); + u.u64 = (f & kDpSignificandMask) | (be << kDpSignificandSize); + return u.d; + } + + static const int kDiySignificandSize = 64; + static const int kDpSignificandSize = 52; + static const int kDpExponentBias = 0x3FF + kDpSignificandSize; + static const int kDpMaxExponent = 0x7FF - kDpExponentBias; + static const int kDpMinExponent = -kDpExponentBias; + static const int kDpDenormalExponent = -kDpExponentBias + 1; + static const uint64_t kDpExponentMask = RAPIDJSON_UINT64_C2(0x7FF00000, 0x00000000); + static const uint64_t kDpSignificandMask = RAPIDJSON_UINT64_C2(0x000FFFFF, 0xFFFFFFFF); + static const uint64_t kDpHiddenBit = RAPIDJSON_UINT64_C2(0x00100000, 0x00000000); + + uint64_t f; + int e; +}; + +inline DiyFp GetCachedPowerByIndex(size_t index) { + // 10^-348, 10^-340, ..., 10^340 + static const uint64_t kCachedPowers_F[] = { + RAPIDJSON_UINT64_C2(0xfa8fd5a0, 0x081c0288), RAPIDJSON_UINT64_C2(0xbaaee17f, 0xa23ebf76), + RAPIDJSON_UINT64_C2(0x8b16fb20, 0x3055ac76), RAPIDJSON_UINT64_C2(0xcf42894a, 0x5dce35ea), + RAPIDJSON_UINT64_C2(0x9a6bb0aa, 0x55653b2d), RAPIDJSON_UINT64_C2(0xe61acf03, 0x3d1a45df), + RAPIDJSON_UINT64_C2(0xab70fe17, 0xc79ac6ca), RAPIDJSON_UINT64_C2(0xff77b1fc, 0xbebcdc4f), + RAPIDJSON_UINT64_C2(0xbe5691ef, 0x416bd60c), RAPIDJSON_UINT64_C2(0x8dd01fad, 0x907ffc3c), + RAPIDJSON_UINT64_C2(0xd3515c28, 0x31559a83), RAPIDJSON_UINT64_C2(0x9d71ac8f, 0xada6c9b5), + RAPIDJSON_UINT64_C2(0xea9c2277, 0x23ee8bcb), RAPIDJSON_UINT64_C2(0xaecc4991, 0x4078536d), + RAPIDJSON_UINT64_C2(0x823c1279, 0x5db6ce57), RAPIDJSON_UINT64_C2(0xc2109436, 0x4dfb5637), + RAPIDJSON_UINT64_C2(0x9096ea6f, 0x3848984f), RAPIDJSON_UINT64_C2(0xd77485cb, 0x25823ac7), + RAPIDJSON_UINT64_C2(0xa086cfcd, 0x97bf97f4), RAPIDJSON_UINT64_C2(0xef340a98, 0x172aace5), + RAPIDJSON_UINT64_C2(0xb23867fb, 0x2a35b28e), RAPIDJSON_UINT64_C2(0x84c8d4df, 0xd2c63f3b), + RAPIDJSON_UINT64_C2(0xc5dd4427, 0x1ad3cdba), RAPIDJSON_UINT64_C2(0x936b9fce, 0xbb25c996), + RAPIDJSON_UINT64_C2(0xdbac6c24, 0x7d62a584), RAPIDJSON_UINT64_C2(0xa3ab6658, 0x0d5fdaf6), + RAPIDJSON_UINT64_C2(0xf3e2f893, 0xdec3f126), RAPIDJSON_UINT64_C2(0xb5b5ada8, 0xaaff80b8), + RAPIDJSON_UINT64_C2(0x87625f05, 0x6c7c4a8b), RAPIDJSON_UINT64_C2(0xc9bcff60, 0x34c13053), + RAPIDJSON_UINT64_C2(0x964e858c, 0x91ba2655), RAPIDJSON_UINT64_C2(0xdff97724, 0x70297ebd), + RAPIDJSON_UINT64_C2(0xa6dfbd9f, 0xb8e5b88f), RAPIDJSON_UINT64_C2(0xf8a95fcf, 0x88747d94), + RAPIDJSON_UINT64_C2(0xb9447093, 0x8fa89bcf), RAPIDJSON_UINT64_C2(0x8a08f0f8, 0xbf0f156b), + RAPIDJSON_UINT64_C2(0xcdb02555, 0x653131b6), RAPIDJSON_UINT64_C2(0x993fe2c6, 0xd07b7fac), + RAPIDJSON_UINT64_C2(0xe45c10c4, 0x2a2b3b06), RAPIDJSON_UINT64_C2(0xaa242499, 0x697392d3), + RAPIDJSON_UINT64_C2(0xfd87b5f2, 0x8300ca0e), RAPIDJSON_UINT64_C2(0xbce50864, 0x92111aeb), + RAPIDJSON_UINT64_C2(0x8cbccc09, 0x6f5088cc), RAPIDJSON_UINT64_C2(0xd1b71758, 0xe219652c), + RAPIDJSON_UINT64_C2(0x9c400000, 0x00000000), RAPIDJSON_UINT64_C2(0xe8d4a510, 0x00000000), + RAPIDJSON_UINT64_C2(0xad78ebc5, 0xac620000), RAPIDJSON_UINT64_C2(0x813f3978, 0xf8940984), + RAPIDJSON_UINT64_C2(0xc097ce7b, 0xc90715b3), RAPIDJSON_UINT64_C2(0x8f7e32ce, 0x7bea5c70), + RAPIDJSON_UINT64_C2(0xd5d238a4, 0xabe98068), RAPIDJSON_UINT64_C2(0x9f4f2726, 0x179a2245), + RAPIDJSON_UINT64_C2(0xed63a231, 0xd4c4fb27), RAPIDJSON_UINT64_C2(0xb0de6538, 0x8cc8ada8), + RAPIDJSON_UINT64_C2(0x83c7088e, 0x1aab65db), RAPIDJSON_UINT64_C2(0xc45d1df9, 0x42711d9a), + RAPIDJSON_UINT64_C2(0x924d692c, 0xa61be758), RAPIDJSON_UINT64_C2(0xda01ee64, 0x1a708dea), + RAPIDJSON_UINT64_C2(0xa26da399, 0x9aef774a), RAPIDJSON_UINT64_C2(0xf209787b, 0xb47d6b85), + RAPIDJSON_UINT64_C2(0xb454e4a1, 0x79dd1877), RAPIDJSON_UINT64_C2(0x865b8692, 0x5b9bc5c2), + RAPIDJSON_UINT64_C2(0xc83553c5, 0xc8965d3d), RAPIDJSON_UINT64_C2(0x952ab45c, 0xfa97a0b3), + RAPIDJSON_UINT64_C2(0xde469fbd, 0x99a05fe3), RAPIDJSON_UINT64_C2(0xa59bc234, 0xdb398c25), + RAPIDJSON_UINT64_C2(0xf6c69a72, 0xa3989f5c), RAPIDJSON_UINT64_C2(0xb7dcbf53, 0x54e9bece), + RAPIDJSON_UINT64_C2(0x88fcf317, 0xf22241e2), RAPIDJSON_UINT64_C2(0xcc20ce9b, 0xd35c78a5), + RAPIDJSON_UINT64_C2(0x98165af3, 0x7b2153df), RAPIDJSON_UINT64_C2(0xe2a0b5dc, 0x971f303a), + RAPIDJSON_UINT64_C2(0xa8d9d153, 0x5ce3b396), RAPIDJSON_UINT64_C2(0xfb9b7cd9, 0xa4a7443c), + RAPIDJSON_UINT64_C2(0xbb764c4c, 0xa7a44410), RAPIDJSON_UINT64_C2(0x8bab8eef, 0xb6409c1a), + RAPIDJSON_UINT64_C2(0xd01fef10, 0xa657842c), RAPIDJSON_UINT64_C2(0x9b10a4e5, 0xe9913129), + RAPIDJSON_UINT64_C2(0xe7109bfb, 0xa19c0c9d), RAPIDJSON_UINT64_C2(0xac2820d9, 0x623bf429), + RAPIDJSON_UINT64_C2(0x80444b5e, 0x7aa7cf85), RAPIDJSON_UINT64_C2(0xbf21e440, 0x03acdd2d), + RAPIDJSON_UINT64_C2(0x8e679c2f, 0x5e44ff8f), RAPIDJSON_UINT64_C2(0xd433179d, 0x9c8cb841), + RAPIDJSON_UINT64_C2(0x9e19db92, 0xb4e31ba9), RAPIDJSON_UINT64_C2(0xeb96bf6e, 0xbadf77d9), + RAPIDJSON_UINT64_C2(0xaf87023b, 0x9bf0ee6b) + }; + static const int16_t kCachedPowers_E[] = { + -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, + -954, -927, -901, -874, -847, -821, -794, -768, -741, -715, + -688, -661, -635, -608, -582, -555, -529, -502, -475, -449, + -422, -396, -369, -343, -316, -289, -263, -236, -210, -183, + -157, -130, -103, -77, -50, -24, 3, 30, 56, 83, + 109, 136, 162, 189, 216, 242, 269, 295, 322, 348, + 375, 402, 428, 455, 481, 508, 534, 561, 588, 614, + 641, 667, 694, 720, 747, 774, 800, 827, 853, 880, + 907, 933, 960, 986, 1013, 1039, 1066 + }; + return DiyFp(kCachedPowers_F[index], kCachedPowers_E[index]); +} + +inline DiyFp GetCachedPower(int e, int* K) { + + //int k = static_cast(ceil((-61 - e) * 0.30102999566398114)) + 374; + double dk = (-61 - e) * 0.30102999566398114 + 347; // dk must be positive, so can do ceiling in positive + int k = static_cast(dk); + if (dk - k > 0.0) + k++; + + unsigned index = static_cast((k >> 3) + 1); + *K = -(-348 + static_cast(index << 3)); // decimal exponent no need lookup table + + return GetCachedPowerByIndex(index); +} + +inline DiyFp GetCachedPower10(int exp, int *outExp) { + unsigned index = (static_cast(exp) + 348u) / 8u; + *outExp = -348 + static_cast(index) * 8; + return GetCachedPowerByIndex(index); + } + +#ifdef __GNUC__ +RAPIDJSON_DIAG_POP +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +RAPIDJSON_DIAG_OFF(padded) +#endif + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_DIYFP_H_ diff --git a/include/rapidjson/internal/dtoa.h b/include/rapidjson/internal/dtoa.h new file mode 100644 index 0000000..8d6350e --- /dev/null +++ b/include/rapidjson/internal/dtoa.h @@ -0,0 +1,245 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +// This is a C++ header-only implementation of Grisu2 algorithm from the publication: +// Loitsch, Florian. "Printing floating-point numbers quickly and accurately with +// integers." ACM Sigplan Notices 45.6 (2010): 233-243. + +#ifndef RAPIDJSON_DTOA_ +#define RAPIDJSON_DTOA_ + +#include "itoa.h" // GetDigitsLut() +#include "diyfp.h" +#include "ieee754.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +RAPIDJSON_DIAG_OFF(array-bounds) // some gcc versions generate wrong warnings https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124 +#endif + +inline void GrisuRound(char* buffer, int len, uint64_t delta, uint64_t rest, uint64_t ten_kappa, uint64_t wp_w) { + while (rest < wp_w && delta - rest >= ten_kappa && + (rest + ten_kappa < wp_w || /// closer + wp_w - rest > rest + ten_kappa - wp_w)) { + buffer[len - 1]--; + rest += ten_kappa; + } +} + +inline unsigned CountDecimalDigit32(uint32_t n) { + // Simple pure C++ implementation was faster than __builtin_clz version in this situation. + if (n < 10) return 1; + if (n < 100) return 2; + if (n < 1000) return 3; + if (n < 10000) return 4; + if (n < 100000) return 5; + if (n < 1000000) return 6; + if (n < 10000000) return 7; + if (n < 100000000) return 8; + // Will not reach 10 digits in DigitGen() + //if (n < 1000000000) return 9; + //return 10; + return 9; +} + +inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) { + static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 }; + const DiyFp one(uint64_t(1) << -Mp.e, Mp.e); + const DiyFp wp_w = Mp - W; + uint32_t p1 = static_cast(Mp.f >> -one.e); + uint64_t p2 = Mp.f & (one.f - 1); + unsigned kappa = CountDecimalDigit32(p1); // kappa in [0, 9] + *len = 0; + + while (kappa > 0) { + uint32_t d = 0; + switch (kappa) { + case 9: d = p1 / 100000000; p1 %= 100000000; break; + case 8: d = p1 / 10000000; p1 %= 10000000; break; + case 7: d = p1 / 1000000; p1 %= 1000000; break; + case 6: d = p1 / 100000; p1 %= 100000; break; + case 5: d = p1 / 10000; p1 %= 10000; break; + case 4: d = p1 / 1000; p1 %= 1000; break; + case 3: d = p1 / 100; p1 %= 100; break; + case 2: d = p1 / 10; p1 %= 10; break; + case 1: d = p1; p1 = 0; break; + default:; + } + if (d || *len) + buffer[(*len)++] = static_cast('0' + static_cast(d)); + kappa--; + uint64_t tmp = (static_cast(p1) << -one.e) + p2; + if (tmp <= delta) { + *K += kappa; + GrisuRound(buffer, *len, delta, tmp, static_cast(kPow10[kappa]) << -one.e, wp_w.f); + return; + } + } + + // kappa = 0 + for (;;) { + p2 *= 10; + delta *= 10; + char d = static_cast(p2 >> -one.e); + if (d || *len) + buffer[(*len)++] = static_cast('0' + d); + p2 &= one.f - 1; + kappa--; + if (p2 < delta) { + *K += kappa; + int index = -static_cast(kappa); + GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * (index < 9 ? kPow10[-static_cast(kappa)] : 0)); + return; + } + } +} + +inline void Grisu2(double value, char* buffer, int* length, int* K) { + const DiyFp v(value); + DiyFp w_m, w_p; + v.NormalizedBoundaries(&w_m, &w_p); + + const DiyFp c_mk = GetCachedPower(w_p.e, K); + const DiyFp W = v.Normalize() * c_mk; + DiyFp Wp = w_p * c_mk; + DiyFp Wm = w_m * c_mk; + Wm.f++; + Wp.f--; + DigitGen(W, Wp, Wp.f - Wm.f, buffer, length, K); +} + +inline char* WriteExponent(int K, char* buffer) { + if (K < 0) { + *buffer++ = '-'; + K = -K; + } + + if (K >= 100) { + *buffer++ = static_cast('0' + static_cast(K / 100)); + K %= 100; + const char* d = GetDigitsLut() + K * 2; + *buffer++ = d[0]; + *buffer++ = d[1]; + } + else if (K >= 10) { + const char* d = GetDigitsLut() + K * 2; + *buffer++ = d[0]; + *buffer++ = d[1]; + } + else + *buffer++ = static_cast('0' + static_cast(K)); + + return buffer; +} + +inline char* Prettify(char* buffer, int length, int k, int maxDecimalPlaces) { + const int kk = length + k; // 10^(kk-1) <= v < 10^kk + + if (0 <= k && kk <= 21) { + // 1234e7 -> 12340000000 + for (int i = length; i < kk; i++) + buffer[i] = '0'; + buffer[kk] = '.'; + buffer[kk + 1] = '0'; + return &buffer[kk + 2]; + } + else if (0 < kk && kk <= 21) { + // 1234e-2 -> 12.34 + std::memmove(&buffer[kk + 1], &buffer[kk], static_cast(length - kk)); + buffer[kk] = '.'; + if (0 > k + maxDecimalPlaces) { + // When maxDecimalPlaces = 2, 1.2345 -> 1.23, 1.102 -> 1.1 + // Remove extra trailing zeros (at least one) after truncation. + for (int i = kk + maxDecimalPlaces; i > kk + 1; i--) + if (buffer[i] != '0') + return &buffer[i + 1]; + return &buffer[kk + 2]; // Reserve one zero + } + else + return &buffer[length + 1]; + } + else if (-6 < kk && kk <= 0) { + // 1234e-6 -> 0.001234 + const int offset = 2 - kk; + std::memmove(&buffer[offset], &buffer[0], static_cast(length)); + buffer[0] = '0'; + buffer[1] = '.'; + for (int i = 2; i < offset; i++) + buffer[i] = '0'; + if (length - kk > maxDecimalPlaces) { + // When maxDecimalPlaces = 2, 0.123 -> 0.12, 0.102 -> 0.1 + // Remove extra trailing zeros (at least one) after truncation. + for (int i = maxDecimalPlaces + 1; i > 2; i--) + if (buffer[i] != '0') + return &buffer[i + 1]; + return &buffer[3]; // Reserve one zero + } + else + return &buffer[length + offset]; + } + else if (kk < -maxDecimalPlaces) { + // Truncate to zero + buffer[0] = '0'; + buffer[1] = '.'; + buffer[2] = '0'; + return &buffer[3]; + } + else if (length == 1) { + // 1e30 + buffer[1] = 'e'; + return WriteExponent(kk - 1, &buffer[2]); + } + else { + // 1234e30 -> 1.234e33 + std::memmove(&buffer[2], &buffer[1], static_cast(length - 1)); + buffer[1] = '.'; + buffer[length + 1] = 'e'; + return WriteExponent(kk - 1, &buffer[0 + length + 2]); + } +} + +inline char* dtoa(double value, char* buffer, int maxDecimalPlaces = 324) { + RAPIDJSON_ASSERT(maxDecimalPlaces >= 1); + Double d(value); + if (d.IsZero()) { + if (d.Sign()) + *buffer++ = '-'; // -0.0, Issue #289 + buffer[0] = '0'; + buffer[1] = '.'; + buffer[2] = '0'; + return &buffer[3]; + } + else { + if (value < 0) { + *buffer++ = '-'; + value = -value; + } + int length, K; + Grisu2(value, buffer, &length, &K); + return Prettify(buffer, length, K, maxDecimalPlaces); + } +} + +#ifdef __GNUC__ +RAPIDJSON_DIAG_POP +#endif + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_DTOA_ diff --git a/include/rapidjson/internal/ieee754.h b/include/rapidjson/internal/ieee754.h new file mode 100644 index 0000000..82bb0b9 --- /dev/null +++ b/include/rapidjson/internal/ieee754.h @@ -0,0 +1,78 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_IEEE754_ +#define RAPIDJSON_IEEE754_ + +#include "../rapidjson.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +class Double { +public: + Double() {} + Double(double d) : d_(d) {} + Double(uint64_t u) : u_(u) {} + + double Value() const { return d_; } + uint64_t Uint64Value() const { return u_; } + + double NextPositiveDouble() const { + RAPIDJSON_ASSERT(!Sign()); + return Double(u_ + 1).Value(); + } + + bool Sign() const { return (u_ & kSignMask) != 0; } + uint64_t Significand() const { return u_ & kSignificandMask; } + int Exponent() const { return static_cast(((u_ & kExponentMask) >> kSignificandSize) - kExponentBias); } + + bool IsNan() const { return (u_ & kExponentMask) == kExponentMask && Significand() != 0; } + bool IsInf() const { return (u_ & kExponentMask) == kExponentMask && Significand() == 0; } + bool IsNanOrInf() const { return (u_ & kExponentMask) == kExponentMask; } + bool IsNormal() const { return (u_ & kExponentMask) != 0 || Significand() == 0; } + bool IsZero() const { return (u_ & (kExponentMask | kSignificandMask)) == 0; } + + uint64_t IntegerSignificand() const { return IsNormal() ? Significand() | kHiddenBit : Significand(); } + int IntegerExponent() const { return (IsNormal() ? Exponent() : kDenormalExponent) - kSignificandSize; } + uint64_t ToBias() const { return (u_ & kSignMask) ? ~u_ + 1 : u_ | kSignMask; } + + static unsigned EffectiveSignificandSize(int order) { + if (order >= -1021) + return 53; + else if (order <= -1074) + return 0; + else + return static_cast(order) + 1074; + } + +private: + static const int kSignificandSize = 52; + static const int kExponentBias = 0x3FF; + static const int kDenormalExponent = 1 - kExponentBias; + static const uint64_t kSignMask = RAPIDJSON_UINT64_C2(0x80000000, 0x00000000); + static const uint64_t kExponentMask = RAPIDJSON_UINT64_C2(0x7FF00000, 0x00000000); + static const uint64_t kSignificandMask = RAPIDJSON_UINT64_C2(0x000FFFFF, 0xFFFFFFFF); + static const uint64_t kHiddenBit = RAPIDJSON_UINT64_C2(0x00100000, 0x00000000); + + union { + double d_; + uint64_t u_; + }; +}; + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_IEEE754_ diff --git a/include/rapidjson/internal/itoa.h b/include/rapidjson/internal/itoa.h new file mode 100644 index 0000000..01a4e7e --- /dev/null +++ b/include/rapidjson/internal/itoa.h @@ -0,0 +1,304 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ITOA_ +#define RAPIDJSON_ITOA_ + +#include "../rapidjson.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +inline const char* GetDigitsLut() { + static const char cDigitsLut[200] = { + '0','0','0','1','0','2','0','3','0','4','0','5','0','6','0','7','0','8','0','9', + '1','0','1','1','1','2','1','3','1','4','1','5','1','6','1','7','1','8','1','9', + '2','0','2','1','2','2','2','3','2','4','2','5','2','6','2','7','2','8','2','9', + '3','0','3','1','3','2','3','3','3','4','3','5','3','6','3','7','3','8','3','9', + '4','0','4','1','4','2','4','3','4','4','4','5','4','6','4','7','4','8','4','9', + '5','0','5','1','5','2','5','3','5','4','5','5','5','6','5','7','5','8','5','9', + '6','0','6','1','6','2','6','3','6','4','6','5','6','6','6','7','6','8','6','9', + '7','0','7','1','7','2','7','3','7','4','7','5','7','6','7','7','7','8','7','9', + '8','0','8','1','8','2','8','3','8','4','8','5','8','6','8','7','8','8','8','9', + '9','0','9','1','9','2','9','3','9','4','9','5','9','6','9','7','9','8','9','9' + }; + return cDigitsLut; +} + +inline char* u32toa(uint32_t value, char* buffer) { + const char* cDigitsLut = GetDigitsLut(); + + if (value < 10000) { + const uint32_t d1 = (value / 100) << 1; + const uint32_t d2 = (value % 100) << 1; + + if (value >= 1000) + *buffer++ = cDigitsLut[d1]; + if (value >= 100) + *buffer++ = cDigitsLut[d1 + 1]; + if (value >= 10) + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + } + else if (value < 100000000) { + // value = bbbbcccc + const uint32_t b = value / 10000; + const uint32_t c = value % 10000; + + const uint32_t d1 = (b / 100) << 1; + const uint32_t d2 = (b % 100) << 1; + + const uint32_t d3 = (c / 100) << 1; + const uint32_t d4 = (c % 100) << 1; + + if (value >= 10000000) + *buffer++ = cDigitsLut[d1]; + if (value >= 1000000) + *buffer++ = cDigitsLut[d1 + 1]; + if (value >= 100000) + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + + *buffer++ = cDigitsLut[d3]; + *buffer++ = cDigitsLut[d3 + 1]; + *buffer++ = cDigitsLut[d4]; + *buffer++ = cDigitsLut[d4 + 1]; + } + else { + // value = aabbbbcccc in decimal + + const uint32_t a = value / 100000000; // 1 to 42 + value %= 100000000; + + if (a >= 10) { + const unsigned i = a << 1; + *buffer++ = cDigitsLut[i]; + *buffer++ = cDigitsLut[i + 1]; + } + else + *buffer++ = static_cast('0' + static_cast(a)); + + const uint32_t b = value / 10000; // 0 to 9999 + const uint32_t c = value % 10000; // 0 to 9999 + + const uint32_t d1 = (b / 100) << 1; + const uint32_t d2 = (b % 100) << 1; + + const uint32_t d3 = (c / 100) << 1; + const uint32_t d4 = (c % 100) << 1; + + *buffer++ = cDigitsLut[d1]; + *buffer++ = cDigitsLut[d1 + 1]; + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + *buffer++ = cDigitsLut[d3]; + *buffer++ = cDigitsLut[d3 + 1]; + *buffer++ = cDigitsLut[d4]; + *buffer++ = cDigitsLut[d4 + 1]; + } + return buffer; +} + +inline char* i32toa(int32_t value, char* buffer) { + uint32_t u = static_cast(value); + if (value < 0) { + *buffer++ = '-'; + u = ~u + 1; + } + + return u32toa(u, buffer); +} + +inline char* u64toa(uint64_t value, char* buffer) { + const char* cDigitsLut = GetDigitsLut(); + const uint64_t kTen8 = 100000000; + const uint64_t kTen9 = kTen8 * 10; + const uint64_t kTen10 = kTen8 * 100; + const uint64_t kTen11 = kTen8 * 1000; + const uint64_t kTen12 = kTen8 * 10000; + const uint64_t kTen13 = kTen8 * 100000; + const uint64_t kTen14 = kTen8 * 1000000; + const uint64_t kTen15 = kTen8 * 10000000; + const uint64_t kTen16 = kTen8 * kTen8; + + if (value < kTen8) { + uint32_t v = static_cast(value); + if (v < 10000) { + const uint32_t d1 = (v / 100) << 1; + const uint32_t d2 = (v % 100) << 1; + + if (v >= 1000) + *buffer++ = cDigitsLut[d1]; + if (v >= 100) + *buffer++ = cDigitsLut[d1 + 1]; + if (v >= 10) + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + } + else { + // value = bbbbcccc + const uint32_t b = v / 10000; + const uint32_t c = v % 10000; + + const uint32_t d1 = (b / 100) << 1; + const uint32_t d2 = (b % 100) << 1; + + const uint32_t d3 = (c / 100) << 1; + const uint32_t d4 = (c % 100) << 1; + + if (value >= 10000000) + *buffer++ = cDigitsLut[d1]; + if (value >= 1000000) + *buffer++ = cDigitsLut[d1 + 1]; + if (value >= 100000) + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + + *buffer++ = cDigitsLut[d3]; + *buffer++ = cDigitsLut[d3 + 1]; + *buffer++ = cDigitsLut[d4]; + *buffer++ = cDigitsLut[d4 + 1]; + } + } + else if (value < kTen16) { + const uint32_t v0 = static_cast(value / kTen8); + const uint32_t v1 = static_cast(value % kTen8); + + const uint32_t b0 = v0 / 10000; + const uint32_t c0 = v0 % 10000; + + const uint32_t d1 = (b0 / 100) << 1; + const uint32_t d2 = (b0 % 100) << 1; + + const uint32_t d3 = (c0 / 100) << 1; + const uint32_t d4 = (c0 % 100) << 1; + + const uint32_t b1 = v1 / 10000; + const uint32_t c1 = v1 % 10000; + + const uint32_t d5 = (b1 / 100) << 1; + const uint32_t d6 = (b1 % 100) << 1; + + const uint32_t d7 = (c1 / 100) << 1; + const uint32_t d8 = (c1 % 100) << 1; + + if (value >= kTen15) + *buffer++ = cDigitsLut[d1]; + if (value >= kTen14) + *buffer++ = cDigitsLut[d1 + 1]; + if (value >= kTen13) + *buffer++ = cDigitsLut[d2]; + if (value >= kTen12) + *buffer++ = cDigitsLut[d2 + 1]; + if (value >= kTen11) + *buffer++ = cDigitsLut[d3]; + if (value >= kTen10) + *buffer++ = cDigitsLut[d3 + 1]; + if (value >= kTen9) + *buffer++ = cDigitsLut[d4]; + if (value >= kTen8) + *buffer++ = cDigitsLut[d4 + 1]; + + *buffer++ = cDigitsLut[d5]; + *buffer++ = cDigitsLut[d5 + 1]; + *buffer++ = cDigitsLut[d6]; + *buffer++ = cDigitsLut[d6 + 1]; + *buffer++ = cDigitsLut[d7]; + *buffer++ = cDigitsLut[d7 + 1]; + *buffer++ = cDigitsLut[d8]; + *buffer++ = cDigitsLut[d8 + 1]; + } + else { + const uint32_t a = static_cast(value / kTen16); // 1 to 1844 + value %= kTen16; + + if (a < 10) + *buffer++ = static_cast('0' + static_cast(a)); + else if (a < 100) { + const uint32_t i = a << 1; + *buffer++ = cDigitsLut[i]; + *buffer++ = cDigitsLut[i + 1]; + } + else if (a < 1000) { + *buffer++ = static_cast('0' + static_cast(a / 100)); + + const uint32_t i = (a % 100) << 1; + *buffer++ = cDigitsLut[i]; + *buffer++ = cDigitsLut[i + 1]; + } + else { + const uint32_t i = (a / 100) << 1; + const uint32_t j = (a % 100) << 1; + *buffer++ = cDigitsLut[i]; + *buffer++ = cDigitsLut[i + 1]; + *buffer++ = cDigitsLut[j]; + *buffer++ = cDigitsLut[j + 1]; + } + + const uint32_t v0 = static_cast(value / kTen8); + const uint32_t v1 = static_cast(value % kTen8); + + const uint32_t b0 = v0 / 10000; + const uint32_t c0 = v0 % 10000; + + const uint32_t d1 = (b0 / 100) << 1; + const uint32_t d2 = (b0 % 100) << 1; + + const uint32_t d3 = (c0 / 100) << 1; + const uint32_t d4 = (c0 % 100) << 1; + + const uint32_t b1 = v1 / 10000; + const uint32_t c1 = v1 % 10000; + + const uint32_t d5 = (b1 / 100) << 1; + const uint32_t d6 = (b1 % 100) << 1; + + const uint32_t d7 = (c1 / 100) << 1; + const uint32_t d8 = (c1 % 100) << 1; + + *buffer++ = cDigitsLut[d1]; + *buffer++ = cDigitsLut[d1 + 1]; + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + *buffer++ = cDigitsLut[d3]; + *buffer++ = cDigitsLut[d3 + 1]; + *buffer++ = cDigitsLut[d4]; + *buffer++ = cDigitsLut[d4 + 1]; + *buffer++ = cDigitsLut[d5]; + *buffer++ = cDigitsLut[d5 + 1]; + *buffer++ = cDigitsLut[d6]; + *buffer++ = cDigitsLut[d6 + 1]; + *buffer++ = cDigitsLut[d7]; + *buffer++ = cDigitsLut[d7 + 1]; + *buffer++ = cDigitsLut[d8]; + *buffer++ = cDigitsLut[d8 + 1]; + } + + return buffer; +} + +inline char* i64toa(int64_t value, char* buffer) { + uint64_t u = static_cast(value); + if (value < 0) { + *buffer++ = '-'; + u = ~u + 1; + } + + return u64toa(u, buffer); +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_ITOA_ diff --git a/include/rapidjson/internal/meta.h b/include/rapidjson/internal/meta.h new file mode 100644 index 0000000..5a9aaa4 --- /dev/null +++ b/include/rapidjson/internal/meta.h @@ -0,0 +1,181 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_META_H_ +#define RAPIDJSON_INTERNAL_META_H_ + +#include "../rapidjson.h" + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +#endif +#if defined(_MSC_VER) +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(6334) +#endif + +#if RAPIDJSON_HAS_CXX11_TYPETRAITS +#include +#endif + +//@cond RAPIDJSON_INTERNAL +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +// Helper to wrap/convert arbitrary types to void, useful for arbitrary type matching +template struct Void { typedef void Type; }; + +/////////////////////////////////////////////////////////////////////////////// +// BoolType, TrueType, FalseType +// +template struct BoolType { + static const bool Value = Cond; + typedef BoolType Type; +}; +typedef BoolType TrueType; +typedef BoolType FalseType; + + +/////////////////////////////////////////////////////////////////////////////// +// SelectIf, BoolExpr, NotExpr, AndExpr, OrExpr +// + +template struct SelectIfImpl { template struct Apply { typedef T1 Type; }; }; +template <> struct SelectIfImpl { template struct Apply { typedef T2 Type; }; }; +template struct SelectIfCond : SelectIfImpl::template Apply {}; +template struct SelectIf : SelectIfCond {}; + +template struct AndExprCond : FalseType {}; +template <> struct AndExprCond : TrueType {}; +template struct OrExprCond : TrueType {}; +template <> struct OrExprCond : FalseType {}; + +template struct BoolExpr : SelectIf::Type {}; +template struct NotExpr : SelectIf::Type {}; +template struct AndExpr : AndExprCond::Type {}; +template struct OrExpr : OrExprCond::Type {}; + + +/////////////////////////////////////////////////////////////////////////////// +// AddConst, MaybeAddConst, RemoveConst +template struct AddConst { typedef const T Type; }; +template struct MaybeAddConst : SelectIfCond {}; +template struct RemoveConst { typedef T Type; }; +template struct RemoveConst { typedef T Type; }; + + +/////////////////////////////////////////////////////////////////////////////// +// IsSame, IsConst, IsMoreConst, IsPointer +// +template struct IsSame : FalseType {}; +template struct IsSame : TrueType {}; + +template struct IsConst : FalseType {}; +template struct IsConst : TrueType {}; + +template +struct IsMoreConst + : AndExpr::Type, typename RemoveConst::Type>, + BoolType::Value >= IsConst::Value> >::Type {}; + +template struct IsPointer : FalseType {}; +template struct IsPointer : TrueType {}; + +/////////////////////////////////////////////////////////////////////////////// +// IsBaseOf +// +#if RAPIDJSON_HAS_CXX11_TYPETRAITS + +template struct IsBaseOf + : BoolType< ::std::is_base_of::value> {}; + +#else // simplified version adopted from Boost + +template struct IsBaseOfImpl { + RAPIDJSON_STATIC_ASSERT(sizeof(B) != 0); + RAPIDJSON_STATIC_ASSERT(sizeof(D) != 0); + + typedef char (&Yes)[1]; + typedef char (&No) [2]; + + template + static Yes Check(const D*, T); + static No Check(const B*, int); + + struct Host { + operator const B*() const; + operator const D*(); + }; + + enum { Value = (sizeof(Check(Host(), 0)) == sizeof(Yes)) }; +}; + +template struct IsBaseOf + : OrExpr, BoolExpr > >::Type {}; + +#endif // RAPIDJSON_HAS_CXX11_TYPETRAITS + + +////////////////////////////////////////////////////////////////////////// +// EnableIf / DisableIf +// +template struct EnableIfCond { typedef T Type; }; +template struct EnableIfCond { /* empty */ }; + +template struct DisableIfCond { typedef T Type; }; +template struct DisableIfCond { /* empty */ }; + +template +struct EnableIf : EnableIfCond {}; + +template +struct DisableIf : DisableIfCond {}; + +// SFINAE helpers +struct SfinaeTag {}; +template struct RemoveSfinaeTag; +template struct RemoveSfinaeTag { typedef T Type; }; + +#define RAPIDJSON_REMOVEFPTR_(type) \ + typename ::RAPIDJSON_NAMESPACE::internal::RemoveSfinaeTag \ + < ::RAPIDJSON_NAMESPACE::internal::SfinaeTag&(*) type>::Type + +#define RAPIDJSON_ENABLEIF(cond) \ + typename ::RAPIDJSON_NAMESPACE::internal::EnableIf \ + ::Type * = NULL + +#define RAPIDJSON_DISABLEIF(cond) \ + typename ::RAPIDJSON_NAMESPACE::internal::DisableIf \ + ::Type * = NULL + +#define RAPIDJSON_ENABLEIF_RETURN(cond,returntype) \ + typename ::RAPIDJSON_NAMESPACE::internal::EnableIf \ + ::Type + +#define RAPIDJSON_DISABLEIF_RETURN(cond,returntype) \ + typename ::RAPIDJSON_NAMESPACE::internal::DisableIf \ + ::Type + +} // namespace internal +RAPIDJSON_NAMESPACE_END +//@endcond + +#if defined(__GNUC__) || defined(_MSC_VER) +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_INTERNAL_META_H_ diff --git a/include/rapidjson/internal/pow10.h b/include/rapidjson/internal/pow10.h new file mode 100644 index 0000000..02f475d --- /dev/null +++ b/include/rapidjson/internal/pow10.h @@ -0,0 +1,55 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_POW10_ +#define RAPIDJSON_POW10_ + +#include "../rapidjson.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +//! Computes integer powers of 10 in double (10.0^n). +/*! This function uses lookup table for fast and accurate results. + \param n non-negative exponent. Must <= 308. + \return 10.0^n +*/ +inline double Pow10(int n) { + static const double e[] = { // 1e-0...1e308: 309 * 8 bytes = 2472 bytes + 1e+0, + 1e+1, 1e+2, 1e+3, 1e+4, 1e+5, 1e+6, 1e+7, 1e+8, 1e+9, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17, 1e+18, 1e+19, 1e+20, + 1e+21, 1e+22, 1e+23, 1e+24, 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31, 1e+32, 1e+33, 1e+34, 1e+35, 1e+36, 1e+37, 1e+38, 1e+39, 1e+40, + 1e+41, 1e+42, 1e+43, 1e+44, 1e+45, 1e+46, 1e+47, 1e+48, 1e+49, 1e+50, 1e+51, 1e+52, 1e+53, 1e+54, 1e+55, 1e+56, 1e+57, 1e+58, 1e+59, 1e+60, + 1e+61, 1e+62, 1e+63, 1e+64, 1e+65, 1e+66, 1e+67, 1e+68, 1e+69, 1e+70, 1e+71, 1e+72, 1e+73, 1e+74, 1e+75, 1e+76, 1e+77, 1e+78, 1e+79, 1e+80, + 1e+81, 1e+82, 1e+83, 1e+84, 1e+85, 1e+86, 1e+87, 1e+88, 1e+89, 1e+90, 1e+91, 1e+92, 1e+93, 1e+94, 1e+95, 1e+96, 1e+97, 1e+98, 1e+99, 1e+100, + 1e+101,1e+102,1e+103,1e+104,1e+105,1e+106,1e+107,1e+108,1e+109,1e+110,1e+111,1e+112,1e+113,1e+114,1e+115,1e+116,1e+117,1e+118,1e+119,1e+120, + 1e+121,1e+122,1e+123,1e+124,1e+125,1e+126,1e+127,1e+128,1e+129,1e+130,1e+131,1e+132,1e+133,1e+134,1e+135,1e+136,1e+137,1e+138,1e+139,1e+140, + 1e+141,1e+142,1e+143,1e+144,1e+145,1e+146,1e+147,1e+148,1e+149,1e+150,1e+151,1e+152,1e+153,1e+154,1e+155,1e+156,1e+157,1e+158,1e+159,1e+160, + 1e+161,1e+162,1e+163,1e+164,1e+165,1e+166,1e+167,1e+168,1e+169,1e+170,1e+171,1e+172,1e+173,1e+174,1e+175,1e+176,1e+177,1e+178,1e+179,1e+180, + 1e+181,1e+182,1e+183,1e+184,1e+185,1e+186,1e+187,1e+188,1e+189,1e+190,1e+191,1e+192,1e+193,1e+194,1e+195,1e+196,1e+197,1e+198,1e+199,1e+200, + 1e+201,1e+202,1e+203,1e+204,1e+205,1e+206,1e+207,1e+208,1e+209,1e+210,1e+211,1e+212,1e+213,1e+214,1e+215,1e+216,1e+217,1e+218,1e+219,1e+220, + 1e+221,1e+222,1e+223,1e+224,1e+225,1e+226,1e+227,1e+228,1e+229,1e+230,1e+231,1e+232,1e+233,1e+234,1e+235,1e+236,1e+237,1e+238,1e+239,1e+240, + 1e+241,1e+242,1e+243,1e+244,1e+245,1e+246,1e+247,1e+248,1e+249,1e+250,1e+251,1e+252,1e+253,1e+254,1e+255,1e+256,1e+257,1e+258,1e+259,1e+260, + 1e+261,1e+262,1e+263,1e+264,1e+265,1e+266,1e+267,1e+268,1e+269,1e+270,1e+271,1e+272,1e+273,1e+274,1e+275,1e+276,1e+277,1e+278,1e+279,1e+280, + 1e+281,1e+282,1e+283,1e+284,1e+285,1e+286,1e+287,1e+288,1e+289,1e+290,1e+291,1e+292,1e+293,1e+294,1e+295,1e+296,1e+297,1e+298,1e+299,1e+300, + 1e+301,1e+302,1e+303,1e+304,1e+305,1e+306,1e+307,1e+308 + }; + RAPIDJSON_ASSERT(n >= 0 && n <= 308); + return e[n]; +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_POW10_ diff --git a/include/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h new file mode 100644 index 0000000..422a524 --- /dev/null +++ b/include/rapidjson/internal/regex.h @@ -0,0 +1,701 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_REGEX_H_ +#define RAPIDJSON_INTERNAL_REGEX_H_ + +#include "../allocators.h" +#include "../stream.h" +#include "stack.h" + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +RAPIDJSON_DIAG_OFF(switch-enum) +RAPIDJSON_DIAG_OFF(implicit-fallthrough) +#endif + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated +#endif + +#ifndef RAPIDJSON_REGEX_VERBOSE +#define RAPIDJSON_REGEX_VERBOSE 0 +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +/////////////////////////////////////////////////////////////////////////////// +// GenericRegex + +static const SizeType kRegexInvalidState = ~SizeType(0); //!< Represents an invalid index in GenericRegex::State::out, out1 +static const SizeType kRegexInvalidRange = ~SizeType(0); + +//! Regular expression engine with subset of ECMAscript grammar. +/*! + Supported regular expression syntax: + - \c ab Concatenation + - \c a|b Alternation + - \c a? Zero or one + - \c a* Zero or more + - \c a+ One or more + - \c a{3} Exactly 3 times + - \c a{3,} At least 3 times + - \c a{3,5} 3 to 5 times + - \c (ab) Grouping + - \c ^a At the beginning + - \c a$ At the end + - \c . Any character + - \c [abc] Character classes + - \c [a-c] Character class range + - \c [a-z0-9_] Character class combination + - \c [^abc] Negated character classes + - \c [^a-c] Negated character class range + - \c [\b] Backspace (U+0008) + - \c \\| \\\\ ... Escape characters + - \c \\f Form feed (U+000C) + - \c \\n Line feed (U+000A) + - \c \\r Carriage return (U+000D) + - \c \\t Tab (U+0009) + - \c \\v Vertical tab (U+000B) + + \note This is a Thompson NFA engine, implemented with reference to + Cox, Russ. "Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby,...).", + https://swtch.com/~rsc/regexp/regexp1.html +*/ +template +class GenericRegex { +public: + typedef typename Encoding::Ch Ch; + + GenericRegex(const Ch* source, Allocator* allocator = 0) : + states_(allocator, 256), ranges_(allocator, 256), root_(kRegexInvalidState), stateCount_(), rangeCount_(), + stateSet_(), state0_(allocator, 0), state1_(allocator, 0), anchorBegin_(), anchorEnd_() + { + GenericStringStream ss(source); + DecodedStream > ds(ss); + Parse(ds); + } + + ~GenericRegex() { + Allocator::Free(stateSet_); + } + + bool IsValid() const { + return root_ != kRegexInvalidState; + } + + template + bool Match(InputStream& is) const { + return SearchWithAnchoring(is, true, true); + } + + bool Match(const Ch* s) const { + GenericStringStream is(s); + return Match(is); + } + + template + bool Search(InputStream& is) const { + return SearchWithAnchoring(is, anchorBegin_, anchorEnd_); + } + + bool Search(const Ch* s) const { + GenericStringStream is(s); + return Search(is); + } + +private: + enum Operator { + kZeroOrOne, + kZeroOrMore, + kOneOrMore, + kConcatenation, + kAlternation, + kLeftParenthesis + }; + + static const unsigned kAnyCharacterClass = 0xFFFFFFFF; //!< For '.' + static const unsigned kRangeCharacterClass = 0xFFFFFFFE; + static const unsigned kRangeNegationFlag = 0x80000000; + + struct Range { + unsigned start; // + unsigned end; + SizeType next; + }; + + struct State { + SizeType out; //!< Equals to kInvalid for matching state + SizeType out1; //!< Equals to non-kInvalid for split + SizeType rangeStart; + unsigned codepoint; + }; + + struct Frag { + Frag(SizeType s, SizeType o, SizeType m) : start(s), out(o), minIndex(m) {} + SizeType start; + SizeType out; //!< link-list of all output states + SizeType minIndex; + }; + + template + class DecodedStream { + public: + DecodedStream(SourceStream& ss) : ss_(ss), codepoint_() { Decode(); } + unsigned Peek() { return codepoint_; } + unsigned Take() { + unsigned c = codepoint_; + if (c) // No further decoding when '\0' + Decode(); + return c; + } + + private: + void Decode() { + if (!Encoding::Decode(ss_, &codepoint_)) + codepoint_ = 0; + } + + SourceStream& ss_; + unsigned codepoint_; + }; + + State& GetState(SizeType index) { + RAPIDJSON_ASSERT(index < stateCount_); + return states_.template Bottom()[index]; + } + + const State& GetState(SizeType index) const { + RAPIDJSON_ASSERT(index < stateCount_); + return states_.template Bottom()[index]; + } + + Range& GetRange(SizeType index) { + RAPIDJSON_ASSERT(index < rangeCount_); + return ranges_.template Bottom()[index]; + } + + const Range& GetRange(SizeType index) const { + RAPIDJSON_ASSERT(index < rangeCount_); + return ranges_.template Bottom()[index]; + } + + template + void Parse(DecodedStream& ds) { + Allocator allocator; + Stack operandStack(&allocator, 256); // Frag + Stack operatorStack(&allocator, 256); // Operator + Stack atomCountStack(&allocator, 256); // unsigned (Atom per parenthesis) + + *atomCountStack.template Push() = 0; + + unsigned codepoint; + while (ds.Peek() != 0) { + switch (codepoint = ds.Take()) { + case '^': + anchorBegin_ = true; + break; + + case '$': + anchorEnd_ = true; + break; + + case '|': + while (!operatorStack.Empty() && *operatorStack.template Top() < kAlternation) + if (!Eval(operandStack, *operatorStack.template Pop(1))) + return; + *operatorStack.template Push() = kAlternation; + *atomCountStack.template Top() = 0; + break; + + case '(': + *operatorStack.template Push() = kLeftParenthesis; + *atomCountStack.template Push() = 0; + break; + + case ')': + while (!operatorStack.Empty() && *operatorStack.template Top() != kLeftParenthesis) + if (!Eval(operandStack, *operatorStack.template Pop(1))) + return; + if (operatorStack.Empty()) + return; + operatorStack.template Pop(1); + atomCountStack.template Pop(1); + ImplicitConcatenation(atomCountStack, operatorStack); + break; + + case '?': + if (!Eval(operandStack, kZeroOrOne)) + return; + break; + + case '*': + if (!Eval(operandStack, kZeroOrMore)) + return; + break; + + case '+': + if (!Eval(operandStack, kOneOrMore)) + return; + break; + + case '{': + { + unsigned n, m; + if (!ParseUnsigned(ds, &n)) + return; + + if (ds.Peek() == ',') { + ds.Take(); + if (ds.Peek() == '}') + m = kInfinityQuantifier; + else if (!ParseUnsigned(ds, &m) || m < n) + return; + } + else + m = n; + + if (!EvalQuantifier(operandStack, n, m) || ds.Peek() != '}') + return; + ds.Take(); + } + break; + + case '.': + PushOperand(operandStack, kAnyCharacterClass); + ImplicitConcatenation(atomCountStack, operatorStack); + break; + + case '[': + { + SizeType range; + if (!ParseRange(ds, &range)) + return; + SizeType s = NewState(kRegexInvalidState, kRegexInvalidState, kRangeCharacterClass); + GetState(s).rangeStart = range; + *operandStack.template Push() = Frag(s, s, s); + } + ImplicitConcatenation(atomCountStack, operatorStack); + break; + + case '\\': // Escape character + if (!CharacterEscape(ds, &codepoint)) + return; // Unsupported escape character + // fall through to default + + default: // Pattern character + PushOperand(operandStack, codepoint); + ImplicitConcatenation(atomCountStack, operatorStack); + } + } + + while (!operatorStack.Empty()) + if (!Eval(operandStack, *operatorStack.template Pop(1))) + return; + + // Link the operand to matching state. + if (operandStack.GetSize() == sizeof(Frag)) { + Frag* e = operandStack.template Pop(1); + Patch(e->out, NewState(kRegexInvalidState, kRegexInvalidState, 0)); + root_ = e->start; + +#if RAPIDJSON_REGEX_VERBOSE + printf("root: %d\n", root_); + for (SizeType i = 0; i < stateCount_ ; i++) { + State& s = GetState(i); + printf("[%2d] out: %2d out1: %2d c: '%c'\n", i, s.out, s.out1, (char)s.codepoint); + } + printf("\n"); +#endif + } + + // Preallocate buffer for SearchWithAnchoring() + RAPIDJSON_ASSERT(stateSet_ == 0); + if (stateCount_ > 0) { + stateSet_ = static_cast(states_.GetAllocator().Malloc(GetStateSetSize())); + state0_.template Reserve(stateCount_); + state1_.template Reserve(stateCount_); + } + } + + SizeType NewState(SizeType out, SizeType out1, unsigned codepoint) { + State* s = states_.template Push(); + s->out = out; + s->out1 = out1; + s->codepoint = codepoint; + s->rangeStart = kRegexInvalidRange; + return stateCount_++; + } + + void PushOperand(Stack& operandStack, unsigned codepoint) { + SizeType s = NewState(kRegexInvalidState, kRegexInvalidState, codepoint); + *operandStack.template Push() = Frag(s, s, s); + } + + void ImplicitConcatenation(Stack& atomCountStack, Stack& operatorStack) { + if (*atomCountStack.template Top()) + *operatorStack.template Push() = kConcatenation; + (*atomCountStack.template Top())++; + } + + SizeType Append(SizeType l1, SizeType l2) { + SizeType old = l1; + while (GetState(l1).out != kRegexInvalidState) + l1 = GetState(l1).out; + GetState(l1).out = l2; + return old; + } + + void Patch(SizeType l, SizeType s) { + for (SizeType next; l != kRegexInvalidState; l = next) { + next = GetState(l).out; + GetState(l).out = s; + } + } + + bool Eval(Stack& operandStack, Operator op) { + switch (op) { + case kConcatenation: + RAPIDJSON_ASSERT(operandStack.GetSize() >= sizeof(Frag) * 2); + { + Frag e2 = *operandStack.template Pop(1); + Frag e1 = *operandStack.template Pop(1); + Patch(e1.out, e2.start); + *operandStack.template Push() = Frag(e1.start, e2.out, Min(e1.minIndex, e2.minIndex)); + } + return true; + + case kAlternation: + if (operandStack.GetSize() >= sizeof(Frag) * 2) { + Frag e2 = *operandStack.template Pop(1); + Frag e1 = *operandStack.template Pop(1); + SizeType s = NewState(e1.start, e2.start, 0); + *operandStack.template Push() = Frag(s, Append(e1.out, e2.out), Min(e1.minIndex, e2.minIndex)); + return true; + } + return false; + + case kZeroOrOne: + if (operandStack.GetSize() >= sizeof(Frag)) { + Frag e = *operandStack.template Pop(1); + SizeType s = NewState(kRegexInvalidState, e.start, 0); + *operandStack.template Push() = Frag(s, Append(e.out, s), e.minIndex); + return true; + } + return false; + + case kZeroOrMore: + if (operandStack.GetSize() >= sizeof(Frag)) { + Frag e = *operandStack.template Pop(1); + SizeType s = NewState(kRegexInvalidState, e.start, 0); + Patch(e.out, s); + *operandStack.template Push() = Frag(s, s, e.minIndex); + return true; + } + return false; + + default: + RAPIDJSON_ASSERT(op == kOneOrMore); + if (operandStack.GetSize() >= sizeof(Frag)) { + Frag e = *operandStack.template Pop(1); + SizeType s = NewState(kRegexInvalidState, e.start, 0); + Patch(e.out, s); + *operandStack.template Push() = Frag(e.start, s, e.minIndex); + return true; + } + return false; + } + } + + bool EvalQuantifier(Stack& operandStack, unsigned n, unsigned m) { + RAPIDJSON_ASSERT(n <= m); + RAPIDJSON_ASSERT(operandStack.GetSize() >= sizeof(Frag)); + + if (n == 0) { + if (m == 0) // a{0} not support + return false; + else if (m == kInfinityQuantifier) + Eval(operandStack, kZeroOrMore); // a{0,} -> a* + else { + Eval(operandStack, kZeroOrOne); // a{0,5} -> a? + for (unsigned i = 0; i < m - 1; i++) + CloneTopOperand(operandStack); // a{0,5} -> a? a? a? a? a? + for (unsigned i = 0; i < m - 1; i++) + Eval(operandStack, kConcatenation); // a{0,5} -> a?a?a?a?a? + } + return true; + } + + for (unsigned i = 0; i < n - 1; i++) // a{3} -> a a a + CloneTopOperand(operandStack); + + if (m == kInfinityQuantifier) + Eval(operandStack, kOneOrMore); // a{3,} -> a a a+ + else if (m > n) { + CloneTopOperand(operandStack); // a{3,5} -> a a a a + Eval(operandStack, kZeroOrOne); // a{3,5} -> a a a a? + for (unsigned i = n; i < m - 1; i++) + CloneTopOperand(operandStack); // a{3,5} -> a a a a? a? + for (unsigned i = n; i < m; i++) + Eval(operandStack, kConcatenation); // a{3,5} -> a a aa?a? + } + + for (unsigned i = 0; i < n - 1; i++) + Eval(operandStack, kConcatenation); // a{3} -> aaa, a{3,} -> aaa+, a{3.5} -> aaaa?a? + + return true; + } + + static SizeType Min(SizeType a, SizeType b) { return a < b ? a : b; } + + void CloneTopOperand(Stack& operandStack) { + const Frag src = *operandStack.template Top(); // Copy constructor to prevent invalidation + SizeType count = stateCount_ - src.minIndex; // Assumes top operand contains states in [src->minIndex, stateCount_) + State* s = states_.template Push(count); + memcpy(s, &GetState(src.minIndex), count * sizeof(State)); + for (SizeType j = 0; j < count; j++) { + if (s[j].out != kRegexInvalidState) + s[j].out += count; + if (s[j].out1 != kRegexInvalidState) + s[j].out1 += count; + } + *operandStack.template Push() = Frag(src.start + count, src.out + count, src.minIndex + count); + stateCount_ += count; + } + + template + bool ParseUnsigned(DecodedStream& ds, unsigned* u) { + unsigned r = 0; + if (ds.Peek() < '0' || ds.Peek() > '9') + return false; + while (ds.Peek() >= '0' && ds.Peek() <= '9') { + if (r >= 429496729 && ds.Peek() > '5') // 2^32 - 1 = 4294967295 + return false; // overflow + r = r * 10 + (ds.Take() - '0'); + } + *u = r; + return true; + } + + template + bool ParseRange(DecodedStream& ds, SizeType* range) { + bool isBegin = true; + bool negate = false; + int step = 0; + SizeType start = kRegexInvalidRange; + SizeType current = kRegexInvalidRange; + unsigned codepoint; + while ((codepoint = ds.Take()) != 0) { + if (isBegin) { + isBegin = false; + if (codepoint == '^') { + negate = true; + continue; + } + } + + switch (codepoint) { + case ']': + if (start == kRegexInvalidRange) + return false; // Error: nothing inside [] + if (step == 2) { // Add trailing '-' + SizeType r = NewRange('-'); + RAPIDJSON_ASSERT(current != kRegexInvalidRange); + GetRange(current).next = r; + } + if (negate) + GetRange(start).start |= kRangeNegationFlag; + *range = start; + return true; + + case '\\': + if (ds.Peek() == 'b') { + ds.Take(); + codepoint = 0x0008; // Escape backspace character + } + else if (!CharacterEscape(ds, &codepoint)) + return false; + // fall through to default + + default: + switch (step) { + case 1: + if (codepoint == '-') { + step++; + break; + } + // fall through to step 0 for other characters + + case 0: + { + SizeType r = NewRange(codepoint); + if (current != kRegexInvalidRange) + GetRange(current).next = r; + if (start == kRegexInvalidRange) + start = r; + current = r; + } + step = 1; + break; + + default: + RAPIDJSON_ASSERT(step == 2); + GetRange(current).end = codepoint; + step = 0; + } + } + } + return false; + } + + SizeType NewRange(unsigned codepoint) { + Range* r = ranges_.template Push(); + r->start = r->end = codepoint; + r->next = kRegexInvalidRange; + return rangeCount_++; + } + + template + bool CharacterEscape(DecodedStream& ds, unsigned* escapedCodepoint) { + unsigned codepoint; + switch (codepoint = ds.Take()) { + case '^': + case '$': + case '|': + case '(': + case ')': + case '?': + case '*': + case '+': + case '.': + case '[': + case ']': + case '{': + case '}': + case '\\': + *escapedCodepoint = codepoint; return true; + case 'f': *escapedCodepoint = 0x000C; return true; + case 'n': *escapedCodepoint = 0x000A; return true; + case 'r': *escapedCodepoint = 0x000D; return true; + case 't': *escapedCodepoint = 0x0009; return true; + case 'v': *escapedCodepoint = 0x000B; return true; + default: + return false; // Unsupported escape character + } + } + + template + bool SearchWithAnchoring(InputStream& is, bool anchorBegin, bool anchorEnd) const { + RAPIDJSON_ASSERT(IsValid()); + DecodedStream ds(is); + + state0_.Clear(); + Stack *current = &state0_, *next = &state1_; + const size_t stateSetSize = GetStateSetSize(); + std::memset(stateSet_, 0, stateSetSize); + + bool matched = AddState(*current, root_); + unsigned codepoint; + while (!current->Empty() && (codepoint = ds.Take()) != 0) { + std::memset(stateSet_, 0, stateSetSize); + next->Clear(); + matched = false; + for (const SizeType* s = current->template Bottom(); s != current->template End(); ++s) { + const State& sr = GetState(*s); + if (sr.codepoint == codepoint || + sr.codepoint == kAnyCharacterClass || + (sr.codepoint == kRangeCharacterClass && MatchRange(sr.rangeStart, codepoint))) + { + matched = AddState(*next, sr.out) || matched; + if (!anchorEnd && matched) + return true; + } + if (!anchorBegin) + AddState(*next, root_); + } + internal::Swap(current, next); + } + + return matched; + } + + size_t GetStateSetSize() const { + return (stateCount_ + 31) / 32 * 4; + } + + // Return whether the added states is a match state + bool AddState(Stack& l, SizeType index) const { + RAPIDJSON_ASSERT(index != kRegexInvalidState); + + const State& s = GetState(index); + if (s.out1 != kRegexInvalidState) { // Split + bool matched = AddState(l, s.out); + return AddState(l, s.out1) || matched; + } + else if (!(stateSet_[index >> 5] & (1 << (index & 31)))) { + stateSet_[index >> 5] |= (1 << (index & 31)); + *l.template PushUnsafe() = index; + } + return s.out == kRegexInvalidState; // by using PushUnsafe() above, we can ensure s is not validated due to reallocation. + } + + bool MatchRange(SizeType rangeIndex, unsigned codepoint) const { + bool yes = (GetRange(rangeIndex).start & kRangeNegationFlag) == 0; + while (rangeIndex != kRegexInvalidRange) { + const Range& r = GetRange(rangeIndex); + if (codepoint >= (r.start & ~kRangeNegationFlag) && codepoint <= r.end) + return yes; + rangeIndex = r.next; + } + return !yes; + } + + Stack states_; + Stack ranges_; + SizeType root_; + SizeType stateCount_; + SizeType rangeCount_; + + static const unsigned kInfinityQuantifier = ~0u; + + // For SearchWithAnchoring() + uint32_t* stateSet_; // allocated by states_.GetAllocator() + mutable Stack state0_; + mutable Stack state1_; + bool anchorBegin_; + bool anchorEnd_; +}; + +typedef GenericRegex > Regex; + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_INTERNAL_REGEX_H_ diff --git a/include/rapidjson/internal/stack.h b/include/rapidjson/internal/stack.h new file mode 100644 index 0000000..022c9aa --- /dev/null +++ b/include/rapidjson/internal/stack.h @@ -0,0 +1,230 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_STACK_H_ +#define RAPIDJSON_INTERNAL_STACK_H_ + +#include "../allocators.h" +#include "swap.h" + +#if defined(__clang__) +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(c++98-compat) +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +/////////////////////////////////////////////////////////////////////////////// +// Stack + +//! A type-unsafe stack for storing different types of data. +/*! \tparam Allocator Allocator for allocating stack memory. +*/ +template +class Stack { +public: + // Optimization note: Do not allocate memory for stack_ in constructor. + // Do it lazily when first Push() -> Expand() -> Resize(). + Stack(Allocator* allocator, size_t stackCapacity) : allocator_(allocator), ownAllocator_(0), stack_(0), stackTop_(0), stackEnd_(0), initialCapacity_(stackCapacity) { + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + Stack(Stack&& rhs) + : allocator_(rhs.allocator_), + ownAllocator_(rhs.ownAllocator_), + stack_(rhs.stack_), + stackTop_(rhs.stackTop_), + stackEnd_(rhs.stackEnd_), + initialCapacity_(rhs.initialCapacity_) + { + rhs.allocator_ = 0; + rhs.ownAllocator_ = 0; + rhs.stack_ = 0; + rhs.stackTop_ = 0; + rhs.stackEnd_ = 0; + rhs.initialCapacity_ = 0; + } +#endif + + ~Stack() { + Destroy(); + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + Stack& operator=(Stack&& rhs) { + if (&rhs != this) + { + Destroy(); + + allocator_ = rhs.allocator_; + ownAllocator_ = rhs.ownAllocator_; + stack_ = rhs.stack_; + stackTop_ = rhs.stackTop_; + stackEnd_ = rhs.stackEnd_; + initialCapacity_ = rhs.initialCapacity_; + + rhs.allocator_ = 0; + rhs.ownAllocator_ = 0; + rhs.stack_ = 0; + rhs.stackTop_ = 0; + rhs.stackEnd_ = 0; + rhs.initialCapacity_ = 0; + } + return *this; + } +#endif + + void Swap(Stack& rhs) RAPIDJSON_NOEXCEPT { + internal::Swap(allocator_, rhs.allocator_); + internal::Swap(ownAllocator_, rhs.ownAllocator_); + internal::Swap(stack_, rhs.stack_); + internal::Swap(stackTop_, rhs.stackTop_); + internal::Swap(stackEnd_, rhs.stackEnd_); + internal::Swap(initialCapacity_, rhs.initialCapacity_); + } + + void Clear() { stackTop_ = stack_; } + + void ShrinkToFit() { + if (Empty()) { + // If the stack is empty, completely deallocate the memory. + Allocator::Free(stack_); + stack_ = 0; + stackTop_ = 0; + stackEnd_ = 0; + } + else + Resize(GetSize()); + } + + // Optimization note: try to minimize the size of this function for force inline. + // Expansion is run very infrequently, so it is moved to another (probably non-inline) function. + template + RAPIDJSON_FORCEINLINE void Reserve(size_t count = 1) { + // Expand the stack if needed + if (RAPIDJSON_UNLIKELY(stackTop_ + sizeof(T) * count > stackEnd_)) + Expand(count); + } + + template + RAPIDJSON_FORCEINLINE T* Push(size_t count = 1) { + Reserve(count); + return PushUnsafe(count); + } + + template + RAPIDJSON_FORCEINLINE T* PushUnsafe(size_t count = 1) { + RAPIDJSON_ASSERT(stackTop_ + sizeof(T) * count <= stackEnd_); + T* ret = reinterpret_cast(stackTop_); + stackTop_ += sizeof(T) * count; + return ret; + } + + template + T* Pop(size_t count) { + RAPIDJSON_ASSERT(GetSize() >= count * sizeof(T)); + stackTop_ -= count * sizeof(T); + return reinterpret_cast(stackTop_); + } + + template + T* Top() { + RAPIDJSON_ASSERT(GetSize() >= sizeof(T)); + return reinterpret_cast(stackTop_ - sizeof(T)); + } + + template + const T* Top() const { + RAPIDJSON_ASSERT(GetSize() >= sizeof(T)); + return reinterpret_cast(stackTop_ - sizeof(T)); + } + + template + T* End() { return reinterpret_cast(stackTop_); } + + template + const T* End() const { return reinterpret_cast(stackTop_); } + + template + T* Bottom() { return reinterpret_cast(stack_); } + + template + const T* Bottom() const { return reinterpret_cast(stack_); } + + bool HasAllocator() const { + return allocator_ != 0; + } + + Allocator& GetAllocator() { + RAPIDJSON_ASSERT(allocator_); + return *allocator_; + } + + bool Empty() const { return stackTop_ == stack_; } + size_t GetSize() const { return static_cast(stackTop_ - stack_); } + size_t GetCapacity() const { return static_cast(stackEnd_ - stack_); } + +private: + template + void Expand(size_t count) { + // Only expand the capacity if the current stack exists. Otherwise just create a stack with initial capacity. + size_t newCapacity; + if (stack_ == 0) { + if (!allocator_) + ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); + newCapacity = initialCapacity_; + } else { + newCapacity = GetCapacity(); + newCapacity += (newCapacity + 1) / 2; + } + size_t newSize = GetSize() + sizeof(T) * count; + if (newCapacity < newSize) + newCapacity = newSize; + + Resize(newCapacity); + } + + void Resize(size_t newCapacity) { + const size_t size = GetSize(); // Backup the current size + stack_ = static_cast(allocator_->Realloc(stack_, GetCapacity(), newCapacity)); + stackTop_ = stack_ + size; + stackEnd_ = stack_ + newCapacity; + } + + void Destroy() { + Allocator::Free(stack_); + RAPIDJSON_DELETE(ownAllocator_); // Only delete if it is owned by the stack + } + + // Prohibit copy constructor & assignment operator. + Stack(const Stack&); + Stack& operator=(const Stack&); + + Allocator* allocator_; + Allocator* ownAllocator_; + char *stack_; + char *stackTop_; + char *stackEnd_; + size_t initialCapacity_; +}; + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#if defined(__clang__) +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_STACK_H_ diff --git a/include/rapidjson/internal/strfunc.h b/include/rapidjson/internal/strfunc.h new file mode 100644 index 0000000..2edfae5 --- /dev/null +++ b/include/rapidjson/internal/strfunc.h @@ -0,0 +1,55 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_STRFUNC_H_ +#define RAPIDJSON_INTERNAL_STRFUNC_H_ + +#include "../stream.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +//! Custom strlen() which works on different character types. +/*! \tparam Ch Character type (e.g. char, wchar_t, short) + \param s Null-terminated input string. + \return Number of characters in the string. + \note This has the same semantics as strlen(), the return value is not number of Unicode codepoints. +*/ +template +inline SizeType StrLen(const Ch* s) { + const Ch* p = s; + while (*p) ++p; + return SizeType(p - s); +} + +//! Returns number of code points in a encoded string. +template +bool CountStringCodePoint(const typename Encoding::Ch* s, SizeType length, SizeType* outCount) { + GenericStringStream is(s); + const typename Encoding::Ch* end = s + length; + SizeType count = 0; + while (is.src_ < end) { + unsigned codepoint; + if (!Encoding::Decode(is, &codepoint)) + return false; + count++; + } + *outCount = count; + return true; +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_INTERNAL_STRFUNC_H_ diff --git a/include/rapidjson/internal/strtod.h b/include/rapidjson/internal/strtod.h new file mode 100644 index 0000000..289c413 --- /dev/null +++ b/include/rapidjson/internal/strtod.h @@ -0,0 +1,269 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_STRTOD_ +#define RAPIDJSON_STRTOD_ + +#include "ieee754.h" +#include "biginteger.h" +#include "diyfp.h" +#include "pow10.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +inline double FastPath(double significand, int exp) { + if (exp < -308) + return 0.0; + else if (exp >= 0) + return significand * internal::Pow10(exp); + else + return significand / internal::Pow10(-exp); +} + +inline double StrtodNormalPrecision(double d, int p) { + if (p < -308) { + // Prevent expSum < -308, making Pow10(p) = 0 + d = FastPath(d, -308); + d = FastPath(d, p + 308); + } + else + d = FastPath(d, p); + return d; +} + +template +inline T Min3(T a, T b, T c) { + T m = a; + if (m > b) m = b; + if (m > c) m = c; + return m; +} + +inline int CheckWithinHalfULP(double b, const BigInteger& d, int dExp) { + const Double db(b); + const uint64_t bInt = db.IntegerSignificand(); + const int bExp = db.IntegerExponent(); + const int hExp = bExp - 1; + + int dS_Exp2 = 0, dS_Exp5 = 0, bS_Exp2 = 0, bS_Exp5 = 0, hS_Exp2 = 0, hS_Exp5 = 0; + + // Adjust for decimal exponent + if (dExp >= 0) { + dS_Exp2 += dExp; + dS_Exp5 += dExp; + } + else { + bS_Exp2 -= dExp; + bS_Exp5 -= dExp; + hS_Exp2 -= dExp; + hS_Exp5 -= dExp; + } + + // Adjust for binary exponent + if (bExp >= 0) + bS_Exp2 += bExp; + else { + dS_Exp2 -= bExp; + hS_Exp2 -= bExp; + } + + // Adjust for half ulp exponent + if (hExp >= 0) + hS_Exp2 += hExp; + else { + dS_Exp2 -= hExp; + bS_Exp2 -= hExp; + } + + // Remove common power of two factor from all three scaled values + int common_Exp2 = Min3(dS_Exp2, bS_Exp2, hS_Exp2); + dS_Exp2 -= common_Exp2; + bS_Exp2 -= common_Exp2; + hS_Exp2 -= common_Exp2; + + BigInteger dS = d; + dS.MultiplyPow5(static_cast(dS_Exp5)) <<= static_cast(dS_Exp2); + + BigInteger bS(bInt); + bS.MultiplyPow5(static_cast(bS_Exp5)) <<= static_cast(bS_Exp2); + + BigInteger hS(1); + hS.MultiplyPow5(static_cast(hS_Exp5)) <<= static_cast(hS_Exp2); + + BigInteger delta(0); + dS.Difference(bS, &delta); + + return delta.Compare(hS); +} + +inline bool StrtodFast(double d, int p, double* result) { + // Use fast path for string-to-double conversion if possible + // see http://www.exploringbinary.com/fast-path-decimal-to-floating-point-conversion/ + if (p > 22 && p < 22 + 16) { + // Fast Path Cases In Disguise + d *= internal::Pow10(p - 22); + p = 22; + } + + if (p >= -22 && p <= 22 && d <= 9007199254740991.0) { // 2^53 - 1 + *result = FastPath(d, p); + return true; + } + else + return false; +} + +// Compute an approximation and see if it is within 1/2 ULP +inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosition, int exp, double* result) { + uint64_t significand = 0; + size_t i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999 + for (; i < length; i++) { + if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) || + (significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] > '5')) + break; + significand = significand * 10u + static_cast(decimals[i] - '0'); + } + + if (i < length && decimals[i] >= '5') // Rounding + significand++; + + size_t remaining = length - i; + const unsigned kUlpShift = 3; + const unsigned kUlp = 1 << kUlpShift; + int64_t error = (remaining == 0) ? 0 : kUlp / 2; + + DiyFp v(significand, 0); + v = v.Normalize(); + error <<= -v.e; + + const int dExp = static_cast(decimalPosition) - static_cast(i) + exp; + + int actualExp; + DiyFp cachedPower = GetCachedPower10(dExp, &actualExp); + if (actualExp != dExp) { + static const DiyFp kPow10[] = { + DiyFp(RAPIDJSON_UINT64_C2(0xa0000000, 00000000), -60), // 10^1 + DiyFp(RAPIDJSON_UINT64_C2(0xc8000000, 00000000), -57), // 10^2 + DiyFp(RAPIDJSON_UINT64_C2(0xfa000000, 00000000), -54), // 10^3 + DiyFp(RAPIDJSON_UINT64_C2(0x9c400000, 00000000), -50), // 10^4 + DiyFp(RAPIDJSON_UINT64_C2(0xc3500000, 00000000), -47), // 10^5 + DiyFp(RAPIDJSON_UINT64_C2(0xf4240000, 00000000), -44), // 10^6 + DiyFp(RAPIDJSON_UINT64_C2(0x98968000, 00000000), -40) // 10^7 + }; + int adjustment = dExp - actualExp - 1; + RAPIDJSON_ASSERT(adjustment >= 0 && adjustment < 7); + v = v * kPow10[adjustment]; + if (length + static_cast(adjustment)> 19u) // has more digits than decimal digits in 64-bit + error += kUlp / 2; + } + + v = v * cachedPower; + + error += kUlp + (error == 0 ? 0 : 1); + + const int oldExp = v.e; + v = v.Normalize(); + error <<= oldExp - v.e; + + const unsigned effectiveSignificandSize = Double::EffectiveSignificandSize(64 + v.e); + unsigned precisionSize = 64 - effectiveSignificandSize; + if (precisionSize + kUlpShift >= 64) { + unsigned scaleExp = (precisionSize + kUlpShift) - 63; + v.f >>= scaleExp; + v.e += scaleExp; + error = (error >> scaleExp) + 1 + static_cast(kUlp); + precisionSize -= scaleExp; + } + + DiyFp rounded(v.f >> precisionSize, v.e + static_cast(precisionSize)); + const uint64_t precisionBits = (v.f & ((uint64_t(1) << precisionSize) - 1)) * kUlp; + const uint64_t halfWay = (uint64_t(1) << (precisionSize - 1)) * kUlp; + if (precisionBits >= halfWay + static_cast(error)) { + rounded.f++; + if (rounded.f & (DiyFp::kDpHiddenBit << 1)) { // rounding overflows mantissa (issue #340) + rounded.f >>= 1; + rounded.e++; + } + } + + *result = rounded.ToDouble(); + + return halfWay - static_cast(error) >= precisionBits || precisionBits >= halfWay + static_cast(error); +} + +inline double StrtodBigInteger(double approx, const char* decimals, size_t length, size_t decimalPosition, int exp) { + const BigInteger dInt(decimals, length); + const int dExp = static_cast(decimalPosition) - static_cast(length) + exp; + Double a(approx); + int cmp = CheckWithinHalfULP(a.Value(), dInt, dExp); + if (cmp < 0) + return a.Value(); // within half ULP + else if (cmp == 0) { + // Round towards even + if (a.Significand() & 1) + return a.NextPositiveDouble(); + else + return a.Value(); + } + else // adjustment + return a.NextPositiveDouble(); +} + +inline double StrtodFullPrecision(double d, int p, const char* decimals, size_t length, size_t decimalPosition, int exp) { + RAPIDJSON_ASSERT(d >= 0.0); + RAPIDJSON_ASSERT(length >= 1); + + double result; + if (StrtodFast(d, p, &result)) + return result; + + // Trim leading zeros + while (*decimals == '0' && length > 1) { + length--; + decimals++; + decimalPosition--; + } + + // Trim trailing zeros + while (decimals[length - 1] == '0' && length > 1) { + length--; + decimalPosition--; + exp++; + } + + // Trim right-most digits + const int kMaxDecimalDigit = 780; + if (static_cast(length) > kMaxDecimalDigit) { + int delta = (static_cast(length) - kMaxDecimalDigit); + exp += delta; + decimalPosition -= static_cast(delta); + length = kMaxDecimalDigit; + } + + // If too small, underflow to zero + if (int(length) + exp < -324) + return 0.0; + + if (StrtodDiyFp(decimals, length, decimalPosition, exp, &result)) + return result; + + // Use approximation from StrtodDiyFp and make adjustment with BigInteger comparison + return StrtodBigInteger(result, decimals, length, decimalPosition, exp); +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_STRTOD_ diff --git a/include/rapidjson/internal/swap.h b/include/rapidjson/internal/swap.h new file mode 100644 index 0000000..666e49f --- /dev/null +++ b/include/rapidjson/internal/swap.h @@ -0,0 +1,46 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_SWAP_H_ +#define RAPIDJSON_INTERNAL_SWAP_H_ + +#include "../rapidjson.h" + +#if defined(__clang__) +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(c++98-compat) +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +//! Custom swap() to avoid dependency on C++ header +/*! \tparam T Type of the arguments to swap, should be instantiated with primitive C++ types only. + \note This has the same semantics as std::swap(). +*/ +template +inline void Swap(T& a, T& b) RAPIDJSON_NOEXCEPT { + T tmp = a; + a = b; + b = tmp; +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#if defined(__clang__) +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_INTERNAL_SWAP_H_ diff --git a/include/rapidjson/istreamwrapper.h b/include/rapidjson/istreamwrapper.h new file mode 100644 index 0000000..f5fe289 --- /dev/null +++ b/include/rapidjson/istreamwrapper.h @@ -0,0 +1,115 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ISTREAMWRAPPER_H_ +#define RAPIDJSON_ISTREAMWRAPPER_H_ + +#include "stream.h" +#include + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4351) // new behavior: elements of array 'array' will be default initialized +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! Wrapper of \c std::basic_istream into RapidJSON's Stream concept. +/*! + The classes can be wrapped including but not limited to: + + - \c std::istringstream + - \c std::stringstream + - \c std::wistringstream + - \c std::wstringstream + - \c std::ifstream + - \c std::fstream + - \c std::wifstream + - \c std::wfstream + + \tparam StreamType Class derived from \c std::basic_istream. +*/ + +template +class BasicIStreamWrapper { +public: + typedef typename StreamType::char_type Ch; + BasicIStreamWrapper(StreamType& stream) : stream_(stream), count_(), peekBuffer_() {} + + Ch Peek() const { + typename StreamType::int_type c = stream_.peek(); + return RAPIDJSON_LIKELY(c != StreamType::traits_type::eof()) ? static_cast(c) : '\0'; + } + + Ch Take() { + typename StreamType::int_type c = stream_.get(); + if (RAPIDJSON_LIKELY(c != StreamType::traits_type::eof())) { + count_++; + return static_cast(c); + } + else + return '\0'; + } + + // tellg() may return -1 when failed. So we count by ourself. + size_t Tell() const { return count_; } + + Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + void Put(Ch) { RAPIDJSON_ASSERT(false); } + void Flush() { RAPIDJSON_ASSERT(false); } + size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } + + // For encoding detection only. + const Ch* Peek4() const { + RAPIDJSON_ASSERT(sizeof(Ch) == 1); // Only usable for byte stream. + int i; + bool hasError = false; + for (i = 0; i < 4; ++i) { + typename StreamType::int_type c = stream_.get(); + if (c == StreamType::traits_type::eof()) { + hasError = true; + stream_.clear(); + break; + } + peekBuffer_[i] = static_cast(c); + } + for (--i; i >= 0; --i) + stream_.putback(peekBuffer_[i]); + return !hasError ? peekBuffer_ : 0; + } + +private: + BasicIStreamWrapper(const BasicIStreamWrapper&); + BasicIStreamWrapper& operator=(const BasicIStreamWrapper&); + + StreamType& stream_; + size_t count_; //!< Number of characters read. Note: + mutable Ch peekBuffer_[4]; +}; + +typedef BasicIStreamWrapper IStreamWrapper; +typedef BasicIStreamWrapper WIStreamWrapper; + +#if defined(__clang__) || defined(_MSC_VER) +RAPIDJSON_DIAG_POP +#endif + +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_ISTREAMWRAPPER_H_ diff --git a/include/rapidjson/memorybuffer.h b/include/rapidjson/memorybuffer.h new file mode 100644 index 0000000..39bee1d --- /dev/null +++ b/include/rapidjson/memorybuffer.h @@ -0,0 +1,70 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_MEMORYBUFFER_H_ +#define RAPIDJSON_MEMORYBUFFER_H_ + +#include "stream.h" +#include "internal/stack.h" + +RAPIDJSON_NAMESPACE_BEGIN + +//! Represents an in-memory output byte stream. +/*! + This class is mainly for being wrapped by EncodedOutputStream or AutoUTFOutputStream. + + It is similar to FileWriteBuffer but the destination is an in-memory buffer instead of a file. + + Differences between MemoryBuffer and StringBuffer: + 1. StringBuffer has Encoding but MemoryBuffer is only a byte buffer. + 2. StringBuffer::GetString() returns a null-terminated string. MemoryBuffer::GetBuffer() returns a buffer without terminator. + + \tparam Allocator type for allocating memory buffer. + \note implements Stream concept +*/ +template +struct GenericMemoryBuffer { + typedef char Ch; // byte + + GenericMemoryBuffer(Allocator* allocator = 0, size_t capacity = kDefaultCapacity) : stack_(allocator, capacity) {} + + void Put(Ch c) { *stack_.template Push() = c; } + void Flush() {} + + void Clear() { stack_.Clear(); } + void ShrinkToFit() { stack_.ShrinkToFit(); } + Ch* Push(size_t count) { return stack_.template Push(count); } + void Pop(size_t count) { stack_.template Pop(count); } + + const Ch* GetBuffer() const { + return stack_.template Bottom(); + } + + size_t GetSize() const { return stack_.GetSize(); } + + static const size_t kDefaultCapacity = 256; + mutable internal::Stack stack_; +}; + +typedef GenericMemoryBuffer<> MemoryBuffer; + +//! Implement specialized version of PutN() with memset() for better performance. +template<> +inline void PutN(MemoryBuffer& memoryBuffer, char c, size_t n) { + std::memset(memoryBuffer.stack_.Push(n), c, n * sizeof(c)); +} + +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_MEMORYBUFFER_H_ diff --git a/include/rapidjson/memorystream.h b/include/rapidjson/memorystream.h new file mode 100644 index 0000000..1d71d8a --- /dev/null +++ b/include/rapidjson/memorystream.h @@ -0,0 +1,71 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_MEMORYSTREAM_H_ +#define RAPIDJSON_MEMORYSTREAM_H_ + +#include "stream.h" + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(unreachable-code) +RAPIDJSON_DIAG_OFF(missing-noreturn) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! Represents an in-memory input byte stream. +/*! + This class is mainly for being wrapped by EncodedInputStream or AutoUTFInputStream. + + It is similar to FileReadBuffer but the source is an in-memory buffer instead of a file. + + Differences between MemoryStream and StringStream: + 1. StringStream has encoding but MemoryStream is a byte stream. + 2. MemoryStream needs size of the source buffer and the buffer don't need to be null terminated. StringStream assume null-terminated string as source. + 3. MemoryStream supports Peek4() for encoding detection. StringStream is specified with an encoding so it should not have Peek4(). + \note implements Stream concept +*/ +struct MemoryStream { + typedef char Ch; // byte + + MemoryStream(const Ch *src, size_t size) : src_(src), begin_(src), end_(src + size), size_(size) {} + + Ch Peek() const { return RAPIDJSON_UNLIKELY(src_ == end_) ? '\0' : *src_; } + Ch Take() { return RAPIDJSON_UNLIKELY(src_ == end_) ? '\0' : *src_++; } + size_t Tell() const { return static_cast(src_ - begin_); } + + Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + void Put(Ch) { RAPIDJSON_ASSERT(false); } + void Flush() { RAPIDJSON_ASSERT(false); } + size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } + + // For encoding detection only. + const Ch* Peek4() const { + return Tell() + 4 <= size_ ? src_ : 0; + } + + const Ch* src_; //!< Current read position. + const Ch* begin_; //!< Original head of the string. + const Ch* end_; //!< End of stream. + size_t size_; //!< Size of the stream. +}; + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_MEMORYBUFFER_H_ diff --git a/include/rapidjson/msinttypes/inttypes.h b/include/rapidjson/msinttypes/inttypes.h new file mode 100644 index 0000000..1811128 --- /dev/null +++ b/include/rapidjson/msinttypes/inttypes.h @@ -0,0 +1,316 @@ +// ISO C9x compliant inttypes.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2013 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the product nor the names of its contributors may +// be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +// The above software in this distribution may have been modified by +// THL A29 Limited ("Tencent Modifications"). +// All Tencent Modifications are Copyright (C) 2015 THL A29 Limited. + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_INTTYPES_H_ // [ +#define _MSC_INTTYPES_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include "stdint.h" + +// miloyip: VC supports inttypes.h since VC2013 +#if _MSC_VER >= 1800 +#include +#else + +// 7.8 Format conversion of integer types + +typedef struct { + intmax_t quot; + intmax_t rem; +} imaxdiv_t; + +// 7.8.1 Macros for format specifiers + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 + +// The fprintf macros for signed integers are: +#define PRId8 "d" +#define PRIi8 "i" +#define PRIdLEAST8 "d" +#define PRIiLEAST8 "i" +#define PRIdFAST8 "d" +#define PRIiFAST8 "i" + +#define PRId16 "hd" +#define PRIi16 "hi" +#define PRIdLEAST16 "hd" +#define PRIiLEAST16 "hi" +#define PRIdFAST16 "hd" +#define PRIiFAST16 "hi" + +#define PRId32 "I32d" +#define PRIi32 "I32i" +#define PRIdLEAST32 "I32d" +#define PRIiLEAST32 "I32i" +#define PRIdFAST32 "I32d" +#define PRIiFAST32 "I32i" + +#define PRId64 "I64d" +#define PRIi64 "I64i" +#define PRIdLEAST64 "I64d" +#define PRIiLEAST64 "I64i" +#define PRIdFAST64 "I64d" +#define PRIiFAST64 "I64i" + +#define PRIdMAX "I64d" +#define PRIiMAX "I64i" + +#define PRIdPTR "Id" +#define PRIiPTR "Ii" + +// The fprintf macros for unsigned integers are: +#define PRIo8 "o" +#define PRIu8 "u" +#define PRIx8 "x" +#define PRIX8 "X" +#define PRIoLEAST8 "o" +#define PRIuLEAST8 "u" +#define PRIxLEAST8 "x" +#define PRIXLEAST8 "X" +#define PRIoFAST8 "o" +#define PRIuFAST8 "u" +#define PRIxFAST8 "x" +#define PRIXFAST8 "X" + +#define PRIo16 "ho" +#define PRIu16 "hu" +#define PRIx16 "hx" +#define PRIX16 "hX" +#define PRIoLEAST16 "ho" +#define PRIuLEAST16 "hu" +#define PRIxLEAST16 "hx" +#define PRIXLEAST16 "hX" +#define PRIoFAST16 "ho" +#define PRIuFAST16 "hu" +#define PRIxFAST16 "hx" +#define PRIXFAST16 "hX" + +#define PRIo32 "I32o" +#define PRIu32 "I32u" +#define PRIx32 "I32x" +#define PRIX32 "I32X" +#define PRIoLEAST32 "I32o" +#define PRIuLEAST32 "I32u" +#define PRIxLEAST32 "I32x" +#define PRIXLEAST32 "I32X" +#define PRIoFAST32 "I32o" +#define PRIuFAST32 "I32u" +#define PRIxFAST32 "I32x" +#define PRIXFAST32 "I32X" + +#define PRIo64 "I64o" +#define PRIu64 "I64u" +#define PRIx64 "I64x" +#define PRIX64 "I64X" +#define PRIoLEAST64 "I64o" +#define PRIuLEAST64 "I64u" +#define PRIxLEAST64 "I64x" +#define PRIXLEAST64 "I64X" +#define PRIoFAST64 "I64o" +#define PRIuFAST64 "I64u" +#define PRIxFAST64 "I64x" +#define PRIXFAST64 "I64X" + +#define PRIoMAX "I64o" +#define PRIuMAX "I64u" +#define PRIxMAX "I64x" +#define PRIXMAX "I64X" + +#define PRIoPTR "Io" +#define PRIuPTR "Iu" +#define PRIxPTR "Ix" +#define PRIXPTR "IX" + +// The fscanf macros for signed integers are: +#define SCNd8 "d" +#define SCNi8 "i" +#define SCNdLEAST8 "d" +#define SCNiLEAST8 "i" +#define SCNdFAST8 "d" +#define SCNiFAST8 "i" + +#define SCNd16 "hd" +#define SCNi16 "hi" +#define SCNdLEAST16 "hd" +#define SCNiLEAST16 "hi" +#define SCNdFAST16 "hd" +#define SCNiFAST16 "hi" + +#define SCNd32 "ld" +#define SCNi32 "li" +#define SCNdLEAST32 "ld" +#define SCNiLEAST32 "li" +#define SCNdFAST32 "ld" +#define SCNiFAST32 "li" + +#define SCNd64 "I64d" +#define SCNi64 "I64i" +#define SCNdLEAST64 "I64d" +#define SCNiLEAST64 "I64i" +#define SCNdFAST64 "I64d" +#define SCNiFAST64 "I64i" + +#define SCNdMAX "I64d" +#define SCNiMAX "I64i" + +#ifdef _WIN64 // [ +# define SCNdPTR "I64d" +# define SCNiPTR "I64i" +#else // _WIN64 ][ +# define SCNdPTR "ld" +# define SCNiPTR "li" +#endif // _WIN64 ] + +// The fscanf macros for unsigned integers are: +#define SCNo8 "o" +#define SCNu8 "u" +#define SCNx8 "x" +#define SCNX8 "X" +#define SCNoLEAST8 "o" +#define SCNuLEAST8 "u" +#define SCNxLEAST8 "x" +#define SCNXLEAST8 "X" +#define SCNoFAST8 "o" +#define SCNuFAST8 "u" +#define SCNxFAST8 "x" +#define SCNXFAST8 "X" + +#define SCNo16 "ho" +#define SCNu16 "hu" +#define SCNx16 "hx" +#define SCNX16 "hX" +#define SCNoLEAST16 "ho" +#define SCNuLEAST16 "hu" +#define SCNxLEAST16 "hx" +#define SCNXLEAST16 "hX" +#define SCNoFAST16 "ho" +#define SCNuFAST16 "hu" +#define SCNxFAST16 "hx" +#define SCNXFAST16 "hX" + +#define SCNo32 "lo" +#define SCNu32 "lu" +#define SCNx32 "lx" +#define SCNX32 "lX" +#define SCNoLEAST32 "lo" +#define SCNuLEAST32 "lu" +#define SCNxLEAST32 "lx" +#define SCNXLEAST32 "lX" +#define SCNoFAST32 "lo" +#define SCNuFAST32 "lu" +#define SCNxFAST32 "lx" +#define SCNXFAST32 "lX" + +#define SCNo64 "I64o" +#define SCNu64 "I64u" +#define SCNx64 "I64x" +#define SCNX64 "I64X" +#define SCNoLEAST64 "I64o" +#define SCNuLEAST64 "I64u" +#define SCNxLEAST64 "I64x" +#define SCNXLEAST64 "I64X" +#define SCNoFAST64 "I64o" +#define SCNuFAST64 "I64u" +#define SCNxFAST64 "I64x" +#define SCNXFAST64 "I64X" + +#define SCNoMAX "I64o" +#define SCNuMAX "I64u" +#define SCNxMAX "I64x" +#define SCNXMAX "I64X" + +#ifdef _WIN64 // [ +# define SCNoPTR "I64o" +# define SCNuPTR "I64u" +# define SCNxPTR "I64x" +# define SCNXPTR "I64X" +#else // _WIN64 ][ +# define SCNoPTR "lo" +# define SCNuPTR "lu" +# define SCNxPTR "lx" +# define SCNXPTR "lX" +#endif // _WIN64 ] + +#endif // __STDC_FORMAT_MACROS ] + +// 7.8.2 Functions for greatest-width integer types + +// 7.8.2.1 The imaxabs function +#define imaxabs _abs64 + +// 7.8.2.2 The imaxdiv function + +// This is modified version of div() function from Microsoft's div.c found +// in %MSVC.NET%\crt\src\div.c +#ifdef STATIC_IMAXDIV // [ +static +#else // STATIC_IMAXDIV ][ +_inline +#endif // STATIC_IMAXDIV ] +imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) +{ + imaxdiv_t result; + + result.quot = numer / denom; + result.rem = numer % denom; + + if (numer < 0 && result.rem > 0) { + // did division wrong; must fix up + ++result.quot; + result.rem -= denom; + } + + return result; +} + +// 7.8.2.3 The strtoimax and strtoumax functions +#define strtoimax _strtoi64 +#define strtoumax _strtoui64 + +// 7.8.2.4 The wcstoimax and wcstoumax functions +#define wcstoimax _wcstoi64 +#define wcstoumax _wcstoui64 + +#endif // _MSC_VER >= 1800 + +#endif // _MSC_INTTYPES_H_ ] diff --git a/include/rapidjson/msinttypes/stdint.h b/include/rapidjson/msinttypes/stdint.h new file mode 100644 index 0000000..3d4477b --- /dev/null +++ b/include/rapidjson/msinttypes/stdint.h @@ -0,0 +1,300 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2013 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the product nor the names of its contributors may +// be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +// The above software in this distribution may have been modified by +// THL A29 Limited ("Tencent Modifications"). +// All Tencent Modifications are Copyright (C) 2015 THL A29 Limited. + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +// miloyip: Originally Visual Studio 2010 uses its own stdint.h. However it generates warning with INT64_C(), so change to use this file for vs2010. +#if _MSC_VER >= 1600 // [ +#include + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +#undef INT8_C +#undef INT16_C +#undef INT32_C +#undef INT64_C +#undef UINT8_C +#undef UINT16_C +#undef UINT32_C +#undef UINT64_C + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +// These #ifndef's are needed to prevent collisions with . +// Check out Issue 9 for the details. +#ifndef INTMAX_C // [ +# define INTMAX_C INT64_C +#endif // INTMAX_C ] +#ifndef UINTMAX_C // [ +# define UINTMAX_C UINT64_C +#endif // UINTMAX_C ] + +#endif // __STDC_CONSTANT_MACROS ] + +#else // ] _MSC_VER >= 1700 [ + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we have to wrap include with 'extern "C++" {}' +// or compiler would give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#if defined(__cplusplus) && !defined(_M_ARM) +extern "C" { +#endif +# include +#if defined(__cplusplus) && !defined(_M_ARM) +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +// These #ifndef's are needed to prevent collisions with . +// Check out Issue 9 for the details. +#ifndef INTMAX_C // [ +# define INTMAX_C INT64_C +#endif // INTMAX_C ] +#ifndef UINTMAX_C // [ +# define UINTMAX_C UINT64_C +#endif // UINTMAX_C ] + +#endif // __STDC_CONSTANT_MACROS ] + +#endif // _MSC_VER >= 1600 ] + +#endif // _MSC_STDINT_H_ ] diff --git a/include/rapidjson/ostreamwrapper.h b/include/rapidjson/ostreamwrapper.h new file mode 100644 index 0000000..6f4667c --- /dev/null +++ b/include/rapidjson/ostreamwrapper.h @@ -0,0 +1,81 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_OSTREAMWRAPPER_H_ +#define RAPIDJSON_OSTREAMWRAPPER_H_ + +#include "stream.h" +#include + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! Wrapper of \c std::basic_ostream into RapidJSON's Stream concept. +/*! + The classes can be wrapped including but not limited to: + + - \c std::ostringstream + - \c std::stringstream + - \c std::wpstringstream + - \c std::wstringstream + - \c std::ifstream + - \c std::fstream + - \c std::wofstream + - \c std::wfstream + + \tparam StreamType Class derived from \c std::basic_ostream. +*/ + +template +class BasicOStreamWrapper { +public: + typedef typename StreamType::char_type Ch; + BasicOStreamWrapper(StreamType& stream) : stream_(stream) {} + + void Put(Ch c) { + stream_.put(c); + } + + void Flush() { + stream_.flush(); + } + + // Not implemented + char Peek() const { RAPIDJSON_ASSERT(false); return 0; } + char Take() { RAPIDJSON_ASSERT(false); return 0; } + size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; } + char* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + size_t PutEnd(char*) { RAPIDJSON_ASSERT(false); return 0; } + +private: + BasicOStreamWrapper(const BasicOStreamWrapper&); + BasicOStreamWrapper& operator=(const BasicOStreamWrapper&); + + StreamType& stream_; +}; + +typedef BasicOStreamWrapper OStreamWrapper; +typedef BasicOStreamWrapper WOStreamWrapper; + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_OSTREAMWRAPPER_H_ diff --git a/include/rapidjson/pointer.h b/include/rapidjson/pointer.h new file mode 100644 index 0000000..0206ac1 --- /dev/null +++ b/include/rapidjson/pointer.h @@ -0,0 +1,1358 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_POINTER_H_ +#define RAPIDJSON_POINTER_H_ + +#include "document.h" +#include "internal/itoa.h" + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(switch-enum) +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +static const SizeType kPointerInvalidIndex = ~SizeType(0); //!< Represents an invalid index in GenericPointer::Token + +//! Error code of parsing. +/*! \ingroup RAPIDJSON_ERRORS + \see GenericPointer::GenericPointer, GenericPointer::GetParseErrorCode +*/ +enum PointerParseErrorCode { + kPointerParseErrorNone = 0, //!< The parse is successful + + kPointerParseErrorTokenMustBeginWithSolidus, //!< A token must begin with a '/' + kPointerParseErrorInvalidEscape, //!< Invalid escape + kPointerParseErrorInvalidPercentEncoding, //!< Invalid percent encoding in URI fragment + kPointerParseErrorCharacterMustPercentEncode //!< A character must percent encoded in URI fragment +}; + +/////////////////////////////////////////////////////////////////////////////// +// GenericPointer + +//! Represents a JSON Pointer. Use Pointer for UTF8 encoding and default allocator. +/*! + This class implements RFC 6901 "JavaScript Object Notation (JSON) Pointer" + (https://tools.ietf.org/html/rfc6901). + + A JSON pointer is for identifying a specific value in a JSON document + (GenericDocument). It can simplify coding of DOM tree manipulation, because it + can access multiple-level depth of DOM tree with single API call. + + After it parses a string representation (e.g. "/foo/0" or URI fragment + representation (e.g. "#/foo/0") into its internal representation (tokens), + it can be used to resolve a specific value in multiple documents, or sub-tree + of documents. + + Contrary to GenericValue, Pointer can be copy constructed and copy assigned. + Apart from assignment, a Pointer cannot be modified after construction. + + Although Pointer is very convenient, please aware that constructing Pointer + involves parsing and dynamic memory allocation. A special constructor with user- + supplied tokens eliminates these. + + GenericPointer depends on GenericDocument and GenericValue. + + \tparam ValueType The value type of the DOM tree. E.g. GenericValue > + \tparam Allocator The allocator type for allocating memory for internal representation. + + \note GenericPointer uses same encoding of ValueType. + However, Allocator of GenericPointer is independent of Allocator of Value. +*/ +template +class GenericPointer { +public: + typedef typename ValueType::EncodingType EncodingType; //!< Encoding type from Value + typedef typename ValueType::Ch Ch; //!< Character type from Value + + //! A token is the basic units of internal representation. + /*! + A JSON pointer string representation "/foo/123" is parsed to two tokens: + "foo" and 123. 123 will be represented in both numeric form and string form. + They are resolved according to the actual value type (object or array). + + For token that are not numbers, or the numeric value is out of bound + (greater than limits of SizeType), they are only treated as string form + (i.e. the token's index will be equal to kPointerInvalidIndex). + + This struct is public so that user can create a Pointer without parsing and + allocation, using a special constructor. + */ + struct Token { + const Ch* name; //!< Name of the token. It has null character at the end but it can contain null character. + SizeType length; //!< Length of the name. + SizeType index; //!< A valid array index, if it is not equal to kPointerInvalidIndex. + }; + + //!@name Constructors and destructor. + //@{ + + //! Default constructor. + GenericPointer(Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) {} + + //! Constructor that parses a string or URI fragment representation. + /*! + \param source A null-terminated, string or URI fragment representation of JSON pointer. + \param allocator User supplied allocator for this pointer. If no allocator is provided, it creates a self-owned one. + */ + explicit GenericPointer(const Ch* source, Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) { + Parse(source, internal::StrLen(source)); + } + +#if RAPIDJSON_HAS_STDSTRING + //! Constructor that parses a string or URI fragment representation. + /*! + \param source A string or URI fragment representation of JSON pointer. + \param allocator User supplied allocator for this pointer. If no allocator is provided, it creates a self-owned one. + \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING. + */ + explicit GenericPointer(const std::basic_string& source, Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) { + Parse(source.c_str(), source.size()); + } +#endif + + //! Constructor that parses a string or URI fragment representation, with length of the source string. + /*! + \param source A string or URI fragment representation of JSON pointer. + \param length Length of source. + \param allocator User supplied allocator for this pointer. If no allocator is provided, it creates a self-owned one. + \note Slightly faster than the overload without length. + */ + GenericPointer(const Ch* source, size_t length, Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) { + Parse(source, length); + } + + //! Constructor with user-supplied tokens. + /*! + This constructor let user supplies const array of tokens. + This prevents the parsing process and eliminates allocation. + This is preferred for memory constrained environments. + + \param tokens An constant array of tokens representing the JSON pointer. + \param tokenCount Number of tokens. + + \b Example + \code + #define NAME(s) { s, sizeof(s) / sizeof(s[0]) - 1, kPointerInvalidIndex } + #define INDEX(i) { #i, sizeof(#i) - 1, i } + + static const Pointer::Token kTokens[] = { NAME("foo"), INDEX(123) }; + static const Pointer p(kTokens, sizeof(kTokens) / sizeof(kTokens[0])); + // Equivalent to static const Pointer p("/foo/123"); + + #undef NAME + #undef INDEX + \endcode + */ + GenericPointer(const Token* tokens, size_t tokenCount) : allocator_(), ownAllocator_(), nameBuffer_(), tokens_(const_cast(tokens)), tokenCount_(tokenCount), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) {} + + //! Copy constructor. + GenericPointer(const GenericPointer& rhs, Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) { + *this = rhs; + } + + //! Destructor. + ~GenericPointer() { + if (nameBuffer_) // If user-supplied tokens constructor is used, nameBuffer_ is nullptr and tokens_ are not deallocated. + Allocator::Free(tokens_); + RAPIDJSON_DELETE(ownAllocator_); + } + + //! Assignment operator. + GenericPointer& operator=(const GenericPointer& rhs) { + if (this != &rhs) { + // Do not delete ownAllcator + if (nameBuffer_) + Allocator::Free(tokens_); + + tokenCount_ = rhs.tokenCount_; + parseErrorOffset_ = rhs.parseErrorOffset_; + parseErrorCode_ = rhs.parseErrorCode_; + + if (rhs.nameBuffer_) + CopyFromRaw(rhs); // Normally parsed tokens. + else { + tokens_ = rhs.tokens_; // User supplied const tokens. + nameBuffer_ = 0; + } + } + return *this; + } + + //@} + + //!@name Append token + //@{ + + //! Append a token and return a new Pointer + /*! + \param token Token to be appended. + \param allocator Allocator for the newly return Pointer. + \return A new Pointer with appended token. + */ + GenericPointer Append(const Token& token, Allocator* allocator = 0) const { + GenericPointer r; + r.allocator_ = allocator; + Ch *p = r.CopyFromRaw(*this, 1, token.length + 1); + std::memcpy(p, token.name, (token.length + 1) * sizeof(Ch)); + r.tokens_[tokenCount_].name = p; + r.tokens_[tokenCount_].length = token.length; + r.tokens_[tokenCount_].index = token.index; + return r; + } + + //! Append a name token with length, and return a new Pointer + /*! + \param name Name to be appended. + \param length Length of name. + \param allocator Allocator for the newly return Pointer. + \return A new Pointer with appended token. + */ + GenericPointer Append(const Ch* name, SizeType length, Allocator* allocator = 0) const { + Token token = { name, length, kPointerInvalidIndex }; + return Append(token, allocator); + } + + //! Append a name token without length, and return a new Pointer + /*! + \param name Name (const Ch*) to be appended. + \param allocator Allocator for the newly return Pointer. + \return A new Pointer with appended token. + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::NotExpr::Type, Ch> >), (GenericPointer)) + Append(T* name, Allocator* allocator = 0) const { + return Append(name, StrLen(name), allocator); + } + +#if RAPIDJSON_HAS_STDSTRING + //! Append a name token, and return a new Pointer + /*! + \param name Name to be appended. + \param allocator Allocator for the newly return Pointer. + \return A new Pointer with appended token. + */ + GenericPointer Append(const std::basic_string& name, Allocator* allocator = 0) const { + return Append(name.c_str(), static_cast(name.size()), allocator); + } +#endif + + //! Append a index token, and return a new Pointer + /*! + \param index Index to be appended. + \param allocator Allocator for the newly return Pointer. + \return A new Pointer with appended token. + */ + GenericPointer Append(SizeType index, Allocator* allocator = 0) const { + char buffer[21]; + char* end = sizeof(SizeType) == 4 ? internal::u32toa(index, buffer) : internal::u64toa(index, buffer); + SizeType length = static_cast(end - buffer); + buffer[length] = '\0'; + + if (sizeof(Ch) == 1) { + Token token = { reinterpret_cast(buffer), length, index }; + return Append(token, allocator); + } + else { + Ch name[21]; + for (size_t i = 0; i <= length; i++) + name[i] = buffer[i]; + Token token = { name, length, index }; + return Append(token, allocator); + } + } + + //! Append a token by value, and return a new Pointer + /*! + \param token token to be appended. + \param allocator Allocator for the newly return Pointer. + \return A new Pointer with appended token. + */ + GenericPointer Append(const ValueType& token, Allocator* allocator = 0) const { + if (token.IsString()) + return Append(token.GetString(), token.GetStringLength(), allocator); + else { + RAPIDJSON_ASSERT(token.IsUint64()); + RAPIDJSON_ASSERT(token.GetUint64() <= SizeType(~0)); + return Append(static_cast(token.GetUint64()), allocator); + } + } + + //!@name Handling Parse Error + //@{ + + //! Check whether this is a valid pointer. + bool IsValid() const { return parseErrorCode_ == kPointerParseErrorNone; } + + //! Get the parsing error offset in code unit. + size_t GetParseErrorOffset() const { return parseErrorOffset_; } + + //! Get the parsing error code. + PointerParseErrorCode GetParseErrorCode() const { return parseErrorCode_; } + + //@} + + //! Get the allocator of this pointer. + Allocator& GetAllocator() { return *allocator_; } + + //!@name Tokens + //@{ + + //! Get the token array (const version only). + const Token* GetTokens() const { return tokens_; } + + //! Get the number of tokens. + size_t GetTokenCount() const { return tokenCount_; } + + //@} + + //!@name Equality/inequality operators + //@{ + + //! Equality operator. + /*! + \note When any pointers are invalid, always returns false. + */ + bool operator==(const GenericPointer& rhs) const { + if (!IsValid() || !rhs.IsValid() || tokenCount_ != rhs.tokenCount_) + return false; + + for (size_t i = 0; i < tokenCount_; i++) { + if (tokens_[i].index != rhs.tokens_[i].index || + tokens_[i].length != rhs.tokens_[i].length || + (tokens_[i].length != 0 && std::memcmp(tokens_[i].name, rhs.tokens_[i].name, sizeof(Ch)* tokens_[i].length) != 0)) + { + return false; + } + } + + return true; + } + + //! Inequality operator. + /*! + \note When any pointers are invalid, always returns true. + */ + bool operator!=(const GenericPointer& rhs) const { return !(*this == rhs); } + + //@} + + //!@name Stringify + //@{ + + //! Stringify the pointer into string representation. + /*! + \tparam OutputStream Type of output stream. + \param os The output stream. + */ + template + bool Stringify(OutputStream& os) const { + return Stringify(os); + } + + //! Stringify the pointer into URI fragment representation. + /*! + \tparam OutputStream Type of output stream. + \param os The output stream. + */ + template + bool StringifyUriFragment(OutputStream& os) const { + return Stringify(os); + } + + //@} + + //!@name Create value + //@{ + + //! Create a value in a subtree. + /*! + If the value is not exist, it creates all parent values and a JSON Null value. + So it always succeed and return the newly created or existing value. + + Remind that it may change types of parents according to tokens, so it + potentially removes previously stored values. For example, if a document + was an array, and "/foo" is used to create a value, then the document + will be changed to an object, and all existing array elements are lost. + + \param root Root value of a DOM subtree to be resolved. It can be any value other than document root. + \param allocator Allocator for creating the values if the specified value or its parents are not exist. + \param alreadyExist If non-null, it stores whether the resolved value is already exist. + \return The resolved newly created (a JSON Null value), or already exists value. + */ + ValueType& Create(ValueType& root, typename ValueType::AllocatorType& allocator, bool* alreadyExist = 0) const { + RAPIDJSON_ASSERT(IsValid()); + ValueType* v = &root; + bool exist = true; + for (const Token *t = tokens_; t != tokens_ + tokenCount_; ++t) { + if (v->IsArray() && t->name[0] == '-' && t->length == 1) { + v->PushBack(ValueType().Move(), allocator); + v = &((*v)[v->Size() - 1]); + exist = false; + } + else { + if (t->index == kPointerInvalidIndex) { // must be object name + if (!v->IsObject()) + v->SetObject(); // Change to Object + } + else { // object name or array index + if (!v->IsArray() && !v->IsObject()) + v->SetArray(); // Change to Array + } + + if (v->IsArray()) { + if (t->index >= v->Size()) { + v->Reserve(t->index + 1, allocator); + while (t->index >= v->Size()) + v->PushBack(ValueType().Move(), allocator); + exist = false; + } + v = &((*v)[t->index]); + } + else { + typename ValueType::MemberIterator m = v->FindMember(GenericStringRef(t->name, t->length)); + if (m == v->MemberEnd()) { + v->AddMember(ValueType(t->name, t->length, allocator).Move(), ValueType().Move(), allocator); + v = &(--v->MemberEnd())->value; // Assumes AddMember() appends at the end + exist = false; + } + else + v = &m->value; + } + } + } + + if (alreadyExist) + *alreadyExist = exist; + + return *v; + } + + //! Creates a value in a document. + /*! + \param document A document to be resolved. + \param alreadyExist If non-null, it stores whether the resolved value is already exist. + \return The resolved newly created, or already exists value. + */ + template + ValueType& Create(GenericDocument& document, bool* alreadyExist = 0) const { + return Create(document, document.GetAllocator(), alreadyExist); + } + + //@} + + //!@name Query value + //@{ + + //! Query a value in a subtree. + /*! + \param root Root value of a DOM sub-tree to be resolved. It can be any value other than document root. + \param unresolvedTokenIndex If the pointer cannot resolve a token in the pointer, this parameter can obtain the index of unresolved token. + \return Pointer to the value if it can be resolved. Otherwise null. + + \note + There are only 3 situations when a value cannot be resolved: + 1. A value in the path is not an array nor object. + 2. An object value does not contain the token. + 3. A token is out of range of an array value. + + Use unresolvedTokenIndex to retrieve the token index. + */ + ValueType* Get(ValueType& root, size_t* unresolvedTokenIndex = 0) const { + RAPIDJSON_ASSERT(IsValid()); + ValueType* v = &root; + for (const Token *t = tokens_; t != tokens_ + tokenCount_; ++t) { + switch (v->GetType()) { + case kObjectType: + { + typename ValueType::MemberIterator m = v->FindMember(GenericStringRef(t->name, t->length)); + if (m == v->MemberEnd()) + break; + v = &m->value; + } + continue; + case kArrayType: + if (t->index == kPointerInvalidIndex || t->index >= v->Size()) + break; + v = &((*v)[t->index]); + continue; + default: + break; + } + + // Error: unresolved token + if (unresolvedTokenIndex) + *unresolvedTokenIndex = static_cast(t - tokens_); + return 0; + } + return v; + } + + //! Query a const value in a const subtree. + /*! + \param root Root value of a DOM sub-tree to be resolved. It can be any value other than document root. + \return Pointer to the value if it can be resolved. Otherwise null. + */ + const ValueType* Get(const ValueType& root, size_t* unresolvedTokenIndex = 0) const { + return Get(const_cast(root), unresolvedTokenIndex); + } + + //@} + + //!@name Query a value with default + //@{ + + //! Query a value in a subtree with default value. + /*! + Similar to Get(), but if the specified value do not exists, it creates all parents and clone the default value. + So that this function always succeed. + + \param root Root value of a DOM sub-tree to be resolved. It can be any value other than document root. + \param defaultValue Default value to be cloned if the value was not exists. + \param allocator Allocator for creating the values if the specified value or its parents are not exist. + \see Create() + */ + ValueType& GetWithDefault(ValueType& root, const ValueType& defaultValue, typename ValueType::AllocatorType& allocator) const { + bool alreadyExist; + Value& v = Create(root, allocator, &alreadyExist); + return alreadyExist ? v : v.CopyFrom(defaultValue, allocator); + } + + //! Query a value in a subtree with default null-terminated string. + ValueType& GetWithDefault(ValueType& root, const Ch* defaultValue, typename ValueType::AllocatorType& allocator) const { + bool alreadyExist; + Value& v = Create(root, allocator, &alreadyExist); + return alreadyExist ? v : v.SetString(defaultValue, allocator); + } + +#if RAPIDJSON_HAS_STDSTRING + //! Query a value in a subtree with default std::basic_string. + ValueType& GetWithDefault(ValueType& root, const std::basic_string& defaultValue, typename ValueType::AllocatorType& allocator) const { + bool alreadyExist; + Value& v = Create(root, allocator, &alreadyExist); + return alreadyExist ? v : v.SetString(defaultValue, allocator); + } +#endif + + //! Query a value in a subtree with default primitive value. + /*! + \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t, \c bool + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (ValueType&)) + GetWithDefault(ValueType& root, T defaultValue, typename ValueType::AllocatorType& allocator) const { + return GetWithDefault(root, ValueType(defaultValue).Move(), allocator); + } + + //! Query a value in a document with default value. + template + ValueType& GetWithDefault(GenericDocument& document, const ValueType& defaultValue) const { + return GetWithDefault(document, defaultValue, document.GetAllocator()); + } + + //! Query a value in a document with default null-terminated string. + template + ValueType& GetWithDefault(GenericDocument& document, const Ch* defaultValue) const { + return GetWithDefault(document, defaultValue, document.GetAllocator()); + } + +#if RAPIDJSON_HAS_STDSTRING + //! Query a value in a document with default std::basic_string. + template + ValueType& GetWithDefault(GenericDocument& document, const std::basic_string& defaultValue) const { + return GetWithDefault(document, defaultValue, document.GetAllocator()); + } +#endif + + //! Query a value in a document with default primitive value. + /*! + \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t, \c bool + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (ValueType&)) + GetWithDefault(GenericDocument& document, T defaultValue) const { + return GetWithDefault(document, defaultValue, document.GetAllocator()); + } + + //@} + + //!@name Set a value + //@{ + + //! Set a value in a subtree, with move semantics. + /*! + It creates all parents if they are not exist or types are different to the tokens. + So this function always succeeds but potentially remove existing values. + + \param root Root value of a DOM sub-tree to be resolved. It can be any value other than document root. + \param value Value to be set. + \param allocator Allocator for creating the values if the specified value or its parents are not exist. + \see Create() + */ + ValueType& Set(ValueType& root, ValueType& value, typename ValueType::AllocatorType& allocator) const { + return Create(root, allocator) = value; + } + + //! Set a value in a subtree, with copy semantics. + ValueType& Set(ValueType& root, const ValueType& value, typename ValueType::AllocatorType& allocator) const { + return Create(root, allocator).CopyFrom(value, allocator); + } + + //! Set a null-terminated string in a subtree. + ValueType& Set(ValueType& root, const Ch* value, typename ValueType::AllocatorType& allocator) const { + return Create(root, allocator) = ValueType(value, allocator).Move(); + } + +#if RAPIDJSON_HAS_STDSTRING + //! Set a std::basic_string in a subtree. + ValueType& Set(ValueType& root, const std::basic_string& value, typename ValueType::AllocatorType& allocator) const { + return Create(root, allocator) = ValueType(value, allocator).Move(); + } +#endif + + //! Set a primitive value in a subtree. + /*! + \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t, \c bool + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (ValueType&)) + Set(ValueType& root, T value, typename ValueType::AllocatorType& allocator) const { + return Create(root, allocator) = ValueType(value).Move(); + } + + //! Set a value in a document, with move semantics. + template + ValueType& Set(GenericDocument& document, ValueType& value) const { + return Create(document) = value; + } + + //! Set a value in a document, with copy semantics. + template + ValueType& Set(GenericDocument& document, const ValueType& value) const { + return Create(document).CopyFrom(value, document.GetAllocator()); + } + + //! Set a null-terminated string in a document. + template + ValueType& Set(GenericDocument& document, const Ch* value) const { + return Create(document) = ValueType(value, document.GetAllocator()).Move(); + } + +#if RAPIDJSON_HAS_STDSTRING + //! Sets a std::basic_string in a document. + template + ValueType& Set(GenericDocument& document, const std::basic_string& value) const { + return Create(document) = ValueType(value, document.GetAllocator()).Move(); + } +#endif + + //! Set a primitive value in a document. + /*! + \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t, \c bool + */ + template + RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (ValueType&)) + Set(GenericDocument& document, T value) const { + return Create(document) = value; + } + + //@} + + //!@name Swap a value + //@{ + + //! Swap a value with a value in a subtree. + /*! + It creates all parents if they are not exist or types are different to the tokens. + So this function always succeeds but potentially remove existing values. + + \param root Root value of a DOM sub-tree to be resolved. It can be any value other than document root. + \param value Value to be swapped. + \param allocator Allocator for creating the values if the specified value or its parents are not exist. + \see Create() + */ + ValueType& Swap(ValueType& root, ValueType& value, typename ValueType::AllocatorType& allocator) const { + return Create(root, allocator).Swap(value); + } + + //! Swap a value with a value in a document. + template + ValueType& Swap(GenericDocument& document, ValueType& value) const { + return Create(document).Swap(value); + } + + //@} + + //! Erase a value in a subtree. + /*! + \param root Root value of a DOM sub-tree to be resolved. It can be any value other than document root. + \return Whether the resolved value is found and erased. + + \note Erasing with an empty pointer \c Pointer(""), i.e. the root, always fail and return false. + */ + bool Erase(ValueType& root) const { + RAPIDJSON_ASSERT(IsValid()); + if (tokenCount_ == 0) // Cannot erase the root + return false; + + ValueType* v = &root; + const Token* last = tokens_ + (tokenCount_ - 1); + for (const Token *t = tokens_; t != last; ++t) { + switch (v->GetType()) { + case kObjectType: + { + typename ValueType::MemberIterator m = v->FindMember(GenericStringRef(t->name, t->length)); + if (m == v->MemberEnd()) + return false; + v = &m->value; + } + break; + case kArrayType: + if (t->index == kPointerInvalidIndex || t->index >= v->Size()) + return false; + v = &((*v)[t->index]); + break; + default: + return false; + } + } + + switch (v->GetType()) { + case kObjectType: + return v->EraseMember(GenericStringRef(last->name, last->length)); + case kArrayType: + if (last->index == kPointerInvalidIndex || last->index >= v->Size()) + return false; + v->Erase(v->Begin() + last->index); + return true; + default: + return false; + } + } + +private: + //! Clone the content from rhs to this. + /*! + \param rhs Source pointer. + \param extraToken Extra tokens to be allocated. + \param extraNameBufferSize Extra name buffer size (in number of Ch) to be allocated. + \return Start of non-occupied name buffer, for storing extra names. + */ + Ch* CopyFromRaw(const GenericPointer& rhs, size_t extraToken = 0, size_t extraNameBufferSize = 0) { + if (!allocator_) // allocator is independently owned. + ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); + + size_t nameBufferSize = rhs.tokenCount_; // null terminators for tokens + for (Token *t = rhs.tokens_; t != rhs.tokens_ + rhs.tokenCount_; ++t) + nameBufferSize += t->length; + + tokenCount_ = rhs.tokenCount_ + extraToken; + tokens_ = static_cast(allocator_->Malloc(tokenCount_ * sizeof(Token) + (nameBufferSize + extraNameBufferSize) * sizeof(Ch))); + nameBuffer_ = reinterpret_cast(tokens_ + tokenCount_); + if (rhs.tokenCount_ > 0) { + std::memcpy(tokens_, rhs.tokens_, rhs.tokenCount_ * sizeof(Token)); + } + if (nameBufferSize > 0) { + std::memcpy(nameBuffer_, rhs.nameBuffer_, nameBufferSize * sizeof(Ch)); + } + + // Adjust pointers to name buffer + std::ptrdiff_t diff = nameBuffer_ - rhs.nameBuffer_; + for (Token *t = tokens_; t != tokens_ + rhs.tokenCount_; ++t) + t->name += diff; + + return nameBuffer_ + nameBufferSize; + } + + //! Check whether a character should be percent-encoded. + /*! + According to RFC 3986 2.3 Unreserved Characters. + \param c The character (code unit) to be tested. + */ + bool NeedPercentEncode(Ch c) const { + return !((c >= '0' && c <= '9') || (c >= 'A' && c <='Z') || (c >= 'a' && c <= 'z') || c == '-' || c == '.' || c == '_' || c =='~'); + } + + //! Parse a JSON String or its URI fragment representation into tokens. +#ifndef __clang__ // -Wdocumentation + /*! + \param source Either a JSON Pointer string, or its URI fragment representation. Not need to be null terminated. + \param length Length of the source string. + \note Source cannot be JSON String Representation of JSON Pointer, e.g. In "/\u0000", \u0000 will not be unescaped. + */ +#endif + void Parse(const Ch* source, size_t length) { + RAPIDJSON_ASSERT(source != NULL); + RAPIDJSON_ASSERT(nameBuffer_ == 0); + RAPIDJSON_ASSERT(tokens_ == 0); + + // Create own allocator if user did not supply. + if (!allocator_) + ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); + + // Count number of '/' as tokenCount + tokenCount_ = 0; + for (const Ch* s = source; s != source + length; s++) + if (*s == '/') + tokenCount_++; + + Token* token = tokens_ = static_cast(allocator_->Malloc(tokenCount_ * sizeof(Token) + length * sizeof(Ch))); + Ch* name = nameBuffer_ = reinterpret_cast(tokens_ + tokenCount_); + size_t i = 0; + + // Detect if it is a URI fragment + bool uriFragment = false; + if (source[i] == '#') { + uriFragment = true; + i++; + } + + if (i != length && source[i] != '/') { + parseErrorCode_ = kPointerParseErrorTokenMustBeginWithSolidus; + goto error; + } + + while (i < length) { + RAPIDJSON_ASSERT(source[i] == '/'); + i++; // consumes '/' + + token->name = name; + bool isNumber = true; + + while (i < length && source[i] != '/') { + Ch c = source[i]; + if (uriFragment) { + // Decoding percent-encoding for URI fragment + if (c == '%') { + PercentDecodeStream is(&source[i], source + length); + GenericInsituStringStream os(name); + Ch* begin = os.PutBegin(); + if (!Transcoder, EncodingType>().Validate(is, os) || !is.IsValid()) { + parseErrorCode_ = kPointerParseErrorInvalidPercentEncoding; + goto error; + } + size_t len = os.PutEnd(begin); + i += is.Tell() - 1; + if (len == 1) + c = *name; + else { + name += len; + isNumber = false; + i++; + continue; + } + } + else if (NeedPercentEncode(c)) { + parseErrorCode_ = kPointerParseErrorCharacterMustPercentEncode; + goto error; + } + } + + i++; + + // Escaping "~0" -> '~', "~1" -> '/' + if (c == '~') { + if (i < length) { + c = source[i]; + if (c == '0') c = '~'; + else if (c == '1') c = '/'; + else { + parseErrorCode_ = kPointerParseErrorInvalidEscape; + goto error; + } + i++; + } + else { + parseErrorCode_ = kPointerParseErrorInvalidEscape; + goto error; + } + } + + // First check for index: all of characters are digit + if (c < '0' || c > '9') + isNumber = false; + + *name++ = c; + } + token->length = static_cast(name - token->name); + if (token->length == 0) + isNumber = false; + *name++ = '\0'; // Null terminator + + // Second check for index: more than one digit cannot have leading zero + if (isNumber && token->length > 1 && token->name[0] == '0') + isNumber = false; + + // String to SizeType conversion + SizeType n = 0; + if (isNumber) { + for (size_t j = 0; j < token->length; j++) { + SizeType m = n * 10 + static_cast(token->name[j] - '0'); + if (m < n) { // overflow detection + isNumber = false; + break; + } + n = m; + } + } + + token->index = isNumber ? n : kPointerInvalidIndex; + token++; + } + + RAPIDJSON_ASSERT(name <= nameBuffer_ + length); // Should not overflow buffer + parseErrorCode_ = kPointerParseErrorNone; + return; + + error: + Allocator::Free(tokens_); + nameBuffer_ = 0; + tokens_ = 0; + tokenCount_ = 0; + parseErrorOffset_ = i; + return; + } + + //! Stringify to string or URI fragment representation. + /*! + \tparam uriFragment True for stringifying to URI fragment representation. False for string representation. + \tparam OutputStream type of output stream. + \param os The output stream. + */ + template + bool Stringify(OutputStream& os) const { + RAPIDJSON_ASSERT(IsValid()); + + if (uriFragment) + os.Put('#'); + + for (Token *t = tokens_; t != tokens_ + tokenCount_; ++t) { + os.Put('/'); + for (size_t j = 0; j < t->length; j++) { + Ch c = t->name[j]; + if (c == '~') { + os.Put('~'); + os.Put('0'); + } + else if (c == '/') { + os.Put('~'); + os.Put('1'); + } + else if (uriFragment && NeedPercentEncode(c)) { + // Transcode to UTF8 sequence + GenericStringStream source(&t->name[j]); + PercentEncodeStream target(os); + if (!Transcoder >().Validate(source, target)) + return false; + j += source.Tell() - 1; + } + else + os.Put(c); + } + } + return true; + } + + //! A helper stream for decoding a percent-encoded sequence into code unit. + /*! + This stream decodes %XY triplet into code unit (0-255). + If it encounters invalid characters, it sets output code unit as 0 and + mark invalid, and to be checked by IsValid(). + */ + class PercentDecodeStream { + public: + typedef typename ValueType::Ch Ch; + + //! Constructor + /*! + \param source Start of the stream + \param end Past-the-end of the stream. + */ + PercentDecodeStream(const Ch* source, const Ch* end) : src_(source), head_(source), end_(end), valid_(true) {} + + Ch Take() { + if (*src_ != '%' || src_ + 3 > end_) { // %XY triplet + valid_ = false; + return 0; + } + src_++; + Ch c = 0; + for (int j = 0; j < 2; j++) { + c = static_cast(c << 4); + Ch h = *src_; + if (h >= '0' && h <= '9') c = static_cast(c + h - '0'); + else if (h >= 'A' && h <= 'F') c = static_cast(c + h - 'A' + 10); + else if (h >= 'a' && h <= 'f') c = static_cast(c + h - 'a' + 10); + else { + valid_ = false; + return 0; + } + src_++; + } + return c; + } + + size_t Tell() const { return static_cast(src_ - head_); } + bool IsValid() const { return valid_; } + + private: + const Ch* src_; //!< Current read position. + const Ch* head_; //!< Original head of the string. + const Ch* end_; //!< Past-the-end position. + bool valid_; //!< Whether the parsing is valid. + }; + + //! A helper stream to encode character (UTF-8 code unit) into percent-encoded sequence. + template + class PercentEncodeStream { + public: + PercentEncodeStream(OutputStream& os) : os_(os) {} + void Put(char c) { // UTF-8 must be byte + unsigned char u = static_cast(c); + static const char hexDigits[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + os_.Put('%'); + os_.Put(hexDigits[u >> 4]); + os_.Put(hexDigits[u & 15]); + } + private: + OutputStream& os_; + }; + + Allocator* allocator_; //!< The current allocator. It is either user-supplied or equal to ownAllocator_. + Allocator* ownAllocator_; //!< Allocator owned by this Pointer. + Ch* nameBuffer_; //!< A buffer containing all names in tokens. + Token* tokens_; //!< A list of tokens. + size_t tokenCount_; //!< Number of tokens in tokens_. + size_t parseErrorOffset_; //!< Offset in code unit when parsing fail. + PointerParseErrorCode parseErrorCode_; //!< Parsing error code. +}; + +//! GenericPointer for Value (UTF-8, default allocator). +typedef GenericPointer Pointer; + +//!@name Helper functions for GenericPointer +//@{ + +////////////////////////////////////////////////////////////////////////////// + +template +typename T::ValueType& CreateValueByPointer(T& root, const GenericPointer& pointer, typename T::AllocatorType& a) { + return pointer.Create(root, a); +} + +template +typename T::ValueType& CreateValueByPointer(T& root, const CharType(&source)[N], typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).Create(root, a); +} + +// No allocator parameter + +template +typename DocumentType::ValueType& CreateValueByPointer(DocumentType& document, const GenericPointer& pointer) { + return pointer.Create(document); +} + +template +typename DocumentType::ValueType& CreateValueByPointer(DocumentType& document, const CharType(&source)[N]) { + return GenericPointer(source, N - 1).Create(document); +} + +////////////////////////////////////////////////////////////////////////////// + +template +typename T::ValueType* GetValueByPointer(T& root, const GenericPointer& pointer, size_t* unresolvedTokenIndex = 0) { + return pointer.Get(root, unresolvedTokenIndex); +} + +template +const typename T::ValueType* GetValueByPointer(const T& root, const GenericPointer& pointer, size_t* unresolvedTokenIndex = 0) { + return pointer.Get(root, unresolvedTokenIndex); +} + +template +typename T::ValueType* GetValueByPointer(T& root, const CharType (&source)[N], size_t* unresolvedTokenIndex = 0) { + return GenericPointer(source, N - 1).Get(root, unresolvedTokenIndex); +} + +template +const typename T::ValueType* GetValueByPointer(const T& root, const CharType(&source)[N], size_t* unresolvedTokenIndex = 0) { + return GenericPointer(source, N - 1).Get(root, unresolvedTokenIndex); +} + +////////////////////////////////////////////////////////////////////////////// + +template +typename T::ValueType& GetValueByPointerWithDefault(T& root, const GenericPointer& pointer, const typename T::ValueType& defaultValue, typename T::AllocatorType& a) { + return pointer.GetWithDefault(root, defaultValue, a); +} + +template +typename T::ValueType& GetValueByPointerWithDefault(T& root, const GenericPointer& pointer, const typename T::Ch* defaultValue, typename T::AllocatorType& a) { + return pointer.GetWithDefault(root, defaultValue, a); +} + +#if RAPIDJSON_HAS_STDSTRING +template +typename T::ValueType& GetValueByPointerWithDefault(T& root, const GenericPointer& pointer, const std::basic_string& defaultValue, typename T::AllocatorType& a) { + return pointer.GetWithDefault(root, defaultValue, a); +} +#endif + +template +RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (typename T::ValueType&)) +GetValueByPointerWithDefault(T& root, const GenericPointer& pointer, T2 defaultValue, typename T::AllocatorType& a) { + return pointer.GetWithDefault(root, defaultValue, a); +} + +template +typename T::ValueType& GetValueByPointerWithDefault(T& root, const CharType(&source)[N], const typename T::ValueType& defaultValue, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).GetWithDefault(root, defaultValue, a); +} + +template +typename T::ValueType& GetValueByPointerWithDefault(T& root, const CharType(&source)[N], const typename T::Ch* defaultValue, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).GetWithDefault(root, defaultValue, a); +} + +#if RAPIDJSON_HAS_STDSTRING +template +typename T::ValueType& GetValueByPointerWithDefault(T& root, const CharType(&source)[N], const std::basic_string& defaultValue, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).GetWithDefault(root, defaultValue, a); +} +#endif + +template +RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (typename T::ValueType&)) +GetValueByPointerWithDefault(T& root, const CharType(&source)[N], T2 defaultValue, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).GetWithDefault(root, defaultValue, a); +} + +// No allocator parameter + +template +typename DocumentType::ValueType& GetValueByPointerWithDefault(DocumentType& document, const GenericPointer& pointer, const typename DocumentType::ValueType& defaultValue) { + return pointer.GetWithDefault(document, defaultValue); +} + +template +typename DocumentType::ValueType& GetValueByPointerWithDefault(DocumentType& document, const GenericPointer& pointer, const typename DocumentType::Ch* defaultValue) { + return pointer.GetWithDefault(document, defaultValue); +} + +#if RAPIDJSON_HAS_STDSTRING +template +typename DocumentType::ValueType& GetValueByPointerWithDefault(DocumentType& document, const GenericPointer& pointer, const std::basic_string& defaultValue) { + return pointer.GetWithDefault(document, defaultValue); +} +#endif + +template +RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (typename DocumentType::ValueType&)) +GetValueByPointerWithDefault(DocumentType& document, const GenericPointer& pointer, T2 defaultValue) { + return pointer.GetWithDefault(document, defaultValue); +} + +template +typename DocumentType::ValueType& GetValueByPointerWithDefault(DocumentType& document, const CharType(&source)[N], const typename DocumentType::ValueType& defaultValue) { + return GenericPointer(source, N - 1).GetWithDefault(document, defaultValue); +} + +template +typename DocumentType::ValueType& GetValueByPointerWithDefault(DocumentType& document, const CharType(&source)[N], const typename DocumentType::Ch* defaultValue) { + return GenericPointer(source, N - 1).GetWithDefault(document, defaultValue); +} + +#if RAPIDJSON_HAS_STDSTRING +template +typename DocumentType::ValueType& GetValueByPointerWithDefault(DocumentType& document, const CharType(&source)[N], const std::basic_string& defaultValue) { + return GenericPointer(source, N - 1).GetWithDefault(document, defaultValue); +} +#endif + +template +RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (typename DocumentType::ValueType&)) +GetValueByPointerWithDefault(DocumentType& document, const CharType(&source)[N], T2 defaultValue) { + return GenericPointer(source, N - 1).GetWithDefault(document, defaultValue); +} + +////////////////////////////////////////////////////////////////////////////// + +template +typename T::ValueType& SetValueByPointer(T& root, const GenericPointer& pointer, typename T::ValueType& value, typename T::AllocatorType& a) { + return pointer.Set(root, value, a); +} + +template +typename T::ValueType& SetValueByPointer(T& root, const GenericPointer& pointer, const typename T::ValueType& value, typename T::AllocatorType& a) { + return pointer.Set(root, value, a); +} + +template +typename T::ValueType& SetValueByPointer(T& root, const GenericPointer& pointer, const typename T::Ch* value, typename T::AllocatorType& a) { + return pointer.Set(root, value, a); +} + +#if RAPIDJSON_HAS_STDSTRING +template +typename T::ValueType& SetValueByPointer(T& root, const GenericPointer& pointer, const std::basic_string& value, typename T::AllocatorType& a) { + return pointer.Set(root, value, a); +} +#endif + +template +RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (typename T::ValueType&)) +SetValueByPointer(T& root, const GenericPointer& pointer, T2 value, typename T::AllocatorType& a) { + return pointer.Set(root, value, a); +} + +template +typename T::ValueType& SetValueByPointer(T& root, const CharType(&source)[N], typename T::ValueType& value, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).Set(root, value, a); +} + +template +typename T::ValueType& SetValueByPointer(T& root, const CharType(&source)[N], const typename T::ValueType& value, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).Set(root, value, a); +} + +template +typename T::ValueType& SetValueByPointer(T& root, const CharType(&source)[N], const typename T::Ch* value, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).Set(root, value, a); +} + +#if RAPIDJSON_HAS_STDSTRING +template +typename T::ValueType& SetValueByPointer(T& root, const CharType(&source)[N], const std::basic_string& value, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).Set(root, value, a); +} +#endif + +template +RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (typename T::ValueType&)) +SetValueByPointer(T& root, const CharType(&source)[N], T2 value, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).Set(root, value, a); +} + +// No allocator parameter + +template +typename DocumentType::ValueType& SetValueByPointer(DocumentType& document, const GenericPointer& pointer, typename DocumentType::ValueType& value) { + return pointer.Set(document, value); +} + +template +typename DocumentType::ValueType& SetValueByPointer(DocumentType& document, const GenericPointer& pointer, const typename DocumentType::ValueType& value) { + return pointer.Set(document, value); +} + +template +typename DocumentType::ValueType& SetValueByPointer(DocumentType& document, const GenericPointer& pointer, const typename DocumentType::Ch* value) { + return pointer.Set(document, value); +} + +#if RAPIDJSON_HAS_STDSTRING +template +typename DocumentType::ValueType& SetValueByPointer(DocumentType& document, const GenericPointer& pointer, const std::basic_string& value) { + return pointer.Set(document, value); +} +#endif + +template +RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (typename DocumentType::ValueType&)) +SetValueByPointer(DocumentType& document, const GenericPointer& pointer, T2 value) { + return pointer.Set(document, value); +} + +template +typename DocumentType::ValueType& SetValueByPointer(DocumentType& document, const CharType(&source)[N], typename DocumentType::ValueType& value) { + return GenericPointer(source, N - 1).Set(document, value); +} + +template +typename DocumentType::ValueType& SetValueByPointer(DocumentType& document, const CharType(&source)[N], const typename DocumentType::ValueType& value) { + return GenericPointer(source, N - 1).Set(document, value); +} + +template +typename DocumentType::ValueType& SetValueByPointer(DocumentType& document, const CharType(&source)[N], const typename DocumentType::Ch* value) { + return GenericPointer(source, N - 1).Set(document, value); +} + +#if RAPIDJSON_HAS_STDSTRING +template +typename DocumentType::ValueType& SetValueByPointer(DocumentType& document, const CharType(&source)[N], const std::basic_string& value) { + return GenericPointer(source, N - 1).Set(document, value); +} +#endif + +template +RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr, internal::IsGenericValue >), (typename DocumentType::ValueType&)) +SetValueByPointer(DocumentType& document, const CharType(&source)[N], T2 value) { + return GenericPointer(source, N - 1).Set(document, value); +} + +////////////////////////////////////////////////////////////////////////////// + +template +typename T::ValueType& SwapValueByPointer(T& root, const GenericPointer& pointer, typename T::ValueType& value, typename T::AllocatorType& a) { + return pointer.Swap(root, value, a); +} + +template +typename T::ValueType& SwapValueByPointer(T& root, const CharType(&source)[N], typename T::ValueType& value, typename T::AllocatorType& a) { + return GenericPointer(source, N - 1).Swap(root, value, a); +} + +template +typename DocumentType::ValueType& SwapValueByPointer(DocumentType& document, const GenericPointer& pointer, typename DocumentType::ValueType& value) { + return pointer.Swap(document, value); +} + +template +typename DocumentType::ValueType& SwapValueByPointer(DocumentType& document, const CharType(&source)[N], typename DocumentType::ValueType& value) { + return GenericPointer(source, N - 1).Swap(document, value); +} + +////////////////////////////////////////////////////////////////////////////// + +template +bool EraseValueByPointer(T& root, const GenericPointer& pointer) { + return pointer.Erase(root); +} + +template +bool EraseValueByPointer(T& root, const CharType(&source)[N]) { + return GenericPointer(source, N - 1).Erase(root); +} + +//@} + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_POINTER_H_ diff --git a/include/rapidjson/prettywriter.h b/include/rapidjson/prettywriter.h new file mode 100644 index 0000000..0dcb0fe --- /dev/null +++ b/include/rapidjson/prettywriter.h @@ -0,0 +1,255 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_PRETTYWRITER_H_ +#define RAPIDJSON_PRETTYWRITER_H_ + +#include "writer.h" + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! Combination of PrettyWriter format flags. +/*! \see PrettyWriter::SetFormatOptions + */ +enum PrettyFormatOptions { + kFormatDefault = 0, //!< Default pretty formatting. + kFormatSingleLineArray = 1 //!< Format arrays on a single line. +}; + +//! Writer with indentation and spacing. +/*! + \tparam OutputStream Type of ouptut os. + \tparam SourceEncoding Encoding of source string. + \tparam TargetEncoding Encoding of output stream. + \tparam StackAllocator Type of allocator for allocating memory of stack. +*/ +template, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags> +class PrettyWriter : public Writer { +public: + typedef Writer Base; + typedef typename Base::Ch Ch; + + //! Constructor + /*! \param os Output stream. + \param allocator User supplied allocator. If it is null, it will create a private one. + \param levelDepth Initial capacity of stack. + */ + explicit PrettyWriter(OutputStream& os, StackAllocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) : + Base(os, allocator, levelDepth), indentChar_(' '), indentCharCount_(4), formatOptions_(kFormatDefault) {} + + + explicit PrettyWriter(StackAllocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) : + Base(allocator, levelDepth), indentChar_(' '), indentCharCount_(4) {} + + //! Set custom indentation. + /*! \param indentChar Character for indentation. Must be whitespace character (' ', '\\t', '\\n', '\\r'). + \param indentCharCount Number of indent characters for each indentation level. + \note The default indentation is 4 spaces. + */ + PrettyWriter& SetIndent(Ch indentChar, unsigned indentCharCount) { + RAPIDJSON_ASSERT(indentChar == ' ' || indentChar == '\t' || indentChar == '\n' || indentChar == '\r'); + indentChar_ = indentChar; + indentCharCount_ = indentCharCount; + return *this; + } + + //! Set pretty writer formatting options. + /*! \param options Formatting options. + */ + PrettyWriter& SetFormatOptions(PrettyFormatOptions options) { + formatOptions_ = options; + return *this; + } + + /*! @name Implementation of Handler + \see Handler + */ + //@{ + + bool Null() { PrettyPrefix(kNullType); return Base::WriteNull(); } + bool Bool(bool b) { PrettyPrefix(b ? kTrueType : kFalseType); return Base::WriteBool(b); } + bool Int(int i) { PrettyPrefix(kNumberType); return Base::WriteInt(i); } + bool Uint(unsigned u) { PrettyPrefix(kNumberType); return Base::WriteUint(u); } + bool Int64(int64_t i64) { PrettyPrefix(kNumberType); return Base::WriteInt64(i64); } + bool Uint64(uint64_t u64) { PrettyPrefix(kNumberType); return Base::WriteUint64(u64); } + bool Double(double d) { PrettyPrefix(kNumberType); return Base::WriteDouble(d); } + + bool RawNumber(const Ch* str, SizeType length, bool copy = false) { + (void)copy; + PrettyPrefix(kNumberType); + return Base::WriteString(str, length); + } + + bool String(const Ch* str, SizeType length, bool copy = false) { + (void)copy; + PrettyPrefix(kStringType); + return Base::WriteString(str, length); + } + +#if RAPIDJSON_HAS_STDSTRING + bool String(const std::basic_string& str) { + return String(str.data(), SizeType(str.size())); + } +#endif + + bool StartObject() { + PrettyPrefix(kObjectType); + new (Base::level_stack_.template Push()) typename Base::Level(false); + return Base::WriteStartObject(); + } + + bool Key(const Ch* str, SizeType length, bool copy = false) { return String(str, length, copy); } + +#if RAPIDJSON_HAS_STDSTRING + bool Key(const std::basic_string& str) { + return Key(str.data(), SizeType(str.size())); + } +#endif + + bool EndObject(SizeType memberCount = 0) { + (void)memberCount; + RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level)); + RAPIDJSON_ASSERT(!Base::level_stack_.template Top()->inArray); + bool empty = Base::level_stack_.template Pop(1)->valueCount == 0; + + if (!empty) { + Base::os_->Put('\n'); + WriteIndent(); + } + bool ret = Base::WriteEndObject(); + (void)ret; + RAPIDJSON_ASSERT(ret == true); + if (Base::level_stack_.Empty()) // end of json text + Base::os_->Flush(); + return true; + } + + bool StartArray() { + PrettyPrefix(kArrayType); + new (Base::level_stack_.template Push()) typename Base::Level(true); + return Base::WriteStartArray(); + } + + bool EndArray(SizeType memberCount = 0) { + (void)memberCount; + RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level)); + RAPIDJSON_ASSERT(Base::level_stack_.template Top()->inArray); + bool empty = Base::level_stack_.template Pop(1)->valueCount == 0; + + if (!empty && !(formatOptions_ & kFormatSingleLineArray)) { + Base::os_->Put('\n'); + WriteIndent(); + } + bool ret = Base::WriteEndArray(); + (void)ret; + RAPIDJSON_ASSERT(ret == true); + if (Base::level_stack_.Empty()) // end of json text + Base::os_->Flush(); + return true; + } + + //@} + + /*! @name Convenience extensions */ + //@{ + + //! Simpler but slower overload. + bool String(const Ch* str) { return String(str, internal::StrLen(str)); } + bool Key(const Ch* str) { return Key(str, internal::StrLen(str)); } + + //@} + + //! Write a raw JSON value. + /*! + For user to write a stringified JSON as a value. + + \param json A well-formed JSON value. It should not contain null character within [0, length - 1] range. + \param length Length of the json. + \param type Type of the root of json. + \note When using PrettyWriter::RawValue(), the result json may not be indented correctly. + */ + bool RawValue(const Ch* json, size_t length, Type type) { PrettyPrefix(type); return Base::WriteRawValue(json, length); } + +protected: + void PrettyPrefix(Type type) { + (void)type; + if (Base::level_stack_.GetSize() != 0) { // this value is not at root + typename Base::Level* level = Base::level_stack_.template Top(); + + if (level->inArray) { + if (level->valueCount > 0) { + Base::os_->Put(','); // add comma if it is not the first element in array + if (formatOptions_ & kFormatSingleLineArray) + Base::os_->Put(' '); + } + + if (!(formatOptions_ & kFormatSingleLineArray)) { + Base::os_->Put('\n'); + WriteIndent(); + } + } + else { // in object + if (level->valueCount > 0) { + if (level->valueCount % 2 == 0) { + Base::os_->Put(','); + Base::os_->Put('\n'); + } + else { + Base::os_->Put(':'); + Base::os_->Put(' '); + } + } + else + Base::os_->Put('\n'); + + if (level->valueCount % 2 == 0) + WriteIndent(); + } + if (!level->inArray && level->valueCount % 2 == 0) + RAPIDJSON_ASSERT(type == kStringType); // if it's in object, then even number should be a name + level->valueCount++; + } + else { + RAPIDJSON_ASSERT(!Base::hasRoot_); // Should only has one and only one root. + Base::hasRoot_ = true; + } + } + + void WriteIndent() { + size_t count = (Base::level_stack_.GetSize() / sizeof(typename Base::Level)) * indentCharCount_; + PutN(*Base::os_, static_cast(indentChar_), count); + } + + Ch indentChar_; + unsigned indentCharCount_; + PrettyFormatOptions formatOptions_; + +private: + // Prohibit copy constructor & assignment operator. + PrettyWriter(const PrettyWriter&); + PrettyWriter& operator=(const PrettyWriter&); +}; + +RAPIDJSON_NAMESPACE_END + +#ifdef __GNUC__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_RAPIDJSON_H_ diff --git a/include/rapidjson/rapidjson.h b/include/rapidjson/rapidjson.h new file mode 100644 index 0000000..053b2ce --- /dev/null +++ b/include/rapidjson/rapidjson.h @@ -0,0 +1,615 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_RAPIDJSON_H_ +#define RAPIDJSON_RAPIDJSON_H_ + +/*!\file rapidjson.h + \brief common definitions and configuration + + \see RAPIDJSON_CONFIG + */ + +/*! \defgroup RAPIDJSON_CONFIG RapidJSON configuration + \brief Configuration macros for library features + + Some RapidJSON features are configurable to adapt the library to a wide + variety of platforms, environments and usage scenarios. Most of the + features can be configured in terms of overriden or predefined + preprocessor macros at compile-time. + + Some additional customization is available in the \ref RAPIDJSON_ERRORS APIs. + + \note These macros should be given on the compiler command-line + (where applicable) to avoid inconsistent values when compiling + different translation units of a single application. + */ + +#include // malloc(), realloc(), free(), size_t +#include // memset(), memcpy(), memmove(), memcmp() + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_VERSION_STRING +// +// ALWAYS synchronize the following 3 macros with corresponding variables in /CMakeLists.txt. +// + +//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN +// token stringification +#define RAPIDJSON_STRINGIFY(x) RAPIDJSON_DO_STRINGIFY(x) +#define RAPIDJSON_DO_STRINGIFY(x) #x +//!@endcond + +/*! \def RAPIDJSON_MAJOR_VERSION + \ingroup RAPIDJSON_CONFIG + \brief Major version of RapidJSON in integer. +*/ +/*! \def RAPIDJSON_MINOR_VERSION + \ingroup RAPIDJSON_CONFIG + \brief Minor version of RapidJSON in integer. +*/ +/*! \def RAPIDJSON_PATCH_VERSION + \ingroup RAPIDJSON_CONFIG + \brief Patch version of RapidJSON in integer. +*/ +/*! \def RAPIDJSON_VERSION_STRING + \ingroup RAPIDJSON_CONFIG + \brief Version of RapidJSON in ".." string format. +*/ +#define RAPIDJSON_MAJOR_VERSION 1 +#define RAPIDJSON_MINOR_VERSION 1 +#define RAPIDJSON_PATCH_VERSION 0 +#define RAPIDJSON_VERSION_STRING \ + RAPIDJSON_STRINGIFY(RAPIDJSON_MAJOR_VERSION.RAPIDJSON_MINOR_VERSION.RAPIDJSON_PATCH_VERSION) + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_NAMESPACE_(BEGIN|END) +/*! \def RAPIDJSON_NAMESPACE + \ingroup RAPIDJSON_CONFIG + \brief provide custom rapidjson namespace + + In order to avoid symbol clashes and/or "One Definition Rule" errors + between multiple inclusions of (different versions of) RapidJSON in + a single binary, users can customize the name of the main RapidJSON + namespace. + + In case of a single nesting level, defining \c RAPIDJSON_NAMESPACE + to a custom name (e.g. \c MyRapidJSON) is sufficient. If multiple + levels are needed, both \ref RAPIDJSON_NAMESPACE_BEGIN and \ref + RAPIDJSON_NAMESPACE_END need to be defined as well: + + \code + // in some .cpp file + #define RAPIDJSON_NAMESPACE my::rapidjson + #define RAPIDJSON_NAMESPACE_BEGIN namespace my { namespace rapidjson { + #define RAPIDJSON_NAMESPACE_END } } + #include "rapidjson/..." + \endcode + + \see rapidjson + */ +/*! \def RAPIDJSON_NAMESPACE_BEGIN + \ingroup RAPIDJSON_CONFIG + \brief provide custom rapidjson namespace (opening expression) + \see RAPIDJSON_NAMESPACE +*/ +/*! \def RAPIDJSON_NAMESPACE_END + \ingroup RAPIDJSON_CONFIG + \brief provide custom rapidjson namespace (closing expression) + \see RAPIDJSON_NAMESPACE +*/ +#ifndef RAPIDJSON_NAMESPACE +#define RAPIDJSON_NAMESPACE rapidjson +#endif +#ifndef RAPIDJSON_NAMESPACE_BEGIN +#define RAPIDJSON_NAMESPACE_BEGIN namespace RAPIDJSON_NAMESPACE { +#endif +#ifndef RAPIDJSON_NAMESPACE_END +#define RAPIDJSON_NAMESPACE_END } +#endif + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_HAS_STDSTRING + +#ifndef RAPIDJSON_HAS_STDSTRING +#ifdef RAPIDJSON_DOXYGEN_RUNNING +#define RAPIDJSON_HAS_STDSTRING 1 // force generation of documentation +#else +#define RAPIDJSON_HAS_STDSTRING 0 // no std::string support by default +#endif +/*! \def RAPIDJSON_HAS_STDSTRING + \ingroup RAPIDJSON_CONFIG + \brief Enable RapidJSON support for \c std::string + + By defining this preprocessor symbol to \c 1, several convenience functions for using + \ref rapidjson::GenericValue with \c std::string are enabled, especially + for construction and comparison. + + \hideinitializer +*/ +#endif // !defined(RAPIDJSON_HAS_STDSTRING) + +#if RAPIDJSON_HAS_STDSTRING +#include +#endif // RAPIDJSON_HAS_STDSTRING + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_NO_INT64DEFINE + +/*! \def RAPIDJSON_NO_INT64DEFINE + \ingroup RAPIDJSON_CONFIG + \brief Use external 64-bit integer types. + + RapidJSON requires the 64-bit integer types \c int64_t and \c uint64_t types + to be available at global scope. + + If users have their own definition, define RAPIDJSON_NO_INT64DEFINE to + prevent RapidJSON from defining its own types. +*/ +#ifndef RAPIDJSON_NO_INT64DEFINE +//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN +#if defined(_MSC_VER) && (_MSC_VER < 1800) // Visual Studio 2013 +#include "msinttypes/stdint.h" +#include "msinttypes/inttypes.h" +#else +// Other compilers should have this. +#include +#include +#endif +//!@endcond +#ifdef RAPIDJSON_DOXYGEN_RUNNING +#define RAPIDJSON_NO_INT64DEFINE +#endif +#endif // RAPIDJSON_NO_INT64TYPEDEF + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_FORCEINLINE + +#ifndef RAPIDJSON_FORCEINLINE +//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN +#if defined(_MSC_VER) && defined(NDEBUG) +#define RAPIDJSON_FORCEINLINE __forceinline +#elif defined(__GNUC__) && __GNUC__ >= 4 && defined(NDEBUG) +#define RAPIDJSON_FORCEINLINE __attribute__((always_inline)) +#else +#define RAPIDJSON_FORCEINLINE +#endif +//!@endcond +#endif // RAPIDJSON_FORCEINLINE + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_ENDIAN +#define RAPIDJSON_LITTLEENDIAN 0 //!< Little endian machine +#define RAPIDJSON_BIGENDIAN 1 //!< Big endian machine + +//! Endianness of the machine. +/*! + \def RAPIDJSON_ENDIAN + \ingroup RAPIDJSON_CONFIG + + GCC 4.6 provided macro for detecting endianness of the target machine. But other + compilers may not have this. User can define RAPIDJSON_ENDIAN to either + \ref RAPIDJSON_LITTLEENDIAN or \ref RAPIDJSON_BIGENDIAN. + + Default detection implemented with reference to + \li https://gcc.gnu.org/onlinedocs/gcc-4.6.0/cpp/Common-Predefined-Macros.html + \li http://www.boost.org/doc/libs/1_42_0/boost/detail/endian.hpp +*/ +#ifndef RAPIDJSON_ENDIAN +// Detect with GCC 4.6's macro +# ifdef __BYTE_ORDER__ +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN +# else +# error Unknown machine endianess detected. User needs to define RAPIDJSON_ENDIAN. +# endif // __BYTE_ORDER__ +// Detect with GLIBC's endian.h +# elif defined(__GLIBC__) +# include +# if (__BYTE_ORDER == __LITTLE_ENDIAN) +# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN +# elif (__BYTE_ORDER == __BIG_ENDIAN) +# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN +# else +# error Unknown machine endianess detected. User needs to define RAPIDJSON_ENDIAN. +# endif // __GLIBC__ +// Detect with _LITTLE_ENDIAN and _BIG_ENDIAN macro +# elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN +# elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) +# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN +// Detect with architecture macros +# elif defined(__sparc) || defined(__sparc__) || defined(_POWER) || defined(__powerpc__) || defined(__ppc__) || defined(__hpux) || defined(__hppa) || defined(_MIPSEB) || defined(_POWER) || defined(__s390__) +# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN +# elif defined(__i386__) || defined(__alpha__) || defined(__ia64) || defined(__ia64__) || defined(_M_IX86) || defined(_M_IA64) || defined(_M_ALPHA) || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || defined(__bfin__) +# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN +# elif defined(_MSC_VER) && defined(_M_ARM) +# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN +# elif defined(RAPIDJSON_DOXYGEN_RUNNING) +# define RAPIDJSON_ENDIAN +# else +# error Unknown machine endianess detected. User needs to define RAPIDJSON_ENDIAN. +# endif +#endif // RAPIDJSON_ENDIAN + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_64BIT + +//! Whether using 64-bit architecture +#ifndef RAPIDJSON_64BIT +#if defined(__LP64__) || (defined(__x86_64__) && defined(__ILP32__)) || defined(_WIN64) || defined(__EMSCRIPTEN__) +#define RAPIDJSON_64BIT 1 +#else +#define RAPIDJSON_64BIT 0 +#endif +#endif // RAPIDJSON_64BIT + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_ALIGN + +//! Data alignment of the machine. +/*! \ingroup RAPIDJSON_CONFIG + \param x pointer to align + + Some machines require strict data alignment. Currently the default uses 4 bytes + alignment on 32-bit platforms and 8 bytes alignment for 64-bit platforms. + User can customize by defining the RAPIDJSON_ALIGN function macro. +*/ +#ifndef RAPIDJSON_ALIGN +#if RAPIDJSON_64BIT == 1 +#define RAPIDJSON_ALIGN(x) (((x) + static_cast(7u)) & ~static_cast(7u)) +#else +#define RAPIDJSON_ALIGN(x) (((x) + 3u) & ~3u) +#endif +#endif + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_UINT64_C2 + +//! Construct a 64-bit literal by a pair of 32-bit integer. +/*! + 64-bit literal with or without ULL suffix is prone to compiler warnings. + UINT64_C() is C macro which cause compilation problems. + Use this macro to define 64-bit constants by a pair of 32-bit integer. +*/ +#ifndef RAPIDJSON_UINT64_C2 +#define RAPIDJSON_UINT64_C2(high32, low32) ((static_cast(high32) << 32) | static_cast(low32)) +#endif + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_48BITPOINTER_OPTIMIZATION + +//! Use only lower 48-bit address for some pointers. +/*! + \ingroup RAPIDJSON_CONFIG + + This optimization uses the fact that current X86-64 architecture only implement lower 48-bit virtual address. + The higher 16-bit can be used for storing other data. + \c GenericValue uses this optimization to reduce its size form 24 bytes to 16 bytes in 64-bit architecture. +*/ +#ifndef RAPIDJSON_48BITPOINTER_OPTIMIZATION +#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64) +#define RAPIDJSON_48BITPOINTER_OPTIMIZATION 1 +#else +#define RAPIDJSON_48BITPOINTER_OPTIMIZATION 0 +#endif +#endif // RAPIDJSON_48BITPOINTER_OPTIMIZATION + +#if RAPIDJSON_48BITPOINTER_OPTIMIZATION == 1 +#if RAPIDJSON_64BIT != 1 +#error RAPIDJSON_48BITPOINTER_OPTIMIZATION can only be set to 1 when RAPIDJSON_64BIT=1 +#endif +#define RAPIDJSON_SETPOINTER(type, p, x) (p = reinterpret_cast((reinterpret_cast(p) & static_cast(RAPIDJSON_UINT64_C2(0xFFFF0000, 0x00000000))) | reinterpret_cast(reinterpret_cast(x)))) +#define RAPIDJSON_GETPOINTER(type, p) (reinterpret_cast(reinterpret_cast(p) & static_cast(RAPIDJSON_UINT64_C2(0x0000FFFF, 0xFFFFFFFF)))) +#else +#define RAPIDJSON_SETPOINTER(type, p, x) (p = (x)) +#define RAPIDJSON_GETPOINTER(type, p) (p) +#endif + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_SSE2/RAPIDJSON_SSE42/RAPIDJSON_SIMD + +/*! \def RAPIDJSON_SIMD + \ingroup RAPIDJSON_CONFIG + \brief Enable SSE2/SSE4.2 optimization. + + RapidJSON supports optimized implementations for some parsing operations + based on the SSE2 or SSE4.2 SIMD extensions on modern Intel-compatible + processors. + + To enable these optimizations, two different symbols can be defined; + \code + // Enable SSE2 optimization. + #define RAPIDJSON_SSE2 + + // Enable SSE4.2 optimization. + #define RAPIDJSON_SSE42 + \endcode + + \c RAPIDJSON_SSE42 takes precedence, if both are defined. + + If any of these symbols is defined, RapidJSON defines the macro + \c RAPIDJSON_SIMD to indicate the availability of the optimized code. +*/ +#if defined(RAPIDJSON_SSE2) || defined(RAPIDJSON_SSE42) \ + || defined(RAPIDJSON_DOXYGEN_RUNNING) +#define RAPIDJSON_SIMD +#endif + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_NO_SIZETYPEDEFINE + +#ifndef RAPIDJSON_NO_SIZETYPEDEFINE +/*! \def RAPIDJSON_NO_SIZETYPEDEFINE + \ingroup RAPIDJSON_CONFIG + \brief User-provided \c SizeType definition. + + In order to avoid using 32-bit size types for indexing strings and arrays, + define this preprocessor symbol and provide the type rapidjson::SizeType + before including RapidJSON: + \code + #define RAPIDJSON_NO_SIZETYPEDEFINE + namespace rapidjson { typedef ::std::size_t SizeType; } + #include "rapidjson/..." + \endcode + + \see rapidjson::SizeType +*/ +#ifdef RAPIDJSON_DOXYGEN_RUNNING +#define RAPIDJSON_NO_SIZETYPEDEFINE +#endif +RAPIDJSON_NAMESPACE_BEGIN +//! Size type (for string lengths, array sizes, etc.) +/*! RapidJSON uses 32-bit array/string indices even on 64-bit platforms, + instead of using \c size_t. Users may override the SizeType by defining + \ref RAPIDJSON_NO_SIZETYPEDEFINE. +*/ +typedef unsigned SizeType; +RAPIDJSON_NAMESPACE_END +#endif + +// always import std::size_t to rapidjson namespace +RAPIDJSON_NAMESPACE_BEGIN +using std::size_t; +RAPIDJSON_NAMESPACE_END + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_ASSERT + +//! Assertion. +/*! \ingroup RAPIDJSON_CONFIG + By default, rapidjson uses C \c assert() for internal assertions. + User can override it by defining RAPIDJSON_ASSERT(x) macro. + + \note Parsing errors are handled and can be customized by the + \ref RAPIDJSON_ERRORS APIs. +*/ +#ifndef RAPIDJSON_ASSERT +#include +#define RAPIDJSON_ASSERT(x) assert(x) +#endif // RAPIDJSON_ASSERT + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_STATIC_ASSERT + +// Adopt from boost +#ifndef RAPIDJSON_STATIC_ASSERT +#ifndef __clang__ +//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN +#endif +RAPIDJSON_NAMESPACE_BEGIN +template struct STATIC_ASSERTION_FAILURE; +template <> struct STATIC_ASSERTION_FAILURE { enum { value = 1 }; }; +template struct StaticAssertTest {}; +RAPIDJSON_NAMESPACE_END + +#define RAPIDJSON_JOIN(X, Y) RAPIDJSON_DO_JOIN(X, Y) +#define RAPIDJSON_DO_JOIN(X, Y) RAPIDJSON_DO_JOIN2(X, Y) +#define RAPIDJSON_DO_JOIN2(X, Y) X##Y + +#if defined(__GNUC__) +#define RAPIDJSON_STATIC_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused)) +#else +#define RAPIDJSON_STATIC_ASSERT_UNUSED_ATTRIBUTE +#endif +#ifndef __clang__ +//!@endcond +#endif + +/*! \def RAPIDJSON_STATIC_ASSERT + \brief (Internal) macro to check for conditions at compile-time + \param x compile-time condition + \hideinitializer + */ +#define RAPIDJSON_STATIC_ASSERT(x) \ + typedef ::RAPIDJSON_NAMESPACE::StaticAssertTest< \ + sizeof(::RAPIDJSON_NAMESPACE::STATIC_ASSERTION_FAILURE)> \ + RAPIDJSON_JOIN(StaticAssertTypedef, __LINE__) RAPIDJSON_STATIC_ASSERT_UNUSED_ATTRIBUTE +#endif + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_LIKELY, RAPIDJSON_UNLIKELY + +//! Compiler branching hint for expression with high probability to be true. +/*! + \ingroup RAPIDJSON_CONFIG + \param x Boolean expression likely to be true. +*/ +#ifndef RAPIDJSON_LIKELY +#if defined(__GNUC__) || defined(__clang__) +#define RAPIDJSON_LIKELY(x) __builtin_expect(!!(x), 1) +#else +#define RAPIDJSON_LIKELY(x) (x) +#endif +#endif + +//! Compiler branching hint for expression with low probability to be true. +/*! + \ingroup RAPIDJSON_CONFIG + \param x Boolean expression unlikely to be true. +*/ +#ifndef RAPIDJSON_UNLIKELY +#if defined(__GNUC__) || defined(__clang__) +#define RAPIDJSON_UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +#define RAPIDJSON_UNLIKELY(x) (x) +#endif +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Helpers + +//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN + +#define RAPIDJSON_MULTILINEMACRO_BEGIN do { +#define RAPIDJSON_MULTILINEMACRO_END \ +} while((void)0, 0) + +// adopted from Boost +#define RAPIDJSON_VERSION_CODE(x,y,z) \ + (((x)*100000) + ((y)*100) + (z)) + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_DIAG_PUSH/POP, RAPIDJSON_DIAG_OFF + +#if defined(__GNUC__) +#define RAPIDJSON_GNUC \ + RAPIDJSON_VERSION_CODE(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) +#endif + +#if defined(__clang__) || (defined(RAPIDJSON_GNUC) && RAPIDJSON_GNUC >= RAPIDJSON_VERSION_CODE(4,2,0)) + +#define RAPIDJSON_PRAGMA(x) _Pragma(RAPIDJSON_STRINGIFY(x)) +#define RAPIDJSON_DIAG_PRAGMA(x) RAPIDJSON_PRAGMA(GCC diagnostic x) +#define RAPIDJSON_DIAG_OFF(x) \ + RAPIDJSON_DIAG_PRAGMA(ignored RAPIDJSON_STRINGIFY(RAPIDJSON_JOIN(-W,x))) + +// push/pop support in Clang and GCC>=4.6 +#if defined(__clang__) || (defined(RAPIDJSON_GNUC) && RAPIDJSON_GNUC >= RAPIDJSON_VERSION_CODE(4,6,0)) +#define RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PRAGMA(push) +#define RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_PRAGMA(pop) +#else // GCC >= 4.2, < 4.6 +#define RAPIDJSON_DIAG_PUSH /* ignored */ +#define RAPIDJSON_DIAG_POP /* ignored */ +#endif + +#elif defined(_MSC_VER) + +// pragma (MSVC specific) +#define RAPIDJSON_PRAGMA(x) __pragma(x) +#define RAPIDJSON_DIAG_PRAGMA(x) RAPIDJSON_PRAGMA(warning(x)) + +#define RAPIDJSON_DIAG_OFF(x) RAPIDJSON_DIAG_PRAGMA(disable: x) +#define RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PRAGMA(push) +#define RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_PRAGMA(pop) + +#else + +#define RAPIDJSON_DIAG_OFF(x) /* ignored */ +#define RAPIDJSON_DIAG_PUSH /* ignored */ +#define RAPIDJSON_DIAG_POP /* ignored */ + +#endif // RAPIDJSON_DIAG_* + +/////////////////////////////////////////////////////////////////////////////// +// C++11 features + +#ifndef RAPIDJSON_HAS_CXX11_RVALUE_REFS +#if defined(__clang__) +#if __has_feature(cxx_rvalue_references) && \ + (defined(_LIBCPP_VERSION) || defined(__GLIBCXX__) && __GLIBCXX__ >= 20080306) +#define RAPIDJSON_HAS_CXX11_RVALUE_REFS 1 +#else +#define RAPIDJSON_HAS_CXX11_RVALUE_REFS 0 +#endif +#elif (defined(RAPIDJSON_GNUC) && (RAPIDJSON_GNUC >= RAPIDJSON_VERSION_CODE(4,3,0)) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || \ + (defined(_MSC_VER) && _MSC_VER >= 1600) + +#define RAPIDJSON_HAS_CXX11_RVALUE_REFS 1 +#else +#define RAPIDJSON_HAS_CXX11_RVALUE_REFS 0 +#endif +#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS + +#ifndef RAPIDJSON_HAS_CXX11_NOEXCEPT +#if defined(__clang__) +#define RAPIDJSON_HAS_CXX11_NOEXCEPT __has_feature(cxx_noexcept) +#elif (defined(RAPIDJSON_GNUC) && (RAPIDJSON_GNUC >= RAPIDJSON_VERSION_CODE(4,6,0)) && defined(__GXX_EXPERIMENTAL_CXX0X__)) +// (defined(_MSC_VER) && _MSC_VER >= ????) // not yet supported +#define RAPIDJSON_HAS_CXX11_NOEXCEPT 1 +#else +#define RAPIDJSON_HAS_CXX11_NOEXCEPT 0 +#endif +#endif +#if RAPIDJSON_HAS_CXX11_NOEXCEPT +#define RAPIDJSON_NOEXCEPT noexcept +#else +#define RAPIDJSON_NOEXCEPT /* noexcept */ +#endif // RAPIDJSON_HAS_CXX11_NOEXCEPT + +// no automatic detection, yet +#ifndef RAPIDJSON_HAS_CXX11_TYPETRAITS +#define RAPIDJSON_HAS_CXX11_TYPETRAITS 0 +#endif + +#ifndef RAPIDJSON_HAS_CXX11_RANGE_FOR +#if defined(__clang__) +#define RAPIDJSON_HAS_CXX11_RANGE_FOR __has_feature(cxx_range_for) +#elif (defined(RAPIDJSON_GNUC) && (RAPIDJSON_GNUC >= RAPIDJSON_VERSION_CODE(4,3,0)) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || \ + (defined(_MSC_VER) && _MSC_VER >= 1700) +#define RAPIDJSON_HAS_CXX11_RANGE_FOR 1 +#else +#define RAPIDJSON_HAS_CXX11_RANGE_FOR 0 +#endif +#endif // RAPIDJSON_HAS_CXX11_RANGE_FOR + +//!@endcond + +/////////////////////////////////////////////////////////////////////////////// +// new/delete + +#ifndef RAPIDJSON_NEW +///! customization point for global \c new +#define RAPIDJSON_NEW(x) new x +#endif +#ifndef RAPIDJSON_DELETE +///! customization point for global \c delete +#define RAPIDJSON_DELETE(x) delete x +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Type + +/*! \namespace rapidjson + \brief main RapidJSON namespace + \see RAPIDJSON_NAMESPACE +*/ +RAPIDJSON_NAMESPACE_BEGIN + +//! Type of JSON value +enum Type { + kNullType = 0, //!< null + kFalseType = 1, //!< false + kTrueType = 2, //!< true + kObjectType = 3, //!< object + kArrayType = 4, //!< array + kStringType = 5, //!< string + kNumberType = 6 //!< number +}; + +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_RAPIDJSON_H_ diff --git a/include/rapidjson/reader.h b/include/rapidjson/reader.h new file mode 100644 index 0000000..19f8849 --- /dev/null +++ b/include/rapidjson/reader.h @@ -0,0 +1,1879 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_READER_H_ +#define RAPIDJSON_READER_H_ + +/*! \file reader.h */ + +#include "allocators.h" +#include "stream.h" +#include "encodedstream.h" +#include "internal/meta.h" +#include "internal/stack.h" +#include "internal/strtod.h" +#include + +#if defined(RAPIDJSON_SIMD) && defined(_MSC_VER) +#include +#pragma intrinsic(_BitScanForward) +#endif +#ifdef RAPIDJSON_SSE42 +#include +#elif defined(RAPIDJSON_SSE2) +#include +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant +RAPIDJSON_DIAG_OFF(4702) // unreachable code +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(old-style-cast) +RAPIDJSON_DIAG_OFF(padded) +RAPIDJSON_DIAG_OFF(switch-enum) +#endif + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +#endif + +//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN +#define RAPIDJSON_NOTHING /* deliberately empty */ +#ifndef RAPIDJSON_PARSE_ERROR_EARLY_RETURN +#define RAPIDJSON_PARSE_ERROR_EARLY_RETURN(value) \ + RAPIDJSON_MULTILINEMACRO_BEGIN \ + if (RAPIDJSON_UNLIKELY(HasParseError())) { return value; } \ + RAPIDJSON_MULTILINEMACRO_END +#endif +#define RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID \ + RAPIDJSON_PARSE_ERROR_EARLY_RETURN(RAPIDJSON_NOTHING) +//!@endcond + +/*! \def RAPIDJSON_PARSE_ERROR_NORETURN + \ingroup RAPIDJSON_ERRORS + \brief Macro to indicate a parse error. + \param parseErrorCode \ref rapidjson::ParseErrorCode of the error + \param offset position of the error in JSON input (\c size_t) + + This macros can be used as a customization point for the internal + error handling mechanism of RapidJSON. + + A common usage model is to throw an exception instead of requiring the + caller to explicitly check the \ref rapidjson::GenericReader::Parse's + return value: + + \code + #define RAPIDJSON_PARSE_ERROR_NORETURN(parseErrorCode,offset) \ + throw ParseException(parseErrorCode, #parseErrorCode, offset) + + #include // std::runtime_error + #include "rapidjson/error/error.h" // rapidjson::ParseResult + + struct ParseException : std::runtime_error, rapidjson::ParseResult { + ParseException(rapidjson::ParseErrorCode code, const char* msg, size_t offset) + : std::runtime_error(msg), ParseResult(code, offset) {} + }; + + #include "rapidjson/reader.h" + \endcode + + \see RAPIDJSON_PARSE_ERROR, rapidjson::GenericReader::Parse + */ +#ifndef RAPIDJSON_PARSE_ERROR_NORETURN +#define RAPIDJSON_PARSE_ERROR_NORETURN(parseErrorCode, offset) \ + RAPIDJSON_MULTILINEMACRO_BEGIN \ + RAPIDJSON_ASSERT(!HasParseError()); /* Error can only be assigned once */ \ + SetParseError(parseErrorCode, offset); \ + RAPIDJSON_MULTILINEMACRO_END +#endif + +/*! \def RAPIDJSON_PARSE_ERROR + \ingroup RAPIDJSON_ERRORS + \brief (Internal) macro to indicate and handle a parse error. + \param parseErrorCode \ref rapidjson::ParseErrorCode of the error + \param offset position of the error in JSON input (\c size_t) + + Invokes RAPIDJSON_PARSE_ERROR_NORETURN and stops the parsing. + + \see RAPIDJSON_PARSE_ERROR_NORETURN + \hideinitializer + */ +#ifndef RAPIDJSON_PARSE_ERROR +#define RAPIDJSON_PARSE_ERROR(parseErrorCode, offset) \ + RAPIDJSON_MULTILINEMACRO_BEGIN \ + RAPIDJSON_PARSE_ERROR_NORETURN(parseErrorCode, offset); \ + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; \ + RAPIDJSON_MULTILINEMACRO_END +#endif + +#include "error/error.h" // ParseErrorCode, ParseResult + +RAPIDJSON_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// ParseFlag + +/*! \def RAPIDJSON_PARSE_DEFAULT_FLAGS + \ingroup RAPIDJSON_CONFIG + \brief User-defined kParseDefaultFlags definition. + + User can define this as any \c ParseFlag combinations. +*/ +#ifndef RAPIDJSON_PARSE_DEFAULT_FLAGS +#define RAPIDJSON_PARSE_DEFAULT_FLAGS kParseNoFlags +#endif + +//! Combination of parseFlags +/*! \see Reader::Parse, Document::Parse, Document::ParseInsitu, Document::ParseStream + */ +enum ParseFlag { + kParseNoFlags = 0, //!< No flags are set. + kParseInsituFlag = 1, //!< In-situ(destructive) parsing. + kParseValidateEncodingFlag = 2, //!< Validate encoding of JSON strings. + kParseIterativeFlag = 4, //!< Iterative(constant complexity in terms of function call stack size) parsing. + kParseStopWhenDoneFlag = 8, //!< After parsing a complete JSON root from stream, stop further processing the rest of stream. When this flag is used, parser will not generate kParseErrorDocumentRootNotSingular error. + kParseFullPrecisionFlag = 16, //!< Parse number in full precision (but slower). + kParseCommentsFlag = 32, //!< Allow one-line (//) and multi-line (/**/) comments. + kParseNumbersAsStringsFlag = 64, //!< Parse all numbers (ints/doubles) as strings. + kParseTrailingCommasFlag = 128, //!< Allow trailing commas at the end of objects and arrays. + kParseNanAndInfFlag = 256, //!< Allow parsing NaN, Inf, Infinity, -Inf and -Infinity as doubles. + kParseDefaultFlags = RAPIDJSON_PARSE_DEFAULT_FLAGS //!< Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS +}; + +/////////////////////////////////////////////////////////////////////////////// +// Handler + +/*! \class rapidjson::Handler + \brief Concept for receiving events from GenericReader upon parsing. + The functions return true if no error occurs. If they return false, + the event publisher should terminate the process. +\code +concept Handler { + typename Ch; + + bool Null(); + bool Bool(bool b); + bool Int(int i); + bool Uint(unsigned i); + bool Int64(int64_t i); + bool Uint64(uint64_t i); + bool Double(double d); + /// enabled via kParseNumbersAsStringsFlag, string is not null-terminated (use length) + bool RawNumber(const Ch* str, SizeType length, bool copy); + bool String(const Ch* str, SizeType length, bool copy); + bool StartObject(); + bool Key(const Ch* str, SizeType length, bool copy); + bool EndObject(SizeType memberCount); + bool StartArray(); + bool EndArray(SizeType elementCount); +}; +\endcode +*/ +/////////////////////////////////////////////////////////////////////////////// +// BaseReaderHandler + +//! Default implementation of Handler. +/*! This can be used as base class of any reader handler. + \note implements Handler concept +*/ +template, typename Derived = void> +struct BaseReaderHandler { + typedef typename Encoding::Ch Ch; + + typedef typename internal::SelectIf, BaseReaderHandler, Derived>::Type Override; + + bool Default() { return true; } + bool Null() { return static_cast(*this).Default(); } + bool Bool(bool) { return static_cast(*this).Default(); } + bool Int(int) { return static_cast(*this).Default(); } + bool Uint(unsigned) { return static_cast(*this).Default(); } + bool Int64(int64_t) { return static_cast(*this).Default(); } + bool Uint64(uint64_t) { return static_cast(*this).Default(); } + bool Double(double) { return static_cast(*this).Default(); } + /// enabled via kParseNumbersAsStringsFlag, string is not null-terminated (use length) + bool RawNumber(const Ch* str, SizeType len, bool copy) { return static_cast(*this).String(str, len, copy); } + bool String(const Ch*, SizeType, bool) { return static_cast(*this).Default(); } + bool StartObject() { return static_cast(*this).Default(); } + bool Key(const Ch* str, SizeType len, bool copy) { return static_cast(*this).String(str, len, copy); } + bool EndObject(SizeType) { return static_cast(*this).Default(); } + bool StartArray() { return static_cast(*this).Default(); } + bool EndArray(SizeType) { return static_cast(*this).Default(); } +}; + +/////////////////////////////////////////////////////////////////////////////// +// StreamLocalCopy + +namespace internal { + +template::copyOptimization> +class StreamLocalCopy; + +//! Do copy optimization. +template +class StreamLocalCopy { +public: + StreamLocalCopy(Stream& original) : s(original), original_(original) {} + ~StreamLocalCopy() { original_ = s; } + + Stream s; + +private: + StreamLocalCopy& operator=(const StreamLocalCopy&) /* = delete */; + + Stream& original_; +}; + +//! Keep reference. +template +class StreamLocalCopy { +public: + StreamLocalCopy(Stream& original) : s(original) {} + + Stream& s; + +private: + StreamLocalCopy& operator=(const StreamLocalCopy&) /* = delete */; +}; + +} // namespace internal + +/////////////////////////////////////////////////////////////////////////////// +// SkipWhitespace + +//! Skip the JSON white spaces in a stream. +/*! \param is A input stream for skipping white spaces. + \note This function has SSE2/SSE4.2 specialization. +*/ +template +void SkipWhitespace(InputStream& is) { + internal::StreamLocalCopy copy(is); + InputStream& s(copy.s); + + typename InputStream::Ch c; + while ((c = s.Peek()) == ' ' || c == '\n' || c == '\r' || c == '\t') + s.Take(); +} + +inline const char* SkipWhitespace(const char* p, const char* end) { + while (p != end && (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t')) + ++p; + return p; +} + +#ifdef RAPIDJSON_SSE42 +//! Skip whitespace with SSE 4.2 pcmpistrm instruction, testing 16 8-byte characters at once. +inline const char *SkipWhitespace_SIMD(const char* p) { + // Fast return for single non-whitespace + if (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t') + ++p; + else + return p; + + // 16-byte align to the next boundary + const char* nextAligned = reinterpret_cast((reinterpret_cast(p) + 15) & static_cast(~15)); + while (p != nextAligned) + if (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t') + ++p; + else + return p; + + // The rest of string using SIMD + static const char whitespace[16] = " \n\r\t"; + const __m128i w = _mm_loadu_si128(reinterpret_cast(&whitespace[0])); + + for (;; p += 16) { + const __m128i s = _mm_load_si128(reinterpret_cast(p)); + const int r = _mm_cvtsi128_si32(_mm_cmpistrm(w, s, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_BIT_MASK | _SIDD_NEGATIVE_POLARITY)); + if (r != 0) { // some of characters is non-whitespace +#ifdef _MSC_VER // Find the index of first non-whitespace + unsigned long offset; + _BitScanForward(&offset, r); + return p + offset; +#else + return p + __builtin_ffs(r) - 1; +#endif + } + } +} + +inline const char *SkipWhitespace_SIMD(const char* p, const char* end) { + // Fast return for single non-whitespace + if (p != end && (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t')) + ++p; + else + return p; + + // The middle of string using SIMD + static const char whitespace[16] = " \n\r\t"; + const __m128i w = _mm_loadu_si128(reinterpret_cast(&whitespace[0])); + + for (; p <= end - 16; p += 16) { + const __m128i s = _mm_loadu_si128(reinterpret_cast(p)); + const int r = _mm_cvtsi128_si32(_mm_cmpistrm(w, s, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_BIT_MASK | _SIDD_NEGATIVE_POLARITY)); + if (r != 0) { // some of characters is non-whitespace +#ifdef _MSC_VER // Find the index of first non-whitespace + unsigned long offset; + _BitScanForward(&offset, r); + return p + offset; +#else + return p + __builtin_ffs(r) - 1; +#endif + } + } + + return SkipWhitespace(p, end); +} + +#elif defined(RAPIDJSON_SSE2) + +//! Skip whitespace with SSE2 instructions, testing 16 8-byte characters at once. +inline const char *SkipWhitespace_SIMD(const char* p) { + // Fast return for single non-whitespace + if (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t') + ++p; + else + return p; + + // 16-byte align to the next boundary + const char* nextAligned = reinterpret_cast((reinterpret_cast(p) + 15) & static_cast(~15)); + while (p != nextAligned) + if (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t') + ++p; + else + return p; + + // The rest of string + #define C16(c) { c, c, c, c, c, c, c, c, c, c, c, c, c, c, c, c } + static const char whitespaces[4][16] = { C16(' '), C16('\n'), C16('\r'), C16('\t') }; + #undef C16 + + const __m128i w0 = _mm_loadu_si128(reinterpret_cast(&whitespaces[0][0])); + const __m128i w1 = _mm_loadu_si128(reinterpret_cast(&whitespaces[1][0])); + const __m128i w2 = _mm_loadu_si128(reinterpret_cast(&whitespaces[2][0])); + const __m128i w3 = _mm_loadu_si128(reinterpret_cast(&whitespaces[3][0])); + + for (;; p += 16) { + const __m128i s = _mm_load_si128(reinterpret_cast(p)); + __m128i x = _mm_cmpeq_epi8(s, w0); + x = _mm_or_si128(x, _mm_cmpeq_epi8(s, w1)); + x = _mm_or_si128(x, _mm_cmpeq_epi8(s, w2)); + x = _mm_or_si128(x, _mm_cmpeq_epi8(s, w3)); + unsigned short r = static_cast(~_mm_movemask_epi8(x)); + if (r != 0) { // some of characters may be non-whitespace +#ifdef _MSC_VER // Find the index of first non-whitespace + unsigned long offset; + _BitScanForward(&offset, r); + return p + offset; +#else + return p + __builtin_ffs(r) - 1; +#endif + } + } +} + +inline const char *SkipWhitespace_SIMD(const char* p, const char* end) { + // Fast return for single non-whitespace + if (p != end && (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t')) + ++p; + else + return p; + + // The rest of string + #define C16(c) { c, c, c, c, c, c, c, c, c, c, c, c, c, c, c, c } + static const char whitespaces[4][16] = { C16(' '), C16('\n'), C16('\r'), C16('\t') }; + #undef C16 + + const __m128i w0 = _mm_loadu_si128(reinterpret_cast(&whitespaces[0][0])); + const __m128i w1 = _mm_loadu_si128(reinterpret_cast(&whitespaces[1][0])); + const __m128i w2 = _mm_loadu_si128(reinterpret_cast(&whitespaces[2][0])); + const __m128i w3 = _mm_loadu_si128(reinterpret_cast(&whitespaces[3][0])); + + for (; p <= end - 16; p += 16) { + const __m128i s = _mm_loadu_si128(reinterpret_cast(p)); + __m128i x = _mm_cmpeq_epi8(s, w0); + x = _mm_or_si128(x, _mm_cmpeq_epi8(s, w1)); + x = _mm_or_si128(x, _mm_cmpeq_epi8(s, w2)); + x = _mm_or_si128(x, _mm_cmpeq_epi8(s, w3)); + unsigned short r = static_cast(~_mm_movemask_epi8(x)); + if (r != 0) { // some of characters may be non-whitespace +#ifdef _MSC_VER // Find the index of first non-whitespace + unsigned long offset; + _BitScanForward(&offset, r); + return p + offset; +#else + return p + __builtin_ffs(r) - 1; +#endif + } + } + + return SkipWhitespace(p, end); +} + +#endif // RAPIDJSON_SSE2 + +#ifdef RAPIDJSON_SIMD +//! Template function specialization for InsituStringStream +template<> inline void SkipWhitespace(InsituStringStream& is) { + is.src_ = const_cast(SkipWhitespace_SIMD(is.src_)); +} + +//! Template function specialization for StringStream +template<> inline void SkipWhitespace(StringStream& is) { + is.src_ = SkipWhitespace_SIMD(is.src_); +} + +template<> inline void SkipWhitespace(EncodedInputStream, MemoryStream>& is) { + is.is_.src_ = SkipWhitespace_SIMD(is.is_.src_, is.is_.end_); +} +#endif // RAPIDJSON_SIMD + +/////////////////////////////////////////////////////////////////////////////// +// GenericReader + +//! SAX-style JSON parser. Use \ref Reader for UTF8 encoding and default allocator. +/*! GenericReader parses JSON text from a stream, and send events synchronously to an + object implementing Handler concept. + + It needs to allocate a stack for storing a single decoded string during + non-destructive parsing. + + For in-situ parsing, the decoded string is directly written to the source + text string, no temporary buffer is required. + + A GenericReader object can be reused for parsing multiple JSON text. + + \tparam SourceEncoding Encoding of the input stream. + \tparam TargetEncoding Encoding of the parse output. + \tparam StackAllocator Allocator type for stack. +*/ +template +class GenericReader { +public: + typedef typename SourceEncoding::Ch Ch; //!< SourceEncoding character type + + //! Constructor. + /*! \param stackAllocator Optional allocator for allocating stack memory. (Only use for non-destructive parsing) + \param stackCapacity stack capacity in bytes for storing a single decoded string. (Only use for non-destructive parsing) + */ + GenericReader(StackAllocator* stackAllocator = 0, size_t stackCapacity = kDefaultStackCapacity) : stack_(stackAllocator, stackCapacity), parseResult_() {} + + //! Parse JSON text. + /*! \tparam parseFlags Combination of \ref ParseFlag. + \tparam InputStream Type of input stream, implementing Stream concept. + \tparam Handler Type of handler, implementing Handler concept. + \param is Input stream to be parsed. + \param handler The handler to receive events. + \return Whether the parsing is successful. + */ + template + ParseResult Parse(InputStream& is, Handler& handler) { + if (parseFlags & kParseIterativeFlag) + return IterativeParse(is, handler); + + parseResult_.Clear(); + + ClearStackOnExit scope(*this); + + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN(parseResult_); + + if (RAPIDJSON_UNLIKELY(is.Peek() == '\0')) { + RAPIDJSON_PARSE_ERROR_NORETURN(kParseErrorDocumentEmpty, is.Tell()); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN(parseResult_); + } + else { + ParseValue(is, handler); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN(parseResult_); + + if (!(parseFlags & kParseStopWhenDoneFlag)) { + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN(parseResult_); + + if (RAPIDJSON_UNLIKELY(is.Peek() != '\0')) { + RAPIDJSON_PARSE_ERROR_NORETURN(kParseErrorDocumentRootNotSingular, is.Tell()); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN(parseResult_); + } + } + } + + return parseResult_; + } + + //! Parse JSON text (with \ref kParseDefaultFlags) + /*! \tparam InputStream Type of input stream, implementing Stream concept + \tparam Handler Type of handler, implementing Handler concept. + \param is Input stream to be parsed. + \param handler The handler to receive events. + \return Whether the parsing is successful. + */ + template + ParseResult Parse(InputStream& is, Handler& handler) { + return Parse(is, handler); + } + + //! Whether a parse error has occured in the last parsing. + bool HasParseError() const { return parseResult_.IsError(); } + + //! Get the \ref ParseErrorCode of last parsing. + ParseErrorCode GetParseErrorCode() const { return parseResult_.Code(); } + + //! Get the position of last parsing error in input, 0 otherwise. + size_t GetErrorOffset() const { return parseResult_.Offset(); } + +protected: + void SetParseError(ParseErrorCode code, size_t offset) { parseResult_.Set(code, offset); } + +private: + // Prohibit copy constructor & assignment operator. + GenericReader(const GenericReader&); + GenericReader& operator=(const GenericReader&); + + void ClearStack() { stack_.Clear(); } + + // clear stack on any exit from ParseStream, e.g. due to exception + struct ClearStackOnExit { + explicit ClearStackOnExit(GenericReader& r) : r_(r) {} + ~ClearStackOnExit() { r_.ClearStack(); } + private: + GenericReader& r_; + ClearStackOnExit(const ClearStackOnExit&); + ClearStackOnExit& operator=(const ClearStackOnExit&); + }; + + template + void SkipWhitespaceAndComments(InputStream& is) { + SkipWhitespace(is); + + if (parseFlags & kParseCommentsFlag) { + while (RAPIDJSON_UNLIKELY(Consume(is, '/'))) { + if (Consume(is, '*')) { + while (true) { + if (RAPIDJSON_UNLIKELY(is.Peek() == '\0')) + RAPIDJSON_PARSE_ERROR(kParseErrorUnspecificSyntaxError, is.Tell()); + else if (Consume(is, '*')) { + if (Consume(is, '/')) + break; + } + else + is.Take(); + } + } + else if (RAPIDJSON_LIKELY(Consume(is, '/'))) + while (is.Peek() != '\0' && is.Take() != '\n'); + else + RAPIDJSON_PARSE_ERROR(kParseErrorUnspecificSyntaxError, is.Tell()); + + SkipWhitespace(is); + } + } + } + + // Parse object: { string : value, ... } + template + void ParseObject(InputStream& is, Handler& handler) { + RAPIDJSON_ASSERT(is.Peek() == '{'); + is.Take(); // Skip '{' + + if (RAPIDJSON_UNLIKELY(!handler.StartObject())) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + + if (Consume(is, '}')) { + if (RAPIDJSON_UNLIKELY(!handler.EndObject(0))) // empty object + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + return; + } + + for (SizeType memberCount = 0;;) { + if (RAPIDJSON_UNLIKELY(is.Peek() != '"')) + RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissName, is.Tell()); + + ParseString(is, handler, true); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + + if (RAPIDJSON_UNLIKELY(!Consume(is, ':'))) + RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissColon, is.Tell()); + + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + + ParseValue(is, handler); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + + ++memberCount; + + switch (is.Peek()) { + case ',': + is.Take(); + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + break; + case '}': + is.Take(); + if (RAPIDJSON_UNLIKELY(!handler.EndObject(memberCount))) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + return; + default: + RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissCommaOrCurlyBracket, is.Tell()); break; // This useless break is only for making warning and coverage happy + } + + if (parseFlags & kParseTrailingCommasFlag) { + if (is.Peek() == '}') { + if (RAPIDJSON_UNLIKELY(!handler.EndObject(memberCount))) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + is.Take(); + return; + } + } + } + } + + // Parse array: [ value, ... ] + template + void ParseArray(InputStream& is, Handler& handler) { + RAPIDJSON_ASSERT(is.Peek() == '['); + is.Take(); // Skip '[' + + if (RAPIDJSON_UNLIKELY(!handler.StartArray())) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + + if (Consume(is, ']')) { + if (RAPIDJSON_UNLIKELY(!handler.EndArray(0))) // empty array + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + return; + } + + for (SizeType elementCount = 0;;) { + ParseValue(is, handler); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + + ++elementCount; + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + + if (Consume(is, ',')) { + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + } + else if (Consume(is, ']')) { + if (RAPIDJSON_UNLIKELY(!handler.EndArray(elementCount))) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + return; + } + else + RAPIDJSON_PARSE_ERROR(kParseErrorArrayMissCommaOrSquareBracket, is.Tell()); + + if (parseFlags & kParseTrailingCommasFlag) { + if (is.Peek() == ']') { + if (RAPIDJSON_UNLIKELY(!handler.EndArray(elementCount))) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + is.Take(); + return; + } + } + } + } + + template + void ParseNull(InputStream& is, Handler& handler) { + RAPIDJSON_ASSERT(is.Peek() == 'n'); + is.Take(); + + if (RAPIDJSON_LIKELY(Consume(is, 'u') && Consume(is, 'l') && Consume(is, 'l'))) { + if (RAPIDJSON_UNLIKELY(!handler.Null())) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + } + else + RAPIDJSON_PARSE_ERROR(kParseErrorValueInvalid, is.Tell()); + } + + template + void ParseTrue(InputStream& is, Handler& handler) { + RAPIDJSON_ASSERT(is.Peek() == 't'); + is.Take(); + + if (RAPIDJSON_LIKELY(Consume(is, 'r') && Consume(is, 'u') && Consume(is, 'e'))) { + if (RAPIDJSON_UNLIKELY(!handler.Bool(true))) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + } + else + RAPIDJSON_PARSE_ERROR(kParseErrorValueInvalid, is.Tell()); + } + + template + void ParseFalse(InputStream& is, Handler& handler) { + RAPIDJSON_ASSERT(is.Peek() == 'f'); + is.Take(); + + if (RAPIDJSON_LIKELY(Consume(is, 'a') && Consume(is, 'l') && Consume(is, 's') && Consume(is, 'e'))) { + if (RAPIDJSON_UNLIKELY(!handler.Bool(false))) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); + } + else + RAPIDJSON_PARSE_ERROR(kParseErrorValueInvalid, is.Tell()); + } + + template + RAPIDJSON_FORCEINLINE static bool Consume(InputStream& is, typename InputStream::Ch expect) { + if (RAPIDJSON_LIKELY(is.Peek() == expect)) { + is.Take(); + return true; + } + else + return false; + } + + // Helper function to parse four hexidecimal digits in \uXXXX in ParseString(). + template + unsigned ParseHex4(InputStream& is, size_t escapeOffset) { + unsigned codepoint = 0; + for (int i = 0; i < 4; i++) { + Ch c = is.Peek(); + codepoint <<= 4; + codepoint += static_cast(c); + if (c >= '0' && c <= '9') + codepoint -= '0'; + else if (c >= 'A' && c <= 'F') + codepoint -= 'A' - 10; + else if (c >= 'a' && c <= 'f') + codepoint -= 'a' - 10; + else { + RAPIDJSON_PARSE_ERROR_NORETURN(kParseErrorStringUnicodeEscapeInvalidHex, escapeOffset); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN(0); + } + is.Take(); + } + return codepoint; + } + + template + class StackStream { + public: + typedef CharType Ch; + + StackStream(internal::Stack& stack) : stack_(stack), length_(0) {} + RAPIDJSON_FORCEINLINE void Put(Ch c) { + *stack_.template Push() = c; + ++length_; + } + + RAPIDJSON_FORCEINLINE void* Push(SizeType count) { + length_ += count; + return stack_.template Push(count); + } + + size_t Length() const { return length_; } + + Ch* Pop() { + return stack_.template Pop(length_); + } + + private: + StackStream(const StackStream&); + StackStream& operator=(const StackStream&); + + internal::Stack& stack_; + SizeType length_; + }; + + // Parse string and generate String event. Different code paths for kParseInsituFlag. + template + void ParseString(InputStream& is, Handler& handler, bool isKey = false) { + internal::StreamLocalCopy copy(is); + InputStream& s(copy.s); + + RAPIDJSON_ASSERT(s.Peek() == '\"'); + s.Take(); // Skip '\"' + + bool success = false; + if (parseFlags & kParseInsituFlag) { + typename InputStream::Ch *head = s.PutBegin(); + ParseStringToStream(s, s); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + size_t length = s.PutEnd(head) - 1; + RAPIDJSON_ASSERT(length <= 0xFFFFFFFF); + const typename TargetEncoding::Ch* const str = reinterpret_cast(head); + success = (isKey ? handler.Key(str, SizeType(length), false) : handler.String(str, SizeType(length), false)); + } + else { + StackStream stackStream(stack_); + ParseStringToStream(s, stackStream); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + SizeType length = static_cast(stackStream.Length()) - 1; + const typename TargetEncoding::Ch* const str = stackStream.Pop(); + success = (isKey ? handler.Key(str, length, true) : handler.String(str, length, true)); + } + if (RAPIDJSON_UNLIKELY(!success)) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, s.Tell()); + } + + // Parse string to an output is + // This function handles the prefix/suffix double quotes, escaping, and optional encoding validation. + template + RAPIDJSON_FORCEINLINE void ParseStringToStream(InputStream& is, OutputStream& os) { +//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN +#define Z16 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + static const char escape[256] = { + Z16, Z16, 0, 0,'\"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,'/', + Z16, Z16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,'\\', 0, 0, 0, + 0, 0,'\b', 0, 0, 0,'\f', 0, 0, 0, 0, 0, 0, 0,'\n', 0, + 0, 0,'\r', 0,'\t', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16 + }; +#undef Z16 +//!@endcond + + for (;;) { + // Scan and copy string before "\\\"" or < 0x20. This is an optional optimzation. + if (!(parseFlags & kParseValidateEncodingFlag)) + ScanCopyUnescapedString(is, os); + + Ch c = is.Peek(); + if (RAPIDJSON_UNLIKELY(c == '\\')) { // Escape + size_t escapeOffset = is.Tell(); // For invalid escaping, report the inital '\\' as error offset + is.Take(); + Ch e = is.Peek(); + if ((sizeof(Ch) == 1 || unsigned(e) < 256) && RAPIDJSON_LIKELY(escape[static_cast(e)])) { + is.Take(); + os.Put(static_cast(escape[static_cast(e)])); + } + else if (RAPIDJSON_LIKELY(e == 'u')) { // Unicode + is.Take(); + unsigned codepoint = ParseHex4(is, escapeOffset); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + if (RAPIDJSON_UNLIKELY(codepoint >= 0xD800 && codepoint <= 0xDBFF)) { + // Handle UTF-16 surrogate pair + if (RAPIDJSON_UNLIKELY(!Consume(is, '\\') || !Consume(is, 'u'))) + RAPIDJSON_PARSE_ERROR(kParseErrorStringUnicodeSurrogateInvalid, escapeOffset); + unsigned codepoint2 = ParseHex4(is, escapeOffset); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID; + if (RAPIDJSON_UNLIKELY(codepoint2 < 0xDC00 || codepoint2 > 0xDFFF)) + RAPIDJSON_PARSE_ERROR(kParseErrorStringUnicodeSurrogateInvalid, escapeOffset); + codepoint = (((codepoint - 0xD800) << 10) | (codepoint2 - 0xDC00)) + 0x10000; + } + TEncoding::Encode(os, codepoint); + } + else + RAPIDJSON_PARSE_ERROR(kParseErrorStringEscapeInvalid, escapeOffset); + } + else if (RAPIDJSON_UNLIKELY(c == '"')) { // Closing double quote + is.Take(); + os.Put('\0'); // null-terminate the string + return; + } + else if (RAPIDJSON_UNLIKELY(static_cast(c) < 0x20)) { // RFC 4627: unescaped = %x20-21 / %x23-5B / %x5D-10FFFF + if (c == '\0') + RAPIDJSON_PARSE_ERROR(kParseErrorStringMissQuotationMark, is.Tell()); + else + RAPIDJSON_PARSE_ERROR(kParseErrorStringEscapeInvalid, is.Tell()); + } + else { + size_t offset = is.Tell(); + if (RAPIDJSON_UNLIKELY((parseFlags & kParseValidateEncodingFlag ? + !Transcoder::Validate(is, os) : + !Transcoder::Transcode(is, os)))) + RAPIDJSON_PARSE_ERROR(kParseErrorStringInvalidEncoding, offset); + } + } + } + + template + static RAPIDJSON_FORCEINLINE void ScanCopyUnescapedString(InputStream&, OutputStream&) { + // Do nothing for generic version + } + +#if defined(RAPIDJSON_SSE2) || defined(RAPIDJSON_SSE42) + // StringStream -> StackStream + static RAPIDJSON_FORCEINLINE void ScanCopyUnescapedString(StringStream& is, StackStream& os) { + const char* p = is.src_; + + // Scan one by one until alignment (unaligned load may cross page boundary and cause crash) + const char* nextAligned = reinterpret_cast((reinterpret_cast(p) + 15) & static_cast(~15)); + while (p != nextAligned) + if (RAPIDJSON_UNLIKELY(*p == '\"') || RAPIDJSON_UNLIKELY(*p == '\\') || RAPIDJSON_UNLIKELY(static_cast(*p) < 0x20)) { + is.src_ = p; + return; + } + else + os.Put(*p++); + + // The rest of string using SIMD + static const char dquote[16] = { '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"' }; + static const char bslash[16] = { '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\' }; + static const char space[16] = { 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19 }; + const __m128i dq = _mm_loadu_si128(reinterpret_cast(&dquote[0])); + const __m128i bs = _mm_loadu_si128(reinterpret_cast(&bslash[0])); + const __m128i sp = _mm_loadu_si128(reinterpret_cast(&space[0])); + + for (;; p += 16) { + const __m128i s = _mm_load_si128(reinterpret_cast(p)); + const __m128i t1 = _mm_cmpeq_epi8(s, dq); + const __m128i t2 = _mm_cmpeq_epi8(s, bs); + const __m128i t3 = _mm_cmpeq_epi8(_mm_max_epu8(s, sp), sp); // s < 0x20 <=> max(s, 0x19) == 0x19 + const __m128i x = _mm_or_si128(_mm_or_si128(t1, t2), t3); + unsigned short r = static_cast(_mm_movemask_epi8(x)); + if (RAPIDJSON_UNLIKELY(r != 0)) { // some of characters is escaped + SizeType length; + #ifdef _MSC_VER // Find the index of first escaped + unsigned long offset; + _BitScanForward(&offset, r); + length = offset; + #else + length = static_cast(__builtin_ffs(r) - 1); + #endif + char* q = reinterpret_cast(os.Push(length)); + for (size_t i = 0; i < length; i++) + q[i] = p[i]; + + p += length; + break; + } + _mm_storeu_si128(reinterpret_cast<__m128i *>(os.Push(16)), s); + } + + is.src_ = p; + } + + // InsituStringStream -> InsituStringStream + static RAPIDJSON_FORCEINLINE void ScanCopyUnescapedString(InsituStringStream& is, InsituStringStream& os) { + RAPIDJSON_ASSERT(&is == &os); + (void)os; + + if (is.src_ == is.dst_) { + SkipUnescapedString(is); + return; + } + + char* p = is.src_; + char *q = is.dst_; + + // Scan one by one until alignment (unaligned load may cross page boundary and cause crash) + const char* nextAligned = reinterpret_cast((reinterpret_cast(p) + 15) & static_cast(~15)); + while (p != nextAligned) + if (RAPIDJSON_UNLIKELY(*p == '\"') || RAPIDJSON_UNLIKELY(*p == '\\') || RAPIDJSON_UNLIKELY(static_cast(*p) < 0x20)) { + is.src_ = p; + is.dst_ = q; + return; + } + else + *q++ = *p++; + + // The rest of string using SIMD + static const char dquote[16] = { '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"' }; + static const char bslash[16] = { '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\' }; + static const char space[16] = { 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19 }; + const __m128i dq = _mm_loadu_si128(reinterpret_cast(&dquote[0])); + const __m128i bs = _mm_loadu_si128(reinterpret_cast(&bslash[0])); + const __m128i sp = _mm_loadu_si128(reinterpret_cast(&space[0])); + + for (;; p += 16, q += 16) { + const __m128i s = _mm_load_si128(reinterpret_cast(p)); + const __m128i t1 = _mm_cmpeq_epi8(s, dq); + const __m128i t2 = _mm_cmpeq_epi8(s, bs); + const __m128i t3 = _mm_cmpeq_epi8(_mm_max_epu8(s, sp), sp); // s < 0x20 <=> max(s, 0x19) == 0x19 + const __m128i x = _mm_or_si128(_mm_or_si128(t1, t2), t3); + unsigned short r = static_cast(_mm_movemask_epi8(x)); + if (RAPIDJSON_UNLIKELY(r != 0)) { // some of characters is escaped + size_t length; +#ifdef _MSC_VER // Find the index of first escaped + unsigned long offset; + _BitScanForward(&offset, r); + length = offset; +#else + length = static_cast(__builtin_ffs(r) - 1); +#endif + for (const char* pend = p + length; p != pend; ) + *q++ = *p++; + break; + } + _mm_storeu_si128(reinterpret_cast<__m128i *>(q), s); + } + + is.src_ = p; + is.dst_ = q; + } + + // When read/write pointers are the same for insitu stream, just skip unescaped characters + static RAPIDJSON_FORCEINLINE void SkipUnescapedString(InsituStringStream& is) { + RAPIDJSON_ASSERT(is.src_ == is.dst_); + char* p = is.src_; + + // Scan one by one until alignment (unaligned load may cross page boundary and cause crash) + const char* nextAligned = reinterpret_cast((reinterpret_cast(p) + 15) & static_cast(~15)); + for (; p != nextAligned; p++) + if (RAPIDJSON_UNLIKELY(*p == '\"') || RAPIDJSON_UNLIKELY(*p == '\\') || RAPIDJSON_UNLIKELY(static_cast(*p) < 0x20)) { + is.src_ = is.dst_ = p; + return; + } + + // The rest of string using SIMD + static const char dquote[16] = { '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"' }; + static const char bslash[16] = { '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\' }; + static const char space[16] = { 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19 }; + const __m128i dq = _mm_loadu_si128(reinterpret_cast(&dquote[0])); + const __m128i bs = _mm_loadu_si128(reinterpret_cast(&bslash[0])); + const __m128i sp = _mm_loadu_si128(reinterpret_cast(&space[0])); + + for (;; p += 16) { + const __m128i s = _mm_load_si128(reinterpret_cast(p)); + const __m128i t1 = _mm_cmpeq_epi8(s, dq); + const __m128i t2 = _mm_cmpeq_epi8(s, bs); + const __m128i t3 = _mm_cmpeq_epi8(_mm_max_epu8(s, sp), sp); // s < 0x20 <=> max(s, 0x19) == 0x19 + const __m128i x = _mm_or_si128(_mm_or_si128(t1, t2), t3); + unsigned short r = static_cast(_mm_movemask_epi8(x)); + if (RAPIDJSON_UNLIKELY(r != 0)) { // some of characters is escaped + size_t length; +#ifdef _MSC_VER // Find the index of first escaped + unsigned long offset; + _BitScanForward(&offset, r); + length = offset; +#else + length = static_cast(__builtin_ffs(r) - 1); +#endif + p += length; + break; + } + } + + is.src_ = is.dst_ = p; + } +#endif + + template + class NumberStream; + + template + class NumberStream { + public: + typedef typename InputStream::Ch Ch; + + NumberStream(GenericReader& reader, InputStream& s) : is(s) { (void)reader; } + ~NumberStream() {} + + RAPIDJSON_FORCEINLINE Ch Peek() const { return is.Peek(); } + RAPIDJSON_FORCEINLINE Ch TakePush() { return is.Take(); } + RAPIDJSON_FORCEINLINE Ch Take() { return is.Take(); } + RAPIDJSON_FORCEINLINE void Push(char) {} + + size_t Tell() { return is.Tell(); } + size_t Length() { return 0; } + const char* Pop() { return 0; } + + protected: + NumberStream& operator=(const NumberStream&); + + InputStream& is; + }; + + template + class NumberStream : public NumberStream { + typedef NumberStream Base; + public: + NumberStream(GenericReader& reader, InputStream& is) : Base(reader, is), stackStream(reader.stack_) {} + ~NumberStream() {} + + RAPIDJSON_FORCEINLINE Ch TakePush() { + stackStream.Put(static_cast(Base::is.Peek())); + return Base::is.Take(); + } + + RAPIDJSON_FORCEINLINE void Push(char c) { + stackStream.Put(c); + } + + size_t Length() { return stackStream.Length(); } + + const char* Pop() { + stackStream.Put('\0'); + return stackStream.Pop(); + } + + private: + StackStream stackStream; + }; + + template + class NumberStream : public NumberStream { + typedef NumberStream Base; + public: + NumberStream(GenericReader& reader, InputStream& is) : Base(reader, is) {} + ~NumberStream() {} + + RAPIDJSON_FORCEINLINE Ch Take() { return Base::TakePush(); } + }; + + template + void ParseNumber(InputStream& is, Handler& handler) { + internal::StreamLocalCopy copy(is); + NumberStream s(*this, copy.s); + + size_t startOffset = s.Tell(); + double d = 0.0; + bool useNanOrInf = false; + + // Parse minus + bool minus = Consume(s, '-'); + + // Parse int: zero / ( digit1-9 *DIGIT ) + unsigned i = 0; + uint64_t i64 = 0; + bool use64bit = false; + int significandDigit = 0; + if (RAPIDJSON_UNLIKELY(s.Peek() == '0')) { + i = 0; + s.TakePush(); + } + else if (RAPIDJSON_LIKELY(s.Peek() >= '1' && s.Peek() <= '9')) { + i = static_cast(s.TakePush() - '0'); + + if (minus) + while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + if (RAPIDJSON_UNLIKELY(i >= 214748364)) { // 2^31 = 2147483648 + if (RAPIDJSON_LIKELY(i != 214748364 || s.Peek() > '8')) { + i64 = i; + use64bit = true; + break; + } + } + i = i * 10 + static_cast(s.TakePush() - '0'); + significandDigit++; + } + else + while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + if (RAPIDJSON_UNLIKELY(i >= 429496729)) { // 2^32 - 1 = 4294967295 + if (RAPIDJSON_LIKELY(i != 429496729 || s.Peek() > '5')) { + i64 = i; + use64bit = true; + break; + } + } + i = i * 10 + static_cast(s.TakePush() - '0'); + significandDigit++; + } + } + // Parse NaN or Infinity here + else if ((parseFlags & kParseNanAndInfFlag) && RAPIDJSON_LIKELY((s.Peek() == 'I' || s.Peek() == 'N'))) { + useNanOrInf = true; + if (RAPIDJSON_LIKELY(Consume(s, 'N') && Consume(s, 'a') && Consume(s, 'N'))) { + d = std::numeric_limits::quiet_NaN(); + } + else if (RAPIDJSON_LIKELY(Consume(s, 'I') && Consume(s, 'n') && Consume(s, 'f'))) { + d = (minus ? -std::numeric_limits::infinity() : std::numeric_limits::infinity()); + if (RAPIDJSON_UNLIKELY(s.Peek() == 'i' && !(Consume(s, 'i') && Consume(s, 'n') + && Consume(s, 'i') && Consume(s, 't') && Consume(s, 'y')))) + RAPIDJSON_PARSE_ERROR(kParseErrorValueInvalid, s.Tell()); + } + else + RAPIDJSON_PARSE_ERROR(kParseErrorValueInvalid, s.Tell()); + } + else + RAPIDJSON_PARSE_ERROR(kParseErrorValueInvalid, s.Tell()); + + // Parse 64bit int + bool useDouble = false; + if (use64bit) { + if (minus) + while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + if (RAPIDJSON_UNLIKELY(i64 >= RAPIDJSON_UINT64_C2(0x0CCCCCCC, 0xCCCCCCCC))) // 2^63 = 9223372036854775808 + if (RAPIDJSON_LIKELY(i64 != RAPIDJSON_UINT64_C2(0x0CCCCCCC, 0xCCCCCCCC) || s.Peek() > '8')) { + d = static_cast(i64); + useDouble = true; + break; + } + i64 = i64 * 10 + static_cast(s.TakePush() - '0'); + significandDigit++; + } + else + while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + if (RAPIDJSON_UNLIKELY(i64 >= RAPIDJSON_UINT64_C2(0x19999999, 0x99999999))) // 2^64 - 1 = 18446744073709551615 + if (RAPIDJSON_LIKELY(i64 != RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) || s.Peek() > '5')) { + d = static_cast(i64); + useDouble = true; + break; + } + i64 = i64 * 10 + static_cast(s.TakePush() - '0'); + significandDigit++; + } + } + + // Force double for big integer + if (useDouble) { + while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + if (RAPIDJSON_UNLIKELY(d >= 1.7976931348623157e307)) // DBL_MAX / 10.0 + RAPIDJSON_PARSE_ERROR(kParseErrorNumberTooBig, startOffset); + d = d * 10 + (s.TakePush() - '0'); + } + } + + // Parse frac = decimal-point 1*DIGIT + int expFrac = 0; + size_t decimalPosition; + if (Consume(s, '.')) { + decimalPosition = s.Length(); + + if (RAPIDJSON_UNLIKELY(!(s.Peek() >= '0' && s.Peek() <= '9'))) + RAPIDJSON_PARSE_ERROR(kParseErrorNumberMissFraction, s.Tell()); + + if (!useDouble) { +#if RAPIDJSON_64BIT + // Use i64 to store significand in 64-bit architecture + if (!use64bit) + i64 = i; + + while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + if (i64 > RAPIDJSON_UINT64_C2(0x1FFFFF, 0xFFFFFFFF)) // 2^53 - 1 for fast path + break; + else { + i64 = i64 * 10 + static_cast(s.TakePush() - '0'); + --expFrac; + if (i64 != 0) + significandDigit++; + } + } + + d = static_cast(i64); +#else + // Use double to store significand in 32-bit architecture + d = static_cast(use64bit ? i64 : i); +#endif + useDouble = true; + } + + while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + if (significandDigit < 17) { + d = d * 10.0 + (s.TakePush() - '0'); + --expFrac; + if (RAPIDJSON_LIKELY(d > 0.0)) + significandDigit++; + } + else + s.TakePush(); + } + } + else + decimalPosition = s.Length(); // decimal position at the end of integer. + + // Parse exp = e [ minus / plus ] 1*DIGIT + int exp = 0; + if (Consume(s, 'e') || Consume(s, 'E')) { + if (!useDouble) { + d = static_cast(use64bit ? i64 : i); + useDouble = true; + } + + bool expMinus = false; + if (Consume(s, '+')) + ; + else if (Consume(s, '-')) + expMinus = true; + + if (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + exp = static_cast(s.Take() - '0'); + if (expMinus) { + while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + exp = exp * 10 + static_cast(s.Take() - '0'); + if (exp >= 214748364) { // Issue #313: prevent overflow exponent + while (RAPIDJSON_UNLIKELY(s.Peek() >= '0' && s.Peek() <= '9')) // Consume the rest of exponent + s.Take(); + } + } + } + else { // positive exp + int maxExp = 308 - expFrac; + while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) { + exp = exp * 10 + static_cast(s.Take() - '0'); + if (RAPIDJSON_UNLIKELY(exp > maxExp)) + RAPIDJSON_PARSE_ERROR(kParseErrorNumberTooBig, startOffset); + } + } + } + else + RAPIDJSON_PARSE_ERROR(kParseErrorNumberMissExponent, s.Tell()); + + if (expMinus) + exp = -exp; + } + + // Finish parsing, call event according to the type of number. + bool cont = true; + + if (parseFlags & kParseNumbersAsStringsFlag) { + if (parseFlags & kParseInsituFlag) { + s.Pop(); // Pop stack no matter if it will be used or not. + typename InputStream::Ch* head = is.PutBegin(); + const size_t length = s.Tell() - startOffset; + RAPIDJSON_ASSERT(length <= 0xFFFFFFFF); + // unable to insert the \0 character here, it will erase the comma after this number + const typename TargetEncoding::Ch* const str = reinterpret_cast(head); + cont = handler.RawNumber(str, SizeType(length), false); + } + else { + SizeType numCharsToCopy = static_cast(s.Length()); + StringStream srcStream(s.Pop()); + StackStream dstStream(stack_); + while (numCharsToCopy--) { + Transcoder, TargetEncoding>::Transcode(srcStream, dstStream); + } + dstStream.Put('\0'); + const typename TargetEncoding::Ch* str = dstStream.Pop(); + const SizeType length = static_cast(dstStream.Length()) - 1; + cont = handler.RawNumber(str, SizeType(length), true); + } + } + else { + size_t length = s.Length(); + const char* decimal = s.Pop(); // Pop stack no matter if it will be used or not. + + if (useDouble) { + int p = exp + expFrac; + if (parseFlags & kParseFullPrecisionFlag) + d = internal::StrtodFullPrecision(d, p, decimal, length, decimalPosition, exp); + else + d = internal::StrtodNormalPrecision(d, p); + + cont = handler.Double(minus ? -d : d); + } + else if (useNanOrInf) { + cont = handler.Double(d); + } + else { + if (use64bit) { + if (minus) + cont = handler.Int64(static_cast(~i64 + 1)); + else + cont = handler.Uint64(i64); + } + else { + if (minus) + cont = handler.Int(static_cast(~i + 1)); + else + cont = handler.Uint(i); + } + } + } + if (RAPIDJSON_UNLIKELY(!cont)) + RAPIDJSON_PARSE_ERROR(kParseErrorTermination, startOffset); + } + + // Parse any JSON value + template + void ParseValue(InputStream& is, Handler& handler) { + switch (is.Peek()) { + case 'n': ParseNull (is, handler); break; + case 't': ParseTrue (is, handler); break; + case 'f': ParseFalse (is, handler); break; + case '"': ParseString(is, handler); break; + case '{': ParseObject(is, handler); break; + case '[': ParseArray (is, handler); break; + default : + ParseNumber(is, handler); + break; + + } + } + + // Iterative Parsing + + // States + enum IterativeParsingState { + IterativeParsingStartState = 0, + IterativeParsingFinishState, + IterativeParsingErrorState, + + // Object states + IterativeParsingObjectInitialState, + IterativeParsingMemberKeyState, + IterativeParsingKeyValueDelimiterState, + IterativeParsingMemberValueState, + IterativeParsingMemberDelimiterState, + IterativeParsingObjectFinishState, + + // Array states + IterativeParsingArrayInitialState, + IterativeParsingElementState, + IterativeParsingElementDelimiterState, + IterativeParsingArrayFinishState, + + // Single value state + IterativeParsingValueState + }; + + enum { cIterativeParsingStateCount = IterativeParsingValueState + 1 }; + + // Tokens + enum Token { + LeftBracketToken = 0, + RightBracketToken, + + LeftCurlyBracketToken, + RightCurlyBracketToken, + + CommaToken, + ColonToken, + + StringToken, + FalseToken, + TrueToken, + NullToken, + NumberToken, + + kTokenCount + }; + + RAPIDJSON_FORCEINLINE Token Tokenize(Ch c) { + +//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN +#define N NumberToken +#define N16 N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N + // Maps from ASCII to Token + static const unsigned char tokenMap[256] = { + N16, // 00~0F + N16, // 10~1F + N, N, StringToken, N, N, N, N, N, N, N, N, N, CommaToken, N, N, N, // 20~2F + N, N, N, N, N, N, N, N, N, N, ColonToken, N, N, N, N, N, // 30~3F + N16, // 40~4F + N, N, N, N, N, N, N, N, N, N, N, LeftBracketToken, N, RightBracketToken, N, N, // 50~5F + N, N, N, N, N, N, FalseToken, N, N, N, N, N, N, N, NullToken, N, // 60~6F + N, N, N, N, TrueToken, N, N, N, N, N, N, LeftCurlyBracketToken, N, RightCurlyBracketToken, N, N, // 70~7F + N16, N16, N16, N16, N16, N16, N16, N16 // 80~FF + }; +#undef N +#undef N16 +//!@endcond + + if (sizeof(Ch) == 1 || static_cast(c) < 256) + return static_cast(tokenMap[static_cast(c)]); + else + return NumberToken; + } + + RAPIDJSON_FORCEINLINE IterativeParsingState Predict(IterativeParsingState state, Token token) { + // current state x one lookahead token -> new state + static const char G[cIterativeParsingStateCount][kTokenCount] = { + // Start + { + IterativeParsingArrayInitialState, // Left bracket + IterativeParsingErrorState, // Right bracket + IterativeParsingObjectInitialState, // Left curly bracket + IterativeParsingErrorState, // Right curly bracket + IterativeParsingErrorState, // Comma + IterativeParsingErrorState, // Colon + IterativeParsingValueState, // String + IterativeParsingValueState, // False + IterativeParsingValueState, // True + IterativeParsingValueState, // Null + IterativeParsingValueState // Number + }, + // Finish(sink state) + { + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState + }, + // Error(sink state) + { + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState + }, + // ObjectInitial + { + IterativeParsingErrorState, // Left bracket + IterativeParsingErrorState, // Right bracket + IterativeParsingErrorState, // Left curly bracket + IterativeParsingObjectFinishState, // Right curly bracket + IterativeParsingErrorState, // Comma + IterativeParsingErrorState, // Colon + IterativeParsingMemberKeyState, // String + IterativeParsingErrorState, // False + IterativeParsingErrorState, // True + IterativeParsingErrorState, // Null + IterativeParsingErrorState // Number + }, + // MemberKey + { + IterativeParsingErrorState, // Left bracket + IterativeParsingErrorState, // Right bracket + IterativeParsingErrorState, // Left curly bracket + IterativeParsingErrorState, // Right curly bracket + IterativeParsingErrorState, // Comma + IterativeParsingKeyValueDelimiterState, // Colon + IterativeParsingErrorState, // String + IterativeParsingErrorState, // False + IterativeParsingErrorState, // True + IterativeParsingErrorState, // Null + IterativeParsingErrorState // Number + }, + // KeyValueDelimiter + { + IterativeParsingArrayInitialState, // Left bracket(push MemberValue state) + IterativeParsingErrorState, // Right bracket + IterativeParsingObjectInitialState, // Left curly bracket(push MemberValue state) + IterativeParsingErrorState, // Right curly bracket + IterativeParsingErrorState, // Comma + IterativeParsingErrorState, // Colon + IterativeParsingMemberValueState, // String + IterativeParsingMemberValueState, // False + IterativeParsingMemberValueState, // True + IterativeParsingMemberValueState, // Null + IterativeParsingMemberValueState // Number + }, + // MemberValue + { + IterativeParsingErrorState, // Left bracket + IterativeParsingErrorState, // Right bracket + IterativeParsingErrorState, // Left curly bracket + IterativeParsingObjectFinishState, // Right curly bracket + IterativeParsingMemberDelimiterState, // Comma + IterativeParsingErrorState, // Colon + IterativeParsingErrorState, // String + IterativeParsingErrorState, // False + IterativeParsingErrorState, // True + IterativeParsingErrorState, // Null + IterativeParsingErrorState // Number + }, + // MemberDelimiter + { + IterativeParsingErrorState, // Left bracket + IterativeParsingErrorState, // Right bracket + IterativeParsingErrorState, // Left curly bracket + IterativeParsingObjectFinishState, // Right curly bracket + IterativeParsingErrorState, // Comma + IterativeParsingErrorState, // Colon + IterativeParsingMemberKeyState, // String + IterativeParsingErrorState, // False + IterativeParsingErrorState, // True + IterativeParsingErrorState, // Null + IterativeParsingErrorState // Number + }, + // ObjectFinish(sink state) + { + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState + }, + // ArrayInitial + { + IterativeParsingArrayInitialState, // Left bracket(push Element state) + IterativeParsingArrayFinishState, // Right bracket + IterativeParsingObjectInitialState, // Left curly bracket(push Element state) + IterativeParsingErrorState, // Right curly bracket + IterativeParsingErrorState, // Comma + IterativeParsingErrorState, // Colon + IterativeParsingElementState, // String + IterativeParsingElementState, // False + IterativeParsingElementState, // True + IterativeParsingElementState, // Null + IterativeParsingElementState // Number + }, + // Element + { + IterativeParsingErrorState, // Left bracket + IterativeParsingArrayFinishState, // Right bracket + IterativeParsingErrorState, // Left curly bracket + IterativeParsingErrorState, // Right curly bracket + IterativeParsingElementDelimiterState, // Comma + IterativeParsingErrorState, // Colon + IterativeParsingErrorState, // String + IterativeParsingErrorState, // False + IterativeParsingErrorState, // True + IterativeParsingErrorState, // Null + IterativeParsingErrorState // Number + }, + // ElementDelimiter + { + IterativeParsingArrayInitialState, // Left bracket(push Element state) + IterativeParsingArrayFinishState, // Right bracket + IterativeParsingObjectInitialState, // Left curly bracket(push Element state) + IterativeParsingErrorState, // Right curly bracket + IterativeParsingErrorState, // Comma + IterativeParsingErrorState, // Colon + IterativeParsingElementState, // String + IterativeParsingElementState, // False + IterativeParsingElementState, // True + IterativeParsingElementState, // Null + IterativeParsingElementState // Number + }, + // ArrayFinish(sink state) + { + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState + }, + // Single Value (sink state) + { + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, IterativeParsingErrorState, + IterativeParsingErrorState + } + }; // End of G + + return static_cast(G[state][token]); + } + + // Make an advance in the token stream and state based on the candidate destination state which was returned by Transit(). + // May return a new state on state pop. + template + RAPIDJSON_FORCEINLINE IterativeParsingState Transit(IterativeParsingState src, Token token, IterativeParsingState dst, InputStream& is, Handler& handler) { + (void)token; + + switch (dst) { + case IterativeParsingErrorState: + return dst; + + case IterativeParsingObjectInitialState: + case IterativeParsingArrayInitialState: + { + // Push the state(Element or MemeberValue) if we are nested in another array or value of member. + // In this way we can get the correct state on ObjectFinish or ArrayFinish by frame pop. + IterativeParsingState n = src; + if (src == IterativeParsingArrayInitialState || src == IterativeParsingElementDelimiterState) + n = IterativeParsingElementState; + else if (src == IterativeParsingKeyValueDelimiterState) + n = IterativeParsingMemberValueState; + // Push current state. + *stack_.template Push(1) = n; + // Initialize and push the member/element count. + *stack_.template Push(1) = 0; + // Call handler + bool hr = (dst == IterativeParsingObjectInitialState) ? handler.StartObject() : handler.StartArray(); + // On handler short circuits the parsing. + if (!hr) { + RAPIDJSON_PARSE_ERROR_NORETURN(kParseErrorTermination, is.Tell()); + return IterativeParsingErrorState; + } + else { + is.Take(); + return dst; + } + } + + case IterativeParsingMemberKeyState: + ParseString(is, handler, true); + if (HasParseError()) + return IterativeParsingErrorState; + else + return dst; + + case IterativeParsingKeyValueDelimiterState: + RAPIDJSON_ASSERT(token == ColonToken); + is.Take(); + return dst; + + case IterativeParsingMemberValueState: + // Must be non-compound value. Or it would be ObjectInitial or ArrayInitial state. + ParseValue(is, handler); + if (HasParseError()) { + return IterativeParsingErrorState; + } + return dst; + + case IterativeParsingElementState: + // Must be non-compound value. Or it would be ObjectInitial or ArrayInitial state. + ParseValue(is, handler); + if (HasParseError()) { + return IterativeParsingErrorState; + } + return dst; + + case IterativeParsingMemberDelimiterState: + case IterativeParsingElementDelimiterState: + is.Take(); + // Update member/element count. + *stack_.template Top() = *stack_.template Top() + 1; + return dst; + + case IterativeParsingObjectFinishState: + { + // Transit from delimiter is only allowed when trailing commas are enabled + if (!(parseFlags & kParseTrailingCommasFlag) && src == IterativeParsingMemberDelimiterState) { + RAPIDJSON_PARSE_ERROR_NORETURN(kParseErrorObjectMissName, is.Tell()); + return IterativeParsingErrorState; + } + // Get member count. + SizeType c = *stack_.template Pop(1); + // If the object is not empty, count the last member. + if (src == IterativeParsingMemberValueState) + ++c; + // Restore the state. + IterativeParsingState n = static_cast(*stack_.template Pop(1)); + // Transit to Finish state if this is the topmost scope. + if (n == IterativeParsingStartState) + n = IterativeParsingFinishState; + // Call handler + bool hr = handler.EndObject(c); + // On handler short circuits the parsing. + if (!hr) { + RAPIDJSON_PARSE_ERROR_NORETURN(kParseErrorTermination, is.Tell()); + return IterativeParsingErrorState; + } + else { + is.Take(); + return n; + } + } + + case IterativeParsingArrayFinishState: + { + // Transit from delimiter is only allowed when trailing commas are enabled + if (!(parseFlags & kParseTrailingCommasFlag) && src == IterativeParsingElementDelimiterState) { + RAPIDJSON_PARSE_ERROR_NORETURN(kParseErrorValueInvalid, is.Tell()); + return IterativeParsingErrorState; + } + // Get element count. + SizeType c = *stack_.template Pop(1); + // If the array is not empty, count the last element. + if (src == IterativeParsingElementState) + ++c; + // Restore the state. + IterativeParsingState n = static_cast(*stack_.template Pop(1)); + // Transit to Finish state if this is the topmost scope. + if (n == IterativeParsingStartState) + n = IterativeParsingFinishState; + // Call handler + bool hr = handler.EndArray(c); + // On handler short circuits the parsing. + if (!hr) { + RAPIDJSON_PARSE_ERROR_NORETURN(kParseErrorTermination, is.Tell()); + return IterativeParsingErrorState; + } + else { + is.Take(); + return n; + } + } + + default: + // This branch is for IterativeParsingValueState actually. + // Use `default:` rather than + // `case IterativeParsingValueState:` is for code coverage. + + // The IterativeParsingStartState is not enumerated in this switch-case. + // It is impossible for that case. And it can be caught by following assertion. + + // The IterativeParsingFinishState is not enumerated in this switch-case either. + // It is a "derivative" state which cannot triggered from Predict() directly. + // Therefore it cannot happen here. And it can be caught by following assertion. + RAPIDJSON_ASSERT(dst == IterativeParsingValueState); + + // Must be non-compound value. Or it would be ObjectInitial or ArrayInitial state. + ParseValue(is, handler); + if (HasParseError()) { + return IterativeParsingErrorState; + } + return IterativeParsingFinishState; + } + } + + template + void HandleError(IterativeParsingState src, InputStream& is) { + if (HasParseError()) { + // Error flag has been set. + return; + } + + switch (src) { + case IterativeParsingStartState: RAPIDJSON_PARSE_ERROR(kParseErrorDocumentEmpty, is.Tell()); return; + case IterativeParsingFinishState: RAPIDJSON_PARSE_ERROR(kParseErrorDocumentRootNotSingular, is.Tell()); return; + case IterativeParsingObjectInitialState: + case IterativeParsingMemberDelimiterState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissName, is.Tell()); return; + case IterativeParsingMemberKeyState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissColon, is.Tell()); return; + case IterativeParsingMemberValueState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissCommaOrCurlyBracket, is.Tell()); return; + case IterativeParsingKeyValueDelimiterState: + case IterativeParsingArrayInitialState: + case IterativeParsingElementDelimiterState: RAPIDJSON_PARSE_ERROR(kParseErrorValueInvalid, is.Tell()); return; + default: RAPIDJSON_ASSERT(src == IterativeParsingElementState); RAPIDJSON_PARSE_ERROR(kParseErrorArrayMissCommaOrSquareBracket, is.Tell()); return; + } + } + + template + ParseResult IterativeParse(InputStream& is, Handler& handler) { + parseResult_.Clear(); + ClearStackOnExit scope(*this); + IterativeParsingState state = IterativeParsingStartState; + + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN(parseResult_); + while (is.Peek() != '\0') { + Token t = Tokenize(is.Peek()); + IterativeParsingState n = Predict(state, t); + IterativeParsingState d = Transit(state, t, n, is, handler); + + if (d == IterativeParsingErrorState) { + HandleError(state, is); + break; + } + + state = d; + + // Do not further consume streams if a root JSON has been parsed. + if ((parseFlags & kParseStopWhenDoneFlag) && state == IterativeParsingFinishState) + break; + + SkipWhitespaceAndComments(is); + RAPIDJSON_PARSE_ERROR_EARLY_RETURN(parseResult_); + } + + // Handle the end of file. + if (state != IterativeParsingFinishState) + HandleError(state, is); + + return parseResult_; + } + + static const size_t kDefaultStackCapacity = 256; //!< Default stack capacity in bytes for storing a single decoded string. + internal::Stack stack_; //!< A stack for storing decoded string temporarily during non-destructive parsing. + ParseResult parseResult_; +}; // class GenericReader + +//! Reader with UTF8 encoding and default allocator. +typedef GenericReader, UTF8<> > Reader; + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + + +#ifdef __GNUC__ +RAPIDJSON_DIAG_POP +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_READER_H_ diff --git a/include/rapidjson/schema.h b/include/rapidjson/schema.h new file mode 100644 index 0000000..b182aa2 --- /dev/null +++ b/include/rapidjson/schema.h @@ -0,0 +1,2006 @@ +// Tencent is pleased to support the open source community by making RapidJSON available-> +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip-> All rights reserved-> +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License-> You may obtain a copy of the License at +// +// http://opensource->org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied-> See the License for the +// specific language governing permissions and limitations under the License-> + +#ifndef RAPIDJSON_SCHEMA_H_ +#define RAPIDJSON_SCHEMA_H_ + +#include "document.h" +#include "pointer.h" +#include // abs, floor + +#if !defined(RAPIDJSON_SCHEMA_USE_INTERNALREGEX) +#define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 1 +#else +#define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 0 +#endif + +#if !RAPIDJSON_SCHEMA_USE_INTERNALREGEX && !defined(RAPIDJSON_SCHEMA_USE_STDREGEX) && (__cplusplus >=201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)) +#define RAPIDJSON_SCHEMA_USE_STDREGEX 1 +#else +#define RAPIDJSON_SCHEMA_USE_STDREGEX 0 +#endif + +#if RAPIDJSON_SCHEMA_USE_INTERNALREGEX +#include "internal/regex.h" +#elif RAPIDJSON_SCHEMA_USE_STDREGEX +#include +#endif + +#if RAPIDJSON_SCHEMA_USE_INTERNALREGEX || RAPIDJSON_SCHEMA_USE_STDREGEX +#define RAPIDJSON_SCHEMA_HAS_REGEX 1 +#else +#define RAPIDJSON_SCHEMA_HAS_REGEX 0 +#endif + +#ifndef RAPIDJSON_SCHEMA_VERBOSE +#define RAPIDJSON_SCHEMA_VERBOSE 0 +#endif + +#if RAPIDJSON_SCHEMA_VERBOSE +#include "stringbuffer.h" +#endif + +RAPIDJSON_DIAG_PUSH + +#if defined(__GNUC__) +RAPIDJSON_DIAG_OFF(effc++) +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_OFF(weak-vtables) +RAPIDJSON_DIAG_OFF(exit-time-destructors) +RAPIDJSON_DIAG_OFF(c++98-compat-pedantic) +RAPIDJSON_DIAG_OFF(variadic-macros) +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// Verbose Utilities + +#if RAPIDJSON_SCHEMA_VERBOSE + +namespace internal { + +inline void PrintInvalidKeyword(const char* keyword) { + printf("Fail keyword: %s\n", keyword); +} + +inline void PrintInvalidKeyword(const wchar_t* keyword) { + wprintf(L"Fail keyword: %ls\n", keyword); +} + +inline void PrintInvalidDocument(const char* document) { + printf("Fail document: %s\n\n", document); +} + +inline void PrintInvalidDocument(const wchar_t* document) { + wprintf(L"Fail document: %ls\n\n", document); +} + +inline void PrintValidatorPointers(unsigned depth, const char* s, const char* d) { + printf("S: %*s%s\nD: %*s%s\n\n", depth * 4, " ", s, depth * 4, " ", d); +} + +inline void PrintValidatorPointers(unsigned depth, const wchar_t* s, const wchar_t* d) { + wprintf(L"S: %*ls%ls\nD: %*ls%ls\n\n", depth * 4, L" ", s, depth * 4, L" ", d); +} + +} // namespace internal + +#endif // RAPIDJSON_SCHEMA_VERBOSE + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_INVALID_KEYWORD_RETURN + +#if RAPIDJSON_SCHEMA_VERBOSE +#define RAPIDJSON_INVALID_KEYWORD_VERBOSE(keyword) internal::PrintInvalidKeyword(keyword) +#else +#define RAPIDJSON_INVALID_KEYWORD_VERBOSE(keyword) +#endif + +#define RAPIDJSON_INVALID_KEYWORD_RETURN(keyword)\ +RAPIDJSON_MULTILINEMACRO_BEGIN\ + context.invalidKeyword = keyword.GetString();\ + RAPIDJSON_INVALID_KEYWORD_VERBOSE(keyword.GetString());\ + return false;\ +RAPIDJSON_MULTILINEMACRO_END + +/////////////////////////////////////////////////////////////////////////////// +// Forward declarations + +template +class GenericSchemaDocument; + +namespace internal { + +template +class Schema; + +/////////////////////////////////////////////////////////////////////////////// +// ISchemaValidator + +class ISchemaValidator { +public: + virtual ~ISchemaValidator() {} + virtual bool IsValid() const = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +// ISchemaStateFactory + +template +class ISchemaStateFactory { +public: + virtual ~ISchemaStateFactory() {} + virtual ISchemaValidator* CreateSchemaValidator(const SchemaType&) = 0; + virtual void DestroySchemaValidator(ISchemaValidator* validator) = 0; + virtual void* CreateHasher() = 0; + virtual uint64_t GetHashCode(void* hasher) = 0; + virtual void DestroryHasher(void* hasher) = 0; + virtual void* MallocState(size_t size) = 0; + virtual void FreeState(void* p) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +// Hasher + +// For comparison of compound value +template +class Hasher { +public: + typedef typename Encoding::Ch Ch; + + Hasher(Allocator* allocator = 0, size_t stackCapacity = kDefaultSize) : stack_(allocator, stackCapacity) {} + + bool Null() { return WriteType(kNullType); } + bool Bool(bool b) { return WriteType(b ? kTrueType : kFalseType); } + bool Int(int i) { Number n; n.u.i = i; n.d = static_cast(i); return WriteNumber(n); } + bool Uint(unsigned u) { Number n; n.u.u = u; n.d = static_cast(u); return WriteNumber(n); } + bool Int64(int64_t i) { Number n; n.u.i = i; n.d = static_cast(i); return WriteNumber(n); } + bool Uint64(uint64_t u) { Number n; n.u.u = u; n.d = static_cast(u); return WriteNumber(n); } + bool Double(double d) { + Number n; + if (d < 0) n.u.i = static_cast(d); + else n.u.u = static_cast(d); + n.d = d; + return WriteNumber(n); + } + + bool RawNumber(const Ch* str, SizeType len, bool) { + WriteBuffer(kNumberType, str, len * sizeof(Ch)); + return true; + } + + bool String(const Ch* str, SizeType len, bool) { + WriteBuffer(kStringType, str, len * sizeof(Ch)); + return true; + } + + bool StartObject() { return true; } + bool Key(const Ch* str, SizeType len, bool copy) { return String(str, len, copy); } + bool EndObject(SizeType memberCount) { + uint64_t h = Hash(0, kObjectType); + uint64_t* kv = stack_.template Pop(memberCount * 2); + for (SizeType i = 0; i < memberCount; i++) + h ^= Hash(kv[i * 2], kv[i * 2 + 1]); // Use xor to achieve member order insensitive + *stack_.template Push() = h; + return true; + } + + bool StartArray() { return true; } + bool EndArray(SizeType elementCount) { + uint64_t h = Hash(0, kArrayType); + uint64_t* e = stack_.template Pop(elementCount); + for (SizeType i = 0; i < elementCount; i++) + h = Hash(h, e[i]); // Use hash to achieve element order sensitive + *stack_.template Push() = h; + return true; + } + + bool IsValid() const { return stack_.GetSize() == sizeof(uint64_t); } + + uint64_t GetHashCode() const { + RAPIDJSON_ASSERT(IsValid()); + return *stack_.template Top(); + } + +private: + static const size_t kDefaultSize = 256; + struct Number { + union U { + uint64_t u; + int64_t i; + }u; + double d; + }; + + bool WriteType(Type type) { return WriteBuffer(type, 0, 0); } + + bool WriteNumber(const Number& n) { return WriteBuffer(kNumberType, &n, sizeof(n)); } + + bool WriteBuffer(Type type, const void* data, size_t len) { + // FNV-1a from http://isthe.com/chongo/tech/comp/fnv/ + uint64_t h = Hash(RAPIDJSON_UINT64_C2(0x84222325, 0xcbf29ce4), type); + const unsigned char* d = static_cast(data); + for (size_t i = 0; i < len; i++) + h = Hash(h, d[i]); + *stack_.template Push() = h; + return true; + } + + static uint64_t Hash(uint64_t h, uint64_t d) { + static const uint64_t kPrime = RAPIDJSON_UINT64_C2(0x00000100, 0x000001b3); + h ^= d; + h *= kPrime; + return h; + } + + Stack stack_; +}; + +/////////////////////////////////////////////////////////////////////////////// +// SchemaValidationContext + +template +struct SchemaValidationContext { + typedef Schema SchemaType; + typedef ISchemaStateFactory SchemaValidatorFactoryType; + typedef typename SchemaType::ValueType ValueType; + typedef typename ValueType::Ch Ch; + + enum PatternValidatorType { + kPatternValidatorOnly, + kPatternValidatorWithProperty, + kPatternValidatorWithAdditionalProperty + }; + + SchemaValidationContext(SchemaValidatorFactoryType& f, const SchemaType* s) : + factory(f), + schema(s), + valueSchema(), + invalidKeyword(), + hasher(), + arrayElementHashCodes(), + validators(), + validatorCount(), + patternPropertiesValidators(), + patternPropertiesValidatorCount(), + patternPropertiesSchemas(), + patternPropertiesSchemaCount(), + valuePatternValidatorType(kPatternValidatorOnly), + propertyExist(), + inArray(false), + valueUniqueness(false), + arrayUniqueness(false) + { + } + + ~SchemaValidationContext() { + if (hasher) + factory.DestroryHasher(hasher); + if (validators) { + for (SizeType i = 0; i < validatorCount; i++) + factory.DestroySchemaValidator(validators[i]); + factory.FreeState(validators); + } + if (patternPropertiesValidators) { + for (SizeType i = 0; i < patternPropertiesValidatorCount; i++) + factory.DestroySchemaValidator(patternPropertiesValidators[i]); + factory.FreeState(patternPropertiesValidators); + } + if (patternPropertiesSchemas) + factory.FreeState(patternPropertiesSchemas); + if (propertyExist) + factory.FreeState(propertyExist); + } + + SchemaValidatorFactoryType& factory; + const SchemaType* schema; + const SchemaType* valueSchema; + const Ch* invalidKeyword; + void* hasher; // Only validator access + void* arrayElementHashCodes; // Only validator access this + ISchemaValidator** validators; + SizeType validatorCount; + ISchemaValidator** patternPropertiesValidators; + SizeType patternPropertiesValidatorCount; + const SchemaType** patternPropertiesSchemas; + SizeType patternPropertiesSchemaCount; + PatternValidatorType valuePatternValidatorType; + PatternValidatorType objectPatternValidatorType; + SizeType arrayElementIndex; + bool* propertyExist; + bool inArray; + bool valueUniqueness; + bool arrayUniqueness; +}; + +/////////////////////////////////////////////////////////////////////////////// +// Schema + +template +class Schema { +public: + typedef typename SchemaDocumentType::ValueType ValueType; + typedef typename SchemaDocumentType::AllocatorType AllocatorType; + typedef typename SchemaDocumentType::PointerType PointerType; + typedef typename ValueType::EncodingType EncodingType; + typedef typename EncodingType::Ch Ch; + typedef SchemaValidationContext Context; + typedef Schema SchemaType; + typedef GenericValue SValue; + friend class GenericSchemaDocument; + + Schema(SchemaDocumentType* schemaDocument, const PointerType& p, const ValueType& value, const ValueType& document, AllocatorType* allocator) : + allocator_(allocator), + enum_(), + enumCount_(), + not_(), + type_((1 << kTotalSchemaType) - 1), // typeless + validatorCount_(), + properties_(), + additionalPropertiesSchema_(), + patternProperties_(), + patternPropertyCount_(), + propertyCount_(), + minProperties_(), + maxProperties_(SizeType(~0)), + additionalProperties_(true), + hasDependencies_(), + hasRequired_(), + hasSchemaDependencies_(), + additionalItemsSchema_(), + itemsList_(), + itemsTuple_(), + itemsTupleCount_(), + minItems_(), + maxItems_(SizeType(~0)), + additionalItems_(true), + uniqueItems_(false), + pattern_(), + minLength_(0), + maxLength_(~SizeType(0)), + exclusiveMinimum_(false), + exclusiveMaximum_(false) + { + typedef typename SchemaDocumentType::ValueType ValueType; + typedef typename ValueType::ConstValueIterator ConstValueIterator; + typedef typename ValueType::ConstMemberIterator ConstMemberIterator; + + if (!value.IsObject()) + return; + + if (const ValueType* v = GetMember(value, GetTypeString())) { + type_ = 0; + if (v->IsString()) + AddType(*v); + else if (v->IsArray()) + for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr) + AddType(*itr); + } + + if (const ValueType* v = GetMember(value, GetEnumString())) + if (v->IsArray() && v->Size() > 0) { + enum_ = static_cast(allocator_->Malloc(sizeof(uint64_t) * v->Size())); + for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr) { + typedef Hasher > EnumHasherType; + char buffer[256 + 24]; + MemoryPoolAllocator<> hasherAllocator(buffer, sizeof(buffer)); + EnumHasherType h(&hasherAllocator, 256); + itr->Accept(h); + enum_[enumCount_++] = h.GetHashCode(); + } + } + + if (schemaDocument) { + AssignIfExist(allOf_, *schemaDocument, p, value, GetAllOfString(), document); + AssignIfExist(anyOf_, *schemaDocument, p, value, GetAnyOfString(), document); + AssignIfExist(oneOf_, *schemaDocument, p, value, GetOneOfString(), document); + } + + if (const ValueType* v = GetMember(value, GetNotString())) { + schemaDocument->CreateSchema(¬_, p.Append(GetNotString(), allocator_), *v, document); + notValidatorIndex_ = validatorCount_; + validatorCount_++; + } + + // Object + + const ValueType* properties = GetMember(value, GetPropertiesString()); + const ValueType* required = GetMember(value, GetRequiredString()); + const ValueType* dependencies = GetMember(value, GetDependenciesString()); + { + // Gather properties from properties/required/dependencies + SValue allProperties(kArrayType); + + if (properties && properties->IsObject()) + for (ConstMemberIterator itr = properties->MemberBegin(); itr != properties->MemberEnd(); ++itr) + AddUniqueElement(allProperties, itr->name); + + if (required && required->IsArray()) + for (ConstValueIterator itr = required->Begin(); itr != required->End(); ++itr) + if (itr->IsString()) + AddUniqueElement(allProperties, *itr); + + if (dependencies && dependencies->IsObject()) + for (ConstMemberIterator itr = dependencies->MemberBegin(); itr != dependencies->MemberEnd(); ++itr) { + AddUniqueElement(allProperties, itr->name); + if (itr->value.IsArray()) + for (ConstValueIterator i = itr->value.Begin(); i != itr->value.End(); ++i) + if (i->IsString()) + AddUniqueElement(allProperties, *i); + } + + if (allProperties.Size() > 0) { + propertyCount_ = allProperties.Size(); + properties_ = static_cast(allocator_->Malloc(sizeof(Property) * propertyCount_)); + for (SizeType i = 0; i < propertyCount_; i++) { + new (&properties_[i]) Property(); + properties_[i].name = allProperties[i]; + properties_[i].schema = GetTypeless(); + } + } + } + + if (properties && properties->IsObject()) { + PointerType q = p.Append(GetPropertiesString(), allocator_); + for (ConstMemberIterator itr = properties->MemberBegin(); itr != properties->MemberEnd(); ++itr) { + SizeType index; + if (FindPropertyIndex(itr->name, &index)) + schemaDocument->CreateSchema(&properties_[index].schema, q.Append(itr->name, allocator_), itr->value, document); + } + } + + if (const ValueType* v = GetMember(value, GetPatternPropertiesString())) { + PointerType q = p.Append(GetPatternPropertiesString(), allocator_); + patternProperties_ = static_cast(allocator_->Malloc(sizeof(PatternProperty) * v->MemberCount())); + patternPropertyCount_ = 0; + + for (ConstMemberIterator itr = v->MemberBegin(); itr != v->MemberEnd(); ++itr) { + new (&patternProperties_[patternPropertyCount_]) PatternProperty(); + patternProperties_[patternPropertyCount_].pattern = CreatePattern(itr->name); + schemaDocument->CreateSchema(&patternProperties_[patternPropertyCount_].schema, q.Append(itr->name, allocator_), itr->value, document); + patternPropertyCount_++; + } + } + + if (required && required->IsArray()) + for (ConstValueIterator itr = required->Begin(); itr != required->End(); ++itr) + if (itr->IsString()) { + SizeType index; + if (FindPropertyIndex(*itr, &index)) { + properties_[index].required = true; + hasRequired_ = true; + } + } + + if (dependencies && dependencies->IsObject()) { + PointerType q = p.Append(GetDependenciesString(), allocator_); + hasDependencies_ = true; + for (ConstMemberIterator itr = dependencies->MemberBegin(); itr != dependencies->MemberEnd(); ++itr) { + SizeType sourceIndex; + if (FindPropertyIndex(itr->name, &sourceIndex)) { + if (itr->value.IsArray()) { + properties_[sourceIndex].dependencies = static_cast(allocator_->Malloc(sizeof(bool) * propertyCount_)); + std::memset(properties_[sourceIndex].dependencies, 0, sizeof(bool)* propertyCount_); + for (ConstValueIterator targetItr = itr->value.Begin(); targetItr != itr->value.End(); ++targetItr) { + SizeType targetIndex; + if (FindPropertyIndex(*targetItr, &targetIndex)) + properties_[sourceIndex].dependencies[targetIndex] = true; + } + } + else if (itr->value.IsObject()) { + hasSchemaDependencies_ = true; + schemaDocument->CreateSchema(&properties_[sourceIndex].dependenciesSchema, q.Append(itr->name, allocator_), itr->value, document); + properties_[sourceIndex].dependenciesValidatorIndex = validatorCount_; + validatorCount_++; + } + } + } + } + + if (const ValueType* v = GetMember(value, GetAdditionalPropertiesString())) { + if (v->IsBool()) + additionalProperties_ = v->GetBool(); + else if (v->IsObject()) + schemaDocument->CreateSchema(&additionalPropertiesSchema_, p.Append(GetAdditionalPropertiesString(), allocator_), *v, document); + } + + AssignIfExist(minProperties_, value, GetMinPropertiesString()); + AssignIfExist(maxProperties_, value, GetMaxPropertiesString()); + + // Array + if (const ValueType* v = GetMember(value, GetItemsString())) { + PointerType q = p.Append(GetItemsString(), allocator_); + if (v->IsObject()) // List validation + schemaDocument->CreateSchema(&itemsList_, q, *v, document); + else if (v->IsArray()) { // Tuple validation + itemsTuple_ = static_cast(allocator_->Malloc(sizeof(const Schema*) * v->Size())); + SizeType index = 0; + for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr, index++) + schemaDocument->CreateSchema(&itemsTuple_[itemsTupleCount_++], q.Append(index, allocator_), *itr, document); + } + } + + AssignIfExist(minItems_, value, GetMinItemsString()); + AssignIfExist(maxItems_, value, GetMaxItemsString()); + + if (const ValueType* v = GetMember(value, GetAdditionalItemsString())) { + if (v->IsBool()) + additionalItems_ = v->GetBool(); + else if (v->IsObject()) + schemaDocument->CreateSchema(&additionalItemsSchema_, p.Append(GetAdditionalItemsString(), allocator_), *v, document); + } + + AssignIfExist(uniqueItems_, value, GetUniqueItemsString()); + + // String + AssignIfExist(minLength_, value, GetMinLengthString()); + AssignIfExist(maxLength_, value, GetMaxLengthString()); + + if (const ValueType* v = GetMember(value, GetPatternString())) + pattern_ = CreatePattern(*v); + + // Number + if (const ValueType* v = GetMember(value, GetMinimumString())) + if (v->IsNumber()) + minimum_.CopyFrom(*v, *allocator_); + + if (const ValueType* v = GetMember(value, GetMaximumString())) + if (v->IsNumber()) + maximum_.CopyFrom(*v, *allocator_); + + AssignIfExist(exclusiveMinimum_, value, GetExclusiveMinimumString()); + AssignIfExist(exclusiveMaximum_, value, GetExclusiveMaximumString()); + + if (const ValueType* v = GetMember(value, GetMultipleOfString())) + if (v->IsNumber() && v->GetDouble() > 0.0) + multipleOf_.CopyFrom(*v, *allocator_); + } + + ~Schema() { + if (allocator_) { + allocator_->Free(enum_); + } + if (properties_) { + for (SizeType i = 0; i < propertyCount_; i++) + properties_[i].~Property(); + AllocatorType::Free(properties_); + } + if (patternProperties_) { + for (SizeType i = 0; i < patternPropertyCount_; i++) + patternProperties_[i].~PatternProperty(); + AllocatorType::Free(patternProperties_); + } + AllocatorType::Free(itemsTuple_); +#if RAPIDJSON_SCHEMA_HAS_REGEX + if (pattern_) { + pattern_->~RegexType(); + allocator_->Free(pattern_); + } +#endif + } + + bool BeginValue(Context& context) const { + if (context.inArray) { + if (uniqueItems_) + context.valueUniqueness = true; + + if (itemsList_) + context.valueSchema = itemsList_; + else if (itemsTuple_) { + if (context.arrayElementIndex < itemsTupleCount_) + context.valueSchema = itemsTuple_[context.arrayElementIndex]; + else if (additionalItemsSchema_) + context.valueSchema = additionalItemsSchema_; + else if (additionalItems_) + context.valueSchema = GetTypeless(); + else + RAPIDJSON_INVALID_KEYWORD_RETURN(GetItemsString()); + } + else + context.valueSchema = GetTypeless(); + + context.arrayElementIndex++; + } + return true; + } + + RAPIDJSON_FORCEINLINE bool EndValue(Context& context) const { + if (context.patternPropertiesValidatorCount > 0) { + bool otherValid = false; + SizeType count = context.patternPropertiesValidatorCount; + if (context.objectPatternValidatorType != Context::kPatternValidatorOnly) + otherValid = context.patternPropertiesValidators[--count]->IsValid(); + + bool patternValid = true; + for (SizeType i = 0; i < count; i++) + if (!context.patternPropertiesValidators[i]->IsValid()) { + patternValid = false; + break; + } + + if (context.objectPatternValidatorType == Context::kPatternValidatorOnly) { + if (!patternValid) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetPatternPropertiesString()); + } + else if (context.objectPatternValidatorType == Context::kPatternValidatorWithProperty) { + if (!patternValid || !otherValid) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetPatternPropertiesString()); + } + else if (!patternValid && !otherValid) // kPatternValidatorWithAdditionalProperty) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetPatternPropertiesString()); + } + + if (enum_) { + const uint64_t h = context.factory.GetHashCode(context.hasher); + for (SizeType i = 0; i < enumCount_; i++) + if (enum_[i] == h) + goto foundEnum; + RAPIDJSON_INVALID_KEYWORD_RETURN(GetEnumString()); + foundEnum:; + } + + if (allOf_.schemas) + for (SizeType i = allOf_.begin; i < allOf_.begin + allOf_.count; i++) + if (!context.validators[i]->IsValid()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetAllOfString()); + + if (anyOf_.schemas) { + for (SizeType i = anyOf_.begin; i < anyOf_.begin + anyOf_.count; i++) + if (context.validators[i]->IsValid()) + goto foundAny; + RAPIDJSON_INVALID_KEYWORD_RETURN(GetAnyOfString()); + foundAny:; + } + + if (oneOf_.schemas) { + bool oneValid = false; + for (SizeType i = oneOf_.begin; i < oneOf_.begin + oneOf_.count; i++) + if (context.validators[i]->IsValid()) { + if (oneValid) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetOneOfString()); + else + oneValid = true; + } + if (!oneValid) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetOneOfString()); + } + + if (not_ && context.validators[notValidatorIndex_]->IsValid()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetNotString()); + + return true; + } + + bool Null(Context& context) const { + if (!(type_ & (1 << kNullSchemaType))) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString()); + return CreateParallelValidator(context); + } + + bool Bool(Context& context, bool) const { + if (!(type_ & (1 << kBooleanSchemaType))) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString()); + return CreateParallelValidator(context); + } + + bool Int(Context& context, int i) const { + if (!CheckInt(context, i)) + return false; + return CreateParallelValidator(context); + } + + bool Uint(Context& context, unsigned u) const { + if (!CheckUint(context, u)) + return false; + return CreateParallelValidator(context); + } + + bool Int64(Context& context, int64_t i) const { + if (!CheckInt(context, i)) + return false; + return CreateParallelValidator(context); + } + + bool Uint64(Context& context, uint64_t u) const { + if (!CheckUint(context, u)) + return false; + return CreateParallelValidator(context); + } + + bool Double(Context& context, double d) const { + if (!(type_ & (1 << kNumberSchemaType))) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString()); + + if (!minimum_.IsNull() && !CheckDoubleMinimum(context, d)) + return false; + + if (!maximum_.IsNull() && !CheckDoubleMaximum(context, d)) + return false; + + if (!multipleOf_.IsNull() && !CheckDoubleMultipleOf(context, d)) + return false; + + return CreateParallelValidator(context); + } + + bool String(Context& context, const Ch* str, SizeType length, bool) const { + if (!(type_ & (1 << kStringSchemaType))) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString()); + + if (minLength_ != 0 || maxLength_ != SizeType(~0)) { + SizeType count; + if (internal::CountStringCodePoint(str, length, &count)) { + if (count < minLength_) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMinLengthString()); + if (count > maxLength_) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMaxLengthString()); + } + } + + if (pattern_ && !IsPatternMatch(pattern_, str, length)) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetPatternString()); + + return CreateParallelValidator(context); + } + + bool StartObject(Context& context) const { + if (!(type_ & (1 << kObjectSchemaType))) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString()); + + if (hasDependencies_ || hasRequired_) { + context.propertyExist = static_cast(context.factory.MallocState(sizeof(bool) * propertyCount_)); + std::memset(context.propertyExist, 0, sizeof(bool) * propertyCount_); + } + + if (patternProperties_) { // pre-allocate schema array + SizeType count = patternPropertyCount_ + 1; // extra for valuePatternValidatorType + context.patternPropertiesSchemas = static_cast(context.factory.MallocState(sizeof(const SchemaType*) * count)); + context.patternPropertiesSchemaCount = 0; + std::memset(context.patternPropertiesSchemas, 0, sizeof(SchemaType*) * count); + } + + return CreateParallelValidator(context); + } + + bool Key(Context& context, const Ch* str, SizeType len, bool) const { + if (patternProperties_) { + context.patternPropertiesSchemaCount = 0; + for (SizeType i = 0; i < patternPropertyCount_; i++) + if (patternProperties_[i].pattern && IsPatternMatch(patternProperties_[i].pattern, str, len)) + context.patternPropertiesSchemas[context.patternPropertiesSchemaCount++] = patternProperties_[i].schema; + } + + SizeType index; + if (FindPropertyIndex(ValueType(str, len).Move(), &index)) { + if (context.patternPropertiesSchemaCount > 0) { + context.patternPropertiesSchemas[context.patternPropertiesSchemaCount++] = properties_[index].schema; + context.valueSchema = GetTypeless(); + context.valuePatternValidatorType = Context::kPatternValidatorWithProperty; + } + else + context.valueSchema = properties_[index].schema; + + if (context.propertyExist) + context.propertyExist[index] = true; + + return true; + } + + if (additionalPropertiesSchema_) { + if (additionalPropertiesSchema_ && context.patternPropertiesSchemaCount > 0) { + context.patternPropertiesSchemas[context.patternPropertiesSchemaCount++] = additionalPropertiesSchema_; + context.valueSchema = GetTypeless(); + context.valuePatternValidatorType = Context::kPatternValidatorWithAdditionalProperty; + } + else + context.valueSchema = additionalPropertiesSchema_; + return true; + } + else if (additionalProperties_) { + context.valueSchema = GetTypeless(); + return true; + } + + if (context.patternPropertiesSchemaCount == 0) // patternProperties are not additional properties + RAPIDJSON_INVALID_KEYWORD_RETURN(GetAdditionalPropertiesString()); + + return true; + } + + bool EndObject(Context& context, SizeType memberCount) const { + if (hasRequired_) + for (SizeType index = 0; index < propertyCount_; index++) + if (properties_[index].required) + if (!context.propertyExist[index]) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetRequiredString()); + + if (memberCount < minProperties_) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMinPropertiesString()); + + if (memberCount > maxProperties_) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMaxPropertiesString()); + + if (hasDependencies_) { + for (SizeType sourceIndex = 0; sourceIndex < propertyCount_; sourceIndex++) + if (context.propertyExist[sourceIndex]) { + if (properties_[sourceIndex].dependencies) { + for (SizeType targetIndex = 0; targetIndex < propertyCount_; targetIndex++) + if (properties_[sourceIndex].dependencies[targetIndex] && !context.propertyExist[targetIndex]) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetDependenciesString()); + } + else if (properties_[sourceIndex].dependenciesSchema) + if (!context.validators[properties_[sourceIndex].dependenciesValidatorIndex]->IsValid()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetDependenciesString()); + } + } + + return true; + } + + bool StartArray(Context& context) const { + if (!(type_ & (1 << kArraySchemaType))) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString()); + + context.arrayElementIndex = 0; + context.inArray = true; + + return CreateParallelValidator(context); + } + + bool EndArray(Context& context, SizeType elementCount) const { + context.inArray = false; + + if (elementCount < minItems_) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMinItemsString()); + + if (elementCount > maxItems_) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMaxItemsString()); + + return true; + } + + // Generate functions for string literal according to Ch +#define RAPIDJSON_STRING_(name, ...) \ + static const ValueType& Get##name##String() {\ + static const Ch s[] = { __VA_ARGS__, '\0' };\ + static const ValueType v(s, sizeof(s) / sizeof(Ch) - 1);\ + return v;\ + } + + RAPIDJSON_STRING_(Null, 'n', 'u', 'l', 'l') + RAPIDJSON_STRING_(Boolean, 'b', 'o', 'o', 'l', 'e', 'a', 'n') + RAPIDJSON_STRING_(Object, 'o', 'b', 'j', 'e', 'c', 't') + RAPIDJSON_STRING_(Array, 'a', 'r', 'r', 'a', 'y') + RAPIDJSON_STRING_(String, 's', 't', 'r', 'i', 'n', 'g') + RAPIDJSON_STRING_(Number, 'n', 'u', 'm', 'b', 'e', 'r') + RAPIDJSON_STRING_(Integer, 'i', 'n', 't', 'e', 'g', 'e', 'r') + RAPIDJSON_STRING_(Type, 't', 'y', 'p', 'e') + RAPIDJSON_STRING_(Enum, 'e', 'n', 'u', 'm') + RAPIDJSON_STRING_(AllOf, 'a', 'l', 'l', 'O', 'f') + RAPIDJSON_STRING_(AnyOf, 'a', 'n', 'y', 'O', 'f') + RAPIDJSON_STRING_(OneOf, 'o', 'n', 'e', 'O', 'f') + RAPIDJSON_STRING_(Not, 'n', 'o', 't') + RAPIDJSON_STRING_(Properties, 'p', 'r', 'o', 'p', 'e', 'r', 't', 'i', 'e', 's') + RAPIDJSON_STRING_(Required, 'r', 'e', 'q', 'u', 'i', 'r', 'e', 'd') + RAPIDJSON_STRING_(Dependencies, 'd', 'e', 'p', 'e', 'n', 'd', 'e', 'n', 'c', 'i', 'e', 's') + RAPIDJSON_STRING_(PatternProperties, 'p', 'a', 't', 't', 'e', 'r', 'n', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'i', 'e', 's') + RAPIDJSON_STRING_(AdditionalProperties, 'a', 'd', 'd', 'i', 't', 'i', 'o', 'n', 'a', 'l', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'i', 'e', 's') + RAPIDJSON_STRING_(MinProperties, 'm', 'i', 'n', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'i', 'e', 's') + RAPIDJSON_STRING_(MaxProperties, 'm', 'a', 'x', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'i', 'e', 's') + RAPIDJSON_STRING_(Items, 'i', 't', 'e', 'm', 's') + RAPIDJSON_STRING_(MinItems, 'm', 'i', 'n', 'I', 't', 'e', 'm', 's') + RAPIDJSON_STRING_(MaxItems, 'm', 'a', 'x', 'I', 't', 'e', 'm', 's') + RAPIDJSON_STRING_(AdditionalItems, 'a', 'd', 'd', 'i', 't', 'i', 'o', 'n', 'a', 'l', 'I', 't', 'e', 'm', 's') + RAPIDJSON_STRING_(UniqueItems, 'u', 'n', 'i', 'q', 'u', 'e', 'I', 't', 'e', 'm', 's') + RAPIDJSON_STRING_(MinLength, 'm', 'i', 'n', 'L', 'e', 'n', 'g', 't', 'h') + RAPIDJSON_STRING_(MaxLength, 'm', 'a', 'x', 'L', 'e', 'n', 'g', 't', 'h') + RAPIDJSON_STRING_(Pattern, 'p', 'a', 't', 't', 'e', 'r', 'n') + RAPIDJSON_STRING_(Minimum, 'm', 'i', 'n', 'i', 'm', 'u', 'm') + RAPIDJSON_STRING_(Maximum, 'm', 'a', 'x', 'i', 'm', 'u', 'm') + RAPIDJSON_STRING_(ExclusiveMinimum, 'e', 'x', 'c', 'l', 'u', 's', 'i', 'v', 'e', 'M', 'i', 'n', 'i', 'm', 'u', 'm') + RAPIDJSON_STRING_(ExclusiveMaximum, 'e', 'x', 'c', 'l', 'u', 's', 'i', 'v', 'e', 'M', 'a', 'x', 'i', 'm', 'u', 'm') + RAPIDJSON_STRING_(MultipleOf, 'm', 'u', 'l', 't', 'i', 'p', 'l', 'e', 'O', 'f') + +#undef RAPIDJSON_STRING_ + +private: + enum SchemaValueType { + kNullSchemaType, + kBooleanSchemaType, + kObjectSchemaType, + kArraySchemaType, + kStringSchemaType, + kNumberSchemaType, + kIntegerSchemaType, + kTotalSchemaType + }; + +#if RAPIDJSON_SCHEMA_USE_INTERNALREGEX + typedef internal::GenericRegex RegexType; +#elif RAPIDJSON_SCHEMA_USE_STDREGEX + typedef std::basic_regex RegexType; +#else + typedef char RegexType; +#endif + + struct SchemaArray { + SchemaArray() : schemas(), count() {} + ~SchemaArray() { AllocatorType::Free(schemas); } + const SchemaType** schemas; + SizeType begin; // begin index of context.validators + SizeType count; + }; + + static const SchemaType* GetTypeless() { + static SchemaType typeless(0, PointerType(), ValueType(kObjectType).Move(), ValueType(kObjectType).Move(), 0); + return &typeless; + } + + template + void AddUniqueElement(V1& a, const V2& v) { + for (typename V1::ConstValueIterator itr = a.Begin(); itr != a.End(); ++itr) + if (*itr == v) + return; + V1 c(v, *allocator_); + a.PushBack(c, *allocator_); + } + + static const ValueType* GetMember(const ValueType& value, const ValueType& name) { + typename ValueType::ConstMemberIterator itr = value.FindMember(name); + return itr != value.MemberEnd() ? &(itr->value) : 0; + } + + static void AssignIfExist(bool& out, const ValueType& value, const ValueType& name) { + if (const ValueType* v = GetMember(value, name)) + if (v->IsBool()) + out = v->GetBool(); + } + + static void AssignIfExist(SizeType& out, const ValueType& value, const ValueType& name) { + if (const ValueType* v = GetMember(value, name)) + if (v->IsUint64() && v->GetUint64() <= SizeType(~0)) + out = static_cast(v->GetUint64()); + } + + void AssignIfExist(SchemaArray& out, SchemaDocumentType& schemaDocument, const PointerType& p, const ValueType& value, const ValueType& name, const ValueType& document) { + if (const ValueType* v = GetMember(value, name)) { + if (v->IsArray() && v->Size() > 0) { + PointerType q = p.Append(name, allocator_); + out.count = v->Size(); + out.schemas = static_cast(allocator_->Malloc(out.count * sizeof(const Schema*))); + memset(out.schemas, 0, sizeof(Schema*)* out.count); + for (SizeType i = 0; i < out.count; i++) + schemaDocument.CreateSchema(&out.schemas[i], q.Append(i, allocator_), (*v)[i], document); + out.begin = validatorCount_; + validatorCount_ += out.count; + } + } + } + +#if RAPIDJSON_SCHEMA_USE_INTERNALREGEX + template + RegexType* CreatePattern(const ValueType& value) { + if (value.IsString()) { + RegexType* r = new (allocator_->Malloc(sizeof(RegexType))) RegexType(value.GetString()); + if (!r->IsValid()) { + r->~RegexType(); + AllocatorType::Free(r); + r = 0; + } + return r; + } + return 0; + } + + static bool IsPatternMatch(const RegexType* pattern, const Ch *str, SizeType) { + return pattern->Search(str); + } +#elif RAPIDJSON_SCHEMA_USE_STDREGEX + template + RegexType* CreatePattern(const ValueType& value) { + if (value.IsString()) + try { + return new (allocator_->Malloc(sizeof(RegexType))) RegexType(value.GetString(), std::size_t(value.GetStringLength()), std::regex_constants::ECMAScript); + } + catch (const std::regex_error&) { + } + return 0; + } + + static bool IsPatternMatch(const RegexType* pattern, const Ch *str, SizeType length) { + std::match_results r; + return std::regex_search(str, str + length, r, *pattern); + } +#else + template + RegexType* CreatePattern(const ValueType&) { return 0; } + + static bool IsPatternMatch(const RegexType*, const Ch *, SizeType) { return true; } +#endif // RAPIDJSON_SCHEMA_USE_STDREGEX + + void AddType(const ValueType& type) { + if (type == GetNullString() ) type_ |= 1 << kNullSchemaType; + else if (type == GetBooleanString()) type_ |= 1 << kBooleanSchemaType; + else if (type == GetObjectString() ) type_ |= 1 << kObjectSchemaType; + else if (type == GetArrayString() ) type_ |= 1 << kArraySchemaType; + else if (type == GetStringString() ) type_ |= 1 << kStringSchemaType; + else if (type == GetIntegerString()) type_ |= 1 << kIntegerSchemaType; + else if (type == GetNumberString() ) type_ |= (1 << kNumberSchemaType) | (1 << kIntegerSchemaType); + } + + bool CreateParallelValidator(Context& context) const { + if (enum_ || context.arrayUniqueness) + context.hasher = context.factory.CreateHasher(); + + if (validatorCount_) { + RAPIDJSON_ASSERT(context.validators == 0); + context.validators = static_cast(context.factory.MallocState(sizeof(ISchemaValidator*) * validatorCount_)); + context.validatorCount = validatorCount_; + + if (allOf_.schemas) + CreateSchemaValidators(context, allOf_); + + if (anyOf_.schemas) + CreateSchemaValidators(context, anyOf_); + + if (oneOf_.schemas) + CreateSchemaValidators(context, oneOf_); + + if (not_) + context.validators[notValidatorIndex_] = context.factory.CreateSchemaValidator(*not_); + + if (hasSchemaDependencies_) { + for (SizeType i = 0; i < propertyCount_; i++) + if (properties_[i].dependenciesSchema) + context.validators[properties_[i].dependenciesValidatorIndex] = context.factory.CreateSchemaValidator(*properties_[i].dependenciesSchema); + } + } + + return true; + } + + void CreateSchemaValidators(Context& context, const SchemaArray& schemas) const { + for (SizeType i = 0; i < schemas.count; i++) + context.validators[schemas.begin + i] = context.factory.CreateSchemaValidator(*schemas.schemas[i]); + } + + // O(n) + bool FindPropertyIndex(const ValueType& name, SizeType* outIndex) const { + SizeType len = name.GetStringLength(); + const Ch* str = name.GetString(); + for (SizeType index = 0; index < propertyCount_; index++) + if (properties_[index].name.GetStringLength() == len && + (std::memcmp(properties_[index].name.GetString(), str, sizeof(Ch) * len) == 0)) + { + *outIndex = index; + return true; + } + return false; + } + + bool CheckInt(Context& context, int64_t i) const { + if (!(type_ & ((1 << kIntegerSchemaType) | (1 << kNumberSchemaType)))) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString()); + + if (!minimum_.IsNull()) { + if (minimum_.IsInt64()) { + if (exclusiveMinimum_ ? i <= minimum_.GetInt64() : i < minimum_.GetInt64()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMinimumString()); + } + else if (minimum_.IsUint64()) { + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMinimumString()); // i <= max(int64_t) < minimum.GetUint64() + } + else if (!CheckDoubleMinimum(context, static_cast(i))) + return false; + } + + if (!maximum_.IsNull()) { + if (maximum_.IsInt64()) { + if (exclusiveMaximum_ ? i >= maximum_.GetInt64() : i > maximum_.GetInt64()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMaximumString()); + } + else if (maximum_.IsUint64()) + /* do nothing */; // i <= max(int64_t) < maximum_.GetUint64() + else if (!CheckDoubleMaximum(context, static_cast(i))) + return false; + } + + if (!multipleOf_.IsNull()) { + if (multipleOf_.IsUint64()) { + if (static_cast(i >= 0 ? i : -i) % multipleOf_.GetUint64() != 0) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMultipleOfString()); + } + else if (!CheckDoubleMultipleOf(context, static_cast(i))) + return false; + } + + return true; + } + + bool CheckUint(Context& context, uint64_t i) const { + if (!(type_ & ((1 << kIntegerSchemaType) | (1 << kNumberSchemaType)))) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString()); + + if (!minimum_.IsNull()) { + if (minimum_.IsUint64()) { + if (exclusiveMinimum_ ? i <= minimum_.GetUint64() : i < minimum_.GetUint64()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMinimumString()); + } + else if (minimum_.IsInt64()) + /* do nothing */; // i >= 0 > minimum.Getint64() + else if (!CheckDoubleMinimum(context, static_cast(i))) + return false; + } + + if (!maximum_.IsNull()) { + if (maximum_.IsUint64()) { + if (exclusiveMaximum_ ? i >= maximum_.GetUint64() : i > maximum_.GetUint64()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMaximumString()); + } + else if (maximum_.IsInt64()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMaximumString()); // i >= 0 > maximum_ + else if (!CheckDoubleMaximum(context, static_cast(i))) + return false; + } + + if (!multipleOf_.IsNull()) { + if (multipleOf_.IsUint64()) { + if (i % multipleOf_.GetUint64() != 0) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMultipleOfString()); + } + else if (!CheckDoubleMultipleOf(context, static_cast(i))) + return false; + } + + return true; + } + + bool CheckDoubleMinimum(Context& context, double d) const { + if (exclusiveMinimum_ ? d <= minimum_.GetDouble() : d < minimum_.GetDouble()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMinimumString()); + return true; + } + + bool CheckDoubleMaximum(Context& context, double d) const { + if (exclusiveMaximum_ ? d >= maximum_.GetDouble() : d > maximum_.GetDouble()) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMaximumString()); + return true; + } + + bool CheckDoubleMultipleOf(Context& context, double d) const { + double a = std::abs(d), b = std::abs(multipleOf_.GetDouble()); + double q = std::floor(a / b); + double r = a - q * b; + if (r > 0.0) + RAPIDJSON_INVALID_KEYWORD_RETURN(GetMultipleOfString()); + return true; + } + + struct Property { + Property() : schema(), dependenciesSchema(), dependenciesValidatorIndex(), dependencies(), required(false) {} + ~Property() { AllocatorType::Free(dependencies); } + SValue name; + const SchemaType* schema; + const SchemaType* dependenciesSchema; + SizeType dependenciesValidatorIndex; + bool* dependencies; + bool required; + }; + + struct PatternProperty { + PatternProperty() : schema(), pattern() {} + ~PatternProperty() { + if (pattern) { + pattern->~RegexType(); + AllocatorType::Free(pattern); + } + } + const SchemaType* schema; + RegexType* pattern; + }; + + AllocatorType* allocator_; + uint64_t* enum_; + SizeType enumCount_; + SchemaArray allOf_; + SchemaArray anyOf_; + SchemaArray oneOf_; + const SchemaType* not_; + unsigned type_; // bitmask of kSchemaType + SizeType validatorCount_; + SizeType notValidatorIndex_; + + Property* properties_; + const SchemaType* additionalPropertiesSchema_; + PatternProperty* patternProperties_; + SizeType patternPropertyCount_; + SizeType propertyCount_; + SizeType minProperties_; + SizeType maxProperties_; + bool additionalProperties_; + bool hasDependencies_; + bool hasRequired_; + bool hasSchemaDependencies_; + + const SchemaType* additionalItemsSchema_; + const SchemaType* itemsList_; + const SchemaType** itemsTuple_; + SizeType itemsTupleCount_; + SizeType minItems_; + SizeType maxItems_; + bool additionalItems_; + bool uniqueItems_; + + RegexType* pattern_; + SizeType minLength_; + SizeType maxLength_; + + SValue minimum_; + SValue maximum_; + SValue multipleOf_; + bool exclusiveMinimum_; + bool exclusiveMaximum_; +}; + +template +struct TokenHelper { + RAPIDJSON_FORCEINLINE static void AppendIndexToken(Stack& documentStack, SizeType index) { + *documentStack.template Push() = '/'; + char buffer[21]; + size_t length = static_cast((sizeof(SizeType) == 4 ? u32toa(index, buffer) : u64toa(index, buffer)) - buffer); + for (size_t i = 0; i < length; i++) + *documentStack.template Push() = buffer[i]; + } +}; + +// Partial specialized version for char to prevent buffer copying. +template +struct TokenHelper { + RAPIDJSON_FORCEINLINE static void AppendIndexToken(Stack& documentStack, SizeType index) { + if (sizeof(SizeType) == 4) { + char *buffer = documentStack.template Push(1 + 10); // '/' + uint + *buffer++ = '/'; + const char* end = internal::u32toa(index, buffer); + documentStack.template Pop(static_cast(10 - (end - buffer))); + } + else { + char *buffer = documentStack.template Push(1 + 20); // '/' + uint64 + *buffer++ = '/'; + const char* end = internal::u64toa(index, buffer); + documentStack.template Pop(static_cast(20 - (end - buffer))); + } + } +}; + +} // namespace internal + +/////////////////////////////////////////////////////////////////////////////// +// IGenericRemoteSchemaDocumentProvider + +template +class IGenericRemoteSchemaDocumentProvider { +public: + typedef typename SchemaDocumentType::Ch Ch; + + virtual ~IGenericRemoteSchemaDocumentProvider() {} + virtual const SchemaDocumentType* GetRemoteDocument(const Ch* uri, SizeType length) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +// GenericSchemaDocument + +//! JSON schema document. +/*! + A JSON schema document is a compiled version of a JSON schema. + It is basically a tree of internal::Schema. + + \note This is an immutable class (i.e. its instance cannot be modified after construction). + \tparam ValueT Type of JSON value (e.g. \c Value ), which also determine the encoding. + \tparam Allocator Allocator type for allocating memory of this document. +*/ +template +class GenericSchemaDocument { +public: + typedef ValueT ValueType; + typedef IGenericRemoteSchemaDocumentProvider IRemoteSchemaDocumentProviderType; + typedef Allocator AllocatorType; + typedef typename ValueType::EncodingType EncodingType; + typedef typename EncodingType::Ch Ch; + typedef internal::Schema SchemaType; + typedef GenericPointer PointerType; + friend class internal::Schema; + template + friend class GenericSchemaValidator; + + //! Constructor. + /*! + Compile a JSON document into schema document. + + \param document A JSON document as source. + \param remoteProvider An optional remote schema document provider for resolving remote reference. Can be null. + \param allocator An optional allocator instance for allocating memory. Can be null. + */ + explicit GenericSchemaDocument(const ValueType& document, IRemoteSchemaDocumentProviderType* remoteProvider = 0, Allocator* allocator = 0) : + remoteProvider_(remoteProvider), + allocator_(allocator), + ownAllocator_(), + root_(), + schemaMap_(allocator, kInitialSchemaMapSize), + schemaRef_(allocator, kInitialSchemaRefSize) + { + if (!allocator_) + ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); + + // Generate root schema, it will call CreateSchema() to create sub-schemas, + // And call AddRefSchema() if there are $ref. + CreateSchemaRecursive(&root_, PointerType(), document, document); + + // Resolve $ref + while (!schemaRef_.Empty()) { + SchemaRefEntry* refEntry = schemaRef_.template Pop(1); + if (const SchemaType* s = GetSchema(refEntry->target)) { + if (refEntry->schema) + *refEntry->schema = s; + + // Create entry in map if not exist + if (!GetSchema(refEntry->source)) { + new (schemaMap_.template Push()) SchemaEntry(refEntry->source, const_cast(s), false, allocator_); + } + } + refEntry->~SchemaRefEntry(); + } + + RAPIDJSON_ASSERT(root_ != 0); + + schemaRef_.ShrinkToFit(); // Deallocate all memory for ref + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + //! Move constructor in C++11 + GenericSchemaDocument(GenericSchemaDocument&& rhs) RAPIDJSON_NOEXCEPT : + remoteProvider_(rhs.remoteProvider_), + allocator_(rhs.allocator_), + ownAllocator_(rhs.ownAllocator_), + root_(rhs.root_), + schemaMap_(std::move(rhs.schemaMap_)), + schemaRef_(std::move(rhs.schemaRef_)) + { + rhs.remoteProvider_ = 0; + rhs.allocator_ = 0; + rhs.ownAllocator_ = 0; + } +#endif + + //! Destructor + ~GenericSchemaDocument() { + while (!schemaMap_.Empty()) + schemaMap_.template Pop(1)->~SchemaEntry(); + + RAPIDJSON_DELETE(ownAllocator_); + } + + //! Get the root schema. + const SchemaType& GetRoot() const { return *root_; } + +private: + //! Prohibit copying + GenericSchemaDocument(const GenericSchemaDocument&); + //! Prohibit assignment + GenericSchemaDocument& operator=(const GenericSchemaDocument&); + + struct SchemaRefEntry { + SchemaRefEntry(const PointerType& s, const PointerType& t, const SchemaType** outSchema, Allocator *allocator) : source(s, allocator), target(t, allocator), schema(outSchema) {} + PointerType source; + PointerType target; + const SchemaType** schema; + }; + + struct SchemaEntry { + SchemaEntry(const PointerType& p, SchemaType* s, bool o, Allocator* allocator) : pointer(p, allocator), schema(s), owned(o) {} + ~SchemaEntry() { + if (owned) { + schema->~SchemaType(); + Allocator::Free(schema); + } + } + PointerType pointer; + SchemaType* schema; + bool owned; + }; + + void CreateSchemaRecursive(const SchemaType** schema, const PointerType& pointer, const ValueType& v, const ValueType& document) { + if (schema) + *schema = SchemaType::GetTypeless(); + + if (v.GetType() == kObjectType) { + const SchemaType* s = GetSchema(pointer); + if (!s) + CreateSchema(schema, pointer, v, document); + + for (typename ValueType::ConstMemberIterator itr = v.MemberBegin(); itr != v.MemberEnd(); ++itr) + CreateSchemaRecursive(0, pointer.Append(itr->name, allocator_), itr->value, document); + } + else if (v.GetType() == kArrayType) + for (SizeType i = 0; i < v.Size(); i++) + CreateSchemaRecursive(0, pointer.Append(i, allocator_), v[i], document); + } + + void CreateSchema(const SchemaType** schema, const PointerType& pointer, const ValueType& v, const ValueType& document) { + RAPIDJSON_ASSERT(pointer.IsValid()); + if (v.IsObject()) { + if (!HandleRefSchema(pointer, schema, v, document)) { + SchemaType* s = new (allocator_->Malloc(sizeof(SchemaType))) SchemaType(this, pointer, v, document, allocator_); + new (schemaMap_.template Push()) SchemaEntry(pointer, s, true, allocator_); + if (schema) + *schema = s; + } + } + } + + bool HandleRefSchema(const PointerType& source, const SchemaType** schema, const ValueType& v, const ValueType& document) { + static const Ch kRefString[] = { '$', 'r', 'e', 'f', '\0' }; + static const ValueType kRefValue(kRefString, 4); + + typename ValueType::ConstMemberIterator itr = v.FindMember(kRefValue); + if (itr == v.MemberEnd()) + return false; + + if (itr->value.IsString()) { + SizeType len = itr->value.GetStringLength(); + if (len > 0) { + const Ch* s = itr->value.GetString(); + SizeType i = 0; + while (i < len && s[i] != '#') // Find the first # + i++; + + if (i > 0) { // Remote reference, resolve immediately + if (remoteProvider_) { + if (const GenericSchemaDocument* remoteDocument = remoteProvider_->GetRemoteDocument(s, i - 1)) { + PointerType pointer(&s[i], len - i, allocator_); + if (pointer.IsValid()) { + if (const SchemaType* sc = remoteDocument->GetSchema(pointer)) { + if (schema) + *schema = sc; + return true; + } + } + } + } + } + else if (s[i] == '#') { // Local reference, defer resolution + PointerType pointer(&s[i], len - i, allocator_); + if (pointer.IsValid()) { + if (const ValueType* nv = pointer.Get(document)) + if (HandleRefSchema(source, schema, *nv, document)) + return true; + + new (schemaRef_.template Push()) SchemaRefEntry(source, pointer, schema, allocator_); + return true; + } + } + } + } + return false; + } + + const SchemaType* GetSchema(const PointerType& pointer) const { + for (const SchemaEntry* target = schemaMap_.template Bottom(); target != schemaMap_.template End(); ++target) + if (pointer == target->pointer) + return target->schema; + return 0; + } + + PointerType GetPointer(const SchemaType* schema) const { + for (const SchemaEntry* target = schemaMap_.template Bottom(); target != schemaMap_.template End(); ++target) + if (schema == target->schema) + return target->pointer; + return PointerType(); + } + + static const size_t kInitialSchemaMapSize = 64; + static const size_t kInitialSchemaRefSize = 64; + + IRemoteSchemaDocumentProviderType* remoteProvider_; + Allocator *allocator_; + Allocator *ownAllocator_; + const SchemaType* root_; //!< Root schema. + internal::Stack schemaMap_; // Stores created Pointer -> Schemas + internal::Stack schemaRef_; // Stores Pointer from $ref and schema which holds the $ref +}; + +//! GenericSchemaDocument using Value type. +typedef GenericSchemaDocument SchemaDocument; +//! IGenericRemoteSchemaDocumentProvider using SchemaDocument. +typedef IGenericRemoteSchemaDocumentProvider IRemoteSchemaDocumentProvider; + +/////////////////////////////////////////////////////////////////////////////// +// GenericSchemaValidator + +//! JSON Schema Validator. +/*! + A SAX style JSON schema validator. + It uses a \c GenericSchemaDocument to validate SAX events. + It delegates the incoming SAX events to an output handler. + The default output handler does nothing. + It can be reused multiple times by calling \c Reset(). + + \tparam SchemaDocumentType Type of schema document. + \tparam OutputHandler Type of output handler. Default handler does nothing. + \tparam StateAllocator Allocator for storing the internal validation states. +*/ +template < + typename SchemaDocumentType, + typename OutputHandler = BaseReaderHandler, + typename StateAllocator = CrtAllocator> +class GenericSchemaValidator : + public internal::ISchemaStateFactory, + public internal::ISchemaValidator +{ +public: + typedef typename SchemaDocumentType::SchemaType SchemaType; + typedef typename SchemaDocumentType::PointerType PointerType; + typedef typename SchemaType::EncodingType EncodingType; + typedef typename EncodingType::Ch Ch; + + //! Constructor without output handler. + /*! + \param schemaDocument The schema document to conform to. + \param allocator Optional allocator for storing internal validation states. + \param schemaStackCapacity Optional initial capacity of schema path stack. + \param documentStackCapacity Optional initial capacity of document path stack. + */ + GenericSchemaValidator( + const SchemaDocumentType& schemaDocument, + StateAllocator* allocator = 0, + size_t schemaStackCapacity = kDefaultSchemaStackCapacity, + size_t documentStackCapacity = kDefaultDocumentStackCapacity) + : + schemaDocument_(&schemaDocument), + root_(schemaDocument.GetRoot()), + outputHandler_(GetNullHandler()), + stateAllocator_(allocator), + ownStateAllocator_(0), + schemaStack_(allocator, schemaStackCapacity), + documentStack_(allocator, documentStackCapacity), + valid_(true) +#if RAPIDJSON_SCHEMA_VERBOSE + , depth_(0) +#endif + { + } + + //! Constructor with output handler. + /*! + \param schemaDocument The schema document to conform to. + \param allocator Optional allocator for storing internal validation states. + \param schemaStackCapacity Optional initial capacity of schema path stack. + \param documentStackCapacity Optional initial capacity of document path stack. + */ + GenericSchemaValidator( + const SchemaDocumentType& schemaDocument, + OutputHandler& outputHandler, + StateAllocator* allocator = 0, + size_t schemaStackCapacity = kDefaultSchemaStackCapacity, + size_t documentStackCapacity = kDefaultDocumentStackCapacity) + : + schemaDocument_(&schemaDocument), + root_(schemaDocument.GetRoot()), + outputHandler_(outputHandler), + stateAllocator_(allocator), + ownStateAllocator_(0), + schemaStack_(allocator, schemaStackCapacity), + documentStack_(allocator, documentStackCapacity), + valid_(true) +#if RAPIDJSON_SCHEMA_VERBOSE + , depth_(0) +#endif + { + } + + //! Destructor. + ~GenericSchemaValidator() { + Reset(); + RAPIDJSON_DELETE(ownStateAllocator_); + } + + //! Reset the internal states. + void Reset() { + while (!schemaStack_.Empty()) + PopSchema(); + documentStack_.Clear(); + valid_ = true; + } + + //! Checks whether the current state is valid. + // Implementation of ISchemaValidator + virtual bool IsValid() const { return valid_; } + + //! Gets the JSON pointer pointed to the invalid schema. + PointerType GetInvalidSchemaPointer() const { + return schemaStack_.Empty() ? PointerType() : schemaDocument_->GetPointer(&CurrentSchema()); + } + + //! Gets the keyword of invalid schema. + const Ch* GetInvalidSchemaKeyword() const { + return schemaStack_.Empty() ? 0 : CurrentContext().invalidKeyword; + } + + //! Gets the JSON pointer pointed to the invalid value. + PointerType GetInvalidDocumentPointer() const { + return documentStack_.Empty() ? PointerType() : PointerType(documentStack_.template Bottom(), documentStack_.GetSize() / sizeof(Ch)); + } + +#if RAPIDJSON_SCHEMA_VERBOSE +#define RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_() \ +RAPIDJSON_MULTILINEMACRO_BEGIN\ + *documentStack_.template Push() = '\0';\ + documentStack_.template Pop(1);\ + internal::PrintInvalidDocument(documentStack_.template Bottom());\ +RAPIDJSON_MULTILINEMACRO_END +#else +#define RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_() +#endif + +#define RAPIDJSON_SCHEMA_HANDLE_BEGIN_(method, arg1)\ + if (!valid_) return false; \ + if (!BeginValue() || !CurrentSchema().method arg1) {\ + RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_();\ + return valid_ = false;\ + } + +#define RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(method, arg2)\ + for (Context* context = schemaStack_.template Bottom(); context != schemaStack_.template End(); context++) {\ + if (context->hasher)\ + static_cast(context->hasher)->method arg2;\ + if (context->validators)\ + for (SizeType i_ = 0; i_ < context->validatorCount; i_++)\ + static_cast(context->validators[i_])->method arg2;\ + if (context->patternPropertiesValidators)\ + for (SizeType i_ = 0; i_ < context->patternPropertiesValidatorCount; i_++)\ + static_cast(context->patternPropertiesValidators[i_])->method arg2;\ + } + +#define RAPIDJSON_SCHEMA_HANDLE_END_(method, arg2)\ + return valid_ = EndValue() && outputHandler_.method arg2 + +#define RAPIDJSON_SCHEMA_HANDLE_VALUE_(method, arg1, arg2) \ + RAPIDJSON_SCHEMA_HANDLE_BEGIN_ (method, arg1);\ + RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(method, arg2);\ + RAPIDJSON_SCHEMA_HANDLE_END_ (method, arg2) + + bool Null() { RAPIDJSON_SCHEMA_HANDLE_VALUE_(Null, (CurrentContext() ), ( )); } + bool Bool(bool b) { RAPIDJSON_SCHEMA_HANDLE_VALUE_(Bool, (CurrentContext(), b), (b)); } + bool Int(int i) { RAPIDJSON_SCHEMA_HANDLE_VALUE_(Int, (CurrentContext(), i), (i)); } + bool Uint(unsigned u) { RAPIDJSON_SCHEMA_HANDLE_VALUE_(Uint, (CurrentContext(), u), (u)); } + bool Int64(int64_t i) { RAPIDJSON_SCHEMA_HANDLE_VALUE_(Int64, (CurrentContext(), i), (i)); } + bool Uint64(uint64_t u) { RAPIDJSON_SCHEMA_HANDLE_VALUE_(Uint64, (CurrentContext(), u), (u)); } + bool Double(double d) { RAPIDJSON_SCHEMA_HANDLE_VALUE_(Double, (CurrentContext(), d), (d)); } + bool RawNumber(const Ch* str, SizeType length, bool copy) + { RAPIDJSON_SCHEMA_HANDLE_VALUE_(String, (CurrentContext(), str, length, copy), (str, length, copy)); } + bool String(const Ch* str, SizeType length, bool copy) + { RAPIDJSON_SCHEMA_HANDLE_VALUE_(String, (CurrentContext(), str, length, copy), (str, length, copy)); } + + bool StartObject() { + RAPIDJSON_SCHEMA_HANDLE_BEGIN_(StartObject, (CurrentContext())); + RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(StartObject, ()); + return valid_ = outputHandler_.StartObject(); + } + + bool Key(const Ch* str, SizeType len, bool copy) { + if (!valid_) return false; + AppendToken(str, len); + if (!CurrentSchema().Key(CurrentContext(), str, len, copy)) return valid_ = false; + RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(Key, (str, len, copy)); + return valid_ = outputHandler_.Key(str, len, copy); + } + + bool EndObject(SizeType memberCount) { + if (!valid_) return false; + RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(EndObject, (memberCount)); + if (!CurrentSchema().EndObject(CurrentContext(), memberCount)) return valid_ = false; + RAPIDJSON_SCHEMA_HANDLE_END_(EndObject, (memberCount)); + } + + bool StartArray() { + RAPIDJSON_SCHEMA_HANDLE_BEGIN_(StartArray, (CurrentContext())); + RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(StartArray, ()); + return valid_ = outputHandler_.StartArray(); + } + + bool EndArray(SizeType elementCount) { + if (!valid_) return false; + RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(EndArray, (elementCount)); + if (!CurrentSchema().EndArray(CurrentContext(), elementCount)) return valid_ = false; + RAPIDJSON_SCHEMA_HANDLE_END_(EndArray, (elementCount)); + } + +#undef RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_ +#undef RAPIDJSON_SCHEMA_HANDLE_BEGIN_ +#undef RAPIDJSON_SCHEMA_HANDLE_PARALLEL_ +#undef RAPIDJSON_SCHEMA_HANDLE_VALUE_ + + // Implementation of ISchemaStateFactory + virtual ISchemaValidator* CreateSchemaValidator(const SchemaType& root) { + return new (GetStateAllocator().Malloc(sizeof(GenericSchemaValidator))) GenericSchemaValidator(*schemaDocument_, root, +#if RAPIDJSON_SCHEMA_VERBOSE + depth_ + 1, +#endif + &GetStateAllocator()); + } + + virtual void DestroySchemaValidator(ISchemaValidator* validator) { + GenericSchemaValidator* v = static_cast(validator); + v->~GenericSchemaValidator(); + StateAllocator::Free(v); + } + + virtual void* CreateHasher() { + return new (GetStateAllocator().Malloc(sizeof(HasherType))) HasherType(&GetStateAllocator()); + } + + virtual uint64_t GetHashCode(void* hasher) { + return static_cast(hasher)->GetHashCode(); + } + + virtual void DestroryHasher(void* hasher) { + HasherType* h = static_cast(hasher); + h->~HasherType(); + StateAllocator::Free(h); + } + + virtual void* MallocState(size_t size) { + return GetStateAllocator().Malloc(size); + } + + virtual void FreeState(void* p) { + return StateAllocator::Free(p); + } + +private: + typedef typename SchemaType::Context Context; + typedef GenericValue, StateAllocator> HashCodeArray; + typedef internal::Hasher HasherType; + + GenericSchemaValidator( + const SchemaDocumentType& schemaDocument, + const SchemaType& root, +#if RAPIDJSON_SCHEMA_VERBOSE + unsigned depth, +#endif + StateAllocator* allocator = 0, + size_t schemaStackCapacity = kDefaultSchemaStackCapacity, + size_t documentStackCapacity = kDefaultDocumentStackCapacity) + : + schemaDocument_(&schemaDocument), + root_(root), + outputHandler_(GetNullHandler()), + stateAllocator_(allocator), + ownStateAllocator_(0), + schemaStack_(allocator, schemaStackCapacity), + documentStack_(allocator, documentStackCapacity), + valid_(true) +#if RAPIDJSON_SCHEMA_VERBOSE + , depth_(depth) +#endif + { + } + + StateAllocator& GetStateAllocator() { + if (!stateAllocator_) + stateAllocator_ = ownStateAllocator_ = RAPIDJSON_NEW(StateAllocator()); + return *stateAllocator_; + } + + bool BeginValue() { + if (schemaStack_.Empty()) + PushSchema(root_); + else { + if (CurrentContext().inArray) + internal::TokenHelper, Ch>::AppendIndexToken(documentStack_, CurrentContext().arrayElementIndex); + + if (!CurrentSchema().BeginValue(CurrentContext())) + return false; + + SizeType count = CurrentContext().patternPropertiesSchemaCount; + const SchemaType** sa = CurrentContext().patternPropertiesSchemas; + typename Context::PatternValidatorType patternValidatorType = CurrentContext().valuePatternValidatorType; + bool valueUniqueness = CurrentContext().valueUniqueness; + if (CurrentContext().valueSchema) + PushSchema(*CurrentContext().valueSchema); + + if (count > 0) { + CurrentContext().objectPatternValidatorType = patternValidatorType; + ISchemaValidator**& va = CurrentContext().patternPropertiesValidators; + SizeType& validatorCount = CurrentContext().patternPropertiesValidatorCount; + va = static_cast(MallocState(sizeof(ISchemaValidator*) * count)); + for (SizeType i = 0; i < count; i++) + va[validatorCount++] = CreateSchemaValidator(*sa[i]); + } + + CurrentContext().arrayUniqueness = valueUniqueness; + } + return true; + } + + bool EndValue() { + if (!CurrentSchema().EndValue(CurrentContext())) + return false; + +#if RAPIDJSON_SCHEMA_VERBOSE + GenericStringBuffer sb; + schemaDocument_->GetPointer(&CurrentSchema()).Stringify(sb); + + *documentStack_.template Push() = '\0'; + documentStack_.template Pop(1); + internal::PrintValidatorPointers(depth_, sb.GetString(), documentStack_.template Bottom()); +#endif + + uint64_t h = CurrentContext().arrayUniqueness ? static_cast(CurrentContext().hasher)->GetHashCode() : 0; + + PopSchema(); + + if (!schemaStack_.Empty()) { + Context& context = CurrentContext(); + if (context.valueUniqueness) { + HashCodeArray* a = static_cast(context.arrayElementHashCodes); + if (!a) + CurrentContext().arrayElementHashCodes = a = new (GetStateAllocator().Malloc(sizeof(HashCodeArray))) HashCodeArray(kArrayType); + for (typename HashCodeArray::ConstValueIterator itr = a->Begin(); itr != a->End(); ++itr) + if (itr->GetUint64() == h) + RAPIDJSON_INVALID_KEYWORD_RETURN(SchemaType::GetUniqueItemsString()); + a->PushBack(h, GetStateAllocator()); + } + } + + // Remove the last token of document pointer + while (!documentStack_.Empty() && *documentStack_.template Pop(1) != '/') + ; + + return true; + } + + void AppendToken(const Ch* str, SizeType len) { + documentStack_.template Reserve(1 + len * 2); // worst case all characters are escaped as two characters + *documentStack_.template PushUnsafe() = '/'; + for (SizeType i = 0; i < len; i++) { + if (str[i] == '~') { + *documentStack_.template PushUnsafe() = '~'; + *documentStack_.template PushUnsafe() = '0'; + } + else if (str[i] == '/') { + *documentStack_.template PushUnsafe() = '~'; + *documentStack_.template PushUnsafe() = '1'; + } + else + *documentStack_.template PushUnsafe() = str[i]; + } + } + + RAPIDJSON_FORCEINLINE void PushSchema(const SchemaType& schema) { new (schemaStack_.template Push()) Context(*this, &schema); } + + RAPIDJSON_FORCEINLINE void PopSchema() { + Context* c = schemaStack_.template Pop(1); + if (HashCodeArray* a = static_cast(c->arrayElementHashCodes)) { + a->~HashCodeArray(); + StateAllocator::Free(a); + } + c->~Context(); + } + + const SchemaType& CurrentSchema() const { return *schemaStack_.template Top()->schema; } + Context& CurrentContext() { return *schemaStack_.template Top(); } + const Context& CurrentContext() const { return *schemaStack_.template Top(); } + + static OutputHandler& GetNullHandler() { + static OutputHandler nullHandler; + return nullHandler; + } + + static const size_t kDefaultSchemaStackCapacity = 1024; + static const size_t kDefaultDocumentStackCapacity = 256; + const SchemaDocumentType* schemaDocument_; + const SchemaType& root_; + OutputHandler& outputHandler_; + StateAllocator* stateAllocator_; + StateAllocator* ownStateAllocator_; + internal::Stack schemaStack_; //!< stack to store the current path of schema (BaseSchemaType *) + internal::Stack documentStack_; //!< stack to store the current path of validating document (Ch) + bool valid_; +#if RAPIDJSON_SCHEMA_VERBOSE + unsigned depth_; +#endif +}; + +typedef GenericSchemaValidator SchemaValidator; + +/////////////////////////////////////////////////////////////////////////////// +// SchemaValidatingReader + +//! A helper class for parsing with validation. +/*! + This helper class is a functor, designed as a parameter of \ref GenericDocument::Populate(). + + \tparam parseFlags Combination of \ref ParseFlag. + \tparam InputStream Type of input stream, implementing Stream concept. + \tparam SourceEncoding Encoding of the input stream. + \tparam SchemaDocumentType Type of schema document. + \tparam StackAllocator Allocator type for stack. +*/ +template < + unsigned parseFlags, + typename InputStream, + typename SourceEncoding, + typename SchemaDocumentType = SchemaDocument, + typename StackAllocator = CrtAllocator> +class SchemaValidatingReader { +public: + typedef typename SchemaDocumentType::PointerType PointerType; + typedef typename InputStream::Ch Ch; + + //! Constructor + /*! + \param is Input stream. + \param sd Schema document. + */ + SchemaValidatingReader(InputStream& is, const SchemaDocumentType& sd) : is_(is), sd_(sd), invalidSchemaKeyword_(), isValid_(true) {} + + template + bool operator()(Handler& handler) { + GenericReader reader; + GenericSchemaValidator validator(sd_, handler); + parseResult_ = reader.template Parse(is_, validator); + + isValid_ = validator.IsValid(); + if (isValid_) { + invalidSchemaPointer_ = PointerType(); + invalidSchemaKeyword_ = 0; + invalidDocumentPointer_ = PointerType(); + } + else { + invalidSchemaPointer_ = validator.GetInvalidSchemaPointer(); + invalidSchemaKeyword_ = validator.GetInvalidSchemaKeyword(); + invalidDocumentPointer_ = validator.GetInvalidDocumentPointer(); + } + + return parseResult_; + } + + const ParseResult& GetParseResult() const { return parseResult_; } + bool IsValid() const { return isValid_; } + const PointerType& GetInvalidSchemaPointer() const { return invalidSchemaPointer_; } + const Ch* GetInvalidSchemaKeyword() const { return invalidSchemaKeyword_; } + const PointerType& GetInvalidDocumentPointer() const { return invalidDocumentPointer_; } + +private: + InputStream& is_; + const SchemaDocumentType& sd_; + + ParseResult parseResult_; + PointerType invalidSchemaPointer_; + const Ch* invalidSchemaKeyword_; + PointerType invalidDocumentPointer_; + bool isValid_; +}; + +RAPIDJSON_NAMESPACE_END +RAPIDJSON_DIAG_POP + +#endif // RAPIDJSON_SCHEMA_H_ diff --git a/include/rapidjson/stream.h b/include/rapidjson/stream.h new file mode 100644 index 0000000..fef82c2 --- /dev/null +++ b/include/rapidjson/stream.h @@ -0,0 +1,179 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#include "rapidjson.h" + +#ifndef RAPIDJSON_STREAM_H_ +#define RAPIDJSON_STREAM_H_ + +#include "encodings.h" + +RAPIDJSON_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// Stream + +/*! \class rapidjson::Stream + \brief Concept for reading and writing characters. + + For read-only stream, no need to implement PutBegin(), Put(), Flush() and PutEnd(). + + For write-only stream, only need to implement Put() and Flush(). + +\code +concept Stream { + typename Ch; //!< Character type of the stream. + + //! Read the current character from stream without moving the read cursor. + Ch Peek() const; + + //! Read the current character from stream and moving the read cursor to next character. + Ch Take(); + + //! Get the current read cursor. + //! \return Number of characters read from start. + size_t Tell(); + + //! Begin writing operation at the current read pointer. + //! \return The begin writer pointer. + Ch* PutBegin(); + + //! Write a character. + void Put(Ch c); + + //! Flush the buffer. + void Flush(); + + //! End the writing operation. + //! \param begin The begin write pointer returned by PutBegin(). + //! \return Number of characters written. + size_t PutEnd(Ch* begin); +} +\endcode +*/ + +//! Provides additional information for stream. +/*! + By using traits pattern, this type provides a default configuration for stream. + For custom stream, this type can be specialized for other configuration. + See TEST(Reader, CustomStringStream) in readertest.cpp for example. +*/ +template +struct StreamTraits { + //! Whether to make local copy of stream for optimization during parsing. + /*! + By default, for safety, streams do not use local copy optimization. + Stream that can be copied fast should specialize this, like StreamTraits. + */ + enum { copyOptimization = 0 }; +}; + +//! Reserve n characters for writing to a stream. +template +inline void PutReserve(Stream& stream, size_t count) { + (void)stream; + (void)count; +} + +//! Write character to a stream, presuming buffer is reserved. +template +inline void PutUnsafe(Stream& stream, typename Stream::Ch c) { + stream.Put(c); +} + +//! Put N copies of a character to a stream. +template +inline void PutN(Stream& stream, Ch c, size_t n) { + PutReserve(stream, n); + for (size_t i = 0; i < n; i++) + PutUnsafe(stream, c); +} + +/////////////////////////////////////////////////////////////////////////////// +// StringStream + +//! Read-only string stream. +/*! \note implements Stream concept +*/ +template +struct GenericStringStream { + typedef typename Encoding::Ch Ch; + + GenericStringStream(const Ch *src) : src_(src), head_(src) {} + + Ch Peek() const { return *src_; } + Ch Take() { return *src_++; } + size_t Tell() const { return static_cast(src_ - head_); } + + Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } + void Put(Ch) { RAPIDJSON_ASSERT(false); } + void Flush() { RAPIDJSON_ASSERT(false); } + size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } + + const Ch* src_; //!< Current read position. + const Ch* head_; //!< Original head of the string. +}; + +template +struct StreamTraits > { + enum { copyOptimization = 1 }; +}; + +//! String stream with UTF8 encoding. +typedef GenericStringStream > StringStream; + +/////////////////////////////////////////////////////////////////////////////// +// InsituStringStream + +//! A read-write string stream. +/*! This string stream is particularly designed for in-situ parsing. + \note implements Stream concept +*/ +template +struct GenericInsituStringStream { + typedef typename Encoding::Ch Ch; + + GenericInsituStringStream(Ch *src) : src_(src), dst_(0), head_(src) {} + + // Read + Ch Peek() { return *src_; } + Ch Take() { return *src_++; } + size_t Tell() { return static_cast(src_ - head_); } + + // Write + void Put(Ch c) { RAPIDJSON_ASSERT(dst_ != 0); *dst_++ = c; } + + Ch* PutBegin() { return dst_ = src_; } + size_t PutEnd(Ch* begin) { return static_cast(dst_ - begin); } + void Flush() {} + + Ch* Push(size_t count) { Ch* begin = dst_; dst_ += count; return begin; } + void Pop(size_t count) { dst_ -= count; } + + Ch* src_; + Ch* dst_; + Ch* head_; +}; + +template +struct StreamTraits > { + enum { copyOptimization = 1 }; +}; + +//! Insitu string stream with UTF8 encoding. +typedef GenericInsituStringStream > InsituStringStream; + +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_STREAM_H_ diff --git a/include/rapidjson/stringbuffer.h b/include/rapidjson/stringbuffer.h new file mode 100644 index 0000000..78f34d2 --- /dev/null +++ b/include/rapidjson/stringbuffer.h @@ -0,0 +1,117 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_STRINGBUFFER_H_ +#define RAPIDJSON_STRINGBUFFER_H_ + +#include "stream.h" +#include "internal/stack.h" + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS +#include // std::move +#endif + +#include "internal/stack.h" + +#if defined(__clang__) +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(c++98-compat) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! Represents an in-memory output stream. +/*! + \tparam Encoding Encoding of the stream. + \tparam Allocator type for allocating memory buffer. + \note implements Stream concept +*/ +template +class GenericStringBuffer { +public: + typedef typename Encoding::Ch Ch; + + GenericStringBuffer(Allocator* allocator = 0, size_t capacity = kDefaultCapacity) : stack_(allocator, capacity) {} + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + GenericStringBuffer(GenericStringBuffer&& rhs) : stack_(std::move(rhs.stack_)) {} + GenericStringBuffer& operator=(GenericStringBuffer&& rhs) { + if (&rhs != this) + stack_ = std::move(rhs.stack_); + return *this; + } +#endif + + void Put(Ch c) { *stack_.template Push() = c; } + void PutUnsafe(Ch c) { *stack_.template PushUnsafe() = c; } + void Flush() {} + + void Clear() { stack_.Clear(); } + void ShrinkToFit() { + // Push and pop a null terminator. This is safe. + *stack_.template Push() = '\0'; + stack_.ShrinkToFit(); + stack_.template Pop(1); + } + + void Reserve(size_t count) { stack_.template Reserve(count); } + Ch* Push(size_t count) { return stack_.template Push(count); } + Ch* PushUnsafe(size_t count) { return stack_.template PushUnsafe(count); } + void Pop(size_t count) { stack_.template Pop(count); } + + const Ch* GetString() const { + // Push and pop a null terminator. This is safe. + *stack_.template Push() = '\0'; + stack_.template Pop(1); + + return stack_.template Bottom(); + } + + size_t GetSize() const { return stack_.GetSize(); } + + static const size_t kDefaultCapacity = 256; + mutable internal::Stack stack_; + +private: + // Prohibit copy constructor & assignment operator. + GenericStringBuffer(const GenericStringBuffer&); + GenericStringBuffer& operator=(const GenericStringBuffer&); +}; + +//! String buffer with UTF8 encoding +typedef GenericStringBuffer > StringBuffer; + +template +inline void PutReserve(GenericStringBuffer& stream, size_t count) { + stream.Reserve(count); +} + +template +inline void PutUnsafe(GenericStringBuffer& stream, typename Encoding::Ch c) { + stream.PutUnsafe(c); +} + +//! Implement specialized version of PutN() with memset() for better performance. +template<> +inline void PutN(GenericStringBuffer >& stream, char c, size_t n) { + std::memset(stream.stack_.Push(n), c, n * sizeof(c)); +} + +RAPIDJSON_NAMESPACE_END + +#if defined(__clang__) +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_STRINGBUFFER_H_ diff --git a/include/rapidjson/writer.h b/include/rapidjson/writer.h new file mode 100644 index 0000000..94f22dd --- /dev/null +++ b/include/rapidjson/writer.h @@ -0,0 +1,610 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_WRITER_H_ +#define RAPIDJSON_WRITER_H_ + +#include "stream.h" +#include "internal/stack.h" +#include "internal/strfunc.h" +#include "internal/dtoa.h" +#include "internal/itoa.h" +#include "stringbuffer.h" +#include // placement new + +#if defined(RAPIDJSON_SIMD) && defined(_MSC_VER) +#include +#pragma intrinsic(_BitScanForward) +#endif +#ifdef RAPIDJSON_SSE42 +#include +#elif defined(RAPIDJSON_SSE2) +#include +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +RAPIDJSON_DIAG_OFF(unreachable-code) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// WriteFlag + +/*! \def RAPIDJSON_WRITE_DEFAULT_FLAGS + \ingroup RAPIDJSON_CONFIG + \brief User-defined kWriteDefaultFlags definition. + + User can define this as any \c WriteFlag combinations. +*/ +#ifndef RAPIDJSON_WRITE_DEFAULT_FLAGS +#define RAPIDJSON_WRITE_DEFAULT_FLAGS kWriteNoFlags +#endif + +//! Combination of writeFlags +enum WriteFlag { + kWriteNoFlags = 0, //!< No flags are set. + kWriteValidateEncodingFlag = 1, //!< Validate encoding of JSON strings. + kWriteNanAndInfFlag = 2, //!< Allow writing of Infinity, -Infinity and NaN. + kWriteDefaultFlags = RAPIDJSON_WRITE_DEFAULT_FLAGS //!< Default write flags. Can be customized by defining RAPIDJSON_WRITE_DEFAULT_FLAGS +}; + +//! JSON writer +/*! Writer implements the concept Handler. + It generates JSON text by events to an output os. + + User may programmatically calls the functions of a writer to generate JSON text. + + On the other side, a writer can also be passed to objects that generates events, + + for example Reader::Parse() and Document::Accept(). + + \tparam OutputStream Type of output stream. + \tparam SourceEncoding Encoding of source string. + \tparam TargetEncoding Encoding of output stream. + \tparam StackAllocator Type of allocator for allocating memory of stack. + \note implements Handler concept +*/ +template, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags> +class Writer { +public: + typedef typename SourceEncoding::Ch Ch; + + static const int kDefaultMaxDecimalPlaces = 324; + + //! Constructor + /*! \param os Output stream. + \param stackAllocator User supplied allocator. If it is null, it will create a private one. + \param levelDepth Initial capacity of stack. + */ + explicit + Writer(OutputStream& os, StackAllocator* stackAllocator = 0, size_t levelDepth = kDefaultLevelDepth) : + os_(&os), level_stack_(stackAllocator, levelDepth * sizeof(Level)), maxDecimalPlaces_(kDefaultMaxDecimalPlaces), hasRoot_(false) {} + + explicit + Writer(StackAllocator* allocator = 0, size_t levelDepth = kDefaultLevelDepth) : + os_(0), level_stack_(allocator, levelDepth * sizeof(Level)), maxDecimalPlaces_(kDefaultMaxDecimalPlaces), hasRoot_(false) {} + + //! Reset the writer with a new stream. + /*! + This function reset the writer with a new stream and default settings, + in order to make a Writer object reusable for output multiple JSONs. + + \param os New output stream. + \code + Writer writer(os1); + writer.StartObject(); + // ... + writer.EndObject(); + + writer.Reset(os2); + writer.StartObject(); + // ... + writer.EndObject(); + \endcode + */ + void Reset(OutputStream& os) { + os_ = &os; + hasRoot_ = false; + level_stack_.Clear(); + } + + //! Checks whether the output is a complete JSON. + /*! + A complete JSON has a complete root object or array. + */ + bool IsComplete() const { + return hasRoot_ && level_stack_.Empty(); + } + + int GetMaxDecimalPlaces() const { + return maxDecimalPlaces_; + } + + //! Sets the maximum number of decimal places for double output. + /*! + This setting truncates the output with specified number of decimal places. + + For example, + + \code + writer.SetMaxDecimalPlaces(3); + writer.StartArray(); + writer.Double(0.12345); // "0.123" + writer.Double(0.0001); // "0.0" + writer.Double(1.234567890123456e30); // "1.234567890123456e30" (do not truncate significand for positive exponent) + writer.Double(1.23e-4); // "0.0" (do truncate significand for negative exponent) + writer.EndArray(); + \endcode + + The default setting does not truncate any decimal places. You can restore to this setting by calling + \code + writer.SetMaxDecimalPlaces(Writer::kDefaultMaxDecimalPlaces); + \endcode + */ + void SetMaxDecimalPlaces(int maxDecimalPlaces) { + maxDecimalPlaces_ = maxDecimalPlaces; + } + + /*!@name Implementation of Handler + \see Handler + */ + //@{ + + bool Null() { Prefix(kNullType); return EndValue(WriteNull()); } + bool Bool(bool b) { Prefix(b ? kTrueType : kFalseType); return EndValue(WriteBool(b)); } + bool Int(int i) { Prefix(kNumberType); return EndValue(WriteInt(i)); } + bool Uint(unsigned u) { Prefix(kNumberType); return EndValue(WriteUint(u)); } + bool Int64(int64_t i64) { Prefix(kNumberType); return EndValue(WriteInt64(i64)); } + bool Uint64(uint64_t u64) { Prefix(kNumberType); return EndValue(WriteUint64(u64)); } + + //! Writes the given \c double value to the stream + /*! + \param d The value to be written. + \return Whether it is succeed. + */ + bool Double(double d) { Prefix(kNumberType); return EndValue(WriteDouble(d)); } + + bool RawNumber(const Ch* str, SizeType length, bool copy = false) { + (void)copy; + Prefix(kNumberType); + return EndValue(WriteString(str, length)); + } + + bool String(const Ch* str, SizeType length, bool copy = false) { + (void)copy; + Prefix(kStringType); + return EndValue(WriteString(str, length)); + } + +#if RAPIDJSON_HAS_STDSTRING + bool String(const std::basic_string& str) { + return String(str.data(), SizeType(str.size())); + } +#endif + + bool StartObject() { + Prefix(kObjectType); + new (level_stack_.template Push()) Level(false); + return WriteStartObject(); + } + + bool Key(const Ch* str, SizeType length, bool copy = false) { return String(str, length, copy); } + + bool EndObject(SizeType memberCount = 0) { + (void)memberCount; + RAPIDJSON_ASSERT(level_stack_.GetSize() >= sizeof(Level)); + RAPIDJSON_ASSERT(!level_stack_.template Top()->inArray); + level_stack_.template Pop(1); + return EndValue(WriteEndObject()); + } + + bool StartArray() { + Prefix(kArrayType); + new (level_stack_.template Push()) Level(true); + return WriteStartArray(); + } + + bool EndArray(SizeType elementCount = 0) { + (void)elementCount; + RAPIDJSON_ASSERT(level_stack_.GetSize() >= sizeof(Level)); + RAPIDJSON_ASSERT(level_stack_.template Top()->inArray); + level_stack_.template Pop(1); + return EndValue(WriteEndArray()); + } + //@} + + /*! @name Convenience extensions */ + //@{ + + //! Simpler but slower overload. + bool String(const Ch* str) { return String(str, internal::StrLen(str)); } + bool Key(const Ch* str) { return Key(str, internal::StrLen(str)); } + + //@} + + //! Write a raw JSON value. + /*! + For user to write a stringified JSON as a value. + + \param json A well-formed JSON value. It should not contain null character within [0, length - 1] range. + \param length Length of the json. + \param type Type of the root of json. + */ + bool RawValue(const Ch* json, size_t length, Type type) { Prefix(type); return EndValue(WriteRawValue(json, length)); } + +protected: + //! Information for each nested level + struct Level { + Level(bool inArray_) : valueCount(0), inArray(inArray_) {} + size_t valueCount; //!< number of values in this level + bool inArray; //!< true if in array, otherwise in object + }; + + static const size_t kDefaultLevelDepth = 32; + + bool WriteNull() { + PutReserve(*os_, 4); + PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'u'); PutUnsafe(*os_, 'l'); PutUnsafe(*os_, 'l'); return true; + } + + bool WriteBool(bool b) { + if (b) { + PutReserve(*os_, 4); + PutUnsafe(*os_, 't'); PutUnsafe(*os_, 'r'); PutUnsafe(*os_, 'u'); PutUnsafe(*os_, 'e'); + } + else { + PutReserve(*os_, 5); + PutUnsafe(*os_, 'f'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'l'); PutUnsafe(*os_, 's'); PutUnsafe(*os_, 'e'); + } + return true; + } + + bool WriteInt(int i) { + char buffer[11]; + const char* end = internal::i32toa(i, buffer); + PutReserve(*os_, static_cast(end - buffer)); + for (const char* p = buffer; p != end; ++p) + PutUnsafe(*os_, static_cast(*p)); + return true; + } + + bool WriteUint(unsigned u) { + char buffer[10]; + const char* end = internal::u32toa(u, buffer); + PutReserve(*os_, static_cast(end - buffer)); + for (const char* p = buffer; p != end; ++p) + PutUnsafe(*os_, static_cast(*p)); + return true; + } + + bool WriteInt64(int64_t i64) { + char buffer[21]; + const char* end = internal::i64toa(i64, buffer); + PutReserve(*os_, static_cast(end - buffer)); + for (const char* p = buffer; p != end; ++p) + PutUnsafe(*os_, static_cast(*p)); + return true; + } + + bool WriteUint64(uint64_t u64) { + char buffer[20]; + char* end = internal::u64toa(u64, buffer); + PutReserve(*os_, static_cast(end - buffer)); + for (char* p = buffer; p != end; ++p) + PutUnsafe(*os_, static_cast(*p)); + return true; + } + + bool WriteDouble(double d) { + if (internal::Double(d).IsNanOrInf()) { + if (!(writeFlags & kWriteNanAndInfFlag)) + return false; + if (internal::Double(d).IsNan()) { + PutReserve(*os_, 3); + PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N'); + return true; + } + if (internal::Double(d).Sign()) { + PutReserve(*os_, 9); + PutUnsafe(*os_, '-'); + } + else + PutReserve(*os_, 8); + PutUnsafe(*os_, 'I'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'f'); + PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 't'); PutUnsafe(*os_, 'y'); + return true; + } + + char buffer[25]; + char* end = internal::dtoa(d, buffer, maxDecimalPlaces_); + PutReserve(*os_, static_cast(end - buffer)); + for (char* p = buffer; p != end; ++p) + PutUnsafe(*os_, static_cast(*p)); + return true; + } + + bool WriteString(const Ch* str, SizeType length) { + static const typename TargetEncoding::Ch hexDigits[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + static const char escape[256] = { +#define Z16 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + //0 1 2 3 4 5 6 7 8 9 A B C D E F + 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'b', 't', 'n', 'u', 'f', 'r', 'u', 'u', // 00 + 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', // 10 + 0, 0, '"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 + Z16, Z16, // 30~4F + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,'\\', 0, 0, 0, // 50 + Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16 // 60~FF +#undef Z16 + }; + + if (TargetEncoding::supportUnicode) + PutReserve(*os_, 2 + length * 6); // "\uxxxx..." + else + PutReserve(*os_, 2 + length * 12); // "\uxxxx\uyyyy..." + + PutUnsafe(*os_, '\"'); + GenericStringStream is(str); + while (ScanWriteUnescapedString(is, length)) { + const Ch c = is.Peek(); + if (!TargetEncoding::supportUnicode && static_cast(c) >= 0x80) { + // Unicode escaping + unsigned codepoint; + if (RAPIDJSON_UNLIKELY(!SourceEncoding::Decode(is, &codepoint))) + return false; + PutUnsafe(*os_, '\\'); + PutUnsafe(*os_, 'u'); + if (codepoint <= 0xD7FF || (codepoint >= 0xE000 && codepoint <= 0xFFFF)) { + PutUnsafe(*os_, hexDigits[(codepoint >> 12) & 15]); + PutUnsafe(*os_, hexDigits[(codepoint >> 8) & 15]); + PutUnsafe(*os_, hexDigits[(codepoint >> 4) & 15]); + PutUnsafe(*os_, hexDigits[(codepoint ) & 15]); + } + else { + RAPIDJSON_ASSERT(codepoint >= 0x010000 && codepoint <= 0x10FFFF); + // Surrogate pair + unsigned s = codepoint - 0x010000; + unsigned lead = (s >> 10) + 0xD800; + unsigned trail = (s & 0x3FF) + 0xDC00; + PutUnsafe(*os_, hexDigits[(lead >> 12) & 15]); + PutUnsafe(*os_, hexDigits[(lead >> 8) & 15]); + PutUnsafe(*os_, hexDigits[(lead >> 4) & 15]); + PutUnsafe(*os_, hexDigits[(lead ) & 15]); + PutUnsafe(*os_, '\\'); + PutUnsafe(*os_, 'u'); + PutUnsafe(*os_, hexDigits[(trail >> 12) & 15]); + PutUnsafe(*os_, hexDigits[(trail >> 8) & 15]); + PutUnsafe(*os_, hexDigits[(trail >> 4) & 15]); + PutUnsafe(*os_, hexDigits[(trail ) & 15]); + } + } + else if ((sizeof(Ch) == 1 || static_cast(c) < 256) && RAPIDJSON_UNLIKELY(escape[static_cast(c)])) { + is.Take(); + PutUnsafe(*os_, '\\'); + PutUnsafe(*os_, static_cast(escape[static_cast(c)])); + if (escape[static_cast(c)] == 'u') { + PutUnsafe(*os_, '0'); + PutUnsafe(*os_, '0'); + PutUnsafe(*os_, hexDigits[static_cast(c) >> 4]); + PutUnsafe(*os_, hexDigits[static_cast(c) & 0xF]); + } + } + else if (RAPIDJSON_UNLIKELY(!(writeFlags & kWriteValidateEncodingFlag ? + Transcoder::Validate(is, *os_) : + Transcoder::TranscodeUnsafe(is, *os_)))) + return false; + } + PutUnsafe(*os_, '\"'); + return true; + } + + bool ScanWriteUnescapedString(GenericStringStream& is, size_t length) { + return RAPIDJSON_LIKELY(is.Tell() < length); + } + + bool WriteStartObject() { os_->Put('{'); return true; } + bool WriteEndObject() { os_->Put('}'); return true; } + bool WriteStartArray() { os_->Put('['); return true; } + bool WriteEndArray() { os_->Put(']'); return true; } + + bool WriteRawValue(const Ch* json, size_t length) { + PutReserve(*os_, length); + for (size_t i = 0; i < length; i++) { + RAPIDJSON_ASSERT(json[i] != '\0'); + PutUnsafe(*os_, json[i]); + } + return true; + } + + void Prefix(Type type) { + (void)type; + if (RAPIDJSON_LIKELY(level_stack_.GetSize() != 0)) { // this value is not at root + Level* level = level_stack_.template Top(); + if (level->valueCount > 0) { + if (level->inArray) + os_->Put(','); // add comma if it is not the first element in array + else // in object + os_->Put((level->valueCount % 2 == 0) ? ',' : ':'); + } + if (!level->inArray && level->valueCount % 2 == 0) + RAPIDJSON_ASSERT(type == kStringType); // if it's in object, then even number should be a name + level->valueCount++; + } + else { + RAPIDJSON_ASSERT(!hasRoot_); // Should only has one and only one root. + hasRoot_ = true; + } + } + + // Flush the value if it is the top level one. + bool EndValue(bool ret) { + if (RAPIDJSON_UNLIKELY(level_stack_.Empty())) // end of json text + os_->Flush(); + return ret; + } + + OutputStream* os_; + internal::Stack level_stack_; + int maxDecimalPlaces_; + bool hasRoot_; + +private: + // Prohibit copy constructor & assignment operator. + Writer(const Writer&); + Writer& operator=(const Writer&); +}; + +// Full specialization for StringStream to prevent memory copying + +template<> +inline bool Writer::WriteInt(int i) { + char *buffer = os_->Push(11); + const char* end = internal::i32toa(i, buffer); + os_->Pop(static_cast(11 - (end - buffer))); + return true; +} + +template<> +inline bool Writer::WriteUint(unsigned u) { + char *buffer = os_->Push(10); + const char* end = internal::u32toa(u, buffer); + os_->Pop(static_cast(10 - (end - buffer))); + return true; +} + +template<> +inline bool Writer::WriteInt64(int64_t i64) { + char *buffer = os_->Push(21); + const char* end = internal::i64toa(i64, buffer); + os_->Pop(static_cast(21 - (end - buffer))); + return true; +} + +template<> +inline bool Writer::WriteUint64(uint64_t u) { + char *buffer = os_->Push(20); + const char* end = internal::u64toa(u, buffer); + os_->Pop(static_cast(20 - (end - buffer))); + return true; +} + +template<> +inline bool Writer::WriteDouble(double d) { + if (internal::Double(d).IsNanOrInf()) { + // Note: This code path can only be reached if (RAPIDJSON_WRITE_DEFAULT_FLAGS & kWriteNanAndInfFlag). + if (!(kWriteDefaultFlags & kWriteNanAndInfFlag)) + return false; + if (internal::Double(d).IsNan()) { + PutReserve(*os_, 3); + PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N'); + return true; + } + if (internal::Double(d).Sign()) { + PutReserve(*os_, 9); + PutUnsafe(*os_, '-'); + } + else + PutReserve(*os_, 8); + PutUnsafe(*os_, 'I'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'f'); + PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 't'); PutUnsafe(*os_, 'y'); + return true; + } + + char *buffer = os_->Push(25); + char* end = internal::dtoa(d, buffer, maxDecimalPlaces_); + os_->Pop(static_cast(25 - (end - buffer))); + return true; +} + +#if defined(RAPIDJSON_SSE2) || defined(RAPIDJSON_SSE42) +template<> +inline bool Writer::ScanWriteUnescapedString(StringStream& is, size_t length) { + if (length < 16) + return RAPIDJSON_LIKELY(is.Tell() < length); + + if (!RAPIDJSON_LIKELY(is.Tell() < length)) + return false; + + const char* p = is.src_; + const char* end = is.head_ + length; + const char* nextAligned = reinterpret_cast((reinterpret_cast(p) + 15) & static_cast(~15)); + const char* endAligned = reinterpret_cast(reinterpret_cast(end) & static_cast(~15)); + if (nextAligned > end) + return true; + + while (p != nextAligned) + if (*p < 0x20 || *p == '\"' || *p == '\\') { + is.src_ = p; + return RAPIDJSON_LIKELY(is.Tell() < length); + } + else + os_->PutUnsafe(*p++); + + // The rest of string using SIMD + static const char dquote[16] = { '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"', '\"' }; + static const char bslash[16] = { '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\' }; + static const char space[16] = { 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19 }; + const __m128i dq = _mm_loadu_si128(reinterpret_cast(&dquote[0])); + const __m128i bs = _mm_loadu_si128(reinterpret_cast(&bslash[0])); + const __m128i sp = _mm_loadu_si128(reinterpret_cast(&space[0])); + + for (; p != endAligned; p += 16) { + const __m128i s = _mm_load_si128(reinterpret_cast(p)); + const __m128i t1 = _mm_cmpeq_epi8(s, dq); + const __m128i t2 = _mm_cmpeq_epi8(s, bs); + const __m128i t3 = _mm_cmpeq_epi8(_mm_max_epu8(s, sp), sp); // s < 0x20 <=> max(s, 0x19) == 0x19 + const __m128i x = _mm_or_si128(_mm_or_si128(t1, t2), t3); + unsigned short r = static_cast(_mm_movemask_epi8(x)); + if (RAPIDJSON_UNLIKELY(r != 0)) { // some of characters is escaped + SizeType len; +#ifdef _MSC_VER // Find the index of first escaped + unsigned long offset; + _BitScanForward(&offset, r); + len = offset; +#else + len = static_cast(__builtin_ffs(r) - 1); +#endif + char* q = reinterpret_cast(os_->PushUnsafe(len)); + for (size_t i = 0; i < len; i++) + q[i] = p[i]; + + p += len; + break; + } + _mm_storeu_si128(reinterpret_cast<__m128i *>(os_->PushUnsafe(16)), s); + } + + is.src_ = p; + return RAPIDJSON_LIKELY(is.Tell() < length); +} +#endif // defined(RAPIDJSON_SSE2) || defined(RAPIDJSON_SSE42) + +RAPIDJSON_NAMESPACE_END + +#ifdef _MSC_VER +RAPIDJSON_DIAG_POP +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_RAPIDJSON_H_ diff --git a/include/switch_string.h b/include/switch_string.h new file mode 100644 index 0000000..a8f124a --- /dev/null +++ b/include/switch_string.h @@ -0,0 +1,47 @@ +#include + +typedef std::uint64_t hash_t; + +constexpr hash_t prime = 0x100000001B3ull; +constexpr hash_t basis = 0xCBF29CE484222325ull; + +hash_t hash_(char const* str) +{ + hash_t ret{basis}; + + while(*str){ + ret ^= *str; + ret *= prime; + str++; + } + + return ret; +} + +constexpr hash_t hash_compile_time(char const* str, hash_t last_value = basis) +{ + return *str ? hash_compile_time(str+1, (*str ^ last_value) * prime) : last_value; +} + +constexpr unsigned long long operator "" _hash(char const* p, size_t) +{ + return hash_compile_time(p); +} + +//void simple_switch(char const* str) +//{ +// using namespace std; +// switch(hash_(str)){ +// case "first"_hash: +// cout << "1st one" << endl; +// break; +// case "second"_hash: +// cout << "2nd one" << endl; +// break; +// case "third"_hash: +// cout << "3rd one" << endl; +// break; +// default: +// cout << "Default..." << endl; +// } +//} \ No newline at end of file diff --git a/include/synthetic/CSyntheticConfig.cpp b/include/synthetic/CSyntheticConfig.cpp new file mode 100644 index 0000000..ca81baf --- /dev/null +++ b/include/synthetic/CSyntheticConfig.cpp @@ -0,0 +1,187 @@ +#include "stdafx.h" +#include "CSyntheticConfig.h" + + +CSyntheticConfig::CSyntheticConfig() +{ +} + + +CSyntheticConfig::~CSyntheticConfig() +{ +} + + +map CSyntheticConfig::Read(const char* filename) +{ + ifstream ifs(filename); + IStreamWrapper isw(ifs); + + Document doc; + doc.ParseStream(isw); + + map ls; + if (!doc.IsArray()) + { + return ls; + } + + for (int i = 0; i < doc.Size(); i++) + { + ConfigItem item; + const Value& object = doc[i]; + item.symbol = object["Symbol"].GetString(); + item.method = object["Method"].GetString(); + //item.emit = object["Emit"].GetString(); + + const Value& emits_array = object["Emits"]; + for (int i=0;i(itr->name.GetString(), itr->value.GetDouble())); + } + ls.insert(pair(item.symbol, item)); + } + m_map = ls; + return ls; +} + +void CSyntheticConfig::Write(const char* filename) +{ + Document doc; + doc.SetArray(); + rapidjson::Document::AllocatorType& allocator = doc.GetAllocator(); + + rapidjson::Value info_array(rapidjson::kArrayType); + + { + rapidjson::Value info_object(rapidjson::kObjectType); + info_object.SetObject(); + info_object.AddMember("Symbol", "IF000", allocator); + info_object.AddMember("Method", "OpenInterest", allocator); + + rapidjson::Value emits_array(rapidjson::kArrayType); + emits_array.SetArray(); + emits_array.PushBack("IF1802", allocator); + emits_array.PushBack("IF1806", allocator); + info_object.AddMember("Emits", emits_array, allocator); + + rapidjson::Value legs_object(rapidjson::kObjectType); + legs_object.SetObject(); + legs_object.AddMember("IF1802", 1.0, allocator); + legs_object.AddMember("IF1803", 1.0, allocator); + legs_object.AddMember("IF1806", 1.0, allocator); + legs_object.AddMember("IF1809", 1.0, allocator); + + info_object.AddMember("Legs", legs_object, allocator); + doc.PushBack(info_object, allocator); + } + + { + rapidjson::Value info_object(rapidjson::kObjectType); + info_object.SetObject(); + info_object.AddMember("Symbol", "IF_WI", allocator); + info_object.AddMember("Method", "Weight", allocator); + + rapidjson::Value emits_array(rapidjson::kArrayType); + emits_array.SetArray(); + emits_array.PushBack("IF1802", allocator); + info_object.AddMember("Emits", emits_array, allocator); + + rapidjson::Value legs_object(rapidjson::kObjectType); + legs_object.SetObject(); + legs_object.AddMember("IF1802", 0.25, allocator); + legs_object.AddMember("IF1803", 0.25, allocator); + legs_object.AddMember("IF1806", 0.25, allocator); + legs_object.AddMember("IF1809", 0.25, allocator); + + info_object.AddMember("Legs", legs_object, allocator); + doc.PushBack(info_object, allocator); + } + + { + rapidjson::Value info_object(rapidjson::kObjectType); + info_object.SetObject(); + info_object.AddMember("Symbol", "IF_IH_1803", allocator); + info_object.AddMember("Method", "Spread", allocator); + + rapidjson::Value emits_array(rapidjson::kArrayType); + emits_array.SetArray(); + emits_array.PushBack("IF1803", allocator); + info_object.AddMember("Emits", emits_array, allocator); + + rapidjson::Value legs_object(rapidjson::kObjectType); + legs_object.SetObject(); + legs_object.AddMember("IF1803", 1.0, allocator); + legs_object.AddMember("IH1803", -1.2, allocator); + + info_object.AddMember("Legs", legs_object, allocator); + doc.PushBack(info_object, allocator); + } + + { + rapidjson::Value info_object(rapidjson::kObjectType); + info_object.SetObject(); + info_object.AddMember("Symbol", "IF888", allocator); + info_object.AddMember("Method", "Copy", allocator); + + rapidjson::Value emits_array(rapidjson::kArrayType); + emits_array.SetArray(); + emits_array.PushBack("IF1802", allocator); + info_object.AddMember("Emits", emits_array, allocator); + + rapidjson::Value legs_object(rapidjson::kObjectType); + legs_object.SetObject(); + legs_object.AddMember("IF1802", 1.0, allocator); + + info_object.AddMember("Legs", legs_object, allocator); + doc.PushBack(info_object, allocator); + } + + ofstream ofs(filename); + OStreamWrapper osw(ofs); + PrettyWriter writer(osw); + doc.Accept(writer); +} + +map CSyntheticConfig::GetMap() +{ + return m_map; +} + +bool CSyntheticConfig::ContainsKey(const char* product) +{ + auto it = m_map.find(product); + if (it == m_map.end()) + { + return false; + } + return true; +} + +void CSyntheticConfig::Classify(set two, set& synthetic_set, set& common_set) +{ + synthetic_set.clear(); + common_set.clear(); + + for (auto it = two.begin(); it != two.end(); it++) + { + auto i = m_map.find(it->data()); + if (i == m_map.end()) + { + // ûҵͨԼ + common_set.insert(it->data()); + } + else + { + // ҵˣϳɺԼ + synthetic_set.insert(it->data()); + } + } +} \ No newline at end of file diff --git a/include/synthetic/CSyntheticConfig.h b/include/synthetic/CSyntheticConfig.h new file mode 100644 index 0000000..1ec8aa2 --- /dev/null +++ b/include/synthetic/CSyntheticConfig.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include +#include +#include + +#include "../rapidjson/rapidjson.h" +#include "../rapidjson/document.h" +#include "../rapidjson/prettywriter.h" +#include "../rapidjson/istreamwrapper.h" +#include "../rapidjson/ostreamwrapper.h" + +// https://github.com/Tencent/rapidjson/blob/master/doc/stream.zh-cn.md + +using namespace std; +using namespace rapidjson; + +struct ConfigItem +{ + string symbol; + string method; + string emit; + set emits; + map legs; +}; + +class CSyntheticConfig +{ +public: + CSyntheticConfig(); + ~CSyntheticConfig(); + + map Read(const char* filename); + void Write(const char* filename); + + bool ContainsKey(const char* product); + + void Classify(set two, set& s1, set& s2); + + map GetMap(); +private: + map m_map; +}; + + diff --git a/include/synthetic/CSyntheticInfos.cpp b/include/synthetic/CSyntheticInfos.cpp new file mode 100644 index 0000000..7cfd0ba --- /dev/null +++ b/include/synthetic/CSyntheticInfos.cpp @@ -0,0 +1,91 @@ +#include "stdafx.h" +#include "CSyntheticInfos.h" + + +CSyntheticInfos::CSyntheticInfos() +{ +} + + +CSyntheticInfos::~CSyntheticInfos() +{ +} + +void CSyntheticInfos::Add_Product(const char* product, const char* instrument, double weight) +{ + auto it = m_map_by_product.find(product); + if (it == m_map_by_product.end()) + { + // ûҵ + unordered_map sd; + sd.insert(pair(instrument, weight)); + + m_map_by_product.insert(pair>(product, sd)); + + m_list_product.push_back(product); + } + else + { + // ҵ + it->second.insert(pair(instrument, weight)); + } +} + +void CSyntheticInfos::Add_Instrument(const char* instrument, const char* product, double weight) +{ + auto it = m_map_by_instrument.find(instrument); + if (it == m_map_by_instrument.end()) + { + // ûҵ + unordered_map sd; + sd.insert(pair(product, weight)); + + m_map_by_instrument.insert(pair>(instrument, sd)); + } + else + { + // ҵ + it->second.insert(pair(product, weight)); + } +} + +void CSyntheticInfos::Add(const char* product, const char* instrument, double weight) +{ + Add_Product(product, instrument, weight); + Add_Instrument(instrument, product, weight); +} + +unordered_map CSyntheticInfos::GetByProduct(const char* product) +{ + auto it = m_map_by_product.find(product); + if (it == m_map_by_product.end()) + { + // ûҵ + unordered_map sd; + return sd; + } + else + { + return it->second; + } +} + +unordered_map CSyntheticInfos::GetByInstrument(const char* product) +{ + auto it = m_map_by_instrument.find(product); + if (it == m_map_by_instrument.end()) + { + // ûҵ + unordered_map sd; + return sd; + } + else + { + return it->second; + } +} + +list CSyntheticInfos::GetProducts() +{ + return m_list_product; +} diff --git a/include/synthetic/CSyntheticInfos.h b/include/synthetic/CSyntheticInfos.h new file mode 100644 index 0000000..3da2faf --- /dev/null +++ b/include/synthetic/CSyntheticInfos.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include + +using namespace std; + +// ϳɺԼϢ +// ڿԴļֱӽҪĸʽ +// ķӳҲûɶʵô +class CSyntheticInfos +{ +public: + CSyntheticInfos(); + ~CSyntheticInfos(); + + void Add(const char* product, const char* instrument, double weight = 0); + unordered_map GetByProduct(const char* product); + unordered_map GetByInstrument(const char* instrument); + + list GetProducts(); +private: + void Add_Product(const char* product, const char* instrument, double weight); + void Add_Instrument(const char* instrument, const char* product, double weight); + +private: + unordered_map> m_map_by_product; + unordered_map> m_map_by_instrument; + + list m_list_product; +}; + diff --git a/include/synthetic/CSyntheticManager.cpp b/include/synthetic/CSyntheticManager.cpp new file mode 100644 index 0000000..60c6871 --- /dev/null +++ b/include/synthetic/CSyntheticManager.cpp @@ -0,0 +1,148 @@ +#include "stdafx.h" +#include "CSyntheticManager.h" + +#include + + +CSyntheticManager::CSyntheticManager() +{ +} + + +CSyntheticManager::~CSyntheticManager() +{ + for (auto iter = m_map_by_product.begin(); iter != m_map_by_product.end(); iter++) + { + delete iter->second; + } + m_map_by_product.clear(); + for (auto iter = m_map_by_instrument.begin(); iter != m_map_by_instrument.end(); iter++) + { + delete[] iter->second; + } + m_map_by_instrument.clear(); +} + +CSyntheticMarketData* CSyntheticManager::Register(const char* product, set emits, map legs, CSyntheticCalculate* pCal) +{ + // 用于注册多少个合成合约 + CSyntheticMarketData* pSMD = nullptr; + auto it = m_map_by_product.find(product); + if (it == m_map_by_product.end()) + { + pSMD = new CSyntheticMarketData(product, emits, pCal); + m_map_by_product.insert(pair(product, pSMD)); + } + else + { + pSMD = it->second; + } + + // 登记需要用到多少实际合约 + for (auto iter = legs.begin(); iter != legs.end(); iter++) + { + char* pBuf = nullptr; + auto it = m_map_by_instrument.find(iter->first); + if (it == m_map_by_instrument.end()) + { + // 创建 + pBuf = new char[LEG_DATA_BUF_LEN](); + memset(pBuf, 0, LEG_DATA_BUF_LEN); + m_map_by_instrument.insert(pair(iter->first, pBuf)); + } + else + { + pBuf = it->second; + } + + pSMD->Create(iter->first.c_str(), iter->second, pBuf); + + // 关联实盘合约与所能合成的合约 + auto it2 = m_map_set_by_instrument.find(iter->first); + if (it2 == m_map_set_by_instrument.end()) + { + auto p = set(); + p.insert(pSMD); + m_map_set_by_instrument.insert(pair>(iter->first, p)); + } + else + { + it2->second.insert(pSMD); + } + } + // 不管有没有用到权重,更新一下 + //pSMD->UpdateWeight(); + return pSMD; +} + +set CSyntheticManager::UnRegister(const char* product) +{ + auto it = m_map_by_product.find(product); + if (it == m_map_by_product.end()) + { + // 没找到,这是开玩笑的吧 + set ss; + return ss; + } + else + { + // 找到合成器指针 + auto p = it->second; + // 找到了,需要得到用到了哪些合约 + auto ss = p->GetInstruments(); + for (auto s1 = ss.begin(); s1 != ss.end(); s1++) + { + auto s2 = m_map_set_by_instrument.find(s1->data()); + if (s2 == m_map_set_by_instrument.end()) + { + // 没找到,这是开玩笑的吧 + } + else + { + // 将此实际合约可以组合成的合成器删了 + s2->second.erase(p); + if (s2->second.size() == 0) + { + // 没有要订的,需要删除 + m_map_by_instrument.erase(s1->data()); + } + } + } + + m_map_by_product.erase(product); + + return ss; + } +} + +char* CSyntheticManager::Update(const char* instrument, void* pData, int size) +{ + auto it = m_map_by_instrument.find(instrument); + if (it == m_map_by_instrument.end()) + { + // 没找到 + return nullptr; + } + else + { + //// 用第一个字节标记数据已经收到 + //*it->second = 1; + //memcpy(it->second+1, pData, size); + memcpy(it->second, pData, size); + return it->second; + } +} + +set CSyntheticManager::GetByInstrument(const char* instrument) +{ + auto it2 = m_map_set_by_instrument.find(instrument); + if (it2 == m_map_set_by_instrument.end()) + { + auto p = set(); + return p; + } + else + { + return it2->second; + } +} diff --git a/include/synthetic/CSyntheticManager.h b/include/synthetic/CSyntheticManager.h new file mode 100644 index 0000000..3bb1a93 --- /dev/null +++ b/include/synthetic/CSyntheticManager.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include + +#include "CSyntheticMarketData.h" + +class CSyntheticManager +{ +public: + CSyntheticManager(); + ~CSyntheticManager(); + + // ԭUpateIF1802ͬʱIF000IF888УԾǰ + CSyntheticMarketData* Register(const char* product, set emits, map legs, CSyntheticCalculate* pCal); + set UnRegister(const char* product); + + // ȸݺԼºԼڴ + // ע⣬صڴ0λDZλ + char* Update(const char* instrument, void* pData, int size); + + set GetByInstrument(const char* instrument); + +private: + // ¼ĶٸϳɺԼ + map m_map_by_product; + // ֻ¼ԭʼbufÿжָָ + map m_map_by_instrument; + // ֻӦ + map> m_map_set_by_instrument; + + mutex m_cs; +}; + diff --git a/include/synthetic/CSyntheticMarketData.cpp b/include/synthetic/CSyntheticMarketData.cpp new file mode 100644 index 0000000..35c7ca0 --- /dev/null +++ b/include/synthetic/CSyntheticMarketData.cpp @@ -0,0 +1,147 @@ +#include "stdafx.h" +#include "CSyntheticMarketData.h" + +#include + + +CSyntheticMarketData::CSyntheticMarketData(const char* product, set emits, CSyntheticCalculate* pCal) +{ + m_product = product; + m_emits = emits; + m_emit = nullptr; + memset(m_emit_buf,0, sizeof(m_emit_buf)); + if (m_emits.size() == 1) + { + // 只保存第一个 + strncpy(m_emit_buf, emits.begin()->data(), sizeof(m_emit_buf)); + m_emit = m_emit_buf; + } + + memset(&m_leg, 0, sizeof(m_leg)); + m_leg.pBuf = new char[LEG_DATA_BUF_LEN](); + memset(m_leg.pBuf, 0, LEG_DATA_BUF_LEN); + m_pCal = pCal; + + m_size = 0; + m_count = 0; + m_last_count = -1; +} + + +CSyntheticMarketData::~CSyntheticMarketData() +{ + if (m_leg.pBuf) + { + delete[] m_leg.pBuf; + m_leg.pBuf = nullptr; + } +} + +void CSyntheticMarketData::Create(const char* instrument, double weight, char* pData) +{ + auto it = m_map.find(instrument); + if (it == m_map.end()) + { + LegData lmd = { 0 }; + lmd.weight = weight; + lmd.pBuf = pData; + m_map.insert(pair(instrument, lmd)); + + m_set.insert(instrument); + } + else + { + } + // 由于这个代码是在Register中调用,合成合约的成份大小是固定的 + m_size = m_map.size(); +} + +void CSyntheticMarketData::UpdateWeight() +{ + double sum = 0; + for (auto iter = m_map.begin(); iter != m_map.end(); iter++) + { + sum += iter->second.weight; + } + for (auto iter = m_map.begin(); iter != m_map.end(); iter++) + { + iter->second.weight = iter->second.weight / sum; + } +} + +void* CSyntheticMarketData::Calculate(char* pBuf) +{ + if (m_pCal == nullptr) + { + return nullptr; + } + lock_guard cl(m_cs); + + m_pCal->Begin(this, pBuf, &m_leg); + + for (auto iter = m_map.begin(); iter != m_map.end(); iter++) + { + // 求和 + m_pCal->Sum(this, &iter->second, &m_leg); + } + + for (auto iter = m_map.begin(); iter != m_map.end(); iter++) + { + // 算权重,或权重已经算好 + m_pCal->ForEach(this, &iter->second, &m_leg); + } + + m_pCal->End(this, pBuf, &m_leg); + + return m_leg.pBuf; +} + +bool CSyntheticMarketData::CheckEmit(const char* instrument, int offest) +{ + // 想统计有多少数据齐了时,发现内存区其实初始化时就已经齐了 + // 只好强行加一个标志位 + if (m_size != m_count) + { + char ch = 0; + for (auto iter = m_map.begin(); iter != m_map.end(); iter++) + { + auto c = iter->second.pBuf[offest]; + ch += c; + } + m_count = ch; + } + if (m_last_count == m_count) + { + if (m_emit) + { + // 觉得strcmp要比set中的find要快,所以。。。 + return strcmp(m_emit, instrument) == 0; + } + + // 没有指定触发合约,都触发 + if (m_emits.size() == 0) + { + return true; + } + + // 相同判断是否指定合约 + auto it = m_emits.find(instrument); + return it != m_emits.end(); + } + else + { + m_last_count = m_count; + // 不同表示正在起步几个数据包 + return m_size == m_count; + } +} + +void* CSyntheticMarketData::GetValue() +{ + return m_leg.pBuf; +} + +set CSyntheticMarketData::GetInstruments() +{ + return m_set; +} diff --git a/include/synthetic/CSyntheticMarketData.h b/include/synthetic/CSyntheticMarketData.h new file mode 100644 index 0000000..5bc9f6c --- /dev/null +++ b/include/synthetic/CSyntheticMarketData.h @@ -0,0 +1,83 @@ +#pragma once + +#include +#include +#include +#include + +using namespace std; + +#define LEG_DATA_BUF_LEN (512) +// 用于内部计算用的结构体 +struct LegData +{ + // 权重,可能在外部已经指定好,也可以先求和,然后再算权重 + double weight; + // 添加此变量是用于解决可能出现的数据溢出问题 + double sum; + // 计数 + int count; + + double ask; + double askSize; + double bid; + double bidSize; + + // 使用内存块来兼容不同类型,数据区的第一个字节非0表示数据已经准备好 + char* pBuf; +}; + +class CSyntheticMarketData; + +class CSyntheticCalculate +{ + // 注意:pBuf和LegData->pBuf都是0号位是标记位 +public: + virtual void Begin(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) = 0; + virtual void Sum(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut) = 0; + virtual void ForEach(CSyntheticMarketData* pCall, LegData* pIn, LegData* pOut) = 0; + virtual void End(CSyntheticMarketData* pCall, char* pBuf, LegData* pOut) = 0; +}; + +class CSyntheticCalculateFactory +{ +public: + virtual CSyntheticCalculate* Create(string method) = 0; +}; + +// 处理的是某一个合成指数 +// 如IF000,南华商品指数等 +// 由外层的key最后决定合约名 +class CSyntheticMarketData +{ +public: + CSyntheticMarketData(const char* product, set emit, CSyntheticCalculate* pCal); + ~CSyntheticMarketData(); + + void Create(const char* instrument, double weight, char* pData); + void UpdateWeight(); + // 注意,用于计算的内存块,第0号位是标记位 + void* Calculate(char* pBuf); + void* GetValue(); + + set GetEmits() { return m_emits; } + string GetProduct() { return m_product; } + set GetInstruments(); + // 判断指定位置字符是否为0,来确认数据是否已经有了 + bool CheckEmit(const char* instrument,int offest); + +private: + string m_product; + set m_emits; + const char* m_emit; + char m_emit_buf[128]; + map m_map; + LegData m_leg; + mutex m_cs; + CSyntheticCalculate* m_pCal; + set m_set; + int m_size; + int m_count; + int m_last_count; +}; + diff --git a/include/toolkit.cpp b/include/toolkit.cpp index 3512727..eba5694 100644 --- a/include/toolkit.cpp +++ b/include/toolkit.cpp @@ -2,6 +2,7 @@ #include "toolkit.h" #include #include +#include #if defined _WIN32 || WIN32 || _WINDOWS #include @@ -55,61 +56,6 @@ double my_round(float val, int x) return i; } - -char* GetSetFromString(const char* szString, const char* seps, vector& vct, set& st, int modify, set& st2, int before, const char* prefix) -{ - vct.clear(); - st.clear(); - - if(nullptr == szString - ||nullptr == seps) - return nullptr; - - if(strlen(szString)==0 - ||strlen(seps)==0) - return nullptr; - - //这里不知道要添加的字符有多长,很悲剧 - size_t len = (size_t)(strlen(szString)*1.5+1); - char* buf = new char[len]; - strncpy(buf,szString,len); - - char* token = strtok(buf, seps); - while(token) - { - if (strlen(token)>0) - { - char temp[64] = {0}; - if (prefix) - { - if (before>0) - { - sprintf(temp, "%s%s", prefix,token); - } - else - { - sprintf(temp, "%s%s", token,prefix); - } - } - else - { - sprintf(temp, "%s", token); - } - - if (modify > 0) - st2.insert(temp); - else if (modify<0) - st2.erase(temp); - - vct.push_back(token); - st.insert(token); - } - token = strtok( nullptr, seps); - } - - return buf; -} - void GetUpdateTime_HH_mm_ss(char* UpdateTime,int* _HH,int* _mm,int* _ss) { *_HH = atoi(&UpdateTime[0]); @@ -469,3 +415,54 @@ void GetOnFrontDisconnectedMsg(int ErrorId, char* ErrorMsg) break; } } + +#if defined _WIN32 || WIN32 || _WINDOWS +void GetDllPathByFunctionName(const char* szFunctionName, char* szPath) +{ + HMODULE hModule = nullptr; + GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, szFunctionName, &hModule); + + GetModuleFileNameA(hModule, szPath, MAX_PATH); +} + +void GetExePath(char* szPath) +{ + HMODULE hModule = GetModuleHandleA(nullptr); + //char szPath[MAX_PATH] = { 0 }; + GetModuleFileNameA(hModule, szPath, MAX_PATH); +} + +void GetDirectoryByPath(const char* szPath, char* szDirectory) +{ + //char szPath[_MAX_PATH] = { 0 }; + char drive[_MAX_DRIVE] = { 0 }; + char dir[_MAX_DIR] = { 0 }; + char fname[_MAX_FNAME] = { 0 }; + char ext[_MAX_EXT] = { 0 }; + + _splitpath(szPath, drive, dir, fname, ext); + _makepath(szDirectory, drive, dir, nullptr, nullptr); +} + +void GetNewPathInSameDirectory(const char* szPath, const char* szFname, const char* szExt, char* szFileName) +{ + //char szPath[_MAX_PATH] = { 0 }; + char drive[_MAX_DRIVE] = { 0 }; + char dir[_MAX_DIR] = { 0 }; + char fname[_MAX_FNAME] = { 0 }; + char ext[_MAX_EXT] = { 0 }; + + _splitpath(szPath, drive, dir, fname, ext); + _makepath(szFileName, drive, dir, szFname, szExt); +} +#else +void GetDllPathByFunctionName(const char* szFunctionName, char* szPath) +{} +void GetExePath(char* szPath) +{} +void GetDirectoryByPath(const char* szPath, char* szDirectory) +{} +void GetNewPathInSameDirectory(const char* szPath, const char* szFname, const char* szExt, char* szFileName) +{} + +#endif diff --git a/include/toolkit.h b/include/toolkit.h index bea689f..6d751f1 100644 --- a/include/toolkit.h +++ b/include/toolkit.h @@ -5,6 +5,8 @@ #include #include +#pragma warning(disable:4996) + using namespace std; void WriteLog(const char *fmt, ...); @@ -12,10 +14,6 @@ void WriteLog(const char *fmt, ...); //输入路径,生成多级目录 void makedirs(const char* dir); -//将字符串按指定字符分割 -typedef void fnGetSetFromStringProcess(char* token); -char* GetSetFromString(const char* szString, const char* seps, vector& vct, set& st, int modify, set& st2, int before = 1, const char* prefix = nullptr); - int GetUpdateTime(char* UpdateTime, int* _UpdateTime, int* UpdateMillisec); void GetExchangeTime_CZCE(int iTradingDay, char* TradingDay, char* ActionDay, char* UpdateTime, int* _TradingDay, int* _ActionDay, int* _UpdateTime, int* UpdateMillisec); void GetExchangeTime_Undefined(int iTradingDay, char* TradingDay, char* ActionDay, char* UpdateTime, int* _TradingDay, int* _ActionDay, int* _UpdateTime, int* UpdateMillisec); @@ -23,6 +21,9 @@ void GetExchangeTime_DCE(char* TradingDay, char* ActionDay, char* UpdateTime, in void GetExchangeTime(char* TradingDay, char* ActionDay, char* UpdateTime, int* _TradingDay, int* _ActionDay, int* _UpdateTime, int* UpdateMillisec); void GetExchangeTime(time_t Time, int* _TradingDay, int* _ActionDay, int* _UpdateTime); +void GetUpdateTime_HH_mm_ss(char* UpdateTime, int* _HH, int* _mm, int* _ss); +void GetUpdateTime_HHmmss(char* UpdateTime, int* _HH, int* _mm, int* _ss); + int GetDate(char* TradingDay); int GetTime(char* UpdateTime); @@ -31,4 +32,15 @@ double my_round(float val, int x = 0); //根据OnFrontDisconnected(int nReason)的值填上错误消息 void GetOnFrontDisconnectedMsg(int ErrorId, char* ErrorMsg); -#endif \ No newline at end of file +#if _WIN32 +// 通过公开的函数名,得到当前的路径 +void GetDllPathByFunctionName(const char* szFunctionName, char* szPath); +// 得到当前可执行程序的路径 +void GetExePath(char* szPath); +// 传入路径,得到目录 +void GetDirectoryByPath(const char* szPath, char* szDirectory); +// 通过一个路径得到新的路径 +void GetNewPathInSameDirectory(const char* szPath, const char* szFname, const char* szExt, char* szFileName); +#endif + +#endif diff --git a/QuantBox_XAPI/ReadMe.txt b/languages/CPP/XAPI_CPP/ReadMe.txt similarity index 100% rename from QuantBox_XAPI/ReadMe.txt rename to languages/CPP/XAPI_CPP/ReadMe.txt diff --git a/QuantBox_XAPI/QuantBox_XAPI.cbp b/languages/CPP/XAPI_CPP/XAPI_CPP.cbp similarity index 100% rename from QuantBox_XAPI/QuantBox_XAPI.cbp rename to languages/CPP/XAPI_CPP/XAPI_CPP.cbp diff --git a/QuantBox_XAPI/QuantBox_XAPI.cpp b/languages/CPP/XAPI_CPP/XAPI_CPP.cpp similarity index 100% rename from QuantBox_XAPI/QuantBox_XAPI.cpp rename to languages/CPP/XAPI_CPP/XAPI_CPP.cpp diff --git a/QuantBox_XAPI/QuantBox_XAPI.vcxproj b/languages/CPP/XAPI_CPP/XAPI_CPP.vcxproj similarity index 78% rename from QuantBox_XAPI/QuantBox_XAPI.vcxproj rename to languages/CPP/XAPI_CPP/XAPI_CPP.vcxproj index 4057688..d2b8a54 100644 --- a/QuantBox_XAPI/QuantBox_XAPI.vcxproj +++ b/languages/CPP/XAPI_CPP/XAPI_CPP.vcxproj @@ -13,19 +13,21 @@ {39599EFE-428F-408F-BF4F-BF462E37C5E8} Win32Proj - QuantBox_XAPI + XAPI_CPP + 8.1 DynamicLibrary true - v120 + v141_xp Unicode + false DynamicLibrary false - v120 + v140 true Unicode @@ -41,6 +43,8 @@ true + ..\..\..\bin\$(Configuration)\$(PlatformTarget)\ + $(ProjectName)_$(PlatformTarget) false @@ -50,16 +54,17 @@ Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;QUANTBOX_XAPI_EXPORTS;_CRT_SECURE_NO_WARNINGS;BUILDING_DLL;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;XAPI_CPP_EXPORTS;_CRT_SECURE_NO_WARNINGS;BUILDING_DLL;%(PreprocessorDefinitions) true Windows true - ..\include\XApiC.def + ../../../include/XApiC.def - xcopy "$(TargetPath)" "$(SolutionDir)XAPI\" /Y + + @@ -69,7 +74,7 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_XAPI_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;XAPI_CPP_EXPORTS;_CRT_SECURE_NO_WARNINGS;BUILDING_DLL;%(PreprocessorDefinitions) true @@ -83,21 +88,14 @@ - - + + - - false - - - false - - - + Create Create diff --git a/QuantBox_XAPI/QuantBox_XAPI.vcxproj.filters b/languages/CPP/XAPI_CPP/XAPI_CPP.vcxproj.filters similarity index 94% rename from QuantBox_XAPI/QuantBox_XAPI.vcxproj.filters rename to languages/CPP/XAPI_CPP/XAPI_CPP.vcxproj.filters index 49328ae..3067039 100644 --- a/QuantBox_XAPI/QuantBox_XAPI.vcxproj.filters +++ b/languages/CPP/XAPI_CPP/XAPI_CPP.vcxproj.filters @@ -30,10 +30,10 @@ Header Files - + include - + include diff --git a/languages/CPP/XAPI_CPP/XApiC.cpp b/languages/CPP/XAPI_CPP/XApiC.cpp new file mode 100644 index 0000000..a11390c --- /dev/null +++ b/languages/CPP/XAPI_CPP/XApiC.cpp @@ -0,0 +1,200 @@ +#include "stdafx.h" + +#include +#include +#include "../../../include/XApiC.h" +#include "../../../include/QueueEnum.h" + +#if defined WINDOWS || WIN32 +//#include +#else +#include +#include +#endif + + +void* X_LoadLib(const char* libPath) +{ + if (libPath == nullptr) + return nullptr; + +#if defined WINDOWS || WIN32 + return LoadLibraryExA(libPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH); +#else + return dlopen(libPath, RTLD_NOW); +#endif +} + +const char* X_GetLastError() +{ +#if defined WINDOWS || WIN32 + char szBuf[256] = {0}; + LPVOID lpMsgBuf; + DWORD dw = GetLastError(); + FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&lpMsgBuf, + 0, NULL); + return (const char*)lpMsgBuf; +#else + extern int errno; + errno = 0; + return dlerror(); +#endif +} + +void* X_GetFunction(void* lib, const char* ProcName) +{ + if (lib == nullptr) + return nullptr; +#if defined WINDOWS || WIN32 + return GetProcAddress((HMODULE)lib, ProcName); +#else + return (dlsym(lib, ProcName)); +#endif +} + +void X_FreeLib(void* lib) +{ + if (lib == nullptr) + return; + +#if defined WINDOWS || WIN32 + FreeLibrary((HMODULE)lib); +#else + dlclose(lib); +#endif +} + +ApiType X_GetApiTypes(void* pFun) +{ + if (pFun == nullptr) + return ApiType::ApiType_None; + + void* p = ((fnOnResponse)pFun)(RequestType::RequestType_GetApiTypes, nullptr, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + return (ApiType)(char)(long long)(p); +} + +const char* X_GetApiVersion(void* pFun) +{ + if (pFun == nullptr) + return nullptr; + + return (const char*)((fnOnResponse)pFun)(RequestType::RequestType_GetApiVersion, nullptr, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); +} + +const char* X_GetApiName(void* pFun) +{ + if (pFun == nullptr) + return nullptr; + + return (const char*)((fnOnResponse)pFun)(RequestType::RequestType_GetApiName, nullptr, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); +} + +void* X_Create(void* pFun) +{ + if (pFun == nullptr) + return nullptr; + + return ((fnOnResponse)pFun)(RequestType::RequestType_Create, nullptr, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); +} + +void X_Register(void* pFun, void* pApi, fnOnResponse pCallback, void* pClass) +{ + if (pFun == nullptr || pApi == nullptr) + return; + + ((fnOnResponse)pFun)(RequestType::RequestType_Register, pApi, nullptr, 0, 0, (void*)pCallback, 0, pClass, 0, nullptr, 0); +} + +void X_Connect(void* pFun, void* pApi, const char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count) +{ + if (pFun == nullptr || pApi == nullptr) + return; + + ((fnOnResponse)pFun)(RequestType::RequestType_Connect, pApi, nullptr, 0, 0, pServerInfo, 0, pUserInfo, count, (void*)szPath, 0); +} + +void X_Disconnect(void* pFun, void* pApi) +{ + if (pFun == nullptr || pApi == nullptr) + return; + + ((fnOnResponse)pFun)(RequestType::RequestType_Disconnect, pApi, nullptr, 0, 0, nullptr, 0, nullptr, 0, nullptr, 0); +} + +void X_Subscribe(void* pFun, void* pApi, const char* szInstrument, const char* szExchange) +{ + if (pFun == nullptr || pApi == nullptr) + return; + + ((fnOnResponse)pFun)(RequestType::RequestType_Subscribe, pApi, nullptr, 0, 0, (void*)szInstrument, 0, (void*)szExchange, 0, nullptr, 0); +} + +void X_Unsubscribe(void* pFun, void* pApi, const char* szInstrument, const char* szExchange) +{ + if (pFun == nullptr || pApi == nullptr) + return; + + ((fnOnResponse)pFun)(RequestType::RequestType_Unsubscribe, pApi, nullptr, 0, 0, (void*)szInstrument, 0, (void*)szExchange, 0, nullptr, 0); +} + +void X_SubscribeQuote(void* pFun, void* pApi, const char* szInstrument, const char* szExchange) +{ + if (pFun == nullptr || pApi == nullptr) + return; + + ((fnOnResponse)pFun)(RequestType::RequestType_SubscribeQuote, pApi, nullptr, 0, 0, (void*)szInstrument, 0, (void*)szExchange, 0, nullptr, 0); +} + +void X_UnsubscribeQuote(void* pFun, void* pApi, const char* szInstrument, const char* szExchange) +{ + if (pFun == nullptr || pApi == nullptr) + return; + + ((fnOnResponse)pFun)(RequestType::RequestType_UnsubscribeQuote, pApi, nullptr, 0, 0, (void*)szInstrument, 0, (void*)szExchange, 0, nullptr, 0); +} + +void X_ReqQuery(void* pFun, void* pApi, QueryType type, ReqQueryField* query) +{ + if (pFun == nullptr || pApi == nullptr) + return; + + ((fnOnResponse)pFun)(type, pApi, nullptr, 0, 0, query, sizeof(ReqQueryField), nullptr, 0, nullptr, 0); +} + +const char* X_SendOrder(void* pFun, void* pApi, OrderField* pOrder, int count, char* pOut) +{ + if (pFun == nullptr || pApi == nullptr) + return nullptr; + + return (const char*)((fnOnResponse)pFun)(RequestType::RequestType_ReqOrderInsert, pApi, nullptr, 0, 0, pOrder, count, pOut, 0, nullptr, 0); +} + +const char* X_CancelOrder(void* pFun, void* pApi, OrderIDType* pIn, int count, char* pOut) +{ + if (pFun == nullptr || pApi == nullptr) + return nullptr; + + return (const char*)((fnOnResponse)pFun)(RequestType::RequestType_ReqOrderAction, pApi, nullptr, 0, 0, pIn, count, pOut, 0, nullptr, 0); +} + +const char* X_SendQuote(void* pFun, void* pApi, QuoteField* pQuote, int count, char* pOut) +{ + if (pFun == nullptr || pApi == nullptr) + return nullptr; + + return (const char*)((fnOnResponse)pFun)(RequestType::RequestType_ReqQuoteInsert, pApi, nullptr, 0, 0, pQuote, count, pOut, 0, nullptr, 0); +} + +const char* X_CancelQuote(void* pFun, void* pApi, OrderIDType* pIn, int count, char* pOut) +{ + if (pFun == nullptr || pApi == nullptr) + return nullptr; + + return (const char*)((fnOnResponse)pFun)(RequestType::RequestType_ReqQuoteAction, pApi, nullptr, 0, 0, pIn, count, pOut, 0, nullptr, 0); +} diff --git a/languages/CPP/XAPI_CPP/XApiCpp.cpp b/languages/CPP/XAPI_CPP/XApiCpp.cpp new file mode 100644 index 0000000..c12cb90 --- /dev/null +++ b/languages/CPP/XAPI_CPP/XApiCpp.cpp @@ -0,0 +1,17 @@ +#include "stdafx.h" +#include "../../../include/XApiCpp.h" + +#include "XApiImpl.h" + +CXApi::CXApi() +{ +} + +CXApi::~CXApi() +{ +} + +CXApi* CXApi::CreateApi(const char* libPath) +{ + return new CXApiImpl(libPath); +} diff --git a/languages/CPP/XAPI_CPP/XApiImpl.cpp b/languages/CPP/XAPI_CPP/XApiImpl.cpp new file mode 100644 index 0000000..0a311f7 --- /dev/null +++ b/languages/CPP/XAPI_CPP/XApiImpl.cpp @@ -0,0 +1,202 @@ +#include "stdafx.h" +#include +#include +#include "XApiImpl.h" + +#include "../../../include/QueueEnum.h" +#include "../../../include/XApiC.h" + +void* __stdcall CXApiImpl::OnResponse(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (pApi2 == nullptr) + return nullptr; + + CXApiImpl* pThisClass = (CXApiImpl*)pApi2; + return pThisClass->_OnResponse(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); +} + +void* CXApiImpl::_OnResponse(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + if (nullptr == m_pSpi) + return nullptr; + + ResponseType rt = (ResponseType)type; + switch (rt) + { + case ResponseType_OnConnectionStatus: + m_pSpi->OnConnectionStatus(this, (ConnectionStatus)(char)double1, (RspUserLoginField*)ptr1, size1); + break; + case ResponseType_OnRtnError: + m_pSpi->OnRtnError(this, (ErrorField*)ptr1); + break; + case ResponseType_OnLog: + m_pSpi->OnLog(this, (LogField*)ptr1); + break; + case ResponseType_OnRtnDepthMarketData: + m_pSpi->OnRtnDepthMarketDataN(this, (DepthMarketDataNField*)ptr1); + break; + case ResponseType_OnRspQryInstrument: + m_pSpi->OnRspQryInstrument(this, (InstrumentField*)ptr1, size1, double1 != 0); + break; + case ResponseType_OnRspQryTradingAccount: + m_pSpi->OnRspQryTradingAccount(this, (AccountField*)ptr1, size1, double1 != 0); + break; + case ResponseType_OnRspQryInvestorPosition: + m_pSpi->OnRspQryInvestorPosition(this, (PositionField*)ptr1, size1, double1 != 0); + break; + case ResponseType_OnRspQrySettlementInfo: + m_pSpi->OnRspQrySettlementInfo(this, (SettlementInfoField*)ptr1, size1, double1 != 0); + break; + + case ResponseType_OnRspQryOrder: + m_pSpi->OnRspQryOrder(this, (OrderField*)ptr1, size1, double1 != 0); + break; + case ResponseType_OnRspQryTrade: + m_pSpi->OnRspQryTrade(this, (TradeField*)ptr1, size1, double1 != 0); + break; + case ResponseType_OnRspQryQuote: + m_pSpi->OnRspQryQuote(this, (QuoteField*)ptr1, size1, double1 != 0); + break; + + case ResponseType_OnRtnOrder: + m_pSpi->OnRtnOrder(this, (OrderField*)ptr1); + break; + case ResponseType_OnRtnTrade: + m_pSpi->OnRtnTrade(this, (TradeField*)ptr1); + break; + case ResponseType_OnRtnQuote: + m_pSpi->OnRtnQuote(this, (QuoteField*)ptr1); + break; + + case ResponseType_OnRtnQuoteRequest: + m_pSpi->OnRtnQuoteRequest(this, (QuoteRequestField*)ptr1); + break; + + case ResponseType_OnRspQryHistoricalTicks: + m_pSpi->OnRspQryHistoricalTicks(this, (TickField*)ptr1, size1, (HistoricalDataRequestField*)ptr2, size2, double1 != 0); + break; + case ResponseType_OnRspQryHistoricalBars: + m_pSpi->OnRspQryHistoricalBars(this, (BarField*)ptr1, size1, (HistoricalDataRequestField*)ptr2, size2, double1 != 0); + break; + case ResponseType_OnRspQryInvestor: + m_pSpi->OnRspQryInvestor(this, (InvestorField*)ptr1, size1, double1 != 0); + break; + case ResponseType_OnRtnInstrumentStatus: + m_pSpi->OnRtnInstrumentStatus(this, (InstrumentStatusField*)ptr1); + break; + + case ResponseType_OnFilterSubscribe: + return (void*)m_pSpi->OnFilterSubscribe(this, (ExchangeType)(char)double1, (int)size1, (int)size1, (int)size3, (char*)ptr1); + default: + break; + } + return nullptr; +} + +CXApiImpl::CXApiImpl(const char* libPath) :CXApi() +{ + m_pLib = nullptr; + m_pFun = nullptr; + m_pApi = nullptr; + m_pSpi = nullptr; + + strncpy(m_LibPath, libPath, sizeof(m_LibPath)); +} + + +CXApiImpl::~CXApiImpl() +{ + Disconnect(); +} + +ApiType CXApiImpl::GetApiTypes() +{ + return X_GetApiTypes(m_pFun); +} + +const char* CXApiImpl::GetApiVersion() +{ + return X_GetApiVersion(m_pFun); +} + +const char* CXApiImpl::GetApiName() +{ + return X_GetApiName(m_pFun); +} + +void CXApiImpl::RegisterSpi(CXSpi *pSpi) +{ + m_pSpi = pSpi; +} + +bool CXApiImpl::Init() +{ + m_pLib = X_LoadLib(m_LibPath); + if (m_pLib) + { + m_pFun = X_GetFunction(m_pLib); + if (m_pFun) + { + return true; + } + } + return false; +} + +const char* CXApiImpl::GetLastError() +{ + return X_GetLastError(); +} + +void CXApiImpl::Connect(const char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count) +{ + m_pApi = X_Create(m_pFun); + X_Register(m_pFun, m_pApi, (fnOnResponse)OnResponse, this); + X_Connect(m_pFun, m_pApi, szPath, pServerInfo, pUserInfo, count); +} + +void CXApiImpl::Disconnect() +{ + X_Disconnect(m_pFun, m_pApi); + X_FreeLib(m_pLib); + + m_pLib = nullptr; + m_pFun = nullptr; + m_pApi = nullptr; + m_pSpi = nullptr; +} + +void CXApiImpl::Subscribe(const char* szInstrument, const char* szExchange) +{ + X_Subscribe(m_pFun, m_pApi, szInstrument, szExchange); +} + +void CXApiImpl::Unsubscribe(const char* szInstrument, const char* szExchange) +{ + X_Unsubscribe(m_pFun, m_pApi, szInstrument, szExchange); +} + +void CXApiImpl::ReqQuery(QueryType type, ReqQueryField* query) +{ + X_ReqQuery(m_pFun, m_pApi, type, query); +} + +const char* CXApiImpl::SendOrder(OrderField* pOrder, int count, char* pOut) +{ + return X_SendOrder(m_pFun, m_pApi, pOrder, count, pOut); +} + +const char* CXApiImpl::CancelOrder(OrderIDType* pIn, int count, char* pOut) +{ + return X_CancelOrder(m_pFun, m_pApi, pIn, count, pOut); +} + +const char* CXApiImpl::SendQuote(QuoteField* pQuote, int count, char* pOut) +{ + return X_SendQuote(m_pFun, m_pApi, pQuote, count, pOut); +} + +const char* CXApiImpl::CancelQuote(OrderIDType* pIn, int count, char* pOut) +{ + return X_CancelQuote(m_pFun, m_pApi, pIn, count, pOut); +} diff --git a/languages/CPP/XAPI_CPP/XApiImpl.h b/languages/CPP/XAPI_CPP/XApiImpl.h new file mode 100644 index 0000000..0cfc981 --- /dev/null +++ b/languages/CPP/XAPI_CPP/XApiImpl.h @@ -0,0 +1,46 @@ +#pragma once +#include "../../../include/CrossPlatform.h" +#include "../../../include/XApiCpp.h" + + +class CXApiImpl : + public CXApi +{ +public: + CXApiImpl(const char* libPath); + ~CXApiImpl(); + + virtual ApiType GetApiTypes(); + virtual const char* GetApiVersion(); + virtual const char* GetApiName(); + + virtual bool Init(); + virtual const char* GetLastError(); + virtual void RegisterSpi(CXSpi *pSpi); + + virtual void Connect(const char* szPath, ServerInfoField* pServerInfo, UserInfoField* pUserInfo, int count); + virtual void Disconnect(); + + virtual void Subscribe(const char* szInstrument, const char* szExchange); + virtual void Unsubscribe(const char* szInstrument, const char* szExchange); + + virtual void ReqQuery(QueryType type, ReqQueryField* query); + + virtual const char* SendOrder(OrderField* pOrder, int count, char* pOut); + virtual const char* CancelOrder(OrderIDType* pIn, int count, char* pOut); + + virtual const char* SendQuote(QuoteField* pQuote, int count, char* pOut); + virtual const char* CancelQuote(OrderIDType* pIn, int count, char* pOut); +public: + static void* __stdcall OnResponse(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); +private: + void* _OnResponse(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + void* m_pLib; + void* m_pFun; + void* m_pApi; + + CXSpi *m_pSpi; + char m_LibPath[1024]; +}; + diff --git a/languages/CPP/XAPI_CPP/dllmain.cpp b/languages/CPP/XAPI_CPP/dllmain.cpp new file mode 100644 index 0000000..69b5891 --- /dev/null +++ b/languages/CPP/XAPI_CPP/dllmain.cpp @@ -0,0 +1,19 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/QuantBox_XAPI/stdafx.cpp b/languages/CPP/XAPI_CPP/stdafx.cpp similarity index 100% rename from QuantBox_XAPI/stdafx.cpp rename to languages/CPP/XAPI_CPP/stdafx.cpp diff --git a/QuantBox_XAPI/stdafx.h b/languages/CPP/XAPI_CPP/stdafx.h similarity index 100% rename from QuantBox_XAPI/stdafx.h rename to languages/CPP/XAPI_CPP/stdafx.h diff --git a/languages/CPP/XAPI_CPP/targetver.h b/languages/CPP/XAPI_CPP/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/languages/CPP/XAPI_CPP/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/languages/CSharp/XAPI_CSharp.sln b/languages/CSharp/XAPI_CSharp.sln new file mode 100644 index 0000000..bf2538c --- /dev/null +++ b/languages/CSharp/XAPI_CSharp.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XAPI_CSharp", "XAPI_CSharp\XAPI_CSharp.csproj", "{6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug64|Any CPU = Debug64|Any CPU + Debug64|x64 = Debug64|x64 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release64|Any CPU = Release64|Any CPU + Release64|x64 = Release64|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|x64.ActiveCfg = Debug|x64 + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug|x64.Build.0 = Debug|x64 + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|Any CPU.ActiveCfg = Debug64|Any CPU + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|Any CPU.Build.0 = Debug64|Any CPU + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|x64.ActiveCfg = Debug64|x64 + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Debug64|x64.Build.0 = Debug64|x64 + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|Any CPU.Build.0 = Release|Any CPU + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|x64.ActiveCfg = Release|x64 + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release|x64.Build.0 = Release|x64 + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release64|Any CPU.ActiveCfg = Release64|Any CPU + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release64|Any CPU.Build.0 = Release64|Any CPU + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release64|x64.ActiveCfg = Release64|x64 + {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB}.Release64|x64.Build.0 = Release64|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/languages/CSharp/XAPI_CSharp/COM/ClassFactoryBase.cs b/languages/CSharp/XAPI_CSharp/COM/ClassFactoryBase.cs new file mode 100644 index 0000000..b64ad36 --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/ClassFactoryBase.cs @@ -0,0 +1,152 @@ +using System; +using System.Runtime.InteropServices; + +namespace XAPI.COM +{ + class ClassFactoryBase : IClassFactory + { + // CoRegisterClassObject() is used to register a Class Factory + // into COM's internal table of Class Factories. + [DllImport("ole32.dll")] + static extern int CoRegisterClassObject([In] ref Guid rclsid, + [MarshalAs(UnmanagedType.IUnknown)] object pUnk, uint dwClsContext, + uint flags, out uint lpdwRegister); + + // Called by an COM EXE Server that can register multiple class objects + // to inform COM about all registered classes, and permits activation + // requests for those class objects. + // This function causes OLE to inform the SCM about all the registered + // classes, and begins letting activation requests into the server process. + [DllImport("ole32.dll")] + static extern int CoResumeClassObjects(); + + // CoRevokeClassObject() is used to unregister a Class Factory + // from COM's internal table of Class Factories. + [DllImport("ole32.dll")] + static extern int CoRevokeClassObject(uint dwRegister); + + public ClassFactoryBase() + { + } + + protected UInt32 m_locked = 0; + protected uint m_ClassContext = (uint)CLSCTX.CLSCTX_LOCAL_SERVER; + protected Guid m_ClassId; + protected uint m_Flags; + protected uint m_Cookie; + + public virtual void virtual_CreateInstance(IntPtr pUnkOuter, ref Guid riid, out IntPtr ppvObject) + { + IntPtr nullPtr = new IntPtr(0); + ppvObject = nullPtr; + } + + public uint ClassContext + { + get + { + return m_ClassContext; + } + set + { + m_ClassContext = value; + } + } + + public Guid ClassId + { + get + { + return m_ClassId; + } + set + { + m_ClassId = value; + } + } + + public uint Flags + { + get + { + return m_Flags; + } + set + { + m_Flags = value; + } + } + + public bool RegisterClassObject() + { + // Register the class factory + int i = CoRegisterClassObject + ( + ref m_ClassId, + this, + ClassContext, + Flags, + out m_Cookie + ); + + if (i == 0) + { + return true; + } + else + { + return false; + } + } + + public bool RevokeClassObject() + { + int i = CoRevokeClassObject(m_Cookie); + + if (i == 0) + { + return true; + } + else + { + return false; + } + } + + public static bool ResumeClassObjects() + { + int i = CoResumeClassObjects(); + + if (i == 0) + { + return true; + } + else + { + return false; + } + } + + #region IClassFactory Implementations + public void CreateInstance(IntPtr pUnkOuter, ref Guid riid, out IntPtr ppvObject) + { + virtual_CreateInstance(pUnkOuter, ref riid, out ppvObject); + } + + public void LockServer(bool bLock) + { + if (bLock) + { + ManagedCOMLocalServer.InterlockedIncrementServerLockCount(); + } + else + { + ManagedCOMLocalServer.InterlockedDecrementServerLockCount(); + } + + // Always attempt to see if we need to shutdown this server application. + ManagedCOMLocalServer.AttemptToTerminateServer(); + } + #endregion + } +} diff --git a/languages/CSharp/XAPI_CSharp/COM/Delegate.cs b/languages/CSharp/XAPI_CSharp/COM/Delegate.cs new file mode 100644 index 0000000..587f579 --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/Delegate.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace XAPI.COM +{ + // 中文问题,以及枚举问题,使用新Class来替代Struct + [ComVisible(false)] + public delegate void DelegateOnConnectionStatus(XApiCom sender, int status, string status_String, RspUserLoginClass userLogin, int size1); + [ComVisible(false)] + public delegate void DelegateOnRtnError(XApiCom sender, ErrorClass error); + [ComVisible(false)] + public delegate void DelegateOnLog(XApiCom sender, LogClass log); + + [ComVisible(false)] + public delegate void DelegateOnRtnDepthMarketData(XApiCom sender, DepthMarketDataNClass marketData); + //public delegate void DelegateOnRtnQuoteRequest(object sender, [In]ref QuoteRequestField quoteRequest); + + [ComVisible(false)] + public delegate void DelegateOnRspQryInstrument(XApiCom sender, InstrumentClass instrument, int size1, bool bIsLast); + [ComVisible(false)] + public delegate void DelegateOnRspQryTradingAccount(XApiCom sender, AccountClass account, int size1, bool bIsLast); + [ComVisible(false)] + public delegate void DelegateOnRspQryInvestorPosition(XApiCom sender, PositionClass position, int size1, bool bIsLast); + [ComVisible(false)] + public delegate void DelegateOnRspQrySettlementInfo(object sender, SettlementInfoClass settlementInfo, int size1, bool bIsLast); + //public delegate void DelegateOnRspQryInvestor(object sender, InvestorField investor, int size1, bool bIsLast); + [ComVisible(false)] + public delegate void DelegateOnRtnOrder(XApiCom sender, OrderClass order); + [ComVisible(false)] + public delegate void DelegateOnRtnTrade(XApiCom sender, TradeClass trade); + //public delegate void DelegateOnRtnQuote(object sender, QuoteField quote); + [ComVisible(false)] + public delegate void DelegateOnRspQryOrder(XApiCom sender, OrderClass order, int size1, bool bIsLast); + [ComVisible(false)] + public delegate void DelegateOnRspQryTrade(XApiCom sender, TradeClass trade, int size1, bool bIsLast); + //public delegate void DelegateOnRspQryQuote(object sender, QuoteField quote, int size1, bool bIsLast); + + //public delegate void DelegateOnRspQryHistoricalTicks(object sender, IntPtr pTicks, int size1, HistoricalDataRequestField request, int size2, bool bIsLast); + //public delegate void DelegateOnRspQryHistoricalBars(object sender, IntPtr pBars, int size1, HistoricalDataRequestField request, int size2, bool bIsLast); + + //public delegate bool DelegateOnFilterSubscribe(object sender, ExchangeType exchange, int instrument_part1, int instrument_part2, int instrument_part3, IntPtr pInstrument); +} diff --git a/languages/CSharp/XAPI_CSharp/COM/GarbageCollection.cs b/languages/CSharp/XAPI_CSharp/COM/GarbageCollection.cs new file mode 100644 index 0000000..2aa11ec --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/GarbageCollection.cs @@ -0,0 +1,63 @@ +using System; +using System.Threading; + +namespace XAPI.COM +{ + /// + /// Summary description for GarbageCollection. + /// + class GarbageCollection + { + protected bool m_bContinueThread; + protected bool m_GCWatchStopped; + protected int m_iInterval; + protected ManualResetEvent m_EventThreadEnded; + + public GarbageCollection(int iInterval) + { + m_bContinueThread = true; + m_GCWatchStopped = false; + m_iInterval = iInterval; + m_EventThreadEnded = new ManualResetEvent(false); + } + + public void GCWatch() + { + Console.WriteLine("GarbageCollection.GCWatch() is now running on another thread."); + // Pause for a moment to provide a delay to make threads more apparent. + while (ContinueThread()) + { + GC.Collect(); + Thread.Sleep(m_iInterval); + } + + Console.WriteLine("Goind to call m_EventThreadEnded.Set()."); + m_EventThreadEnded.Set(); + } + + protected bool ContinueThread() + { + lock(this) + { + return m_bContinueThread; + } + } + + public void StopThread() + { + lock(this) + { + Console.WriteLine("StopThread()."); + m_bContinueThread = false; + } + } + + public void WaitForThreadToStop() + { + Console.WriteLine("WaitForThreadToStop()."); + m_EventThreadEnded.WaitOne(); + m_EventThreadEnded.Reset(); + Console.WriteLine("WaitForThreadToStop() exiting."); + } + } +} diff --git a/languages/CSharp/XAPI_CSharp/COM/IClassFactory.cs b/languages/CSharp/XAPI_CSharp/COM/IClassFactory.cs new file mode 100644 index 0000000..1ddae0d --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/IClassFactory.cs @@ -0,0 +1,19 @@ +using System; +using System.Runtime.InteropServices; + +namespace XAPI.COM +{ + // Interface IClassFactory is here to provide a C# definition of the + // COM IClassFactory interface. + [ + ComImport, // This interface originated from COM. + ComVisible(false), // It is not hard to imagine that this interface must not be exposed to COM. + InterfaceType(ComInterfaceType.InterfaceIsIUnknown), // Indicate that this interface is not IDispatch-based. + Guid("00000001-0000-0000-C000-000000000046") // This GUID is the actual GUID of IClassFactory. + ] + public interface IClassFactory + { + void CreateInstance(IntPtr pUnkOuter, ref Guid riid, out IntPtr ppvObject); + void LockServer(bool fLock); + } +} diff --git a/languages/CSharp/XAPI_CSharp/COM/IXApi.cs b/languages/CSharp/XAPI_CSharp/COM/IXApi.cs new file mode 100644 index 0000000..d3016cb --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/IXApi.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; + +namespace XAPI.COM +{ + [ComVisible(true)] + [Guid("DBCAEFA9-4337-47B8-9B47-66070604CE2C")] + public interface IXApi + { + [DispId(1)] + void SetLibPath(string LibPath); + [DispId(2)] + void SetServerInfo(string key,object value); + [DispId(3)] + void SetUserInfo(string key, object value); + + + [DispId(10)] + void Connect(); + [DispId(11)] + void Disconnect(); + + [DispId(20)] + void Subscribe(string szInstrument, string szExchange); + [DispId(21)] + void Unsubscribe(string szInstrument, string szExchange); + + [DispId(31)] + void NewOrder(); + [DispId(32)] + void SetOrder(string key, object value); + [DispId(33)] + string SendOrder(); + [DispId(34)] + string CancelOrder(string id); + + [DispId(40)] + void NewQuery(); + [DispId(41)] + void SetQuery(string key, object value); + [DispId(42)] + void ReqQuery(string type); + [DispId(50)] + QueueData TryDequeue(); + + [DispId(60)] + void GCCollect(); + } +} diff --git a/languages/CSharp/XAPI_CSharp/COM/IXApiEvents.cs b/languages/CSharp/XAPI_CSharp/COM/IXApiEvents.cs new file mode 100644 index 0000000..522f8b2 --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/IXApiEvents.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace XAPI.COM +{ + /// + /// 将object sender改成XApiCom sender后,在MATLAB下只是OnData事件可以注册后收到消息,而其它的事件都无法直接收到 + /// 如果将OnConnectionStatus这类的事件修改成不带类成员的这种,一些信息又无法传递 + /// + [ComVisible(true)] + [Guid("4D7F9B54-3098-45AE-8EEB-4ED24AC47613")] + [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + public interface IXApiEvents + { + [DispId(2)] + void OnConnectionStatus(XApiCom sender, int status, string status_String, RspUserLoginClass userLogin, int size1); + [DispId(3)] + void OnRtnError(XApiCom sender, ErrorClass error); + [DispId(4)] + void OnLog(XApiCom sender, LogClass log); + + [DispId(5)] + void OnRtnDepthMarketData(XApiCom sender, DepthMarketDataNClass marketData); + //public delegate void DelegateOnRtnQuoteRequest(object sender, [In]ref QuoteRequestField quoteRequest); + + [DispId(6)] + void OnRspQryInstrument(XApiCom sender, InstrumentClass instrument, int size1, bool bIsLast); + [DispId(7)] + void OnRspQryTradingAccount(XApiCom sender, AccountClass account, int size1, bool bIsLast); + [DispId(8)] + void OnRspQryInvestorPosition(XApiCom sender, PositionClass position, int size1, bool bIsLast); + [DispId(9)] + void OnRspQrySettlementInfo(object sender, SettlementInfoClass settlementInfo, int size1, bool bIsLast); + //public delegate void DelegateOnRspQryInvestor(object sender, InvestorField investor, int size1, bool bIsLast); + [DispId(10)] + void OnRtnOrder(XApiCom sender, OrderClass order); + [DispId(11)] + void OnRtnTrade(XApiCom sender, TradeClass trade); + //public delegate void DelegateOnRtnQuote(object sender, QuoteField quote); + [DispId(12)] + void OnRspQryOrder(XApiCom sender, OrderClass order, int size1, bool bIsLast); + [DispId(13)] + void OnRspQryTrade(XApiCom sender, TradeClass trade, int size1, bool bIsLast); + //public delegate void DelegateOnRspQryQuote(object sender, QuoteField quote, int size1, bool bIsLast); + + //public delegate void DelegateOnRspQryHistoricalTicks(object sender, IntPtr pTicks, int size1, HistoricalDataRequestField request, int size2, bool bIsLast); + //public delegate void DelegateOnRspQryHistoricalBars(object sender, IntPtr pBars, int size1, HistoricalDataRequestField request, int size2, bool bIsLast); + + //public delegate bool DelegateOnFilterSubscribe(object sender, ExchangeType exchange, int instrument_part1, int instrument_part2, int instrument_part3, IntPtr pInstrument); + + } +} diff --git a/languages/CSharp/XAPI_CSharp/COM/ManagedCOMLocalServer.cs b/languages/CSharp/XAPI_CSharp/COM/ManagedCOMLocalServer.cs new file mode 100644 index 0000000..6de3b0f --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/ManagedCOMLocalServer.cs @@ -0,0 +1,385 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using Microsoft.Win32; +using System.Text; +using System.Threading; + +namespace XAPI.COM +{ + [Flags] + enum COINIT : uint + { + /// Initializes the thread for multi-threaded object concurrency. + COINIT_MULTITHREADED = 0x0, + /// Initializes the thread for apartment-threaded object concurrency. + COINIT_APARTMENTTHREADED = 0x2, + /// Disables DDE for Ole1 support. + COINIT_DISABLE_OLE1DDE = 0x4, + /// Trades memory for speed. + COINIT_SPEED_OVER_MEMORY = 0x8 + } + + [Flags] + enum CLSCTX : uint + { + CLSCTX_INPROC_SERVER = 0x1, + CLSCTX_INPROC_HANDLER = 0x2, + CLSCTX_LOCAL_SERVER = 0x4, + CLSCTX_INPROC_SERVER16 = 0x8, + CLSCTX_REMOTE_SERVER = 0x10, + CLSCTX_INPROC_HANDLER16 = 0x20, + CLSCTX_RESERVED1 = 0x40, + CLSCTX_RESERVED2 = 0x80, + CLSCTX_RESERVED3 = 0x100, + CLSCTX_RESERVED4 = 0x200, + CLSCTX_NO_CODE_DOWNLOAD = 0x400, + CLSCTX_RESERVED5 = 0x800, + CLSCTX_NO_CUSTOM_MARSHAL= 0x1000, + CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000, + CLSCTX_NO_FAILURE_LOG = 0x4000, + CLSCTX_DISABLE_AAA = 0x8000, + CLSCTX_ENABLE_AAA = 0x10000, + CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000, + CLSCTX_INPROC = CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, + CLSCTX_SERVER = CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER, + CLSCTX_ALL = CLSCTX_SERVER|CLSCTX_INPROC_HANDLER + } + + [Flags] + enum REGCLS : uint + { + REGCLS_SINGLEUSE = 0, + REGCLS_MULTIPLEUSE = 1, + REGCLS_MULTI_SEPARATE = 2, + REGCLS_SUSPENDED = 4, + REGCLS_SURROGATE = 8 + } + + // We import the POINT structure because it is referenced + // by the MSG structure. + [ComVisible(false)] + [StructLayout( LayoutKind.Sequential )] + public struct POINT + { + public int X; + public int Y; + + public POINT( int x, int y ) + { + this.X = x; + this.Y = y; + } + + public static implicit operator Point( POINT p ) + { + return new Point( p.X, p.Y ); + } + + public static implicit operator POINT( Point p ) + { + return new POINT( p.X, p.Y ); + } + } + + // We import the MSG structure because it is referenced + // by the GetMessage(), TranslateMessage() and DispatchMessage() + // Win32 APIs. + [ComVisible(false)] + [StructLayout(LayoutKind.Sequential)] + [CLSCompliant(false)] + public struct MSG + { + public IntPtr hwnd; + public uint message; + public IntPtr wParam; + public IntPtr lParam; + public uint time; + public POINT pt; + } + + // Note that ManagedCOMLocalServer_Impl01 is NOT declared as public. + // This is so that it will not be exposed to COM when we call regasm + // or tlbexp. + class ManagedCOMLocalServer + { + // CoInitializeEx() can be used to set the apartment model + // of individual threads. + [DllImport("ole32.dll")] + static extern int CoInitializeEx(IntPtr pvReserved, uint dwCoInit); + + // CoUninitialize() is used to uninitialize a COM thread. + [DllImport("ole32.dll")] + static extern void CoUninitialize(); + + // PostThreadMessage() allows us to post a Windows Message to + // a specific thread (identified by its thread id). + // We will need this API to post a WM_QUIT message to the main + // thread in order to terminate this application. + [DllImport("user32.dll")] + static extern bool PostThreadMessage(uint idThread, uint Msg, UIntPtr wParam, + IntPtr lParam); + + // GetCurrentThreadId() allows us to obtain the thread id of the + // calling thread. This allows us to post the WM_QUIT message to + // the main thread. + [DllImport("kernel32.dll")] + static extern uint GetCurrentThreadId(); + + // We will be manually performing a Message Loop within the main thread + // of this application. Hence we will need to import GetMessage(), + // TranslateMessage() and DispatchMessage(). + [DllImport("user32.dll")] + static extern bool GetMessage(out MSG lpMsg, IntPtr hWnd, uint wMsgFilterMin, + uint wMsgFilterMax); + + [DllImport("user32.dll")] + static extern bool TranslateMessage([In] ref MSG lpMsg); + + [DllImport("user32.dll")] + static extern IntPtr DispatchMessage([In] ref MSG lpmsg); + + // Define two common GUID objects for public usage. + public static Guid IID_IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}"); + public static Guid IID_IDispatch = new Guid("{00020400-0000-0000-C000-000000000046}"); + + protected static uint m_uiMainThreadId; // Stores the main thread's thread id. + protected static int m_iObjsInUse; // Keeps a count on the total number of objects alive. + protected static int m_iServerLocks;// Keeps a lock count on this application. + + // This property returns the main thread's id. + public static uint MainThreadId + { + get + { + return m_uiMainThreadId; + } + } + + // This method performs a thread-safe incrementation of the objects count. + public static int InterlockedIncrementObjectsCount() + { + Console.WriteLine("InterlockedIncrementObjectsCount()"); + // Increment the global count of objects. + return Interlocked.Increment(ref m_iObjsInUse); + } + + // This method performs a thread-safe decrementation the objects count. + public static int InterlockedDecrementObjectsCount() + { + Console.WriteLine("InterlockedDecrementObjectsCount()"); + // Decrement the global count of objects. + return Interlocked.Decrement(ref m_iObjsInUse); + } + + // Returns the total number of objects alive currently. + public static int ObjectsCount + { + get + { + lock(typeof(ManagedCOMLocalServer)) + { + return m_iObjsInUse; + } + } + } + + // This method performs a thread-safe incrementation the + // server lock count. + public static int InterlockedIncrementServerLockCount() + { + Console.WriteLine("InterlockedIncrementServerLockCount()"); + // Increment the global lock count of this server. + return Interlocked.Increment(ref m_iServerLocks); + } + + // This method performs a thread-safe decrementation the + // server lock count. + public static int InterlockedDecrementServerLockCount() + { + Console.WriteLine("InterlockedDecrementServerLockCount()"); + // Decrement the global lock count of this server. + return Interlocked.Decrement(ref m_iServerLocks); + } + + // Returns the current server lock count. + public static int ServerLockCount + { + get + { + lock(typeof(ManagedCOMLocalServer)) + { + return m_iServerLocks; + } + } + } + + // AttemptToTerminateServer() will check to see if + // the objects count and the server lock count has + // both dropped to zero. + // If so, we post a WM_QUIT message to the main thread's + // message loop. This will cause the message loop to + // exit and hence the termination of this application. + public static void AttemptToTerminateServer() + { + lock(typeof(ManagedCOMLocalServer)) + { + Console.WriteLine("AttemptToTerminateServer()"); + + // Get the most up-to-date values of these critical data. + int iObjsInUse = ObjectsCount; + int iServerLocks = ServerLockCount; + + // Print out these info for debug purposes. + StringBuilder sb = new StringBuilder(""); + sb.AppendFormat("m_iObjsInUse : {0}. m_iServerLocks : {1}", iObjsInUse, iServerLocks); + Console.WriteLine(sb.ToString()); + + if ((iObjsInUse > 0) || (iServerLocks > 0)) + { + Console.WriteLine("There are still referenced objects or the server lock count is non-zero."); + } + else + { + UIntPtr wParam = new UIntPtr(0); + IntPtr lParam = new IntPtr(0); + Console.WriteLine("PostThreadMessage(WM_QUIT)"); + PostThreadMessage(MainThreadId, 0x0012, wParam, lParam); + } + } + } + + // ProcessArguments() will process the command-line arguments + // of this application. + // If the return value is true, we carry + // on and start this application. + // If the return value is false, we terminate + // this application immediately. + protected static bool ProcessArguments(string[] args) + { + bool bRet = true; + + if (args.Length > 0) + { + RegistryKey key = null; + RegistryKey key2 = null; + + switch (args[0].ToLower()) + { + case "-embedding": + Console.WriteLine("Request to start as out-of-process COM server."); + break; + + case "-register": + case "/register": + try + { + key = Registry.ClassesRoot.CreateSubKey("CLSID\\" + Marshal.GenerateGuidForType(typeof(XApiCom)).ToString("B")); + key2 = key.CreateSubKey("LocalServer32"); + key2.SetValue(null, Application.ExecutablePath); + } + catch (Exception ex) + { + MessageBox.Show("Error while registering the server:\n"+ex.ToString()); + } + finally + { + if (key != null) + key.Close(); + if (key2 != null) + key2.Close(); + } + bRet = false; + break; + + case "-unregister": + case "/unregister": + try + { + key = Registry.ClassesRoot.OpenSubKey("CLSID\\" + Marshal.GenerateGuidForType(typeof(XApiCom)).ToString("B"), true); + key.DeleteSubKey("LocalServer32"); + } + catch (Exception ex) + { + MessageBox.Show("Error while unregistering the server:\n"+ex.ToString()); + } + finally + { + if (key != null) + key.Close(); + if (key2 != null) + key2.Close(); + } + bRet = false; + break; + + default: + Console.WriteLine("Unknown argument: " + args[0] + "\nValid are : -register, -unregister and -embedding"); + break; + } + } + + return bRet; + } + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { + if (!ProcessArguments(args)) + { + return; + } + + // Initialize critical member variables. + m_iObjsInUse = 0; + m_iServerLocks = 0; + m_uiMainThreadId = GetCurrentThreadId(); + + // Register the SimpleCOMObjectClassFactory. + SimpleCOMObjectClassFactory factory = new SimpleCOMObjectClassFactory(); + factory.ClassContext = (uint)CLSCTX.CLSCTX_LOCAL_SERVER; + factory.ClassId = Marshal.GenerateGuidForType(typeof(XApiCom)); + factory.Flags = (uint)REGCLS.REGCLS_MULTIPLEUSE | (uint)REGCLS.REGCLS_SUSPENDED; + factory.RegisterClassObject(); + ClassFactoryBase.ResumeClassObjects(); + + // Start up the garbage collection thread. + GarbageCollection GarbageCollector = new GarbageCollection(10000); + Thread GarbageCollectionThread = new Thread(new ThreadStart(GarbageCollector.GCWatch)); + + // Set the name of the thread object. + GarbageCollectionThread.Name = "Garbage Collection Thread"; + // Start the thread. + GarbageCollectionThread.Start(); + + // Start the message loop. + MSG msg; + IntPtr null_hwnd = new IntPtr(0); + while (GetMessage(out msg, null_hwnd, 0, 0) != false) + { + TranslateMessage(ref msg); + DispatchMessage(ref msg); + } + Console.WriteLine("Out of message loop."); + + // Revoke the class factory immediately. + // Don't wait until the thread has stopped before + // we perform revokation. + factory.RevokeClassObject(); + Console.WriteLine("SimpleCOMObjectClassFactory Revoked."); + + // Now stop the Garbage Collector thread. + GarbageCollector.StopThread(); + GarbageCollector.WaitForThreadToStop(); + Console.WriteLine("GarbageCollector thread stopped."); + + // Just an indication that this COM EXE Server is stopped. + Console.WriteLine("Press [ENTER] to exit."); + Console.ReadLine(); + } + } +} diff --git a/languages/CSharp/XAPI_CSharp/COM/SimpleCOMObject.cs b/languages/CSharp/XAPI_CSharp/COM/SimpleCOMObject.cs new file mode 100644 index 0000000..a959c89 --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/SimpleCOMObject.cs @@ -0,0 +1,81 @@ +using System; +using System.Diagnostics; +using System.Text; +using System.Windows.Forms; // For using MessageBox. +using Interop.SimpleCOMObject; // In order to implement ISimpleCOMObject. +using System.Runtime.InteropServices; // For use of the GuidAttribute, ProgIdAttribute and ClassInterfaceAttribute. + +namespace XAPI.COM +{ + /// + /// Summary description for SimpleCOMObject. + /// This is the class that will be exported to unmanaged COM client apps. + /// + [ + Guid("E1FE1223-45C2-4872-9B1E-634FB850E753"), // We indicate a specific CLSID for "ManagedCOMLocalServer_Impl01.SimpleCOMObject" for convenience of searching the registry. + ProgId("ManagedCOMLocalServer_Impl01.SimpleCOMObject"), // This ProgId is used by default. Not 100% necessary. + ClassInterface(ClassInterfaceType.None) // Specify that we will not generate any additional interface with a name like _SimpleCOMObject. + ] + public class SimpleCOMObject : + ReferenceCountedObjectBase, // SimpleCOMObject is derived from ReferenceCountedObjectBase so that we can track its creation and destruction. + ISimpleCOMObject // SimpleCOMObject must implement the ISimpleCOMObject interface. + { + private int m_iLongProperty; + + public SimpleCOMObject() + { + // ReferenceCountedObjectBase constructor will be invoked. + Console.WriteLine("SimpleCOMObject constructor."); + } + + ~SimpleCOMObject() + { + // ReferenceCountedObjectBase destructor will be invoked. + Console.WriteLine("SimpleCOMObject destructor."); + } + + public int LongProperty + { + get + { + return m_iLongProperty; + } + + set + { + m_iLongProperty = value; + } + } + + public void Method01 (String strMessage) + { + StringBuilder sb = new StringBuilder(strMessage); + + sb.Append(LongProperty.ToString()); + + MessageBox.Show(sb.ToString(), "ManagedCOMLocalServer_Impl01.SimpleCOMObject"); + } + } + + //class SimpleCOMObjectClassFactory : ClassFactoryBase + //{ + // public override void virtual_CreateInstance(IntPtr pUnkOuter, ref Guid riid, out IntPtr ppvObject) + // { + // Console.WriteLine("SimpleCOMObjectClassFactory.CreateInstance()."); + // Console.WriteLine("Requesting Interface : " + riid.ToString()); + + // if (riid == Marshal.GenerateGuidForType(typeof(ISimpleCOMObject)) || + // riid == ManagedCOMLocalServer.IID_IDispatch || + // riid == ManagedCOMLocalServer.IID_IUnknown) + // { + // SimpleCOMObject SimpleCOMObject_New = new SimpleCOMObject(); + + // ppvObject = Marshal.GetComInterfaceForObject(SimpleCOMObject_New, typeof(ISimpleCOMObject)); + // } + // else + // { + // throw new COMException("No interface", unchecked((int) 0x80004002)); + // } + // } + //} +} diff --git a/languages/CSharp/XAPI_CSharp/COM/Struct.cs b/languages/CSharp/XAPI_CSharp/COM/Struct.cs new file mode 100644 index 0000000..cb9ae10 --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/Struct.cs @@ -0,0 +1,702 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + + +namespace XAPI.COM +{ + ///持仓 + [ComVisible(true)] + [Guid("07C1DA6E-A85E-4931-ABE6-03681A3DBB0B")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class PositionClass + { + public string InstrumentName; + public string Symbol; + public string InstrumentID; + public string ExchangeID; + public string ClientID; + public string AccountID; + + public int Side; + public string Side_String; + public int HedgeFlag; + public string HedgeFlag_String; + public int Date; + public double PositionCost; + + public double Position; + public double TodayPosition; + public double HistoryPosition; + public double HistoryFrozen; + + ///今日买卖持仓 + public double TodayBSPosition; + ///今日买卖持仓冻结 + public double TodayBSFrozen; + ///今日申赎持仓 + public double TodayPRPosition; + ///今日申赎持仓冻结 + public double TodayPRFrozen; + + public string ID; + + public string PortfolioID1; + public string PortfolioID2; + public string PortfolioID3; + + public int Business; + public string Business_String; + } + + /// + /// 做市商双向报价 + /// + [ComVisible(false)] + [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] + public struct QuoteField + { + public byte[] InstrumentName; + public string Symbol; + public string InstrumentID; + public string ExchangeID; + public string ClientID; + public string AccountID; + + + public double AskQty; + public double AskPrice; + public OpenCloseType AskOpenClose; + public HedgeFlagType AskHedgeFlag; + + public double BidQty; + public double BidPrice; + public OpenCloseType BidOpenClose; + public HedgeFlagType BidHedgeFlag; + + public OrderStatus Status; + public ExecType ExecType; + + + public string QuoteReqID; + public string LocalID; + public string ID; + public string AskID; + public string BidID; + public string AskOrderID; + public string BidOrderID; + + public int XErrorID; + public int RawErrorID; + public byte[] Text; + } + + /// + /// 订单信息 + /// + [ComVisible(true)] + [Guid("23FC4E48-54FF-4A89-B924-B8668C5D9570")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class OrderClass + { + public string InstrumentName; + public string Symbol; + public string InstrumentID; + public string ExchangeID; + public string ClientID; + public string AccountID; + + + public int Side; + public string Side_String; + public double Qty; + public double Price; + public int OpenClose; + public string OpenClose_String; + public int HedgeFlag; + public string HedgeFlag_String; + public int Date; + public int Time; + + + public string ID; + public string OrderID; + public string LocalID; + + + public int Type; + public string Type_String; + public double StopPx; + public int TimeInForce; + public string TimeInForce_String; + + public int Status; + public string Status_String; + public int ExecType; + public string ExecType_String; + public double LeavesQty; + public double CumQty; + public double AvgPx; + + public int XErrorID; + public int RawErrorID; + public string Text; + + public int ReserveInt32; + public string ReserveChar64; + + public string PortfolioID1; + public string PortfolioID2; + public string PortfolioID3; + + public int Business; + public string Business_String; + } + + /// + /// 成交回报 + /// + [ComVisible(true)] + [Guid("9FF68AA1-CB14-49E5-91F9-856400663C5E")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class TradeClass + { + public string InstrumentName; + public string Symbol; + public string InstrumentID; + public string ExchangeID; + public string ClientID; + public string AccountID; + + public int Side; + public string Side_String; + public double Qty; + public double Price; + public int OpenClose; + public string OpenClose_String; + public int HedgeFlag; + public string HedgeFlag_String; + public int Date; + public int Time; + + + public string ID; + public string TradeID; + + public double Commission; + + public int ReserveInt32; + public string ReserveChar64; + + + public string PortfolioID1; + public string PortfolioID2; + public string PortfolioID3; + + public int Business; + public string Business_String; + } + + + /// + /// 错误信息 + /// + [ComVisible(true)] + [Guid("5F68D385-04A7-4247-8C07-839C6CE68EFF")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class ErrorClass + { + /// + /// 错误代码 + /// + public int XErrorID; + /// + /// 错误代码 + /// + public int RawErrorID; + /// + /// 错误信息 + /// + public string Text; + /// + /// 信息来源 + /// + public string Source; + } + + + /// + /// 日志信息 + /// + [ComVisible(true)] + [Guid("4A4FDEFA-AEA6-496E-AE92-F00FD28A2075")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class LogClass + { + /// + /// 日志级别 + /// + public int Level; + public string Level_String; + /// + /// 错误信息 + /// + public string Message; + } + + + [ComVisible(true)] + [Guid("D642BDD2-8BB7-4BC9-BDC4-29CF05D1EAD4")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class RspUserLoginClass + { + public int TradingDay; + public int LoginTime; + public string SessionID; + public string UserID; + public string AccountID; + public string InvestorName; + public int XErrorID; + public int RawErrorID; + public string Text; + } + + + + /// + /// DepthField行情 + /// + [ComVisible(true)] + [Guid("6A9597AE-9AB2-4C48-8A96-F386DBCD8AB6")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class DepthClass + { + public double Price; + public int Size; + public int Count; + } + + + /// + /// 合约信息 + /// + [ComVisible(true)] + [Guid("37ED5322-1C11-477A-AC97-F947AD8532B2")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class InstrumentClass + { + public string InstrumentName; + public string Symbol; + public string InstrumentID; + public string ExchangeID; + public string ClientID; + public string AccountID; + + + public string ExchangeInstID; + + + /// + /// 类型 + /// + public int Type; + public string Type_String; + /// + /// 合约数量乘数 + /// + public int VolumeMultiple; + /// + /// 最小变动价位 + /// + public double PriceTick; + /// + /// 到期日 + /// + public int ExpireDate; + + /// + /// 执行价 + /// + public double StrikePrice; + /// + /// 期权类型 + /// + public int OptionsType; + public string OptionsType_String; + /// + /// 产品代码 + /// + public string ProductID; + /// + /// 基础商品代码 + /// + public string UnderlyingInstrID; + ///合约生命周期状态 + public int InstLifePhase; + public string InstLifePhase_String; + } + + /// + /// 账号 + /// + [ComVisible(true)] + [Guid("6A75FF0C-C78F-4805-96AB-0FB4AF196152")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class AccountClass + { + public string ClientID; + public string AccountID; + public string CurrencyID; + /// + /// 上次结算准备金 + /// + public double PreBalance; + /// + /// 当前保证金总额 + /// + public double CurrMargin; + /// + /// 平仓盈亏 + /// + public double CloseProfit; + /// + /// 持仓盈亏 + /// + public double PositionProfit; + /// + /// 期货结算准备金 + /// + public double Balance; + /// + /// 可用资金 + /// + public double Available; + /// + /// 入金金额 + /// + public double Deposit; + /// + /// 出金金额 + /// + public double Withdraw; + /// + /// 可取资金 + /// + public double WithdrawQuota; + /// + /// 冻结的过户费 + /// + public double FrozenTransferFee; + /// + /// 冻结的印花税 + /// + public double FrozenStampTax; + /// + /// 冻结的手续费 + /// + public double FrozenCommission; + /// + /// 冻结的资金 + /// + public double FrozenCash; + /// + /// 过户费 + /// + public double TransferFee; + /// + /// 印花税 + /// + public double StampTax; + /// + /// 手续费 + /// + public double Commission; + /// + /// 资金差额 + /// + public double CashIn; + } + + + + /// + /// 发给做市商的询价请求 + /// + [ComVisible(false)] + [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] + public struct QuoteRequestField + { + /// + /// 合约代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] + public string Symbol; + /// + /// 合约代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] + public string InstrumentID; + /// + /// 交易所代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 9)] + public string ExchangeID; + /// + /// 交易日 + /// + public int TradingDay; + /// + /// 询价时间 + /// + public int QuoteTime; + + /// + /// 询价编号 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] + public string QuoteID; + } + + + [ComVisible(true)] + [Guid("E08904CE-0E96-48B5-9D87-F4C5ACE3E560")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class SettlementInfoClass + { + /// + /// 交易日 + /// + public int TradingDay; + ///// + ///// 消息正文 + ///// + public string Content; + } + + /// + /// 投资者 + /// + [ComVisible(false)] + [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] + public struct InvestorField + { + public string InvestorID; + public string BrokerID; + public int IdentifiedCardType; + public string IdentifiedCardType_String; + public string IdentifiedCardNo; + public string InvestorName; + } + + + //[ComVisible(false)] + //[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] + //public struct OrderIDType + //{ + // public string ID; + //} + + + [ComVisible(true)] + [Guid("734AF40E-D336-4C0C-A8B7-C7DB9C7FF726")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class DepthMarketDataNClass + { + public int TradingDay; + public int ActionDay; + public int UpdateTime; + public int UpdateMillisec; + public string Symbol; + public string InstrumentID; + public string ExchangeID; + + /// + /// 交易所代码 + /// + public int Exchange; + + + /// + /// 最新价 + /// + public double LastPrice; + /// + /// 数量 + /// + public double Volume; + /// + /// 成交金额 + /// + public double Turnover; + /// + /// 持仓量 + /// + public double OpenInterest; + /// + /// 当日均价 + /// + public double AveragePrice; + + + /// + /// 今开盘 + /// + public double OpenPrice; + /// + /// 最高价 + /// + public double HighestPrice; + /// + /// 最低价 + /// + public double LowestPrice; + /// + /// 今收盘 + /// + public double ClosePrice; + /// + /// 本次结算价 + /// + public double SettlementPrice; + + /// + /// 涨停板价 + /// + public double UpperLimitPrice; + /// + /// 跌停板价 + /// + public double LowerLimitPrice; + /// + /// 昨收盘 + /// + public double PreClosePrice; + /// + /// 上次结算价 + /// + public double PreSettlementPrice; + /// + /// 昨持仓量 + /// + public double PreOpenInterest; + + ///交易阶段类型 + public int TradingPhase; + public string TradingPhase_String; + + + public double AskPrice1; + public int AskSize; + public double BidPrice1; + public int BidSize; + } + + + + + + + + + + + + + + + + /// + /// Tick行情 + /// + [ComVisible(false)] + [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] + public struct TickField + { + public int Date; + public int Time; + public int Millisecond; + + public double LastPrice; + public double Volume; + public double OpenInterest; + public double BidPrice1; + public double AskPrice1; + public int BidSize1; + public int AskSize1; + } + + /// + /// Bar行情 + /// + [ComVisible(false)] + [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] + public struct BarField + { + public int Date; + public int Time; + + public double Open; + public double High; + public double Low; + public double Close; + public double Volume; + public double OpenInterest; + public double Turnover; + } + + + + /// + /// 合约信息 + /// + [ComVisible(false)] + [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] + public struct HistoricalDataRequestField + { + public int Date1; + public int Date2; + public int Time1; + public int Time2; + + public DataObjetType DataType; + public BarType BarType; + public int BarSize; + + public int RequestId; + public int CurrentDate; + public int lRequest; + + /// + /// 合约代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] + public string Symbol; + /// + /// 合约代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] + public string InstrumentID; + /// + /// 交易所代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 9)] + public string ExchangeID; + } + + [ComVisible(true)] + [Guid("42AB7905-CC91-480A-AEF0-FF8795872FF4")] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class QueueData + { + public int Type; + public string Type_String; + public object Sender; + public object Data1; + public object Data2; + public object Data3; + public object Data4; + } + +} diff --git a/languages/CSharp/XAPI_CSharp/COM/XApiCom.cs b/languages/CSharp/XAPI_CSharp/COM/XApiCom.cs new file mode 100644 index 0000000..7d97cb6 --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/XApiCom.cs @@ -0,0 +1,961 @@ +using Ideafixxxer.Generics; +using XAPI.Callback; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +//using System.EnterpriseServices; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using Microsoft.Win32; + +namespace XAPI.COM +{ + [ComVisible(true)] + [Guid("825E3182-8444-4580-8A8C-965485FBF451")] + [ClassInterface(ClassInterfaceType.None)] + [ComSourceInterfaces(typeof(IXApiEvents))] + [ProgId("XAPI.COM")] + //[EventTrackingEnabled(true)] + //[Description("Interface Serviced Component")] + public class XApiCom : UserControl,/*ServicedComponent,*/ IXApi, + IObjectSafety // implement IObjectSafety to supress the unsafe for scripting + // warning message + { + #region Constants + // Constants for implementation of the IObjectSafety interface. + private const int INTERFACESAFE_FOR_UNTRUSTED_CALLER = 0x00000001; + private const int INTERFACESAFE_FOR_UNTRUSTED_DATA = 0x00000002; + private Label label1; + private const int S_OK = 0; + #endregion + + #region IObjectSafety Methods + public int GetInterfaceSafetyOptions(ref Guid riid, out int pdwSupportedOptions, out int pdwEnabledOptions) + { + pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA; + pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA; + return S_OK; // return S_OK + } + + public int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionSetMask, int dwEnabledOptions) + { + return S_OK; // return S_OK + } + #endregion + + public event DelegateOnConnectionStatus OnConnectionStatus; + public event DelegateOnRtnError OnRtnError; + public event DelegateOnLog OnLog; + public event DelegateOnRtnDepthMarketData OnRtnDepthMarketData; + public event DelegateOnRspQryInstrument OnRspQryInstrument; + public event DelegateOnRspQryTradingAccount OnRspQryTradingAccount; + public event DelegateOnRspQryInvestorPosition OnRspQryInvestorPosition; + public event DelegateOnRspQrySettlementInfo OnRspQrySettlementInfo; + public event DelegateOnRtnOrder OnRtnOrder; + public event DelegateOnRtnTrade OnRtnTrade; + public event DelegateOnRspQryOrder OnRspQryOrder; + public event DelegateOnRspQryTrade OnRspQryTrade; + + private readonly ConcurrentQueue MessageQueue; + + private readonly XApi api; + private ServerInfoField _Server; + private UserInfoField _User; + private OrderField _Order; + private ReqQueryField _Query; + + //private static int cookie; + //private static RegistrationServices msRegSvc = new RegistrationServices(); + + // http://www.codeproject.com/Articles/24089/Create-ActiveX-in-NET-Step-by-Step + // http://www.codeproject.com/Articles/1256/Exposing-Windows-Forms-Controls-as-ActiveX-control + /// + ///Register the class as a control and set its CodeBase entry + /// + ///The registry key of the control + [ComRegisterFunction()] + public static void RegisterClass(string key) + { + // Strip off HKEY_CLASSES_ROOT\ from the passed key as I don't need it + StringBuilder sb = new StringBuilder(key); + sb.Replace(@"HKEY_CLASSES_ROOT\", ""); + + // Open the CLSID\{guid} key for write access + RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true); + + // And create the 'Control' key - this allows it to show up in + // the ActiveX control container + RegistryKey ctrl = k.CreateSubKey("Control"); + ctrl.Close(); + + // Next create the CodeBase entry - needed if not string named and GACced. + RegistryKey inprocServer32 = k.OpenSubKey("InprocServer32", true); + inprocServer32.SetValue("CodeBase", Assembly.GetExecutingAssembly().CodeBase); + inprocServer32.Close(); + + // 是否有必要将InprocServer32给删了来支持进程外呢? + RegistryKey localServer32 = k.CreateSubKey("LocalServer32"); + localServer32.SetValue("", Assembly.GetExecutingAssembly().Location); + inprocServer32.Close(); + + // Finally close the main key + k.Close(); + } + + /// + ///Called to unregister the control + /// + ///The registry key + [ComUnregisterFunction()] + public static void UnregisterClass(string key) + { + StringBuilder sb = new StringBuilder(key); + sb.Replace(@"HKEY_CLASSES_ROOT\", ""); + + // Open HKCR\CLSID\{guid} for write access + RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true); + + // Delete the 'Control' key, but don't throw an exception if it does not exist + k.DeleteSubKey("Control", false); + + // Next open up InprocServer32 + RegistryKey inprocServer32 = k.OpenSubKey("InprocServer32", true); + + // And delete the CodeBase key, again not throwing if missing + k.DeleteSubKey("CodeBase", false); + + // Finally close the main key + k.Close(); + } + + public XApiCom() + { + MessageQueue = new ConcurrentQueue(); + + api = new XApi(); + + api.OnConnectionStatus = OnConnectionStatus_callback; + api.OnRtnError = OnRtnError_callback; + api.OnLog = OnLog_callback; + + api.OnRtnDepthMarketData = OnRtnDepthMarketData_callback; + //base.OnRtnQuoteRequest = OnRtnQuoteRequest_callback; + + api.OnRspQryInstrument = OnRspQryInstrument_callback; + api.OnRspQryTradingAccount = OnRspQryTradingAccount_callback; + api.OnRspQryInvestorPosition = OnRspQryInvestorPosition_callback; + api.OnRspQrySettlementInfo = OnRspQrySettlementInfo_callback; + + api.OnRspQryOrder = OnRspQryOrder_callback; + api.OnRspQryTrade = OnRspQryTrade_callback; + //base.OnRspQryQuote = OnRspQryQuote_callback; + + api.OnRtnOrder = OnRtnOrder_callback; + api.OnRtnTrade = OnRtnTrade_callback; + //base.OnRtnQuote = OnRtnQuote_callback; + + //base.OnRspQryHistoricalTicks = OnRspQryHistoricalTicks_callback; + //base.OnRspQryHistoricalBars = OnRspQryHistoricalBars_callback; + + //base.OnRspQryInvestor = OnRspQryInvestor_callback; + + InitializeComponent(); + + + Console.WriteLine("ReferenceCountedObjectBase contructor."); + // We increment the global count of objects. + ManagedCOMLocalServer.InterlockedIncrementObjectsCount(); + } + + ~XApiCom() + { + Console.WriteLine("ReferenceCountedObjectBase destructor."); + // We decrement the global count of objects. + ManagedCOMLocalServer.InterlockedDecrementObjectsCount(); + // We then immediately test to see if we the conditions + // are right to attempt to terminate this server application. + ManagedCOMLocalServer.AttemptToTerminateServer(); + } + + public void SetLibPath(string LibPath) + { + api.LibPath = LibPath; + } + + public void SetServerInfo(string key, object value) + { + Type type = typeof(ServerInfoField); + FieldInfo field = type.GetField(key,BindingFlags.Public | BindingFlags.Instance); + if (field == null) + { + throw new ArgumentException(key +" is not exist!", key); + } + try + { + object obj = Helper.ChangeType(value, field.FieldType); + field.SetValue(_Server, obj); + } + catch(Exception ex) + { + throw new InvalidCastException(ex.Message); + } + } + + public void SetUserInfo(string key, object value) + { + Type type = typeof(UserInfoField); + FieldInfo field = type.GetField(key, BindingFlags.Public | BindingFlags.Instance); + if (field == null) + { + throw new ArgumentException(key + " is not exist!", key); + } + try + { + object obj = Helper.ChangeType(value, field.FieldType); + field.SetValue(_User, obj); + } + catch (Exception ex) + { + throw new InvalidCastException(ex.Message); + } + } + + public void Connect() + { + api.Server = _Server; + api.User = _User; + api.Connect(); + } + + public void Disconnect() + { + api.Disconnect(); + } + + public void Subscribe(string szInstrument, string szExchange) + { + api.Subscribe(szInstrument, szExchange); + } + + public void Unsubscribe(string szInstrument, string szExchange) + { + api.Unsubscribe(szInstrument, szExchange); + } + + public void NewOrder() + { + _Order = default(OrderField); + } + public void SetOrder(string key, object value) + { + Type type = typeof(OrderField); + FieldInfo field = type.GetField(key, BindingFlags.Public | BindingFlags.Instance); + if (field == null) + { + throw new ArgumentException(key + " is not exist!", key); + } + try + { + object obj = Helper.ChangeType(value, field.FieldType); + field.SetValue(_Order, obj); + } + catch (Exception ex) + { + throw new InvalidCastException(ex.Message); + } + } + + public string SendOrder() + { + return api.SendOrder(_Order); + } + public string CancelOrder(string id) + { + return api.CancelOrder(id); + } + + public void NewQuery() + { + _Query = default(ReqQueryField); + } + public void SetQuery(string key, object value) + { + Type type = typeof(ReqQueryField); + FieldInfo field = type.GetField(key, BindingFlags.Public | BindingFlags.Instance); + if (field == null) + { + throw new ArgumentException(key + " is not exist!", key); + } + try + { + object obj = Helper.ChangeType(value, field.FieldType); + field.SetValue(_Query, obj); + } + catch (Exception ex) + { + throw new InvalidCastException(ex.Message); + } + } + + public void ReqQuery(string type) + { + QueryType obj = Enum.Parse(type); + api.ReqQuery(obj, _Query); + } + + public QueueData TryDequeue() + { + QueueData qd; + if (MessageQueue.TryDequeue(out qd)) + { + return qd; + } + return null; + } + + /// + /// 给COM使用,进行内存回收 + /// + public void GCCollect() + { + api.GCCollect(); + } + + private void OnConnectionStatus_callback(object sender, XAPI.ConnectionStatus status, [In] ref RspUserLoginField userLogin, int size1) + { + RspUserLoginClass cls = new RspUserLoginClass(); + + if (size1 > 0) + { + RspUserLoginField field = userLogin; + + cls.TradingDay = field.TradingDay; + cls.LoginTime = field.LoginTime; + cls.SessionID = field.SessionID; + cls.UserID = field.UserID; + cls.AccountID = field.AccountID; + cls.InvestorName = field.InvestorName(); + cls.XErrorID = field.XErrorID; + cls.RawErrorID = field.RawErrorID; + cls.Text = field.Text(); + } + + if (null == OnConnectionStatus) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnConnectionStatus; + qd.Type_String = Enum.ToString(ResponseType.OnConnectionStatus); + qd.Sender = this; + qd.Data1 = status; + qd.Data2 = Enum.ToString(status); + qd.Data3 = cls; + qd.Data4 = size1; + + MessageQueue.Enqueue(qd); + } + else + { + OnConnectionStatus(this, (int)status, Enum.ToString(status), cls, size1); + } + } + + private void OnRtnError_callback(object sender, [In] ref ErrorField error) + { + ErrorClass cls = null; + + cls = new ErrorClass(); + ErrorField field = error; + + cls.XErrorID = field.XErrorID; + cls.RawErrorID = field.RawErrorID; + cls.Text = field.Text(); + cls.Source = field.Source; + + if (null == OnRtnError) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRtnError; + qd.Type_String = Enum.ToString(ResponseType.OnRtnError); + qd.Sender = this; + qd.Data1 = cls; + + MessageQueue.Enqueue(qd); + } + else + { + OnRtnError(this, cls); + } + } + + private void OnLog_callback(object sender, [In] ref LogField log) + { + LogClass cls = null; + + cls = new LogClass(); + LogField field = log; + + cls.Level = (int)field.Level; + cls.Level_String = Enum.ToString(field.Level); + cls.Message = field.Message(); + + if (null == OnLog) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnLog; + qd.Type_String = Enum.ToString(ResponseType.OnLog); + qd.Sender = this; + qd.Data1 = cls; + + MessageQueue.Enqueue(qd); + } + else + { + OnLog(this, cls); + } + } + + private void OnRtnDepthMarketData_callback(object sender, [In] ref XAPI.DepthMarketDataNClass marketData) + { + DepthMarketDataNClass cls = new DepthMarketDataNClass(); + XAPI.DepthMarketDataNClass field = marketData; + + cls.TradingDay = field.TradingDay; + cls.ActionDay = field.ActionDay; + cls.UpdateTime = field.UpdateTime; + cls.UpdateMillisec = field.UpdateMillisec; + cls.Exchange = (int)field.Exchange; + cls.Symbol = field.Symbol; + cls.InstrumentID = field.InstrumentID; + cls.ExchangeID = field.ExchangeID; + cls.LastPrice = field.LastPrice; + cls.Volume = field.Volume; + cls.Turnover = field.Turnover; + cls.OpenInterest = field.OpenInterest; + cls.AveragePrice = field.AveragePrice; + cls.OpenPrice = field.OpenPrice; + cls.HighestPrice = field.HighestPrice; + cls.LowestPrice = field.LowestPrice; + cls.ClosePrice = field.ClosePrice; + cls.SettlementPrice = field.SettlementPrice; + cls.UpperLimitPrice = field.UpperLimitPrice; + cls.LowerLimitPrice = field.LowerLimitPrice; + cls.PreClosePrice = field.PreClosePrice; + cls.PreSettlementPrice = field.PreSettlementPrice; + cls.PreOpenInterest = field.PreOpenInterest; + cls.TradingPhase = (int)field.TradingPhase; + cls.TradingPhase_String = Enum.ToString(field.TradingPhase); + + if (field.Bids != null && field.Bids.Length > 0) + { + cls.BidPrice1 = field.Bids[0].Price; + cls.BidSize = field.Bids[0].Size; + } + + if (field.Asks != null && field.Asks.Length > 0) + { + cls.AskPrice1 = field.Asks[0].Price; + cls.AskSize = field.Asks[0].Size; + } + + if (null == OnRtnDepthMarketData) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRtnDepthMarketData; + qd.Type_String = Enum.ToString(ResponseType.OnRtnDepthMarketData); + qd.Sender = this; + qd.Data1 = cls; + + MessageQueue.Enqueue(qd); + } + else + { + OnRtnDepthMarketData(this, cls); + } + } + + private void OnRtnOrder_callback(object sender, [In] ref OrderField order) + { + OrderField field = order; + + OrderClass cls = new OrderClass(); + + cls.InstrumentName = field.InstrumentName(); + cls.Symbol = field.Symbol; + cls.InstrumentID = field.InstrumentID; + cls.ExchangeID = field.ExchangeID; + cls.ClientID = field.ClientID; + cls.AccountID = field.AccountID; + cls.Side = (int)field.Side; + cls.Side_String = Enum.ToString(field.Side); + cls.Qty = field.Qty; + cls.Price = field.Price; + cls.OpenClose = (int)field.OpenClose; + cls.OpenClose_String = Enum.ToString(field.OpenClose); + cls.HedgeFlag = (int)field.HedgeFlag; + cls.HedgeFlag_String = Enum.ToString(field.HedgeFlag); + cls.Date = field.Date; + cls.Time = field.Time; + cls.ID = field.ID; + cls.OrderID = field.OrderID; + cls.LocalID = field.LocalID; + cls.Type = (int)field.Type; + cls.Type_String = Enum.ToString(field.Type); + cls.StopPx = field.StopPx; + cls.TimeInForce = (int)field.TimeInForce; + cls.TimeInForce_String = Enum.ToString(field.TimeInForce); + cls.Status = (int)field.Status; + cls.Status_String = Enum.ToString(field.Status); + cls.ExecType = (int)field.ExecType; + cls.ExecType_String = Enum.ToString(field.ExecType); + cls.LeavesQty = field.LeavesQty; + cls.CumQty = field.CumQty; + cls.AvgPx = field.AvgPx; + cls.XErrorID = field.XErrorID; + cls.RawErrorID = field.RawErrorID; + cls.Text = field.Text(); + cls.ReserveInt32 = field.ReserveInt32; + cls.ReserveChar64 = field.ReserveChar64; + + cls.PortfolioID1 = field.PortfolioID1; + cls.PortfolioID2 = field.PortfolioID2; + cls.PortfolioID3 = field.PortfolioID3; + cls.Business = (int)field.Business; + cls.Business_String = Enum.ToString(field.Business); + + if (null == OnRtnOrder) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRtnOrder; + qd.Type_String = Enum.ToString(ResponseType.OnRtnOrder); + qd.Sender = this; + qd.Data1 = cls; + + MessageQueue.Enqueue(qd); + } + else + { + OnRtnOrder(this, cls); + } + } + + private void OnRtnTrade_callback(object sender, [In] ref TradeField trade) + { + if (null == OnRtnTrade) + return; + + TradeField field = trade; + + TradeClass cls = new TradeClass(); + + cls.InstrumentName = field.InstrumentName(); + cls.Symbol = field.Symbol; + cls.InstrumentID = field.InstrumentID; + cls.ExchangeID = field.ExchangeID; + cls.ClientID = field.ClientID; + cls.AccountID = field.AccountID; + cls.Side = (int)field.Side; + cls.Side_String = Enum.ToString(field.Side); + cls.Qty = field.Qty; + cls.Price = field.Price; + cls.OpenClose = (int)field.OpenClose; + cls.OpenClose_String = Enum.ToString(field.OpenClose); + cls.HedgeFlag = (int)field.HedgeFlag; + cls.HedgeFlag_String = Enum.ToString(field.HedgeFlag); + cls.Date = field.Date; + cls.Time = field.Time; + cls.ID = field.ID; + cls.TradeID = field.TradeID; + cls.ReserveInt32 = field.ReserveInt32; + cls.ReserveChar64 = field.ReserveChar64; + + cls.PortfolioID1 = field.PortfolioID1; + cls.PortfolioID2 = field.PortfolioID2; + cls.PortfolioID3 = field.PortfolioID3; + cls.Business = (int)field.Business; + cls.Business_String = Enum.ToString(field.Business); + + if (null == OnRtnTrade) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRtnTrade; + qd.Type_String = Enum.ToString(ResponseType.OnRtnTrade); + qd.Sender = this; + qd.Data1 = cls; + + MessageQueue.Enqueue(qd); + } + else + { + OnRtnTrade(this, cls); + } + } + + private void OnRspQryInstrument_callback(object sender, [In] ref InstrumentField instrument, int size1, bool bIsLast) + { + if (null == OnRspQryInstrument) + return; + + InstrumentField field = instrument; + + InstrumentClass cls = new InstrumentClass(); + + cls.InstrumentName = field.InstrumentName(); + cls.Symbol = field.Symbol; + cls.InstrumentID = field.InstrumentID; + cls.ExchangeID = field.ExchangeID; + cls.ClientID = field.ClientID; + cls.AccountID = field.AccountID; + + cls.ExchangeInstID = field.ExchangeInstID; + + cls.Type = (int)field.Type; + cls.Type_String = Enum.ToString(field.Type); + + cls.VolumeMultiple = field.VolumeMultiple; + cls.PriceTick = field.PriceTick; + cls.ExpireDate = field.ExpireDate; + cls.StrikePrice = field.StrikePrice; + + cls.OptionsType = (int)field.OptionsType; + cls.OptionsType_String = Enum.ToString(field.OptionsType); + + cls.ProductID = field.ProductID; + cls.UnderlyingInstrID = field.UnderlyingInstrID; + + cls.InstLifePhase = (int)field.InstLifePhase; + cls.InstLifePhase_String = Enum.ToString(field.InstLifePhase); + + if (null == OnRspQryInstrument) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRspQryInstrument; + qd.Type_String = Enum.ToString(ResponseType.OnRspQryInstrument); + qd.Sender = this; + qd.Data1 = cls; + qd.Data2 = size1; + qd.Data3 = bIsLast; + + MessageQueue.Enqueue(qd); + } + else + { + OnRspQryInstrument(this, cls, size1, bIsLast); + } + } + + private void OnRspQryInvestorPosition_callback(object sender, [In] ref PositionField position, int size1, bool bIsLast) + { + if (null == OnRspQryInvestorPosition) + return; + + PositionField field = position; + + PositionClass cls = new PositionClass(); + + cls.InstrumentName = field.InstrumentName(); + cls.Symbol = field.Symbol; + cls.InstrumentID = field.InstrumentID; + cls.ExchangeID = field.ExchangeID; + cls.ClientID = field.ClientID; + cls.AccountID = field.AccountID; + + cls.Side = (int)field.Side; + cls.Side_String = Enum.ToString(field.Side); + cls.HedgeFlag = (int)field.HedgeFlag; + cls.HedgeFlag_String = Enum.ToString(field.HedgeFlag); + + cls.Date = field.Date; + cls.PositionCost = field.PositionCost; + cls.Position = field.Position; + cls.TodayPosition = field.TodayPosition; + cls.HistoryPosition = field.HistoryPosition; + cls.HistoryFrozen = field.HistoryFrozen; + cls.TodayBSPosition = field.TodayBSPosition; + cls.TodayBSFrozen = field.TodayBSFrozen; + cls.TodayPRPosition = field.TodayPRPosition; + cls.TodayPRFrozen = field.TodayPRFrozen; + cls.ID = field.ID; + + cls.PortfolioID1 = field.PortfolioID1; + cls.PortfolioID2 = field.PortfolioID2; + cls.PortfolioID3 = field.PortfolioID3; + cls.Business = (int)field.Business; + cls.Business_String = Enum.ToString(field.Business); + + + if (null == OnRspQryInvestorPosition) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRspQryInvestorPosition; + qd.Type_String = Enum.ToString(ResponseType.OnRspQryInvestorPosition); + qd.Sender = this; + qd.Data1 = cls; + qd.Data2 = size1; + qd.Data3 = bIsLast; + + MessageQueue.Enqueue(qd); + } + else + { + OnRspQryInvestorPosition(this, cls, size1, bIsLast); + } + } + + private void OnRspQrySettlementInfo_callback(object sender, [In] ref XAPI.SettlementInfoClass settlementInfo, int size1, bool bIsLast) + { + if (null == OnRspQrySettlementInfo) + return; + + XAPI.SettlementInfoClass field = settlementInfo; + + XAPI.COM.SettlementInfoClass cls = new XAPI.COM.SettlementInfoClass(); + cls.TradingDay = field.TradingDay; + cls.Content = field.Content; + + if (null == OnRspQrySettlementInfo) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRspQrySettlementInfo; + qd.Type_String = Enum.ToString(ResponseType.OnRspQrySettlementInfo); + qd.Sender = this; + qd.Data1 = cls; + qd.Data2 = size1; + qd.Data3 = bIsLast; + + MessageQueue.Enqueue(qd); + } + else + { + OnRspQrySettlementInfo(this, cls, size1, bIsLast); + } + } + + + private void OnRspQryTradingAccount_callback(object sender, [In] ref AccountField account, int size1, bool bIsLast) + { + if (null == OnRspQryTradingAccount) + return; + + AccountField field = account; + + AccountClass cls = new AccountClass(); + + cls.ClientID = field.ClientID; + cls.AccountID = field.AccountID; + cls.CurrencyID = field.CurrencyID; + + cls.PreBalance = field.PreBalance; + cls.CurrMargin = field.CurrMargin; + cls.CloseProfit = field.CloseProfit; + cls.PositionProfit = field.PositionProfit; + cls.Balance = field.Balance; + cls.Available = field.Available; + cls.Deposit = field.Deposit; + cls.Withdraw = field.Withdraw; + cls.WithdrawQuota = field.WithdrawQuota; + cls.FrozenTransferFee = field.FrozenTransferFee; + cls.FrozenStampTax = field.FrozenStampTax; + cls.FrozenCommission = field.FrozenCommission; + cls.FrozenCash = field.FrozenCash; + cls.StampTax = field.StampTax; + cls.Commission = field.Commission; + cls.CashIn = field.CashIn; + + if (null == OnRspQryTradingAccount) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRspQryTradingAccount; + qd.Type_String = Enum.ToString(ResponseType.OnRspQryTradingAccount); + qd.Sender = this; + qd.Data1 = cls; + qd.Data2 = size1; + qd.Data3 = bIsLast; + + MessageQueue.Enqueue(qd); + } + else + { + OnRspQryTradingAccount(this, cls, size1, bIsLast); + } + } + + private void OnRspQryOrder_callback(object sender, [In] ref OrderField order, int size1, bool bIsLast) + { + if (null == OnRspQryOrder) + return; + + OrderClass cls = new OrderClass(); + + if (size1 > 0) + { + OrderField field = order; + + cls.InstrumentName = field.InstrumentName(); + cls.Symbol = field.Symbol; + cls.InstrumentID = field.InstrumentID; + cls.ExchangeID = field.ExchangeID; + cls.ClientID = field.ClientID; + cls.AccountID = field.AccountID; + cls.Side = (int) field.Side; + cls.Side_String = Enum.ToString(field.Side); + cls.Qty = field.Qty; + cls.Price = field.Price; + cls.OpenClose = (int) field.OpenClose; + cls.OpenClose_String = Enum.ToString(field.OpenClose); + cls.HedgeFlag = (int) field.HedgeFlag; + cls.HedgeFlag_String = Enum.ToString(field.HedgeFlag); + cls.Date = field.Date; + cls.Time = field.Time; + cls.ID = field.ID; + cls.OrderID = field.OrderID; + cls.LocalID = field.LocalID; + cls.Type = (int) field.Type; + cls.Type_String = Enum.ToString(field.Type); + cls.StopPx = field.StopPx; + cls.TimeInForce = (int) field.TimeInForce; + cls.TimeInForce_String = Enum.ToString(field.TimeInForce); + cls.Status = (int) field.Status; + cls.Status_String = Enum.ToString(field.Status); + cls.ExecType = (int) field.ExecType; + cls.ExecType_String = Enum.ToString(field.ExecType); + cls.LeavesQty = field.LeavesQty; + cls.CumQty = field.CumQty; + cls.AvgPx = field.AvgPx; + cls.XErrorID = field.XErrorID; + cls.RawErrorID = field.RawErrorID; + cls.Text = field.Text(); + cls.ReserveInt32 = field.ReserveInt32; + cls.ReserveChar64 = field.ReserveChar64; + + cls.PortfolioID1 = field.PortfolioID1; + cls.PortfolioID2 = field.PortfolioID2; + cls.PortfolioID3 = field.PortfolioID3; + cls.Business = (int)field.Business; + cls.Business_String = Enum.ToString(field.Business); + } + + if (null == OnRspQryOrder) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRspQryOrder; + qd.Type_String = Enum.ToString(ResponseType.OnRspQryOrder); + qd.Sender = this; + qd.Data1 = cls; + qd.Data2 = size1; + qd.Data3 = bIsLast; + + MessageQueue.Enqueue(qd); + } + else + { + OnRspQryOrder(this, cls, size1, bIsLast); + } + } + + private void OnRspQryTrade_callback(object sender, [In] ref TradeField trade, int size1, bool bIsLast) + { + if (null == OnRspQryTrade) + return; + + TradeClass cls = new TradeClass(); + + if (size1 > 0) + { + TradeField field = trade; + + cls.InstrumentName = field.InstrumentName(); + cls.Symbol = field.Symbol; + cls.InstrumentID = field.InstrumentID; + cls.ExchangeID = field.ExchangeID; + cls.ClientID = field.ClientID; + cls.AccountID = field.AccountID; + cls.Side = (int)field.Side; + cls.Side_String = Enum.ToString(field.Side); + cls.Qty = field.Qty; + cls.Price = field.Price; + cls.OpenClose = (int)field.OpenClose; + cls.OpenClose_String = Enum.ToString(field.OpenClose); + cls.HedgeFlag = (int)field.HedgeFlag; + cls.HedgeFlag_String = Enum.ToString(field.HedgeFlag); + cls.Date = field.Date; + cls.Time = field.Time; + cls.ID = field.ID; + cls.TradeID = field.TradeID; + cls.ReserveInt32 = field.ReserveInt32; + cls.ReserveChar64 = field.ReserveChar64; + + cls.PortfolioID1 = field.PortfolioID1; + cls.PortfolioID2 = field.PortfolioID2; + cls.PortfolioID3 = field.PortfolioID3; + cls.Business = (int)field.Business; + cls.Business_String = Enum.ToString(field.Business); + } + + if (null == OnRspQryTrade) + { + QueueData qd = new QueueData(); + qd.Type = (int)ResponseType.OnRspQryTrade; + qd.Type_String = Enum.ToString(ResponseType.OnRspQryTrade); + qd.Sender = this; + qd.Data1 = cls; + qd.Data2 = size1; + qd.Data3 = bIsLast; + + MessageQueue.Enqueue(qd); + } + else + { + OnRspQryTrade(this, cls, size1, bIsLast); + } + } + + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(20, 12); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(31, 13); + this.label1.TabIndex = 0; + this.label1.Text = "XAPI"; + // + // XApiCom + // + this.Controls.Add(this.label1); + this.Name = "XApiCom"; + this.Size = new System.Drawing.Size(122, 33); + this.ResumeLayout(false); + this.PerformLayout(); + + } + } + + class SimpleCOMObjectClassFactory : ClassFactoryBase + { + public override void virtual_CreateInstance(IntPtr pUnkOuter, ref Guid riid, out IntPtr ppvObject) + { + Console.WriteLine("SimpleCOMObjectClassFactory.CreateInstance()."); + Console.WriteLine("Requesting Interface : " + riid.ToString()); + + if (riid == Marshal.GenerateGuidForType(typeof(IXApi)) || + riid == ManagedCOMLocalServer.IID_IDispatch || + riid == ManagedCOMLocalServer.IID_IUnknown) + { + XApiCom SimpleCOMObject_New = new XApiCom(); + + ppvObject = Marshal.GetComInterfaceForObject(SimpleCOMObject_New, typeof(IXApi)); + } + else + { + throw new COMException("No interface", unchecked((int)0x80004002)); + } + } + } +} diff --git a/languages/CSharp/XAPI_CSharp/COM/XApiCom.resx b/languages/CSharp/XAPI_CSharp/COM/XApiCom.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/COM/XApiCom.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/csharp/QuantBox.XAPI/Callback/BaseApi.cs b/languages/CSharp/XAPI_CSharp/Callback/BaseApi.cs similarity index 78% rename from csharp/QuantBox.XAPI/Callback/BaseApi.cs rename to languages/CSharp/XAPI_CSharp/Callback/BaseApi.cs index 7a2d9c5..8ca86c3 100644 --- a/csharp/QuantBox.XAPI/Callback/BaseApi.cs +++ b/languages/CSharp/XAPI_CSharp/Callback/BaseApi.cs @@ -1,4 +1,4 @@ -using NLog; +//using NLog; using System; using System.Collections.Generic; using System.IO; @@ -6,19 +6,25 @@ using System.Runtime.InteropServices; using System.Text; -namespace QuantBox.XAPI.Callback +namespace XAPI.Callback { + [ComVisible(false)] public class BaseApi : IDisposable { - public Logger Log; + // 没有必要专门引入一个库,但又很少用 + //public Logger Log; + public object Log { get; set; } + protected Proxy proxy; protected IntPtr Handle = IntPtr.Zero; public string LibPath; + [CLSCompliant(false)] protected XCall _XRespone; - public ServerInfoField Server; - public UserInfoField User; + public RspUserLoginField UserLogin { get; set; } + public ServerInfoField Server { get; set; } + public UserInfoField User { get; set; } public List UserList = new List(); public DelegateOnConnectionStatus OnConnectionStatus @@ -40,7 +46,7 @@ public DelegateOnLog OnLog private DelegateOnRtnError OnRtnError_; private DelegateOnLog OnLog_; - public RspUserLoginField UserLoginField; + protected object locker = new object(); @@ -50,17 +56,18 @@ public DelegateOnLog OnLog public int ReconnectInterval { get { return _reconnectInterval; } - set { + set + { if (_reconnectInterval == value) return; - + _reconnectInterval = value; _Timer.Elapsed -= _Timer_Elapsed; if (_reconnectInterval >= 10) { _Timer.Elapsed += _Timer_Elapsed; - _Timer.Interval = _reconnectInterval*1000; + _Timer.Interval = _reconnectInterval * 1000; } _Timer.Enabled = _reconnectInterval >= 10; } @@ -80,6 +87,9 @@ public BaseApi(string path) : this() { LibPath = path; + Server = new ServerInfoField(); + User = new UserInfoField(); + UserLogin = new RspUserLoginField(); } void _Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) @@ -95,7 +105,7 @@ void _Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) Connect(); } } - + _Timer.Enabled = true; } @@ -108,7 +118,7 @@ void _Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private bool disposed; // 一定要先调用API的,再调用队列的,否则会出错 - public void Dispose() + public void Dispose() { Dispose(true); GC.SuppressFinalize(this); @@ -130,11 +140,11 @@ protected virtual void Dispose(bool disposing) //base.Dispose(disposing); } - + public virtual void Connect() { - lock(locker) + lock (locker) { // XSpeed多次连接出问题,发现会生成多次 if (proxy == null) @@ -175,31 +185,39 @@ public virtual void Connect() Marshal.FreeHGlobal(UserListIntPtr); } - + } public virtual void Disconnect() { - lock(locker) + lock (locker) { _Timer.Enabled = false; IsConnected = false; - if (proxy != null && Handle.ToInt64() !=0) - { + if (proxy != null && Handle.ToInt64() != 0) + { proxy.XRequest((byte)RequestType.Disconnect, Handle, IntPtr.Zero, 0, 0, IntPtr.Zero, 0, IntPtr.Zero, 0, IntPtr.Zero, 0); proxy.XRequest((byte)RequestType.Release, Handle, IntPtr.Zero, 0, 0, IntPtr.Zero, 0, IntPtr.Zero, 0, IntPtr.Zero, 0); proxy.Dispose(); } - + proxy = null; Handle = IntPtr.Zero; } } + /// + /// 这个功能主要是给非.NET语言在调用时使用 + /// + public void GCCollect() + { + System.GC.Collect(); + } + public void RegisterAndStart(IntPtr ptr1) { lock (this) @@ -211,14 +229,16 @@ public void RegisterAndStart(IntPtr ptr1) } } - public ApiType GetApiType + + public ApiType GetApiTypes { - get{ + get + { if (proxy == null) { proxy = new Proxy(LibPath); } - return (ApiType)proxy.XRequest((byte)RequestType.GetApiType, IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, 0, IntPtr.Zero, 0, IntPtr.Zero, 0); + return (ApiType)proxy.XRequest((byte)RequestType.GetApiTypes, IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, 0, IntPtr.Zero, 0, IntPtr.Zero, 0); } } @@ -250,26 +270,36 @@ public string GetApiName private IntPtr _OnRespone(byte type, IntPtr pApi1, IntPtr pApi2, double double1, double double2, IntPtr ptr1, int size1, IntPtr ptr2, int size2, IntPtr ptr3, int size3) { - // 队列过来的消息,如何处理? - switch((ResponeType)type) + //try { - case ResponeType.OnConnectionStatus: - _OnConnectionStatus(double1, ptr1,size1); - break; - case ResponeType.OnRtnError: - _OnRtnError(ptr1); - break; - case ResponeType.OnLog: - _OnLog(ptr1); - break; - default: - return OnRespone(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + // 队列过来的消息,如何处理? + switch ((ResponseType)type) + { + case ResponseType.OnConnectionStatus: + _OnConnectionStatus(double1, ptr1, size1); + break; + case ResponseType.OnRtnError: + _OnRtnError(ptr1); + break; + case ResponseType.OnLog: + _OnLog(ptr1); + break; + default: + return OnResponse(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + } } + //catch(Exception ex) + //{ + // // 有些封装老是出错,没办法,只好报一个例外出来 + // Console.WriteLine(ex.Message); + // Console.WriteLine(ex.StackTrace); + //} + return IntPtr.Zero; } - protected virtual IntPtr OnRespone(byte type, IntPtr pApi1, IntPtr pApi2, double double1, double double2, IntPtr ptr1, int size1, IntPtr ptr2, int size2, IntPtr ptr3, int size3) + protected virtual IntPtr OnResponse(byte type, IntPtr pApi1, IntPtr pApi2, double double1, double double2, IntPtr ptr1, int size1, IntPtr ptr2, int size2, IntPtr ptr3, int size3) { return IntPtr.Zero; } @@ -290,10 +320,10 @@ private void _OnConnectionStatus(double double1, IntPtr ptr1, int size1) } RspUserLoginField obj = default(RspUserLoginField); - if(size1>0) + if (size1 > 0) { obj = PInvokeUtility.GetObjectFromIntPtr(ptr1); - UserLoginField = obj; + UserLogin = obj; } if (OnConnectionStatus_ != null) @@ -306,7 +336,7 @@ private void _OnRtnError(IntPtr ptr1) return; ErrorField obj = PInvokeUtility.GetObjectFromIntPtr(ptr1); - + OnRtnError_(this, ref obj); } diff --git a/csharp/QuantBox.XAPI/Callback/XApi.HistoricalData.cs b/languages/CSharp/XAPI_CSharp/Callback/XApi.HistoricalData.cs similarity index 90% rename from csharp/QuantBox.XAPI/Callback/XApi.HistoricalData.cs rename to languages/CSharp/XAPI_CSharp/Callback/XApi.HistoricalData.cs index 20d8da6..0dfbc91 100644 --- a/csharp/QuantBox.XAPI/Callback/XApi.HistoricalData.cs +++ b/languages/CSharp/XAPI_CSharp/Callback/XApi.HistoricalData.cs @@ -1,13 +1,13 @@ -using QuantBox.XAPI.Interface; +using XAPI; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; -namespace QuantBox.XAPI.Callback +namespace XAPI.Callback { - public partial class XApi : IXHistoricalData + public partial class XApi { public DelegateOnRspQryHistoricalTicks OnRspQryHistoricalTicks { get; set; } public DelegateOnRspQryHistoricalBars OnRspQryHistoricalBars { get; set; } diff --git a/csharp/QuantBox.XAPI/Callback/XApi.Instrument.cs b/languages/CSharp/XAPI_CSharp/Callback/XApi.Instrument.cs similarity index 86% rename from csharp/QuantBox.XAPI/Callback/XApi.Instrument.cs rename to languages/CSharp/XAPI_CSharp/Callback/XApi.Instrument.cs index 2d5b8d2..f004419 100644 --- a/csharp/QuantBox.XAPI/Callback/XApi.Instrument.cs +++ b/languages/CSharp/XAPI_CSharp/Callback/XApi.Instrument.cs @@ -1,4 +1,4 @@ -using QuantBox.XAPI.Interface; +using XAPI; using System; using System.Collections.Generic; using System.Linq; @@ -6,9 +6,9 @@ using System.Text; -namespace QuantBox.XAPI.Callback +namespace XAPI.Callback { - public partial class XApi:IXInstrument + public partial class XApi { public DelegateOnRspQryInstrument OnRspQryInstrument { diff --git a/csharp/QuantBox.XAPI/Callback/XApi.MarketData.cs b/languages/CSharp/XAPI_CSharp/Callback/XApi.MarketData.cs similarity index 87% rename from csharp/QuantBox.XAPI/Callback/XApi.MarketData.cs rename to languages/CSharp/XAPI_CSharp/Callback/XApi.MarketData.cs index a5fe162..bb04885 100644 --- a/csharp/QuantBox.XAPI/Callback/XApi.MarketData.cs +++ b/languages/CSharp/XAPI_CSharp/Callback/XApi.MarketData.cs @@ -1,13 +1,13 @@ -using QuantBox.XAPI.Interface; +using XAPI; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; -namespace QuantBox.XAPI.Callback +namespace XAPI.Callback { - public partial class XApi : IXMarketData + public partial class XApi { public DelegateOnRtnDepthMarketData OnRtnDepthMarketData { @@ -24,7 +24,15 @@ public DelegateOnFilterSubscribe OnFilterSubscribe } // 这种写法的主要目的是求快 private DelegateOnFilterSubscribe OnFilterSubscribe_; - + + public DelegateOnRtnInstrumentStatus OnRtnInstrumentStatus + { + get { return OnRtnInstrumentStatus_; } + set { OnRtnInstrumentStatus_ = value; } + } + + private DelegateOnRtnInstrumentStatus OnRtnInstrumentStatus_; + #region 已经订阅的行情 public int MaxSubscribedInstrumentsCount; @@ -135,6 +143,17 @@ private void _OnRtnDepthMarketData(IntPtr ptr1,int size1,double double1) OnRtnDepthMarketData_(this, ref cls); } + private void _OnRtnInstrumentStatus(IntPtr ptr1, int size1) + { + // 求快,不加 + if (OnRtnInstrumentStatus_ == null) + return; + + InstrumentStatusField obj = (InstrumentStatusField)Marshal.PtrToStructure(ptr1, typeof(InstrumentStatusField)); + + OnRtnInstrumentStatus_(this, ref obj); + } + private bool _OnFilterSubscribe(double double1, int size1, int size2, int size3, IntPtr ptr1) { if (OnFilterSubscribe_ == null) diff --git a/csharp/QuantBox.XAPI/Callback/XApi.Query.cs b/languages/CSharp/XAPI_CSharp/Callback/XApi.Query.cs similarity index 97% rename from csharp/QuantBox.XAPI/Callback/XApi.Query.cs rename to languages/CSharp/XAPI_CSharp/Callback/XApi.Query.cs index 1c0463e..1bbc71f 100644 --- a/csharp/QuantBox.XAPI/Callback/XApi.Query.cs +++ b/languages/CSharp/XAPI_CSharp/Callback/XApi.Query.cs @@ -1,4 +1,4 @@ -using QuantBox.XAPI.Interface; +using XAPI; using System; using System.Collections.Generic; using System.Linq; @@ -6,9 +6,9 @@ using System.Text; -namespace QuantBox.XAPI.Callback +namespace XAPI.Callback { - public partial class XApi : IXQuery + public partial class XApi { public DelegateOnRspQryTradingAccount OnRspQryTradingAccount { diff --git a/csharp/QuantBox.XAPI/Callback/XApi.QuoteRequest.cs b/languages/CSharp/XAPI_CSharp/Callback/XApi.QuoteRequest.cs similarity index 99% rename from csharp/QuantBox.XAPI/Callback/XApi.QuoteRequest.cs rename to languages/CSharp/XAPI_CSharp/Callback/XApi.QuoteRequest.cs index 154d99e..f4b610d 100644 --- a/csharp/QuantBox.XAPI/Callback/XApi.QuoteRequest.cs +++ b/languages/CSharp/XAPI_CSharp/Callback/XApi.QuoteRequest.cs @@ -5,7 +5,7 @@ using System.Text; -namespace QuantBox.XAPI.Callback +namespace XAPI.Callback { public partial class XApi { diff --git a/csharp/QuantBox.XAPI/Callback/XApi.Trade.cs b/languages/CSharp/XAPI_CSharp/Callback/XApi.Trade.cs similarity index 62% rename from csharp/QuantBox.XAPI/Callback/XApi.Trade.cs rename to languages/CSharp/XAPI_CSharp/Callback/XApi.Trade.cs index abb5bb7..5597d9b 100644 --- a/csharp/QuantBox.XAPI/Callback/XApi.Trade.cs +++ b/languages/CSharp/XAPI_CSharp/Callback/XApi.Trade.cs @@ -1,4 +1,4 @@ -using QuantBox.XAPI.Interface; +using XAPI; using System; using System.Collections.Generic; using System.Linq; @@ -6,9 +6,9 @@ using System.Text; -namespace QuantBox.XAPI.Callback +namespace XAPI.Callback { - public partial class XApi : IXTrade + public partial class XApi { public DelegateOnRtnOrder OnRtnOrder { @@ -30,7 +30,22 @@ public DelegateOnRtnQuote OnRtnQuote private DelegateOnRtnTrade OnRtnTrade_; private DelegateOnRtnQuote OnRtnQuote_; - public void SendOrder(ref OrderField[] orders,out string[] OrderRefs) + + public string SendOrder(OrderField order) + { + OrderField[] orders = new OrderField[1]; + orders[0] = order; + return SendOrder(orders); + } + + public string CancelOrder(string szId) + { + string[] szIds = new string[1]; + szIds[0] = szId; + return CancelOrder(szIds); + } + + public string SendOrder(OrderField[] orders) { int OrderField_size = Marshal.SizeOf(typeof(OrderField)); int OrderIDType_size = Marshal.SizeOf(typeof(OrderIDType)); @@ -48,60 +63,47 @@ public void SendOrder(ref OrderField[] orders,out string[] OrderRefs) 0, 0, OrderField_Ptr, orders.Length, OrderIDType_Ptr, 0, IntPtr.Zero, 0); - OrderRefs = new string[orders.Length]; - - for(int i = 0;i /// 连接状态 /// + [ComVisible(false)] public enum ConnectionStatus : byte { /// @@ -84,10 +86,11 @@ public enum ConnectionStatus : byte Unknown, } + [ComVisible(false)] [Flags] public enum ApiType : byte { - Nono = 0, + None = 0, Trade = 1, MarketData = 2, Level2 = 4, @@ -97,7 +100,7 @@ public enum ApiType : byte Query = 64, }; - + [ComVisible(false)] public enum ResumeType : byte { Restart, @@ -106,6 +109,7 @@ public enum ResumeType : byte Undefined, }; + [ComVisible(false)] public enum LogLevel : byte { Trace, @@ -116,12 +120,14 @@ public enum LogLevel : byte Fatal, }; + [ComVisible(false)] public enum PutCall : byte { Put, Call, }; + [ComVisible(false)] public enum OrderStatus : byte { NotSent, @@ -137,16 +143,23 @@ public enum OrderStatus : byte Replaced, }; + [ComVisible(false)] public enum OrderSide : byte { Buy, Sell, - Creation, ///申购 - Redemption, ///赎回 - Merge, ///合并 - Split, ///拆分 + LOFCreation, ///LOF申购 + LOFRedemption, ///LOF赎回 + ETFCreation, ///ETF申购 + ETFRedemption, ///ETF赎回 + Merge, ///合并 + Split, ///拆分 + CBConvert, ///可转债转股,参考于https://en.wikipedia.org/wiki/Convertible_bond + CBRedemption, + Unknown, }; + [ComVisible(false)] public enum OrderType : byte { Market, @@ -159,6 +172,7 @@ public enum OrderType : byte TrailingStopLimit, }; + [ComVisible(false)] public enum TimeInForce : byte { ATC, @@ -174,12 +188,14 @@ public enum TimeInForce : byte AUC, }; + [ComVisible(false)] public enum PositionSide : byte { Long, Short, }; + [ComVisible(false)] public enum ExecType : byte { New, @@ -193,15 +209,23 @@ public enum ExecType : byte PendingReplace, Replace, ReplaceReject, + TradeCorrect, + TradeCancel, + OrderStatus, + PendingNew, + ClearingHold, }; + [ComVisible(false)] public enum OpenCloseType : byte { + Undefined, Open, Close, CloseToday, }; + [ComVisible(false)] public enum HedgeFlagType : byte { Speculation, @@ -211,6 +235,7 @@ public enum HedgeFlagType : byte MarketMaker, }; + [ComVisible(false)] public enum InstrumentType : byte { Stock, @@ -225,6 +250,7 @@ public enum InstrumentType : byte Synthetic, }; + [ComVisible(false)] public enum IdCardType : byte { EID, ///组织机构代码 @@ -238,6 +264,7 @@ public enum IdCardType : byte OtherCard, ///其他证件 }; + [ComVisible(false)] public enum ExchangeType : byte { Undefined, /// 未定义 @@ -254,6 +281,7 @@ public enum ExchangeType : byte }; ///合约生命周期状态类型 + [ComVisible(false)] public enum InstLifePhaseType : byte { NotStart, ///未上市 @@ -268,6 +296,7 @@ public enum InstLifePhaseType : byte ///交易阶段类型 + [ComVisible(false)] public enum TradingPhaseType : byte { BeforeTrading, ///开盘前 @@ -281,6 +310,14 @@ public enum TradingPhaseType : byte Fuse, ///熔断时段,参考于LTS }; + [ComVisible(false)] + public enum BusinessType : byte + { + Undefined, + Future, + Stock, + Option, + }; @@ -288,7 +325,7 @@ public enum TradingPhaseType : byte /// /// ///////////////////////////////////////////////////////// /// - + [ComVisible(false)] public enum BarType:byte { Time = 1, @@ -298,6 +335,7 @@ public enum BarType:byte Session, }; + [ComVisible(false)] public enum DataObjetType : byte { DataObject, @@ -315,7 +353,7 @@ public enum DataObjetType : byte /// /// /// - + [ComVisible(false)] public enum DepthLevelType : byte { L0, diff --git a/csharp/QuantBox.XAPI/Event/EventArgs.cs b/languages/CSharp/XAPI_CSharp/Event/EventArgs.cs similarity index 93% rename from csharp/QuantBox.XAPI/Event/EventArgs.cs rename to languages/CSharp/XAPI_CSharp/Event/EventArgs.cs index a28e8be..0a39348 100644 --- a/csharp/QuantBox.XAPI/Event/EventArgs.cs +++ b/languages/CSharp/XAPI_CSharp/Event/EventArgs.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; -namespace QuantBox.XAPI.Event +namespace XAPI.Event { + [ComVisible(false)] public class OnConnectionStatusEventArgs:EventArgs { public readonly ConnectionStatus status; @@ -18,7 +20,7 @@ public OnConnectionStatusEventArgs(ConnectionStatus status, ref RspUserLoginFiel this.size1 = size1; } } - + [ComVisible(false)] public class OnRtnErrorEventArgs : EventArgs { public readonly ErrorField error; @@ -28,7 +30,7 @@ public OnRtnErrorEventArgs(ref ErrorField error) this.error = error; } } - + [ComVisible(false)] public class OnLogEventArgs : EventArgs { public readonly LogField log; @@ -38,7 +40,7 @@ public OnLogEventArgs(ref LogField log) this.log = log; } } - + [ComVisible(false)] public class OnRtnDepthMarketDataNEventArgs : EventArgs { public readonly DepthMarketDataNClass marketData; @@ -48,7 +50,7 @@ public OnRtnDepthMarketDataNEventArgs(ref DepthMarketDataNClass marketData) this.marketData = marketData; } } - + [ComVisible(false)] public class OnRtnQuoteRequestEventArgs : EventArgs { public readonly QuoteRequestField quoteRequest; @@ -58,7 +60,7 @@ public OnRtnQuoteRequestEventArgs(ref QuoteRequestField quoteRequest) this.quoteRequest = quoteRequest; } } - + [ComVisible(false)] public class OnRspQryInstrumentEventArgs : EventArgs { public readonly InstrumentField instrument; @@ -72,7 +74,7 @@ public OnRspQryInstrumentEventArgs(ref InstrumentField instrument, int size1, bo this.bIsLast = bIsLast; } } - + [ComVisible(false)] public class OnRspQryTradingAccountEventArgs : EventArgs { public readonly AccountField account; @@ -86,7 +88,7 @@ public OnRspQryTradingAccountEventArgs(ref AccountField account, int size1, bool this.bIsLast = bIsLast; } } - + [ComVisible(false)] public class OnRspQryInvestorPositionEventArgs : EventArgs { public readonly PositionField position; @@ -100,7 +102,7 @@ public OnRspQryInvestorPositionEventArgs(ref PositionField position, int size1, this.bIsLast = bIsLast; } } - + [ComVisible(false)] public class OnRspQrySettlementInfoEventArgs : EventArgs { public readonly SettlementInfoClass settlementInfo; @@ -114,7 +116,7 @@ public OnRspQrySettlementInfoEventArgs(ref SettlementInfoClass settlementInfo, i this.bIsLast = bIsLast; } } - + [ComVisible(false)] public class OnRspQryOrderEventArgs : EventArgs { public readonly OrderField order; @@ -128,7 +130,7 @@ public OnRspQryOrderEventArgs(ref OrderField order, int size1, bool bIsLast) this.bIsLast = bIsLast; } } - + [ComVisible(false)] public class OnRspQryTradeEventArgs : EventArgs { public readonly TradeField trade; @@ -142,7 +144,7 @@ public OnRspQryTradeEventArgs(ref TradeField trade, int size1, bool bIsLast) this.bIsLast = bIsLast; } } - + [ComVisible(false)] public class OnRspQryQuoteEventArgs : EventArgs { public readonly QuoteField quote; @@ -156,7 +158,7 @@ public OnRspQryQuoteEventArgs(ref QuoteField quote, int size1, bool bIsLast) this.bIsLast = bIsLast; } } - + [ComVisible(false)] public class OnRtnOrderEventArgs : EventArgs { public readonly OrderField order; @@ -166,7 +168,7 @@ public OnRtnOrderEventArgs(ref OrderField order) this.order = order; } } - + [ComVisible(false)] public class OnRtnTradeEventArgs : EventArgs { public readonly TradeField trade; @@ -176,7 +178,7 @@ public OnRtnTradeEventArgs(ref TradeField trade) this.trade = trade; } } - + [ComVisible(false)] public class OnRtnQuoteEventArgs : EventArgs { public readonly QuoteField quote; @@ -186,7 +188,7 @@ public OnRtnQuoteEventArgs(ref QuoteField quote) this.quote = quote; } } - + [ComVisible(false)] public class OnRspQryHistoricalTicksEventArgs : EventArgs { public readonly IntPtr pTicks; @@ -204,7 +206,7 @@ public OnRspQryHistoricalTicksEventArgs(IntPtr pTicks, int size1, ref Historical this.bIsLast = bIsLast; } } - + [ComVisible(false)] public class OnRspQryHistoricalBarsEventArgs : EventArgs { public readonly IntPtr pTicks; @@ -222,7 +224,7 @@ public OnRspQryHistoricalBarsEventArgs(IntPtr pTicks, int size1, ref HistoricalD this.bIsLast = bIsLast; } } - + [ComVisible(false)] public class OnRspQryInvestorEventArgs : EventArgs { public readonly InvestorField investor; diff --git a/csharp/QuantBox.XAPI/Event/XApiWrapper.cs b/languages/CSharp/XAPI_CSharp/Event/XApiWrapper.cs similarity index 81% rename from csharp/QuantBox.XAPI/Event/XApiWrapper.cs rename to languages/CSharp/XAPI_CSharp/Event/XApiWrapper.cs index 0ada749..387e625 100644 --- a/csharp/QuantBox.XAPI/Event/XApiWrapper.cs +++ b/languages/CSharp/XAPI_CSharp/Event/XApiWrapper.cs @@ -1,4 +1,4 @@ -using QuantBox.XAPI.Callback; +using XAPI.Callback; using System; using System.Collections.Generic; using System.Linq; @@ -7,35 +7,35 @@ using System.Windows.Forms; -namespace QuantBox.XAPI.Event +namespace XAPI.Event { - [ProgId("QuantBox.XAPI.Event.XApiWrapper"), ComVisible(true)] + [ComVisible(false)] public class XApiWrapper:XApi { - public new event EventHandler OnConnectionStatus; - public new event EventHandler OnRtnError; - public new event EventHandler OnLog; + public new event EventHandler OnConnectionStatus; + public new event EventHandler OnRtnError; + public new event EventHandler OnLog; - public new event EventHandler OnRtnDepthMarketData; - public new event EventHandler OnRtnQuoteRequest; + public new event EventHandler OnRtnDepthMarketData; + public new event EventHandler OnRtnQuoteRequest; - public new event EventHandler OnRspQryInstrument; - public new event EventHandler OnRspQryTradingAccount; - public new event EventHandler OnRspQryInvestorPosition; - public new event EventHandler OnRspQrySettlementInfo; + public new event EventHandler OnRspQryInstrument; + public new event EventHandler OnRspQryTradingAccount; + public new event EventHandler OnRspQryInvestorPosition; + public new event EventHandler OnRspQrySettlementInfo; - public new event EventHandler OnRspQryOrder; - public new event EventHandler OnRspQryTrade; - public new event EventHandler OnRspQryQuote; + public new event EventHandler OnRspQryOrder; + public new event EventHandler OnRspQryTrade; + public new event EventHandler OnRspQryQuote; - public new event EventHandler OnRtnOrder; - public new event EventHandler OnRtnTrade; - public new event EventHandler OnRtnQuote; + public new event EventHandler OnRtnOrder; + public new event EventHandler OnRtnTrade; + public new event EventHandler OnRtnQuote; - public new event EventHandler OnRspQryHistoricalTicks; - public new event EventHandler OnRspQryHistoricalBars; + public new event EventHandler OnRspQryHistoricalTicks; + public new event EventHandler OnRspQryHistoricalBars; - public new event EventHandler OnRspQryInvestor; + public new event EventHandler OnRspQryInvestor; public XApiWrapper(string path):this() diff --git a/csharp/QuantBox.XAPI/Extensions.cs b/languages/CSharp/XAPI_CSharp/Extensions.cs similarity index 85% rename from csharp/QuantBox.XAPI/Extensions.cs rename to languages/CSharp/XAPI_CSharp/Extensions.cs index 24e26da..5acb42a 100644 --- a/csharp/QuantBox.XAPI/Extensions.cs +++ b/languages/CSharp/XAPI_CSharp/Extensions.cs @@ -5,8 +5,9 @@ using System.Runtime.InteropServices; using System.Text; -namespace QuantBox.XAPI +namespace XAPI { + [ComVisible(false)] public static class Extensions_GBK { public static string InstrumentName([In]this InstrumentField field) @@ -14,6 +15,21 @@ public static string InstrumentName([In]this InstrumentField field) return PInvokeUtility.GetUnicodeString(field.InstrumentName); } + public static string InstrumentName([In]this OrderField field) + { + return PInvokeUtility.GetUnicodeString(field.InstrumentName); + } + + public static string InstrumentName([In]this TradeField field) + { + return PInvokeUtility.GetUnicodeString(field.InstrumentName); + } + + public static string InstrumentName([In]this PositionField field) + { + return PInvokeUtility.GetUnicodeString(field.InstrumentName); + } + public static string Text([In]this OrderField field) { return PInvokeUtility.GetUnicodeString(field.Text); @@ -63,6 +79,7 @@ public static string InvestorName([In]this RspUserLoginField field) TradeDay: 行情日 ActionDay:行情日 */ + [ComVisible(false)] public static class Extensions_Misc { public static DateTime ExchangeDateTime([In]this DepthMarketDataNClass field) @@ -82,7 +99,7 @@ public static DateTime ExchangeDateTime([In]this DepthMarketDataNClass field) public static DateTime ExchangeDateTime_([In]this DepthMarketDataNClass field) { // 表示传回来的时间可能有问题,要检查一下 - if(field.UpdateTime == 0) + if (field.UpdateTime == 0) { DateTime now = DateTime.Now; @@ -123,6 +140,7 @@ public static DateTime ExchangeDateTime_([In]this DepthMarketDataNClass field) } } + [ComVisible(false)] public static class Extensions_Output { public static string ToFormattedString([In]this ErrorField field) @@ -137,7 +155,7 @@ public static string ToFormattedString([In]this OrderField field) + "LocalID={8};ID={9};OrderID={10};Date={11};Time={12};" + "Type={13};TimeInForce={14};Status={15};ExecType={16};" + "XErrorID={17};RawErrorID={18};Text={19}]", - field.InstrumentID, field.ExchangeID, Enum.ToString(field.Side), field.Qty,field.LeavesQty, field.Price, Enum.ToString(field.OpenClose), Enum.ToString(field.HedgeFlag), + field.InstrumentID, field.ExchangeID, Enum.ToString(field.Side), field.Qty, field.LeavesQty, field.Price, Enum.ToString(field.OpenClose), Enum.ToString(field.HedgeFlag), field.LocalID, field.ID, field.OrderID, field.Date, field.Time, Enum.ToString(field.Type), Enum.ToString(field.TimeInForce), Enum.ToString(field.Status), Enum.ToString(field.ExecType), field.XErrorID, field.RawErrorID, field.Text()); @@ -163,7 +181,7 @@ public static string ToFormattedString([In]this QuoteField field) + "AskOpenClose={15};AskHedgeFlag={16};BidOpenClose={17};BidHedgeFlag={18}]", field.InstrumentID, field.ExchangeID, field.AskPrice, field.AskQty, field.BidPrice, field.BidQty, - field.LocalID,field.ID,field.AskOrderID,field.BidOrderID, + field.LocalID, field.ID, field.AskOrderID, field.BidOrderID, Enum.ToString(field.Status), Enum.ToString(field.ExecType), field.XErrorID, field.RawErrorID, field.Text(), Enum.ToString(field.AskOpenClose), Enum.ToString(field.AskHedgeFlag), Enum.ToString(field.BidOpenClose), Enum.ToString(field.BidHedgeFlag)); @@ -206,16 +224,23 @@ public static string ToFormattedString([In]this LogField field) public static string ToFormattedString([In]this AccountField field) { - return string.Format("[AccountID={0};CurrencyID={1};Balance={2};Available={3}]", - field.AccountID, field.CurrencyID, field.Balance, field.Available); + return string.Format("[AccountID={0};CurrencyID={1};Balance={2};Available={3};Deposit={4};Withdraw={5}]", + field.AccountID, field.CurrencyID, field.Balance, field.Available, field.Deposit, field.Withdraw); } public static string ToFormattedString([In]this PositionField field) { - return string.Format("[InstrumentID={0};ExchangeID={1};HedgeFlag={2};Side={3};" - + "Position={4};TodayPosition={5};HistoryPosition={6}]", - field.InstrumentID, field.ExchangeID, Enum.ToString(field.HedgeFlag), Enum.ToString(field.Side), - field.Position, field.TodayPosition, field.HistoryPosition); + return string.Format("[InstrumentID={0};ExchangeID={1};InstrumentName={2};HedgeFlag={3};Side={4};" + + "Position={5};TodayPosition={6};HistoryPosition={7};ID={8}]", + field.InstrumentID, field.ExchangeID, field.InstrumentName(), Enum.ToString(field.HedgeFlag), Enum.ToString(field.Side), + field.Position, field.TodayPosition, field.HistoryPosition, field.ID); + } + + public static string ToFormattedString([In]this InstrumentStatusField field) + { + return string.Format("[Symbol={0};ExchangeID={1};InstrumentID={2};InstrumentStatus={3};" + + "EnterTime={4}]", + field.Symbol, field.ExchangeID, field.InstrumentID, Enum.ToString(field.InstrumentStatus), field.EnterTime); } public static string ToFormattedHeader([In]this TickField field) @@ -236,7 +261,7 @@ public static string ToFormattedString([In]this TickField field) string date = string.Format("{0}-{1:D2}-{2:D2} {3:D2}:{4:D2}:{5:D2}.{6:D3}", yyyy, MM, dd, hh, mm, ss, field.Millisecond); return string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", date, field.LastPrice, field.Volume, field.OpenInterest, - field.BidPrice1,field.BidSize1,field.AskPrice1,field.AskSize1); + field.BidPrice1, field.BidSize1, field.AskPrice1, field.AskSize1); } public static string ToFormattedHeader([In]this BarField field) @@ -259,6 +284,6 @@ public static string ToFormattedString([In]this BarField field) date, field.Open, field.High, field.Low, field.Close, field.Volume, field.OpenInterest); } - + } } \ No newline at end of file diff --git a/csharp/QuantBox.XAPI/GB2312Marshaler.cs b/languages/CSharp/XAPI_CSharp/GB2312Marshaler.cs similarity index 98% rename from csharp/QuantBox.XAPI/GB2312Marshaler.cs rename to languages/CSharp/XAPI_CSharp/GB2312Marshaler.cs index 6c0b7a9..01554a2 100644 --- a/csharp/QuantBox.XAPI/GB2312Marshaler.cs +++ b/languages/CSharp/XAPI_CSharp/GB2312Marshaler.cs @@ -5,12 +5,13 @@ using System.Text; -namespace QuantBox.XAPI +namespace XAPI { /// /// Custom marshalers cannot be used on fields of structures /// 无语,本想实现中文直接的正常使用,后来发现这个不能用在结构体上还是没办法使用 /// + [ComVisible(false)] public class GB2312Marshaler : ICustomMarshaler { static Encoding encodingGB2312 = Encoding.GetEncoding(936); diff --git a/languages/CSharp/XAPI_CSharp/Helper.cs b/languages/CSharp/XAPI_CSharp/Helper.cs new file mode 100644 index 0000000..da3232f --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/Helper.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; + +namespace XAPI +{ + [CLSCompliant(true)] + [ComVisible(false)] + public static class Helper + { + public static void SetValueForValueType(this FieldInfo field, ref T item, object value) where T : struct + { + field.SetValueDirect(__makeref(item), value); + } + + public static object ChangeType(object value, Type type) + { + if (value == null && type.IsGenericType) return Activator.CreateInstance(type); + if (value == null) return null; + if (type == value.GetType()) return value; + if (type.IsEnum) + { + if (value is string) + return Enum.Parse(type, value as string); + else + return Enum.ToObject(type, value); + } + if (!type.IsInterface && type.IsGenericType) + { + Type innerType = type.GetGenericArguments()[0]; + object innerValue = ChangeType(value, innerType); + return Activator.CreateInstance(type, new object[] { innerValue }); + } + if (value is string && type == typeof(Guid)) return new Guid(value as string); + if (value is string && type == typeof(Version)) return new Version(value as string); + if (!(value is IConvertible)) return value; + return Convert.ChangeType(value, type); + } + } +} diff --git a/languages/CSharp/XAPI_CSharp/IObjectSafety.cs b/languages/CSharp/XAPI_CSharp/IObjectSafety.cs new file mode 100644 index 0000000..506d96b --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/IObjectSafety.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +namespace XAPI +{ + /// + /// Import the IObjectSaftety COM Interface. + /// See http://msdn.microsoft.com/en-us/library/aa768224(VS.85).aspx + /// + [ComImport] + [Guid("CB5BDC81-93C1-11CF-8F20-00805F2CD064")] // This is the only Guid that cannot be modifed in this file + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface IObjectSafety + { + [PreserveSig] + int GetInterfaceSafetyOptions(ref Guid riid, out int pdwSupportedOptions, out int pdwEnabledOptions); + + [PreserveSig] + int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionSetMask, int dwEnabledOptions); + } +} diff --git a/languages/CSharp/XAPI_CSharp/IXApi.cs b/languages/CSharp/XAPI_CSharp/IXApi.cs new file mode 100644 index 0000000..304e3fb --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/IXApi.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + + +namespace XAPI +{ + [ComVisible(false)] + public interface IXApi:IXSpi, IDisposable + { + ApiType GetApiTypes { get; } + string GetApiName { get; } + string GetApiVersion { get; } + + bool IsConnected { get; } + void Connect(); + void Disconnect(); + + void ReqQuery(QueryType type, ReqQueryField query); + + void Subscribe(string szInstrument, string szExchange); + void Unsubscribe(string szInstrument, string szExchange); + + void SubscribeQuote(string szInstrument, string szExchange); + void UnsubscribeQuote(string szInstrument, string szExchange); + + string SendOrder(OrderField[] orders); + string CancelOrder(string[] szId); + string SendQuote(QuoteField quote); + string CancelQuote(string szId); + + ServerInfoField Server { get; set; } + UserInfoField User { get; set; } + RspUserLoginField UserLogin { get; set; } + + object Log { get; set; } + + int ReconnectInterval { get; set; } + } +} diff --git a/languages/CSharp/XAPI_CSharp/IXSpi.cs b/languages/CSharp/XAPI_CSharp/IXSpi.cs new file mode 100644 index 0000000..3bdc968 --- /dev/null +++ b/languages/CSharp/XAPI_CSharp/IXSpi.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + + +namespace XAPI +{ + [ComVisible(false)] + public interface IXSpi + { + DelegateOnConnectionStatus OnConnectionStatus { get; set; } + DelegateOnRtnError OnRtnError { get; set; } + DelegateOnLog OnLog { get; set; } + + DelegateOnRtnInstrumentStatus OnRtnInstrumentStatus { get; set; } + + /// + /// + /// + DelegateOnRtnDepthMarketData OnRtnDepthMarketData { get; set; } + + /// + /// + /// + DelegateOnRspQryInstrument OnRspQryInstrument { get; set; } + + /// + /// + /// + DelegateOnRspQryInvestor OnRspQryInvestor { get; set; } + DelegateOnRspQryTradingAccount OnRspQryTradingAccount { get; set; } + DelegateOnRspQryInvestorPosition OnRspQryInvestorPosition { get; set; } + DelegateOnRspQrySettlementInfo OnRspQrySettlementInfo { get; set; } + + DelegateOnRspQryOrder OnRspQryOrder { get; set; } + DelegateOnRspQryTrade OnRspQryTrade { get; set; } + DelegateOnRspQryQuote OnRspQryQuote { get; set; } + + /// + /// + /// + DelegateOnRtnOrder OnRtnOrder { get; set; } + DelegateOnRtnTrade OnRtnTrade { get; set; } + DelegateOnRtnQuote OnRtnQuote { get; set; } + + DelegateOnRtnQuoteRequest OnRtnQuoteRequest { get; set; } + + /// + /// + /// + DelegateOnRspQryHistoricalTicks OnRspQryHistoricalTicks { get; set; } + DelegateOnRspQryHistoricalBars OnRspQryHistoricalBars { get; set; } + } +} diff --git a/csharp/QuantBox.XAPI/InvokeBase.cs b/languages/CSharp/XAPI_CSharp/InvokeBase.cs similarity index 81% rename from csharp/QuantBox.XAPI/InvokeBase.cs rename to languages/CSharp/XAPI_CSharp/InvokeBase.cs index b6bb3a5..21854db 100644 --- a/csharp/QuantBox.XAPI/InvokeBase.cs +++ b/languages/CSharp/XAPI_CSharp/InvokeBase.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; -namespace QuantBox.XAPI +namespace XAPI { + [ComVisible(false)] public class InvokeBase { protected IntPtr hLib = IntPtr.Zero; diff --git a/csharp/QuantBox.XAPI/OptimizedEnum.cs b/languages/CSharp/XAPI_CSharp/OptimizedEnum.cs similarity index 99% rename from csharp/QuantBox.XAPI/OptimizedEnum.cs rename to languages/CSharp/XAPI_CSharp/OptimizedEnum.cs index d6a2c52..8f868b3 100644 --- a/csharp/QuantBox.XAPI/OptimizedEnum.cs +++ b/languages/CSharp/XAPI_CSharp/OptimizedEnum.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; namespace Ideafixxxer.Generics @@ -17,6 +18,8 @@ namespace Ideafixxxer.Generics /// Helper class for enum types /// /// Must be enum type (declared using enum keyword) + [ComVisible(false)] + [CLSCompliant(false)] public static class Enum where T : struct, IConvertible { private static readonly EnumConverter Converter; diff --git a/csharp/QuantBox.XAPI/PInvokeUtility.cs b/languages/CSharp/XAPI_CSharp/PInvokeUtility.cs similarity index 96% rename from csharp/QuantBox.XAPI/PInvokeUtility.cs rename to languages/CSharp/XAPI_CSharp/PInvokeUtility.cs index e0ce4a7..76c2797 100644 --- a/csharp/QuantBox.XAPI/PInvokeUtility.cs +++ b/languages/CSharp/XAPI_CSharp/PInvokeUtility.cs @@ -5,8 +5,9 @@ using System.Text; -namespace QuantBox.XAPI +namespace XAPI { + [ComVisible(false)] public class PInvokeUtility { [DllImport("kernel32.dll", CharSet = CharSet.Auto)] @@ -71,6 +72,7 @@ public static DepthMarketDataNClass GetDepthMarketDataNClass(IntPtr ptr) cls.SettlementPrice = obj.SettlementPrice; cls.UpperLimitPrice = obj.UpperLimitPrice; cls.LowerLimitPrice = obj.LowerLimitPrice; + cls.PreClosePrice = obj.PreClosePrice; cls.PreSettlementPrice = obj.PreSettlementPrice; cls.PreOpenInterest = obj.PreOpenInterest; cls.TradingPhase = obj.TradingPhase; @@ -99,9 +101,11 @@ public static DepthMarketDataNClass GetDepthMarketDataNClass(IntPtr ptr) public static SettlementInfoClass GetSettlementInfoClass(IntPtr ptr) { - SettlementInfoField obj = (SettlementInfoField)Marshal.PtrToStructure(ptr, typeof(SettlementInfoField)); - SettlementInfoClass cls = new SettlementInfoClass(); + if (ptr == IntPtr.Zero) + return cls; + + SettlementInfoField obj = (SettlementInfoField)Marshal.PtrToStructure(ptr, typeof(SettlementInfoField)); int size = Marshal.SizeOf(typeof (SettlementInfoField)); IntPtr pContent = new IntPtr(ptr.ToInt64() + size); diff --git a/csharp/QuantBox.XAPI/PositionFieldEx.cs b/languages/CSharp/XAPI_CSharp/PositionFieldEx.cs similarity index 83% rename from csharp/QuantBox.XAPI/PositionFieldEx.cs rename to languages/CSharp/XAPI_CSharp/PositionFieldEx.cs index d710097..4d96cf7 100644 --- a/csharp/QuantBox.XAPI/PositionFieldEx.cs +++ b/languages/CSharp/XAPI_CSharp/PositionFieldEx.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; -namespace QuantBox.XAPI +namespace XAPI { + [ComVisible(false)] public class PositionFieldEx { public string Symbol { get; private set; } @@ -15,6 +17,12 @@ public class PositionFieldEx public PositionField Long { get; private set; } public PositionField Short { get; private set; } + public PositionFieldEx() + { + Long = new PositionField(); + Short = new PositionField(); + } + public void AddPosition(PositionField position) { Symbol = position.Symbol; diff --git a/csharp/QuantBox.XAPI/Program.cs b/languages/CSharp/XAPI_CSharp/Program.cs similarity index 64% rename from csharp/QuantBox.XAPI/Program.cs rename to languages/CSharp/XAPI_CSharp/Program.cs index 9324fbc..60b5ae5 100644 --- a/csharp/QuantBox.XAPI/Program.cs +++ b/languages/CSharp/XAPI_CSharp/Program.cs @@ -1,4 +1,4 @@ -using QuantBox.XAPI.Callback; +using XAPI.Callback; using System; using System.Collections.Generic; using System.Diagnostics; @@ -7,8 +7,9 @@ using System.IO; using System.Threading; +using XAPI.Event; -namespace QuantBox.XAPI +namespace XAPI { class Program { @@ -16,6 +17,7 @@ static void OnConnectionStatus(object sender, ConnectionStatus status, ref RspUs { if (size1>0) { + Console.WriteLine("333333" + status); Console.WriteLine("333333" + userLogin.ToFormattedStringLong()); } else @@ -28,6 +30,7 @@ static void OnConnectionStatus2(object sender, ConnectionStatus status, ref RspU { if (size1 > 0) { + Console.WriteLine("222222" + status); Console.WriteLine("222222" + userLogin.ToFormattedStringLong()); } else @@ -40,8 +43,17 @@ static void OnRtnDepthMarketData(object sender, ref DepthMarketDataNClass market { Debugger.Log(0, null, "CTP:C#"); Console.WriteLine(marketData.InstrumentID); - Console.WriteLine(marketData.Exchange); + //Console.WriteLine(marketData.Exchange); Console.WriteLine(marketData.LastPrice); + //Console.WriteLine(marketData.OpenInterest); + if(marketData.Bids.Count()>0) + { + Console.WriteLine(marketData.Bids[0].Price); + } + if (marketData.Asks.Count() > 0) + { + Console.WriteLine(marketData.Asks[0].Price); + } } static void OnRspQryInstrument(object sender, ref InstrumentField instrument,int size1, bool bIsLast) @@ -56,7 +68,7 @@ static void OnRspQryTradingAccount(object sender, ref AccountField account, int static void OnRspQrySettlementInfo(object sender, ref SettlementInfoClass settlementInfo, int size1, bool bIsLast) { - + Console.WriteLine(settlementInfo.Content); } static void OnRtnOrder(object sender, ref OrderField order) @@ -102,9 +114,23 @@ static bool OnFilterSubscribe(object sender, ExchangeType exchange, int instrume static void Main(string[] args) { + // 注意:为了进行进程外COM技术的支持,项目已经修改了启动对象, + // 默认是从另一个Main中启动,如想测试此内容,请修改项目的属性,Application->Startup object + int i; + int iCount = args.Length; + + for (i = 0; i < iCount; i++) + { + Console.Write("Argument : "); + Console.WriteLine(args[i]); + } + + Console.WriteLine("Press [ENTER] to exit."); + Console.ReadLine(); + //for (int i = 0; i < 10000; ++i) { - test_Tdx_Main(args); + test_CTP_Main(args); } Console.ReadKey(); } @@ -186,8 +212,8 @@ static void test_LTS_Main(string[] args) Console.ReadKey(); - ReqQueryField query = default(ReqQueryField); - api2.ReqQuery(QueryType.ReqQryInstrument, ref query); + ReqQueryField query = new ReqQueryField(); + api2.ReqQuery(QueryType.ReqQryInstrument, query); Console.ReadKey(); @@ -197,7 +223,7 @@ static void test_LTS_Main(string[] args) } #endregion - static XApi api; + static IXApi api; static void test_TongShi_Main(string[] args) { @@ -208,12 +234,11 @@ static void test_TongShi_Main(string[] args) api.OnConnectionStatus = OnConnectionStatus; api.OnRtnDepthMarketData = OnRtnDepthMarketData; - api.OnFilterSubscribe = OnFilterSubscribe; api.Connect(); Thread.Sleep(10 * 1000); - ReqQueryField query = default(ReqQueryField); - api.ReqQuery(QueryType.ReqQryInstrument, ref query); + ReqQueryField query = new ReqQueryField(); + api.ReqQuery(QueryType.ReqQryInstrument, query); Thread.Sleep(300 * 1000); @@ -224,30 +249,77 @@ static void test_TongShi_Main(string[] args) static void test_CTP_Main(string[] args) { + Type type = Type.GetType("XAPI.Callback.XApi, XAPI_CSharp"); + var a = (IXApi)Activator.CreateInstance(type, @"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\x86\CTP\CTP_Quote_x86.dll"); + + api = a; + + api.Server.BrokerID = "9999"; + api.Server.Address = "tcp://180.168.146.187:10010"; + api.Server.PrivateTopicResumeType = ResumeType.Undefined; + + api.User.UserID = "037505"; + api.User.Password = "123456"; + + api.OnConnectionStatus = OnConnectionStatus; + api.OnRtnDepthMarketData = OnRtnDepthMarketData; + api.OnRspQryInstrument = OnRspQryInstrument; + api.OnRspQrySettlementInfo = OnRspQrySettlementInfo; + + api.Connect(); + Thread.Sleep(3 * 1000); + api.Subscribe("IF000;IF_WI;IF_IH_1803;IF888", ""); + + Console.ReadKey(); + Thread.Sleep(1000 * 1000); + + api.Dispose(); + + Thread.Sleep(5 * 1000); + } + + static void test_CTP_Main2(string[] args) + { + Type type = Type.GetType("XAPI.Callback.XApi, XAPI_CSharp"); + var a = (IXApi)Activator.CreateInstance(type, @"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\x86\CTP\CTP_Quote_x86.dll"); + //api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP\x86\QuantBox_CTP_Quote.dll"); //api.Server.BrokerID = "1017"; //api.Server.Address = "tcp://ctpmn1-front1.citicsf.com:51213"; - api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP\x86\QuantBox_CTP_Trade.dll"); + //api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\x86\CTP\CTP_Trade_x86.dll"); + api = a; - api.Server.BrokerID = "1017"; - api.Server.Address = "tcp://ctpmn1-front1.citicsf.com:51205"; + api.Server.BrokerID = "9999"; + api.Server.Address = "tcp://180.168.146.187:10010"; api.Server.PrivateTopicResumeType = ResumeType.Undefined; - api.User.UserID = "00000015"; + api.User.UserID = "037505"; api.User.Password = "123456"; api.OnConnectionStatus = OnConnectionStatus; api.OnRtnDepthMarketData = OnRtnDepthMarketData; api.OnRspQryInstrument = OnRspQryInstrument; + api.OnRspQrySettlementInfo = OnRspQrySettlementInfo; api.Connect(); - Thread.Sleep(10 * 1000); - //api.Subscribe("IF1502", ""); - ReqQueryField query = default(ReqQueryField); - api.ReqQuery(QueryType.ReqQryInstrument, ref query); + Thread.Sleep(3 * 1000); + api.Subscribe("IF1802;au1806;au000;IF000", ""); - Thread.Sleep(300 * 1000); + Console.ReadKey(); + api.Unsubscribe("au1806", ""); + Console.ReadKey(); + api.Unsubscribe("au000", ""); + Console.ReadKey(); + api.Unsubscribe("au1806", ""); + Console.ReadKey(); + + + api.Subscribe("au1806;au000", ""); + Console.ReadKey(); + api.Unsubscribe("au000", ""); + Console.ReadKey(); + Thread.Sleep(1000 * 1000); api.Dispose(); @@ -306,7 +378,43 @@ static void test_KingstarGold_Main(string[] args) static void test_Tdx_Main(string[] args) { - api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\Tdx\x86\QuantBox_Tdx_Trade.dll"); + api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\x86\Tdx\Tdx_Trade_x86.dll"); + + + api.Server.Address = @"D:\tc_yhzq_v6\Login.lua"; + api.Server.ExtInfoChar128 = @"D:\tc_yhzq_v6\"; + api.User.UserID = "16206"; + api.User.Password = "198450"; + + api.Server.Address = @"D:\new_gjzq_v6\Login.lua"; + api.Server.ExtInfoChar128 = @"D:\new_gjzq_v6\"; + api.User.UserID = "31244679"; + api.User.Password = "400323"; + + api.OnConnectionStatus = OnConnectionStatus; + api.OnRtnDepthMarketData = OnRtnDepthMarketData; + + api.Connect(); + + Console.ReadKey(); + Console.WriteLine("回车后开始查持仓"); + Console.ReadKey(); + + ReqQueryField query = new ReqQueryField(); + query.Int32ID = -1; + api.ReqQuery(QueryType.ReqQryInvestorPosition, query); + + // api.Dispose(); + + Console.ReadKey(); + + Console.WriteLine("回车后退出"); + Console.ReadKey(); + } + + static void test_Tdx_Event_Main(string[] args) + { + XApiWrapper api = new XApiWrapper(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\Tdx\x86\QuantBox_Tdx_Trade.dll"); api.Server.BrokerID = ""; api.Server.Address = @"D:\new_hbzq_qq\Login.lua"; @@ -315,8 +423,8 @@ static void test_Tdx_Main(string[] args) api.User.UserID = "05000000000"; api.User.Password = "123456"; - api.OnConnectionStatus = OnConnectionStatus; - api.OnRtnDepthMarketData = OnRtnDepthMarketData; + api.OnConnectionStatus += api_OnConnectionStatus; + api.OnRtnDepthMarketData += api_OnRtnDepthMarketData; api.Connect(); @@ -330,5 +438,15 @@ static void test_Tdx_Main(string[] args) Console.ReadKey(); } + + static void api_OnRtnDepthMarketData(object sender, OnRtnDepthMarketDataNEventArgs e) + { + throw new NotImplementedException(); + } + + static void api_OnConnectionStatus(object sender, OnConnectionStatusEventArgs e) + { + throw new NotImplementedException(); + } } } diff --git a/csharp/QuantBox.XAPI/Properties/AssemblyInfo.cs b/languages/CSharp/XAPI_CSharp/Properties/AssemblyInfo.cs similarity index 61% rename from csharp/QuantBox.XAPI/Properties/AssemblyInfo.cs rename to languages/CSharp/XAPI_CSharp/Properties/AssemblyInfo.cs index bb86af5..4c7a166 100644 --- a/csharp/QuantBox.XAPI/Properties/AssemblyInfo.cs +++ b/languages/CSharp/XAPI_CSharp/Properties/AssemblyInfo.cs @@ -1,26 +1,31 @@ -using System.Reflection; +using System; +//using System.EnterpriseServices; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("QuantBox.XAPI")] +[assembly: AssemblyTitle("XAPI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("QuantBox.XAPI")] -[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyProduct("XAPI")] +[assembly: AssemblyCopyright("Copyright © 2015-2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] +[assembly: ComVisible(true)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4a780d41-2861-4c6e-8cfc-f604b1ce2ace")] +[assembly: CLSCompliant(true)] + +//[assembly: System.Security.AllowPartiallyTrustedCallers] // Version information for an assembly consists of the following four values: // @@ -32,5 +37,14 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.0.0")] -[assembly: AssemblyFileVersion("1.3.0.0")] +[assembly: AssemblyVersion("1.5.0.0")] +[assembly: AssemblyFileVersion("1.5.0.0")] + +//[assembly: ApplicationName("XApiComPlus")] +//[assembly: Description("XApiComPlus Assembly")] +//[assembly: ApplicationActivation(ActivationOption.Server)] +//[assembly: ApplicationAccessControl(false)] + +//[assembly: ImportedFromTypeLib("")] +//[assembly: PrimaryInteropAssembly(1,1)] + diff --git a/csharp/QuantBox.XAPI/Proxy.cs b/languages/CSharp/XAPI_CSharp/Proxy.cs similarity index 95% rename from csharp/QuantBox.XAPI/Proxy.cs rename to languages/CSharp/XAPI_CSharp/Proxy.cs index 6afad2e..05b1993 100644 --- a/csharp/QuantBox.XAPI/Proxy.cs +++ b/languages/CSharp/XAPI_CSharp/Proxy.cs @@ -1,12 +1,15 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; -namespace QuantBox.XAPI +namespace XAPI { + [ComVisible(false)] public delegate IntPtr XCall(byte type, IntPtr pApi1, IntPtr pApi2, double double1, double double2, IntPtr ptr1, int size1, IntPtr ptr2, int size2, IntPtr ptr3, int size3); + [ComVisible(false)] public class Proxy { private InvokeBase _Invoke; diff --git a/csharp/QuantBox.XAPI/QueryType.cs b/languages/CSharp/XAPI_CSharp/QueryType.cs similarity index 90% rename from csharp/QuantBox.XAPI/QueryType.cs rename to languages/CSharp/XAPI_CSharp/QueryType.cs index e0126c5..7036bd6 100644 --- a/csharp/QuantBox.XAPI/QueryType.cs +++ b/languages/CSharp/XAPI_CSharp/QueryType.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; -namespace QuantBox.XAPI +namespace XAPI { public enum QueryType : byte { diff --git a/csharp/QuantBox.XAPI/RequestType.cs b/languages/CSharp/XAPI_CSharp/RequestType.cs similarity index 93% rename from csharp/QuantBox.XAPI/RequestType.cs rename to languages/CSharp/XAPI_CSharp/RequestType.cs index dba3f93..3def22e 100644 --- a/csharp/QuantBox.XAPI/RequestType.cs +++ b/languages/CSharp/XAPI_CSharp/RequestType.cs @@ -4,11 +4,11 @@ using System.Text; -namespace QuantBox.XAPI +namespace XAPI { public enum RequestType:byte { - GetApiType = 0, + GetApiTypes = 0, GetApiVersion, GetApiName, diff --git a/csharp/QuantBox.XAPI/ResponeType.cs b/languages/CSharp/XAPI_CSharp/ResponseType.cs similarity index 88% rename from csharp/QuantBox.XAPI/ResponeType.cs rename to languages/CSharp/XAPI_CSharp/ResponseType.cs index c9b3a4e..a1b5d05 100644 --- a/csharp/QuantBox.XAPI/ResponeType.cs +++ b/languages/CSharp/XAPI_CSharp/ResponseType.cs @@ -4,9 +4,9 @@ using System.Text; -namespace QuantBox.XAPI +namespace XAPI { - public enum ResponeType : byte + public enum ResponseType : byte { OnConnectionStatus = 64, OnRtnError, @@ -31,6 +31,7 @@ public enum ResponeType : byte OnRspQryHistoricalTicks, OnRspQryHistoricalBars, OnRspQryInvestor, + OnRtnInstrumentStatus, OnFilterSubscribe, } diff --git a/csharp/QuantBox.XAPI/SoInvoke.cs b/languages/CSharp/XAPI_CSharp/SoInvoke.cs similarity index 97% rename from csharp/QuantBox.XAPI/SoInvoke.cs rename to languages/CSharp/XAPI_CSharp/SoInvoke.cs index 5f55529..c620d9f 100644 --- a/csharp/QuantBox.XAPI/SoInvoke.cs +++ b/languages/CSharp/XAPI_CSharp/SoInvoke.cs @@ -5,8 +5,9 @@ using System.Text; -namespace QuantBox.XAPI +namespace XAPI { + [ComVisible(false)] public class SoInvoke : InvokeBase { [DllImport("libdl.so")] diff --git a/csharp/QuantBox.XAPI/Struct.cs b/languages/CSharp/XAPI_CSharp/Struct.cs similarity index 87% rename from csharp/QuantBox.XAPI/Struct.cs rename to languages/CSharp/XAPI_CSharp/Struct.cs index 856596a..9de6249 100644 --- a/csharp/QuantBox.XAPI/Struct.cs +++ b/languages/CSharp/XAPI_CSharp/Struct.cs @@ -5,13 +5,14 @@ using System.Text; -namespace QuantBox.XAPI +namespace XAPI { /// /// 查询持仓,查委托,查成交 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct ReqQueryField + public class ReqQueryField { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] InstrumentName; @@ -39,13 +40,23 @@ public struct ReqQueryField public string Char64ID; public int Int32ID; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string Char64RefID; - public int Int32RefID; + public string Char64PositionIndex; + public int Int32PositionIndex; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID1; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID2; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID3; + + public BusinessType Business; } ///持仓 + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct PositionField + public class PositionField { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] InstrumentName; @@ -64,7 +75,7 @@ public struct PositionField public HedgeFlagType HedgeFlag; public int Date; public double PositionCost; - + public double Position; public double TodayPosition; public double HistoryPosition; @@ -78,13 +89,26 @@ public struct PositionField public double TodayPRPosition; ///今日申赎持仓冻结 public double TodayPRFrozen; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] + public string ID; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID1; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID2; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID3; + + public BusinessType Business; } /// /// 做市商双向报价 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct QuoteField + public class QuoteField { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] InstrumentName; @@ -138,8 +162,9 @@ public struct QuoteField /// /// 订单信息 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct OrderField + public class OrderField { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] InstrumentName; @@ -190,13 +215,23 @@ public struct OrderField public int ReserveInt32; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string ReserveChar64; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID1; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID2; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID3; + + public BusinessType Business; } /// /// 成交回报 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct TradeField + public class TradeField { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] InstrumentName; @@ -230,14 +265,24 @@ public struct TradeField public int ReserveInt32; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string ReserveChar64; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID1; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID2; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string PortfolioID3; + + public BusinessType Business; } /// /// 服务器信息 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct ServerInfoField + public class ServerInfoField { /// /// 订阅主题 @@ -300,8 +345,9 @@ public struct ServerInfoField /// /// 用户信息 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct UserInfoField + public class UserInfoField { /// /// 用户代码 @@ -328,8 +374,9 @@ public struct UserInfoField /// /// 错误信息 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct ErrorField + public class ErrorField { /// /// 错误代码 @@ -355,8 +402,9 @@ public struct ErrorField /// /// 日志信息 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct LogField + public class LogField { /// /// 日志级别 @@ -373,8 +421,9 @@ public struct LogField /// /// 登录回报 /// + [ComVisible(true)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct RspUserLoginField + public class RspUserLoginField { /// /// 交易日 @@ -389,7 +438,7 @@ public struct RspUserLoginField /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string SessionID; - + /// /// /// @@ -421,13 +470,14 @@ public struct RspUserLoginField public byte[] Text; } - + /// /// DepthField行情 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct DepthField + public class DepthField { public double Price; public int Size; @@ -438,8 +488,9 @@ public struct DepthField /// /// 合约信息 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct InstrumentField + public class InstrumentField { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] InstrumentName; @@ -501,8 +552,9 @@ public struct InstrumentField /// /// 账号 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct AccountField + public class AccountField { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string ClientID; @@ -580,13 +632,12 @@ public struct AccountField public double CashIn; } - - /// /// 发给做市商的询价请求 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct QuoteRequestField + public class QuoteRequestField { /// /// 合约代码 @@ -622,6 +673,7 @@ public struct QuoteRequestField /// /// 结算信息 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] public struct SettlementInfoField { @@ -637,6 +689,7 @@ public struct SettlementInfoField //public byte[] Content; } + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] public struct SettlementInfoClass { @@ -654,8 +707,9 @@ public struct SettlementInfoClass /// /// 投资者 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct InvestorField + public class InvestorField { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string InvestorID; @@ -669,8 +723,9 @@ public struct InvestorField } + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct OrderIDType + public class OrderIDType { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string ID; @@ -679,8 +734,9 @@ public struct OrderIDType /// /// 深度行情N档 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct DepthMarketDataNField + public class DepthMarketDataNField { ///占用总字节大小 public int Size; @@ -703,6 +759,11 @@ public struct DepthMarketDataNField /// /// 交易所代码 /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 9)] + public string ExchangeID; + /// + /// 交易所代码 + /// public ExchangeType Exchange; @@ -777,6 +838,7 @@ public struct DepthMarketDataNField public int BidCount; } + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] public class DepthMarketDataNClass { @@ -785,11 +847,6 @@ public class DepthMarketDataNClass public int UpdateTime; public int UpdateMillisec; - /// - /// 交易所代码 - /// - public ExchangeType Exchange; - /// /// 合约代码 /// @@ -800,6 +857,16 @@ public class DepthMarketDataNClass /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] public string InstrumentID; + /// + /// 交易所代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 9)] + public string ExchangeID; + + /// + /// 交易所代码 + /// + public ExchangeType Exchange; /// @@ -875,6 +942,35 @@ public class DepthMarketDataNClass } + /// + /// 深度行情N档 + /// + [ComVisible(false)] + [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] + public class InstrumentStatusField + { + /// + /// 合约代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] + public string Symbol; + /// + /// 合约代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] + public string InstrumentID; + /// + /// 交易所代码 + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 9)] + public string ExchangeID; + + ///交易阶段类型 + public TradingPhaseType InstrumentStatus; + + public int EnterTime; + }; + @@ -891,8 +987,9 @@ public class DepthMarketDataNClass /// /// Tick行情 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct TickField + public class TickField { public int Date; public int Time; @@ -910,8 +1007,9 @@ public struct TickField /// /// Bar行情 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] - public struct BarField + public class BarField { public int Date; public int Time; @@ -930,6 +1028,7 @@ public struct BarField /// /// 合约信息 /// + [ComVisible(false)] [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] public struct HistoricalDataRequestField { diff --git a/languages/CSharp/XAPI_CSharp/XAPI.snk b/languages/CSharp/XAPI_CSharp/XAPI.snk new file mode 100644 index 0000000..fe95a6b Binary files /dev/null and b/languages/CSharp/XAPI_CSharp/XAPI.snk differ diff --git a/csharp/QuantBox.XAPI/QuantBox.XAPI.csproj b/languages/CSharp/XAPI_CSharp/XAPI_CSharp.csproj similarity index 55% rename from csharp/QuantBox.XAPI/QuantBox.XAPI.csproj rename to languages/CSharp/XAPI_CSharp/XAPI_CSharp.csproj index aa3e5f3..432ad19 100644 --- a/csharp/QuantBox.XAPI/QuantBox.XAPI.csproj +++ b/languages/CSharp/XAPI_CSharp/XAPI_CSharp.csproj @@ -1,17 +1,32 @@  - + Debug AnyCPU {6AA065F5-2E4A-4112-A3AE-1F75CAE42FFB} - Library + Exe Properties - QuantBox.XAPI - QuantBox.XAPI - v4.5 + XAPI + XAPI_CSharp + v4.5.1 512 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true true @@ -21,10 +36,11 @@ DEBUG;TRACE prompt 4 - false + true AnyCPU true - false + true + ManagedMinimumRules.ruleset pdbonly @@ -34,10 +50,7 @@ prompt 4 false - - - - + true true @@ -48,6 +61,9 @@ prompt MinimumRecommendedRules.ruleset false + true + 4 + false true @@ -59,6 +75,8 @@ MinimumRecommendedRules.ruleset true false + 4 + false bin\x64\Release\ @@ -69,10 +87,12 @@ prompt MinimumRecommendedRules.ruleset false + 4 + true true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\ + bin\Debug\x64 DEBUG;TRACE full AnyCPU @@ -80,14 +100,44 @@ MinimumRecommendedRules.ruleset true false + 4 + false + + + true + + + XAPI.snk + + + bin\Release64\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + 4 + true + + + bin\x64\Release64\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + 4 + true + + + XAPI.Program - - False - ..\..\packages\NLog.4.0.1\lib\net45\NLog.dll - + @@ -102,6 +152,17 @@ + + + + + + + + + + UserControl + @@ -109,8 +170,10 @@ - + + + @@ -119,21 +182,43 @@ - + + + + + + + + + XApiCom.cs + + + + + False + Microsoft .NET Framework 4.5 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + - xcopy "$(TargetPath)" "$(SolutionDir)XAPI\" /Y -xcopy "$(TargetDir)NLog.dll" "$(SolutionDir)XAPI\" /Y + +