├── .gitattributes
├── .gitignore
├── CPlus
├── AlgoWorker
│ ├── AlgoWorker.vcxproj
│ └── AlgoWorker.vcxproj.filters
├── DataCenter
│ ├── DataCenter.vcxproj
│ └── DataCenter.vcxproj.filters
├── MDReceiver
│ ├── MDReceiver.vcxproj
│ └── MDReceiver.vcxproj.filters
└── TradingCenter
│ ├── TradingCenter.vcxproj
│ └── TradingCenter.vcxproj.filters
├── CSharp
├── Api
│ ├── Api.csproj
│ ├── BaseFastTest.cs
│ ├── BaseStrategy.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── QuotationApi.cs
│ └── TradeApi.cs
├── Asteroids
│ ├── Asteroids.csproj
│ ├── Functions
│ │ ├── AverageE.cs
│ │ ├── AverageS.cs
│ │ ├── BaseFunction.cs
│ │ ├── MaxValue.cs
│ │ └── MinValue.cs
│ ├── Indicators
│ │ ├── BaseIndicator.cs
│ │ ├── IndicatorGraph.cs
│ │ ├── KDJ.cs
│ │ ├── MA.cs
│ │ └── MACD.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── Commons
│ ├── Commons.csproj
│ ├── NetHelper.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── StringHelper.cs
├── DataAccess
│ ├── BaseDataAccess.cs
│ ├── BaseMySql.cs
│ ├── ContractMySql.cs
│ ├── DataAccess.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── UserMySql.cs
├── FTCenter
│ ├── FTCenter.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
├── FTWorker
│ ├── FTWorker.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
├── Model
│ ├── BarData.cs
│ ├── Contracts.cs
│ ├── DailyMoneys.cs
│ ├── Enums
│ │ ├── EnumBarStruct.cs
│ │ ├── EnumLineStyle.cs
│ │ ├── EnumOrderStatus.cs
│ │ └── EnumSide.cs
│ ├── IStrategy.cs
│ ├── JPR.cs
│ ├── Messages.cs
│ ├── Models.csproj
│ ├── Orders.cs
│ ├── Positions.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Reports.cs
│ ├── ResData.cs
│ ├── Settings.cs
│ ├── Strategies.cs
│ ├── TickData.cs
│ ├── Trades.cs
│ └── Users.cs
├── Quant
│ ├── App.config
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── Quant.csproj
│ ├── frmMain.Designer.cs
│ ├── frmMain.cs
│ └── frmMain.resx
├── Resources
│ ├── MySql.Data.dll
│ ├── MySql.Data.xml
│ ├── Newtonsoft.Json.dll
│ ├── Newtonsoft.Json.xml
│ └── ZeroMQ.4.1.0.26
│ │ ├── .signature.p7s
│ │ └── lib
│ │ └── net40
│ │ ├── ZeroMQ.dll
│ │ └── ZeroMQ.xml
├── Services
│ ├── BaseService.cs
│ ├── ContractService.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Services.csproj
│ └── UserService.cs
├── SettleWorker
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── SettleWorker.csproj
├── StrategyWorker
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── StrategyWorker.csproj
└── Tests
│ ├── App.config
│ ├── Program.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── StrategyTest.cs
│ ├── Tests.csproj
│ └── ZMQTest.cs
├── Datas
├── quant_accounts.sql
├── quant_contracts.sql
├── quant_dailymoneys.sql
├── quant_logs.sql
├── quant_orders.sql
├── quant_positions.sql
├── quant_reports.sql
├── quant_settles.sql
├── quant_strategies.sql
├── quant_trades.sql
└── quant_users.sql
├── NodeJs
├── api
│ ├── strategy.js
│ └── user.js
├── app.js
├── common
│ ├── Msg.js
│ └── util.js
├── models
│ ├── Strategies.js
│ ├── Sys.js
│ ├── Users.js
│ └── mysqldb.js
├── package-lock.json
├── package.json
├── public
│ ├── css
│ │ └── style.css
│ └── js
│ │ └── util.js
├── routes
│ ├── index.js
│ ├── strategy.js
│ └── user.js
└── views
│ ├── error.ejs
│ ├── footer.ejs
│ ├── header.ejs
│ ├── index.ejs
│ ├── login.ejs
│ ├── login2.ejs
│ ├── strategy.ejs
│ └── user.ejs
├── Quant.sln
├── README.md
└── favicon.ico
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | [Xx]64/
19 | [Xx]86/
20 | [Bb]uild/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 |
85 | # Visual Studio profiler
86 | *.psess
87 | *.vsp
88 | *.vspx
89 | *.sap
90 |
91 | # TFS 2012 Local Workspace
92 | $tf/
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 | *.DotSettings.user
101 |
102 | # JustCode is a .NET coding add-in
103 | .JustCode
104 |
105 | # TeamCity is a build add-in
106 | _TeamCity*
107 |
108 | # DotCover is a Code Coverage Tool
109 | *.dotCover
110 |
111 | # NCrunch
112 | _NCrunch_*
113 | .*crunch*.local.xml
114 | nCrunchTemp_*
115 |
116 | # MightyMoose
117 | *.mm.*
118 | AutoTest.Net/
119 |
120 | # Web workbench (sass)
121 | .sass-cache/
122 |
123 | # Installshield output folder
124 | [Ee]xpress/
125 |
126 | # DocProject is a documentation generator add-in
127 | DocProject/buildhelp/
128 | DocProject/Help/*.HxT
129 | DocProject/Help/*.HxC
130 | DocProject/Help/*.hhc
131 | DocProject/Help/*.hhk
132 | DocProject/Help/*.hhp
133 | DocProject/Help/Html2
134 | DocProject/Help/html
135 |
136 | # Click-Once directory
137 | publish/
138 |
139 | # Publish Web Output
140 | *.[Pp]ublish.xml
141 | *.azurePubxml
142 |
143 | # TODO: Un-comment the next line if you do not want to checkin
144 | # your web deploy settings because they may include unencrypted
145 | # passwords
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # NuGet Packages
150 | *.nupkg
151 | # The packages folder can be ignored because of Package Restore
152 | **/packages/*
153 | # except build/, which is used as an MSBuild target.
154 | !**/packages/build/
155 | # Uncomment if necessary however generally it will be regenerated when needed
156 | #!**/packages/repositories.config
157 | # NuGet v3's project.json files produces more ignoreable files
158 | *.nuget.props
159 | *.nuget.targets
160 |
161 | # Microsoft Azure Build Output
162 | csx/
163 | *.build.csdef
164 |
165 | # Microsoft Azure Emulator
166 | ecf/
167 | rcf/
168 |
169 | # Windows Store app package directory
170 | AppPackages/
171 | BundleArtifacts/
172 |
173 | # Visual Studio cache files
174 | # files ending in .cache can be ignored
175 | *.[Cc]ache
176 | # but keep track of directories ending in .cache
177 | !*.[Cc]ache/
178 |
179 | # Others
180 | ClientBin/
181 | [Ss]tyle[Cc]op.*
182 | ~$*
183 | *~
184 | *.dbmdl
185 | *.dbproj.schemaview
186 | *.pfx
187 | *.publishsettings
188 | node_modules/
189 | sessions/
190 | orleans.codegen.cs
191 |
192 | # RIA/Silverlight projects
193 | Generated_Code/
194 |
195 | # Backup & report files from converting an old project file
196 | # to a newer Visual Studio version. Backup files are not needed,
197 | # because we have git ;-)
198 | _UpgradeReport_Files/
199 | Backup*/
200 | UpgradeLog*.XML
201 | UpgradeLog*.htm
202 |
203 | # SQL Server files
204 | *.mdf
205 | *.ldf
206 |
207 | # Business Intelligence projects
208 | *.rdl.data
209 | *.bim.layout
210 | *.bim_*.settings
211 |
212 | # Microsoft Fakes
213 | FakesAssemblies/
214 |
215 | # GhostDoc plugin setting file
216 | *.GhostDoc.xml
217 |
218 | # Node.js Tools for Visual Studio
219 | .ntvs_analysis.dat
220 |
221 | # Visual Studio 6 build log
222 | *.plg
223 |
224 | # Visual Studio 6 workspace options file
225 | *.opt
226 |
227 | # Visual Studio LightSwitch build output
228 | **/*.HTMLClient/GeneratedArtifacts
229 | **/*.DesktopClient/GeneratedArtifacts
230 | **/*.DesktopClient/ModelManifest.xml
231 | **/*.Server/GeneratedArtifacts
232 | **/*.Server/ModelManifest.xml
233 | _Pvt_Extensions
234 |
235 | # LightSwitch generated files
236 | GeneratedArtifacts/
237 | ModelManifest.xml
238 |
239 | # Paket dependency manager
240 | .paket/paket.exe
241 |
242 | # FAKE - F# Make
243 | .fake/
244 |
--------------------------------------------------------------------------------
/CPlus/AlgoWorker/AlgoWorker.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {818193AC-BE49-42D0-ADD0-8643ABFC5251}
23 | AlgoWorker
24 | 8.1
25 |
26 |
27 |
28 | Application
29 | true
30 | v140
31 | MultiByte
32 |
33 |
34 | Application
35 | false
36 | v140
37 | true
38 | MultiByte
39 |
40 |
41 | Application
42 | true
43 | v140
44 | MultiByte
45 |
46 |
47 | Application
48 | false
49 | v140
50 | true
51 | MultiByte
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | Level3
75 | Disabled
76 | true
77 |
78 |
79 |
80 |
81 | Level3
82 | Disabled
83 | true
84 |
85 |
86 |
87 |
88 | Level3
89 | MaxSpeed
90 | true
91 | true
92 | true
93 |
94 |
95 | true
96 | true
97 |
98 |
99 |
100 |
101 | Level3
102 | MaxSpeed
103 | true
104 | true
105 | true
106 |
107 |
108 | true
109 | true
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/CPlus/AlgoWorker/AlgoWorker.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
--------------------------------------------------------------------------------
/CPlus/DataCenter/DataCenter.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {F076824B-A905-4B85-93D9-AFF849121F67}
23 | DataCenter
24 | 8.1
25 |
26 |
27 |
28 | Application
29 | true
30 | v140
31 | MultiByte
32 |
33 |
34 | Application
35 | false
36 | v140
37 | true
38 | MultiByte
39 |
40 |
41 | Application
42 | true
43 | v140
44 | MultiByte
45 |
46 |
47 | Application
48 | false
49 | v140
50 | true
51 | MultiByte
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | Level3
75 | Disabled
76 | true
77 |
78 |
79 |
80 |
81 | Level3
82 | Disabled
83 | true
84 |
85 |
86 |
87 |
88 | Level3
89 | MaxSpeed
90 | true
91 | true
92 | true
93 |
94 |
95 | true
96 | true
97 |
98 |
99 |
100 |
101 | Level3
102 | MaxSpeed
103 | true
104 | true
105 | true
106 |
107 |
108 | true
109 | true
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/CPlus/DataCenter/DataCenter.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
--------------------------------------------------------------------------------
/CPlus/MDReceiver/MDReceiver.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {71AE3803-3C95-462C-8881-0DBD8509933F}
23 | MDReceiver
24 | 8.1
25 |
26 |
27 |
28 | Application
29 | true
30 | v140
31 | MultiByte
32 |
33 |
34 | Application
35 | false
36 | v140
37 | true
38 | MultiByte
39 |
40 |
41 | Application
42 | true
43 | v140
44 | MultiByte
45 |
46 |
47 | Application
48 | false
49 | v140
50 | true
51 | MultiByte
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | Level3
75 | Disabled
76 | true
77 |
78 |
79 |
80 |
81 | Level3
82 | Disabled
83 | true
84 |
85 |
86 |
87 |
88 | Level3
89 | MaxSpeed
90 | true
91 | true
92 | true
93 |
94 |
95 | true
96 | true
97 |
98 |
99 |
100 |
101 | Level3
102 | MaxSpeed
103 | true
104 | true
105 | true
106 |
107 |
108 | true
109 | true
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/CPlus/MDReceiver/MDReceiver.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
--------------------------------------------------------------------------------
/CPlus/TradingCenter/TradingCenter.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
--------------------------------------------------------------------------------
/CSharp/Api/Api.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {86E4F9A4-D170-41AB-9385-1965B09C4E1C}
8 | Library
9 | Properties
10 | EPI.CSharp.Api
11 | Api
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | {704f62d5-467c-4701-be8e-020984078f74}
52 | Commons
53 |
54 |
55 | {fca5e410-9f2b-4a74-a7ae-45227d92e64d}
56 | Models
57 |
58 |
59 | {0cb731cb-caf6-4495-b62a-b8083353e5f1}
60 | Services
61 |
62 |
63 |
64 |
71 |
--------------------------------------------------------------------------------
/CSharp/Api/BaseStrategy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Api
8 | {
9 | class BaseStrategy
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/CSharp/Api/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("TradeApi")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("TradeApi")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("86e4f9a4-d170-41ab-9385-1965b09c4e1c")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/Api/QuotationApi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Api
8 | {
9 | ///
10 | /// 行情接口类
11 | ///
12 | public class QuotationApi
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/CSharp/Api/TradeApi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Api
8 | {
9 | ///
10 | /// 交易接口类
11 | ///
12 | public class TradeApi
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/CSharp/Asteroids/Asteroids.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {20677463-0008-4077-85D1-F439B7E49DD2}
8 | Library
9 | Properties
10 | Asteroids
11 | Asteroids
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | {fca5e410-9f2b-4a74-a7ae-45227d92e64d}
60 | Models
61 |
62 |
63 |
64 |
71 |
--------------------------------------------------------------------------------
/CSharp/Asteroids/Functions/AverageE.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Asteroids.Functions
9 | {
10 | public class AverageE : BaseFunction
11 | {
12 | private int _length;
13 | private double factor;
14 | private double preLastValue;
15 | private double lastValue;
16 |
17 | public AverageE()
18 | {
19 | Name = "AverageE";
20 | Description = "指数求平均";
21 | lastValue = JPR.NaN;
22 | }
23 |
24 | public void SetParameters(int length)
25 | {
26 | _length = length;
27 | factor = 2d / (length + 1);
28 | lastValue = JPR.NaN;
29 | }
30 |
31 | public double Caculate(double data)
32 | {
33 | double result;
34 | if (lastValue == JPR.NaN)
35 | {
36 | preLastValue = lastValue = data;
37 | result = lastValue;
38 | }
39 | else
40 | {
41 | preLastValue = lastValue;
42 | lastValue = lastValue + factor * (data - lastValue);
43 | result = lastValue;
44 | }
45 | return result;
46 | }
47 |
48 | public void ResetValue()
49 | {
50 | lastValue = preLastValue;
51 | }
52 |
53 | public int Length
54 | {
55 | get { return _length; }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/CSharp/Asteroids/Functions/AverageS.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Asteroids.Functions
9 | {
10 | public class AverageS : BaseFunction
11 | {
12 | private int _length;
13 | private List tmpList;
14 |
15 | public AverageS()
16 | {
17 | Name = "AverageS";
18 | Description = "简单求平均";
19 | tmpList = new List();
20 | }
21 |
22 | public void SetParameters(int length)
23 | {
24 | _length = length;
25 | tmpList.Clear();
26 | }
27 |
28 | public void Clear()
29 | {
30 | tmpList.Clear();
31 | }
32 |
33 | public double AddValue(double data)
34 | {
35 | double result;
36 | if (tmpList.Count > 0 && tmpList.Count == _length)
37 | { tmpList.RemoveAt(0); }
38 | else if (tmpList.Count > _length)
39 | { throw new Exception("计算数量超出范围"); }
40 | tmpList.Add(data);
41 | if (tmpList.Count == _length)
42 | { result = tmpList.Average(); }
43 | else
44 | { result = JPR.NaN; }
45 | return result;
46 | }
47 |
48 | public void RemoveLast()
49 | {
50 | tmpList.RemoveAt(tmpList.Count - 1);
51 | }
52 |
53 | public int Length
54 | {
55 | get { return _length; }
56 | }
57 |
58 | public double REF(int refidx)
59 | {
60 | if (refidx >= 0 && refidx < _length && refidx < tmpList.Count)
61 | {
62 | return tmpList[tmpList.Count - refidx - 1];
63 | }
64 | else
65 | return JPR.NaN;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/CSharp/Asteroids/Functions/BaseFunction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Asteroids.Functions
8 | {
9 | public class BaseFunction
10 | {
11 | ///
12 | /// 方法名称
13 | ///
14 | public string Name { get; set; }
15 | ///
16 | /// 方法描述
17 | ///
18 | public string Description { get; set; }
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/CSharp/Asteroids/Functions/MaxValue.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Asteroids.Functions
9 | {
10 | public class MaxValue : BaseFunction
11 | {
12 | private int _length;
13 | private List tmpList;
14 |
15 | public MaxValue()
16 | {
17 | Name = "MaxValue";
18 | Description = "求最高值";
19 | tmpList = new List();
20 | }
21 |
22 | public void SetParameters(int length)
23 | {
24 | _length = length;
25 | tmpList.Clear();
26 | }
27 |
28 | public double AddValue(double data)
29 | {
30 | double result;
31 | if (tmpList.Count == _length)
32 | { tmpList.RemoveAt(0); }
33 | else if (tmpList.Count > _length)
34 | { throw new Exception("计算数量超出范围"); }
35 | tmpList.Add(data);
36 | if (tmpList.Count == _length)
37 | { result = tmpList.Max(); }
38 | else
39 | { result = JPR.NaN; }
40 | return result;
41 | }
42 |
43 | public void RemoveLast()
44 | {
45 | tmpList.RemoveAt(tmpList.Count - 1);
46 | }
47 |
48 | public int Length
49 | {
50 | get { return _length; }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/CSharp/Asteroids/Functions/MinValue.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Asteroids.Functions
9 | {
10 | public class MinValue : BaseFunction
11 | {
12 | private int _length;
13 | private List tmpList;
14 |
15 | public MinValue()
16 | {
17 | Name = "MinValue";
18 | Description = "求最低值";
19 | tmpList = new List();
20 | }
21 |
22 | public void SetParameters(int length)
23 | {
24 | _length = length;
25 | tmpList.Clear();
26 | }
27 |
28 | public double AddValue(double data)
29 | {
30 | double result;
31 | if (tmpList.Count == _length)
32 | { tmpList.RemoveAt(0); }
33 | else if (tmpList.Count > _length)
34 | { throw new Exception("计算数量超出范围"); }
35 | tmpList.Add(data);
36 | if (tmpList.Count == _length)
37 | { result = tmpList.Min(); }
38 | else
39 | { result = JPR.NaN; }
40 | return result;
41 | }
42 |
43 | public void RemoveLast()
44 | {
45 | tmpList.RemoveAt(tmpList.Count - 1);
46 | }
47 |
48 | public int Length
49 | {
50 | get { return _length; }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/CSharp/Asteroids/Indicators/IndicatorGraph.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Model.Enums;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Drawing;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Asteroids.Indicators
10 | {
11 | public class IndicatorGraph
12 | {
13 | private List _colors;
14 |
15 | private List _values;
16 |
17 | public IndicatorGraph()
18 | {
19 | _values = new List();
20 | _colors = new List();
21 | }
22 | ///
23 | /// 图形名称
24 | ///
25 | public string Name { get; set; }
26 | ///
27 | /// 图形标签
28 | ///
29 | public string Tag { get; set; }
30 | ///
31 | /// 图形样式
32 | ///
33 | public EnumLineStyle LineStyle { get; set; }
34 | ///
35 | /// 图形颜色
36 | ///
37 | public List Colors
38 | {
39 | get { return _colors; }
40 | }
41 | ///
42 | /// 图形值
43 | ///
44 | public List Values
45 | {
46 | get { return _values; }
47 | }
48 |
49 | ///
50 | /// 添加值
51 | ///
52 | ///
53 | ///
54 | public void AddValue(double value, Color color)
55 | {
56 | _values.Add(value);
57 | _colors.Add(color);
58 | }
59 |
60 | public void RemoveLast()
61 | {
62 | _values.RemoveAt(_values.Count - 1);
63 | _colors.RemoveAt(_colors.Count - 1);
64 | }
65 | ///
66 | /// 清空记录
67 | ///
68 | public void Clear()
69 | {
70 | _values.Clear();
71 | _colors.Clear();
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/CSharp/Asteroids/Indicators/MA.cs:
--------------------------------------------------------------------------------
1 | using Asteroids.Functions;
2 | using EPI.CSharp.Model;
3 | using EPI.CSharp.Model.Enums;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace Asteroids.Indicators
12 | {
13 | public class MA : BaseIndicator
14 | {
15 | private EnumBarStruct barStruct;
16 | private int _length;
17 | private AverageS averageS;
18 |
19 | public MA(List barDatas, EnumBarStruct objBarStruct = EnumBarStruct.Close,
20 | int length = 10, bool isSimpleMode = true, bool isShowInMain = true, string tag = "1")
21 | : base(barDatas)
22 | {
23 | Tag = tag;
24 | _length = length;
25 | barStruct = objBarStruct;
26 | IsSimpleMode = isSimpleMode;
27 | string paramTag = string.Format("({0},{1})", barStruct.ToString(), _length);
28 | Name = string.Format("MA{0}", paramTag);
29 | Description = "移动平均";
30 | valueDict.Add("MA", new List());
31 | if (!IsSimpleMode)
32 | {
33 | graphDict.Add("MA", new IndicatorGraph() { Name = "MA", Tag = paramTag, LineStyle = EnumLineStyle.SolidLine });
34 | }
35 | averageS = new AverageS();
36 | IsShowInMain = isShowInMain;
37 | Caculate();
38 | }
39 |
40 | public void SetParameters(EnumBarStruct objBarStruct, int length)
41 | {
42 | if (objBarStruct != barStruct || length != _length)
43 | {
44 | string paramTag = string.Format("({0},{1})", objBarStruct.ToString(), length);
45 | Name = string.Format("MA{0}", paramTag);
46 | if (!IsSimpleMode)
47 | {
48 | graphDict["MA"].Tag = paramTag;
49 | }
50 | barStruct = objBarStruct;
51 | _length = length;
52 | Caculate();
53 | }
54 | }
55 |
56 | protected override void Caculate()
57 | {
58 | valueDict["MA"].Clear();
59 | if (!IsSimpleMode)
60 | {
61 | graphDict["MA"].Clear();
62 | }
63 | averageS.SetParameters(_length);
64 | if (barDatas != null && Count != 0)
65 | {
66 | for (int i = 0; i < Count; i++)
67 | {
68 | GenerateSMA(i);
69 | }
70 | }
71 | base.Caculate();
72 | }
73 |
74 | private void GenerateSMA(int i)
75 | {
76 | BarData curData = null;
77 | if (i >= barDatas.Count)
78 | {
79 | curData = GetBarData(0);
80 | }
81 | else
82 | {
83 | curData = barDatas[i];
84 | }
85 | double value = averageS.AddValue(GetData(curData));
86 | valueDict["MA"].Add(value);
87 | if (!IsSimpleMode)
88 | {
89 | graphDict["MA"].AddValue(value, Color.Yellow);
90 | }
91 | }
92 |
93 | public override void UpdateBarData(BarData bar)
94 | {
95 | base.UpdateBarData(bar);
96 | valueDict["MA"].RemoveAt(Count - 1);
97 | if (!IsSimpleMode)
98 | {
99 | graphDict["MA"].RemoveLast();
100 | }
101 | averageS.RemoveLast();
102 | GenerateSMA(Count - 1);
103 |
104 |
105 | }
106 |
107 | public override void AddBarData(BarData bar)
108 | {
109 | base.AddBarData(bar);
110 | GenerateSMA(Count - 1);
111 | }
112 |
113 | private double GetData(BarData bar)
114 | {
115 | double data;
116 | switch (barStruct)
117 | {
118 | case EnumBarStruct.Open:
119 | data = bar.Open;
120 | break;
121 | case EnumBarStruct.High:
122 | data = bar.High;
123 | break;
124 | case EnumBarStruct.Low:
125 | data = bar.Low;
126 | break;
127 | case EnumBarStruct.Close:
128 | data = bar.Close;
129 | break;
130 | case EnumBarStruct.Volume:
131 | data = bar.Volume;
132 | break;
133 | case EnumBarStruct.OpenInterest:
134 | data = bar.OpenInterest;
135 | break;
136 | case EnumBarStruct.Amount:
137 | data = bar.Amount;
138 | break;
139 | default:
140 | data = 0;
141 | break;
142 | }
143 | return data;
144 | }
145 |
146 | public List GetValues()
147 | {
148 | return valueDict["MA"];
149 | }
150 |
151 | public double GetValue(int index)
152 | {
153 | if (index >= 0 && index < Count)
154 | return valueDict["MA"][index];
155 | else
156 | return JPR.NaN;
157 | }
158 |
159 | public double GetLast()
160 | {
161 | if (Count != 0)
162 | return valueDict["MA"][Count - 1];
163 | else
164 | return JPR.NaN;
165 | }
166 |
167 | public int Length
168 | {
169 | get { return _length; }
170 | }
171 |
172 | public int DataType
173 | {
174 | get { return barStruct.GetHashCode(); }
175 | }
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/CSharp/Asteroids/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("Asteroids")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("Asteroids")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("20677463-0008-4077-85d1-f439b7e49dd2")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/Commons/Commons.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {704F62D5-467C-4701-BE8E-020984078F74}
8 | Library
9 | Properties
10 | EPI.CSharp.Commons
11 | Commons
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
55 |
--------------------------------------------------------------------------------
/CSharp/Commons/NetHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Net;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace EPI.CSharp.Commons
10 | {
11 | public class NetHelper
12 | {
13 | #region 公共方法
14 | ///
15 | /// Get数据接口
16 | ///
17 | /// 接口地址
18 | ///
19 | public string GetWebRequest(string getUrl)
20 | {
21 | string responseContent = "";
22 |
23 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(getUrl);
24 | request.ContentType = "application/json";
25 | request.Method = "GET";
26 |
27 | HttpWebResponse response = (HttpWebResponse)request.GetResponse();
28 | //在这里对接收到的页面内容进行处理
29 | using (Stream resStream = response.GetResponseStream())
30 | {
31 | using (StreamReader reader = new StreamReader(resStream, Encoding.UTF8))
32 | {
33 | responseContent = reader.ReadToEnd().ToString();
34 | }
35 | }
36 | return responseContent;
37 | }
38 | ///
39 | /// Post数据接口
40 | ///
41 | /// 接口地址
42 | /// 提交json数据
43 | /// 编码方式(Encoding.UTF8)
44 | ///
45 | public string PostWebRequest(string postUrl, string paramData, Encoding dataEncode)
46 | {
47 | string responseContent = string.Empty;
48 | try
49 | {
50 | byte[] byteArray = dataEncode.GetBytes(paramData); //转化
51 | HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(postUrl));
52 | webReq.Method = "POST";
53 | webReq.ContentType = "application/x-www-form-urlencoded";
54 | webReq.ContentLength = byteArray.Length;
55 | using (Stream reqStream = webReq.GetRequestStream())
56 | {
57 | reqStream.Write(byteArray, 0, byteArray.Length);//写入参数
58 | //reqStream.Close();
59 | }
60 | using (HttpWebResponse response = (HttpWebResponse)webReq.GetResponse())
61 | {
62 | //在这里对接收到的页面内容进行处理
63 | using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default))
64 | {
65 | responseContent = sr.ReadToEnd().ToString();
66 | }
67 | }
68 | }
69 | catch (Exception ex)
70 | {
71 | return ex.Message;
72 | }
73 | return responseContent;
74 | }
75 |
76 | #endregion
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/CSharp/Commons/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("FCommons")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("FCommons")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("704f62d5-467c-4701-be8e-020984078f74")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/Commons/StringHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Commons
8 | {
9 | public static class StringHelper
10 | {
11 | ///
12 | /// 转换周期为分钟数
13 | ///
14 | ///
15 | ///
16 | public static int ConvertCycleToMinute(string cycle)
17 | {
18 | cycle = cycle.ToUpper();
19 | var sign = cycle[cycle.Length - 1];
20 | var numStr = cycle.Substring(0, cycle.Length - 1);
21 | var num = 0;
22 | if (int.TryParse(numStr, out num))
23 | {
24 | if (sign == 'H')
25 | {
26 | return num * 60;
27 | }
28 | else if (sign == 'D')
29 | {
30 | return num * 60 * 24;
31 | }
32 | else if (sign == 'W')
33 | {
34 | return num * 60 * 24 * 7;
35 | }
36 | else if (sign == 'U')
37 | {
38 | return num * 60 * 24 * 30;
39 | }
40 | else if (sign == 'Y')
41 | {
42 | return num * 60 * 24 * 365;
43 | }
44 | else
45 | {
46 | return num;
47 | }
48 | }
49 | else return -1;
50 | }
51 |
52 | ///
53 | /// 是否标准合约
54 | ///
55 | /// 周期
56 | ///
57 | public static bool IsStandardCycle(string cycle)
58 | {
59 | cycle = cycle.ToUpper();
60 | return cycle == "1M" || cycle == "3M" || cycle == "5M" || cycle == "15M" || cycle == "1D";
61 | }
62 |
63 | ///
64 | /// 获取提取数据数量
65 | ///
66 | ///
67 | ///
68 | ///
69 | ///
70 | public static int GetTakeNumber(string cycle, string minCycle, int takeNumber)
71 | {
72 | char symbol = cycle[cycle.Length - 1];
73 | int usrNum = int.Parse(RemoveNotNumber(cycle));
74 | if (symbol == 'M')
75 | {
76 | int realNum = int.Parse(RemoveNotNumber(minCycle));
77 | return takeNumber * (usrNum / realNum);
78 | }
79 | else if (symbol == 'H')
80 | {
81 | return takeNumber * 4 * usrNum;
82 | }
83 | else if (symbol == 'W')
84 | {
85 | return takeNumber * 7 * usrNum;
86 | }
87 | else if (symbol == 'U')
88 | {
89 | return takeNumber * 30 * usrNum;
90 | }
91 | else
92 | {
93 | return takeNumber * 360 * usrNum;
94 | }
95 | }
96 |
97 | ///
98 | /// 创建数据库字符串(In内字符串)
99 | ///
100 | /// 字符串队列
101 | /// 是否数字
102 | ///
103 | public static string CreateDBInStr(string[] strArray, bool isNumber = true)
104 | {
105 | for (int i = 0; i < strArray.Length; i++)
106 | {
107 | strArray[i] = strArray[i].Replace("'", "''");
108 | }
109 | if (isNumber)
110 | return string.Join(",", strArray);
111 | else
112 | return string.Format("'{0}'", string.Join("','", strArray));
113 | }
114 |
115 | ///
116 | /// 返回构成周期
117 | ///
118 | ///
119 | ///
120 | public static string ComposeCycle(string objCycle)
121 | {
122 | if (RemoveNumber(objCycle) == "U" || RemoveNumber(objCycle) == "W" || RemoveNumber(objCycle) == "Y" || RemoveNumber(objCycle) == "D")
123 | { return "1D"; }
124 | else if (RemoveNumber(objCycle) == "H")
125 | { return "15M"; }
126 | else if (IsStandardCycle(objCycle))
127 | { return objCycle; }
128 | else if (RemoveNumber(objCycle) == "M")
129 | {
130 | int Number = 1;
131 | if (int.TryParse(RemoveNotNumber(objCycle), out Number))
132 | {
133 | if (Number % 15 == 0)
134 | { return "15M"; }
135 | else if (Number % 5 == 0)
136 | { return "5M"; }
137 | else if (Number % 3 == 0)
138 | { return "3M"; }
139 | else
140 | { return "1M"; }
141 | }
142 | else
143 | { return "1M"; }
144 | }
145 | else
146 | { return null; }
147 | }
148 |
149 | ///
150 | /// 去掉字符串中的数字
151 | ///
152 | /// 关键字
153 | ///
154 | public static string RemoveNumber(string key)
155 | {
156 | return System.Text.RegularExpressions.Regex.Replace(key, @"\d", "");
157 | }
158 |
159 | ///
160 | /// 去掉字符串中的非数字
161 | ///
162 | /// 关键字
163 | ///
164 | public static string RemoveNotNumber(string key)
165 | {
166 | return System.Text.RegularExpressions.Regex.Replace(key, @"[^\d]*", "");
167 | }
168 |
169 | }
170 | }
171 |
--------------------------------------------------------------------------------
/CSharp/DataAccess/BaseDataAccess.cs:
--------------------------------------------------------------------------------
1 | using MySql.Data.MySqlClient;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Configuration;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace EPI.CSharp.DataAccess
10 | {
11 | public class BaseDataAccess
12 | {
13 |
14 |
15 | public BaseDataAccess()
16 | {
17 | string constr = ConfigurationManager.ConnectionStrings["MySqlConn"].ConnectionString.ToString();
18 | //string constr = "Server=localhost;Data Source=127.0.0.1;User ID=root;Password=1234;DataBase=mysql;Charset=gb2312;";
19 | MySqlConnection conn = new MySqlConnection(constr);
20 | conn.Open();
21 | MySqlCommand cmd = new MySqlCommand("select * from Users", conn);
22 | MySqlDataReader dr = cmd.ExecuteReader();
23 |
24 | //dr.Close();
25 | conn.Close();
26 |
27 | }
28 |
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/CSharp/DataAccess/ContractMySql.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Commons;
2 | using EPI.CSharp.Model;
3 | using MySql.Data.MySqlClient;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Data;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace EPI.CSharp.DataAccess
12 | {
13 | public class ContractMySql: BaseMySql
14 | {
15 | ///
16 | /// 获取合约信息
17 | ///
18 | ///
19 | public List GetContracts()
20 | {
21 | List contractList = new List();
22 | string sql = @"select * from contracts where status=1";
23 | DataTable dt = ExcuteDataTable(sql, null);
24 | if (dt!=null)
25 | {
26 | foreach(DataRow row in dt.Rows)
27 | {
28 | Contracts contract = new Contracts()
29 | {
30 | Contract = row["Code"].ToString(),
31 | Category = row["Category"].ToString(),
32 | PriceTick = double.Parse(row["PriceTick"].ToString()),
33 | VolumeMultiple = double.Parse(row["VolumeMultiple"].ToString()),
34 | Fee = double.Parse(row["Fee"].ToString()),
35 | Margin = double.Parse(row["Margin"].ToString())
36 | };
37 | contractList.Add(contract);
38 | }
39 | }
40 | return contractList;
41 | }
42 |
43 | ///
44 | /// 获取合约
45 | ///
46 | ///
47 | ///
48 | public List GetContracts(string[] contracts)
49 | {
50 | List contractList = new List();
51 | string sql = @"select * from contracts where Status=1 and Code in("+ StringHelper.CreateDBInStr(contracts, false) + ")";
52 | DataTable dt = ExcuteDataTable(sql, null);
53 | if (dt != null)
54 | {
55 | foreach (DataRow row in dt.Rows)
56 | {
57 | Contracts contract = new Contracts()
58 | {
59 | Contract = row["Code"].ToString(),
60 | Category = row["Category"].ToString(),
61 | PriceTick = double.Parse(row["PriceTick"].ToString()),
62 | VolumeMultiple = double.Parse(row["VolumeMultiple"].ToString()),
63 | Fee = double.Parse(row["Fee"].ToString()),
64 | Margin = double.Parse(row["Margin"].ToString())
65 | };
66 | contractList.Add(contract);
67 | }
68 | }
69 | return contractList;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/CSharp/DataAccess/DataAccess.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F1BE9AE9-8EC2-4D29-88F7-ADA74F20CCBA}
8 | Library
9 | Properties
10 | EPI.CSharp.DataAccess
11 | DataAccess
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 | False
35 | ..\Resources\MySql.Data.dll
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | {704f62d5-467c-4701-be8e-020984078f74}
57 | Commons
58 |
59 |
60 | {fca5e410-9f2b-4a74-a7ae-45227d92e64d}
61 | Models
62 |
63 |
64 |
65 |
72 |
--------------------------------------------------------------------------------
/CSharp/DataAccess/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("DataAccess")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("DataAccess")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("f1be9ae9-8ec2-4d29-88f7-ada74f20ccba")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/DataAccess/UserMySql.cs:
--------------------------------------------------------------------------------
1 | using MySql.Data.MySqlClient;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace EPI.CSharp.DataAccess
10 | {
11 | public class UserMySql: BaseMySql
12 | {
13 | public void GetUserInfo()
14 | {
15 | string sql = @"select * from log_account where (createtime between @startTime and @endTime) and (serverinfo like @serverinfo)";
16 | List Paramter = new List();
17 | //Paramter.Add(new MySqlParameter("@startTime", startTime));
18 | //Paramter.Add(new MySqlParameter("@endTime", endTime));
19 | //Paramter.Add(new MySqlParameter("@serverinfo", (ConfManager.Ins.currentConf.serverid + "-%")));
20 | //DataTable data = DbManager.Ins.ExcuteDataTable(sql, Paramter.ToArray());
21 |
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CSharp/FTCenter/FTCenter.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {233CC9AF-80B2-45AF-B678-9C2C43FC842B}
8 | Library
9 | Properties
10 | EPI.CSharp.FTCenter
11 | FTCenter
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
53 |
--------------------------------------------------------------------------------
/CSharp/FTCenter/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("FTCenter")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("FTCenter")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("233cc9af-80b2-45af-b678-9c2c43fc842b")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/FTWorker/FTWorker.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {FD6B0D80-394B-40DD-8D29-7EC28A4B54C2}
8 | Library
9 | Properties
10 | EPI.CSharp.FTWorker
11 | FTWorker
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
53 |
--------------------------------------------------------------------------------
/CSharp/FTWorker/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("FTWorker")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("FTWorker")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("fd6b0d80-394b-40dd-8d29-7ec28a4b54c2")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/Model/BarData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class BarData
10 | {
11 | public BarData()
12 | {
13 |
14 | }
15 | public BarData(BarData bar)
16 | {
17 | Contract = bar.Contract;
18 | Cycle = bar.Cycle;
19 | Open = bar.Open;
20 | High = bar.High;
21 | Low = bar.Low;
22 | Volume = bar.Volume;
23 | OpenInterest = bar.OpenInterest;
24 | Amount = bar.Amount;
25 | Close = bar.Close;
26 | Offset = bar.Offset;
27 | RealDay = bar.RealDay;
28 | TradingDay = bar.TradingDay;
29 | UpdateTime = bar.UpdateTime;
30 | }
31 | ///
32 | /// 合约名
33 | ///
34 | public string Contract { get; set; }
35 | ///
36 | /// 周期
37 | ///
38 | public string Cycle { get; set; }
39 | ///
40 | /// 开盘价
41 | ///
42 | public double Open { get; set; }
43 | ///
44 | /// 收盘价
45 | ///
46 | public double Close { get; set; }
47 | ///
48 | /// 最高价
49 | ///
50 | public double High { get; set; }
51 | ///
52 | /// 最低价
53 | ///
54 | public double Low { get; set; }
55 | ///
56 | /// 成交量
57 | ///
58 | public double Volume { get; set; }
59 | ///
60 | /// 持仓量
61 | ///
62 | public double OpenInterest { get; set; }
63 | ///
64 | /// 成交金额
65 | ///
66 | public double Amount { get; set; }
67 | ///
68 | /// 偏移量
69 | ///
70 | public double Offset { get; set; }
71 | ///
72 | /// 真实日期
73 | ///
74 | public string RealDay { get; set; }
75 | ///
76 | /// 交易日
77 | ///
78 | public string TradingDay { get; set; }
79 | ///
80 | /// 更新时间(HH:mm:ss)
81 | ///
82 | public string UpdateTime { get; set; }
83 |
84 | ///
85 | /// 真实时间
86 | ///
87 | public DateTime RealDateTime
88 | {
89 | get
90 | {
91 | return DateTime.ParseExact(string.Format("{0} {1}", RealDay, UpdateTime.Length == 5 ? UpdateTime + ":00" : UpdateTime), "yyyyMMdd HH:mm:ss", null);
92 | }
93 | }
94 |
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/CSharp/Model/Contracts.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class Contracts
10 | {
11 | public string Contract { get; set; }
12 |
13 | public string Category { get; set; }
14 |
15 | public double PriceTick { get; set; }
16 |
17 | public double VolumeMultiple { get; set; }
18 |
19 | public double Fee { get; set; }
20 |
21 | public double Margin { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/CSharp/Model/DailyMoneys.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class DailyMoneys
10 | {
11 | public int Id { get; set; }
12 |
13 | public int UserId { get; set; }
14 |
15 | public string StrategyId { get; set; }
16 |
17 | public double Right { get; set; }
18 |
19 | public double Profit { get; set; }
20 |
21 | public double BaseYield { get; set; }
22 |
23 | public double CompoundYield { get; set; }
24 |
25 | public double NetValue { get; set; }
26 |
27 | public double Fee { get; set; }
28 |
29 | public int NetVolume { get; set; }
30 |
31 | public double UsedMargin { get; set; }
32 |
33 | public DateTime CreateTime { get; set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/CSharp/Model/Enums/EnumBarStruct.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model.Enums
8 | {
9 | public enum EnumBarStruct
10 | {
11 | Open = 0,
12 | High = 1,
13 | Low = 2,
14 | Close = 3,
15 | Average = 4,
16 | Volume = 5,
17 | OpenInterest = 6,
18 | Amount = 7
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/CSharp/Model/Enums/EnumLineStyle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model.Enums
8 | {
9 | public enum EnumLineStyle
10 | {
11 | SolidLine = 1,
12 | DashLine = 2,
13 | DotLine = 3,
14 | DashDotLine = 4,
15 | DashDotDotLine = 5,
16 | Steam = 6,
17 | Point = 7,
18 | Circle = 8
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/CSharp/Model/Enums/EnumOrderStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model.Enums
8 | {
9 | public enum EnumOrderStatus : byte
10 | {
11 | ///
12 | /// 全部成交
13 | ///
14 | AllTraded = (byte)'0',
15 | ///
16 | /// 部分成交还在队列中
17 | ///
18 | PartTradedQueueing = (byte)'1',
19 | ///
20 | /// 部分成交不在队列中
21 | ///
22 | PartTradedNotQueueing = (byte)'2',
23 | ///
24 | /// 未成交还在队列中
25 | ///
26 | NoTradeQueueing = (byte)'3',
27 | ///
28 | /// 未成交不在队列中
29 | ///
30 | NoTradeNotQueueing = (byte)'4',
31 | ///
32 | /// 撤单
33 | ///
34 | Canceled = (byte)'5',
35 | ///
36 | /// 限制
37 | ///
38 | Limit = (byte)'6',
39 | ///
40 | /// 未知
41 | ///
42 | Unknown = (byte)'a',
43 | ///
44 | /// 尚未触发
45 | ///
46 | NotTouched = (byte)'b',
47 | ///
48 | /// 已触发
49 | ///
50 | Touched = (byte)'c',
51 | ///
52 | /// 交易中心已收到
53 | ///
54 | CenterReceived = (byte)'d',
55 | ///
56 | /// 算法服务器已接收
57 | ///
58 | AlgServerReceived = (byte)'e',
59 | ///
60 | /// 错误
61 | ///
62 | Error = (byte)'f',
63 | ///
64 | /// 待撤
65 | ///
66 | WaitCancel = (byte)'w'
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/CSharp/Model/Enums/EnumSide.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model.Enums
8 | {
9 | public enum EnumSide : byte
10 | {
11 | ///
12 | /// 买
13 | ///
14 | Buy = (byte)'1',
15 | ///
16 | /// 卖
17 | ///
18 | Sell = (byte)'2'
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/CSharp/Model/JPR.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public static class JPR
10 | {
11 | ///
12 | /// 非有效数值
13 | ///
14 | public const double NaN = -3.1415926;
15 | ///
16 | /// 是非有效数
17 | ///
18 | public static bool IsNaN(double value)
19 | {
20 | return value == -3.142 || value == -3.1415926 || value == -3.141593 || value == -3.1415925;
21 | }
22 | ///
23 | /// 是非有效数
24 | ///
25 | public static bool IsNaN(float value)
26 | {
27 | return value == -3.142f || value == -3.141593f || value == -3.141592f || value == -3.1415925f;
28 | }
29 |
30 | ///
31 | /// 判断是否为正常价格
32 | ///
33 | public static bool IsValidPrice(double price, bool isGroup)
34 | {
35 | if (isGroup)
36 | return !JPR.IsNaN(price) && price != double.MaxValue && price != double.MinValue;
37 | else
38 | return !JPR.IsNaN(price) && price != 0 && price != double.MaxValue && price != double.MinValue;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/CSharp/Model/Messages.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class Messages
10 | {
11 | public int Id { get; set; }
12 |
13 | public string OrderId { get; set; }
14 |
15 | public string MsgType { get; set; }
16 |
17 | public string MsgContent { get; set; }
18 |
19 | public DateTime CreateTime { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/CSharp/Model/Models.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {FCA5E410-9F2B-4A74-A7AE-45227D92E64D}
8 | Library
9 | Properties
10 | EPI.CSharp.Model
11 | Model
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
72 |
--------------------------------------------------------------------------------
/CSharp/Model/Orders.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Model.Enums;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace EPI.CSharp.Model
9 | {
10 | public class Orders
11 | {
12 | public string OrderId { get; set; }
13 |
14 | public int UserId { get; set; }
15 |
16 | public string StrategyId { get; set; }
17 |
18 | public string OrderType { get; set; }
19 |
20 | public string Contract { get; set; }
21 |
22 | private EnumSide _eSide;
23 | ///
24 | /// 买卖(通讯字段)
25 | ///
26 | public EnumSide ESide
27 | {
28 | get { return _eSide; }
29 | set
30 | {
31 | _eSide = value;
32 | _side = _eSide.ToString();
33 | }
34 | }
35 |
36 | private string _side;
37 | ///
38 | /// 买卖(数据库字段)
39 | ///
40 | public string Side
41 | {
42 | get { return _side; }
43 | set
44 | {
45 | _side = value;
46 | _eSide = (EnumSide)Enum.Parse(typeof(EnumSide), _side);
47 | }
48 | }
49 |
50 | public double InsertPrice { get; set; }
51 |
52 | public int InsertVolume { get; set; }
53 |
54 | public DateTime InsertTime { get; set; }
55 |
56 | public double TradedPrice { get; set; }
57 |
58 | public int TradedVolume { get; set; }
59 |
60 | public DateTime TradedTime { get; set; }
61 |
62 | public string RealAccount { get; set; }
63 |
64 | private EnumOrderStatus _eOrderStatus;
65 | ///
66 | /// 订单状态(通讯字段)
67 | ///
68 | public EnumOrderStatus EOrderStatus
69 | {
70 | get { return _eOrderStatus; }
71 | set
72 | {
73 | _eOrderStatus = value;
74 | _orderStatus = _eOrderStatus.ToString();
75 | }
76 | }
77 | private string _orderStatus;
78 | ///
79 | /// 订单状态(数据库字段)
80 | ///
81 | public string OrderStatus
82 | {
83 | get { return _orderStatus; }
84 | set
85 | {
86 | _orderStatus = value;
87 | _eOrderStatus = (EnumOrderStatus)Enum.Parse(typeof(EnumOrderStatus), _orderStatus);
88 | }
89 | }
90 |
91 | public string TradeDay { get; set; }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/CSharp/Model/Positions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class Positions
10 | {
11 | public Positions Clone()
12 | {
13 | return (Positions)this.MemberwiseClone();
14 | }
15 | public int Id { get; set; }
16 |
17 | public int UserId { get; set; }
18 |
19 | public string StrategyId { get; set; }
20 |
21 | public string Contract { get; set; }
22 |
23 | public double LongPrice { get; set; }
24 |
25 | public int LongVolume { get; set; }
26 |
27 | public double ShortPrice { get; set; }
28 |
29 | public int ShortVolume { get; set; }
30 | public double LongMarketValue { get; set; }
31 | public double ShortMarketValue { get; set; }
32 |
33 | public double UsedMargin { get; set; }
34 |
35 | public double Fee { get; set; }
36 |
37 | public double SlippageFee { get; set; }
38 | public double LeftProfit { get; set; }
39 |
40 | public string LongUnitMarketValues { get; set; }
41 |
42 | public string ShortUnitMarketValues { get; set; }
43 |
44 | public int NetVolume { get { return LongVolume - ShortVolume; } }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/CSharp/Model/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("FModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("FModel")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("fca5e410-9f2b-4a74-a7ae-45227d92e64d")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/Model/Reports.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class Reports
10 | {
11 | public Reports()
12 | {
13 |
14 | }
15 |
16 | public Reports Clone()
17 | {
18 | return (Reports)this.MemberwiseClone();
19 | }
20 |
21 | public string Id { get; set; }
22 |
23 | public string StrategyId { get; set; }
24 |
25 | public string StrategyName { get; set; }
26 |
27 | public int UserId { get; set; }
28 |
29 | public double InitRight { get; set; }
30 |
31 | public double TotalProfit { get; set; }
32 |
33 | public double TotalFee { get; set; }
34 |
35 | public double TotalSlippageFee { get; set; }
36 |
37 | public double MaxRight { get; set; }
38 |
39 | public double MaxUsedMargin { get; set; }
40 |
41 | public double MaxMarketValue { get; set; }
42 |
43 | public double MaxBack { get; set; }
44 |
45 | public DateTime MaxBackTime { get; set; }
46 |
47 | public double MaxWin { get; set; }
48 |
49 | public double MaxLoss { get; set; }
50 |
51 | public int TradedDays { get; set; }
52 |
53 | public double LongWinMoney { get; set; }
54 |
55 | public int LongWinCount { get; set; }
56 |
57 | public double ShortWinMoney { get; set; }
58 |
59 | public int ShortWinCount { get; set; }
60 |
61 | public double LongLossMoney { get; set; }
62 |
63 | public int LongLossCount { get; set; }
64 |
65 | public double ShortLossMoney { get; set; }
66 |
67 | public int ShortLossCount { get; set; }
68 |
69 | public int CurHoldDayCount { get; set; }
70 |
71 | public int MaxHoldDayCount { get; set; }
72 |
73 | public string UserFields { get; set; }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/CSharp/Model/ResData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class ResData
10 | {
11 | public bool status { get; set; }
12 | public int code { get; set; }
13 | public string msg { get; set; }
14 |
15 | public object result { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/CSharp/Model/Settings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class Settings
10 | {
11 | public string StrategyName { get; set; }
12 |
13 | public double InitMoney { get; set; }
14 |
15 | public int MaxLongVolumeAllowed { get; set; }
16 |
17 | public int MaxShortVolumeAllowed { get; set; }
18 |
19 | public string[] Contracts { get; set; }
20 |
21 | public string[] Cycles { get; set; }
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CSharp/Model/Strategies.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class Strategies
10 | {
11 | public string StrategyId { get; set; }
12 |
13 | public string UserId { get; set; }
14 |
15 | public string Name { get; set; }
16 |
17 | public string Category { get; set; }
18 |
19 | public string StrategyParams { get; set; }
20 |
21 | public string StrategySettings { get; set; }
22 |
23 | public string StrategyWorker { get; set; }
24 |
25 | public string RealAccount { get; set; }
26 |
27 | public bool IsAuto { get; set; }
28 |
29 | public DateTime CreateTime { get; set; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/CSharp/Model/TickData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class TickData
10 | {
11 | public string Contract { get; set; }
12 |
13 | public double LastPrice { get; set; }
14 |
15 | public double AskPrice1 { get; set; }
16 |
17 | public int AskVolume1 { get; set; }
18 |
19 | public double BidPrice { get; set; }
20 |
21 | public int BidVolume { get; set; }
22 |
23 | public int Volume { get; set; }
24 |
25 | public double Amount { get; set; }
26 |
27 | public double OpenInst { get; set; }
28 |
29 | public DateTime RealTime { get; set; }
30 |
31 | public string TradeDay { get; set; }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/CSharp/Model/Trades.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Model.Enums;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace EPI.CSharp.Model
9 | {
10 | public class Trades
11 | {
12 | public int TradeId { get; set; }
13 |
14 | public string OrderId { get; set; }
15 |
16 | public int UserId { get; set; }
17 |
18 | public string StrategyId { get; set; }
19 |
20 | public string Contract { get; set; }
21 |
22 | private EnumSide _eSide;
23 | ///
24 | /// 买卖(通讯字段)
25 | ///
26 | public EnumSide ESide
27 | {
28 | get { return _eSide; }
29 | set
30 | {
31 | _eSide = value;
32 | _side = _eSide.ToString();
33 | }
34 | }
35 |
36 | private string _side;
37 | ///
38 | /// 买卖(数据库字段)
39 | ///
40 | public string Side
41 | {
42 | get { return _side; }
43 | set
44 | {
45 | _side = value;
46 | _eSide = (EnumSide)Enum.Parse(typeof(EnumSide), _side);
47 | }
48 | }
49 |
50 | public double TradedPrice { get; set; }
51 |
52 | public double Fee { get; set; }
53 |
54 | public double SlippageFee { get; set; }
55 |
56 | public double Offset { get; set; }
57 |
58 | public string RealAccount { get; set; }
59 |
60 | public int TradedVolume { get; set; }
61 |
62 | public DateTime TradedTime { get; set; }
63 |
64 | public string TradeDay { get; set; }
65 |
66 |
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/CSharp/Model/Users.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EPI.CSharp.Model
8 | {
9 | public class Users
10 | {
11 | public int UserId { get; set; }
12 |
13 | public string UserName { get; set; }
14 |
15 | public string UserPwd { get; set; }
16 |
17 | public string Token { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/CSharp/Quant/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CSharp/Quant/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace EPI.CSharp.Quant
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 应用程序的主入口点。
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new frmMain());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CSharp/Quant/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("Quant")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("Quant")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("8d9ac7cc-8612-4679-8bd5-93392a3f7f19")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/Quant/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace EPI.CSharp.Quant.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EPI.CSharp.Quant.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/CSharp/Quant/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/CSharp/Quant/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace EPI.CSharp.Quant.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/CSharp/Quant/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CSharp/Quant/Quant.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {8D9AC7CC-8612-4679-8BD5-93392A3F7F19}
8 | WinExe
9 | Properties
10 | EPI.CSharp.Quant
11 | Quant
12 | v4.5
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | Form
50 |
51 |
52 | frmMain.cs
53 |
54 |
55 |
56 |
57 | frmMain.cs
58 |
59 |
60 | ResXFileCodeGenerator
61 | Resources.Designer.cs
62 | Designer
63 |
64 |
65 | True
66 | Resources.resx
67 | True
68 |
69 |
70 | SettingsSingleFileGenerator
71 | Settings.Designer.cs
72 |
73 |
74 | True
75 | Settings.settings
76 | True
77 |
78 |
79 |
80 |
81 |
82 |
83 |
90 |
--------------------------------------------------------------------------------
/CSharp/Quant/frmMain.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace EPI.CSharp.Quant
2 | {
3 | partial class frmMain
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows 窗体设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // frmMain
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.ClientSize = new System.Drawing.Size(791, 435);
38 | this.Name = "frmMain";
39 | this.Text = "Quant";
40 | this.ResumeLayout(false);
41 |
42 | }
43 |
44 | #endregion
45 | }
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/CSharp/Quant/frmMain.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace EPI.CSharp.Quant
12 | {
13 | public partial class frmMain : Form
14 | {
15 | public frmMain()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/CSharp/Resources/MySql.Data.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/epaiquant/quant/e8e385781a02e362f92cebc31183da1c1df1ee6c/CSharp/Resources/MySql.Data.dll
--------------------------------------------------------------------------------
/CSharp/Resources/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/epaiquant/quant/e8e385781a02e362f92cebc31183da1c1df1ee6c/CSharp/Resources/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/CSharp/Resources/ZeroMQ.4.1.0.26/.signature.p7s:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/epaiquant/quant/e8e385781a02e362f92cebc31183da1c1df1ee6c/CSharp/Resources/ZeroMQ.4.1.0.26/.signature.p7s
--------------------------------------------------------------------------------
/CSharp/Resources/ZeroMQ.4.1.0.26/lib/net40/ZeroMQ.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/epaiquant/quant/e8e385781a02e362f92cebc31183da1c1df1ee6c/CSharp/Resources/ZeroMQ.4.1.0.26/lib/net40/ZeroMQ.dll
--------------------------------------------------------------------------------
/CSharp/Services/BaseService.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Commons;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Configuration;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace EPI.CSharp.Services
10 | {
11 | public class BaseService
12 | {
13 | #region 私有方法
14 | private string _hostUrl; // 主机Url
15 | private NetHelper _net; // 网络类
16 |
17 | #endregion
18 |
19 | public delegate void OnRtnLogDelegate(string msg, bool isError = false);
20 | ///
21 | /// 日志事件
22 | ///
23 | public event OnRtnLogDelegate OnRtnLogEvent;
24 |
25 | public delegate void OnRtnErrorDelegate(string title, Exception ex);
26 | ///
27 | /// 错误事件
28 | ///
29 | public event OnRtnErrorDelegate OnRtnErrorEvent;
30 |
31 | ///
32 | /// 网络帮助
33 | ///
34 | internal NetHelper Net { get { return _net; } }
35 |
36 | internal string HostUrl { get { return _hostUrl; } }
37 |
38 | public BaseService()
39 | {
40 | if (String.IsNullOrEmpty(ConfigurationManager.AppSettings["HostUrl"]))
41 | _hostUrl = "http://localhost:3000";
42 | else
43 | _hostUrl = ConfigurationManager.AppSettings["HostUrl"];
44 | _net = new NetHelper();
45 | }
46 |
47 | ///
48 | /// 日志
49 | ///
50 | /// 消息
51 | /// 是否错误消息
52 | public void Log(string msg, bool isError = false)
53 | {
54 | if (OnRtnLogEvent != null)
55 | OnRtnLogEvent(msg, isError);
56 | }
57 | ///
58 | /// 日志
59 | ///
60 | /// 标题
61 | /// 异常
62 | public void Log(string title, Exception ex)
63 | {
64 | if (OnRtnErrorEvent != null)
65 | OnRtnErrorEvent(title, ex);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/CSharp/Services/ContractService.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Commons;
2 | using EPI.CSharp.DataAccess;
3 | using EPI.CSharp.Model;
4 | using Newtonsoft.Json;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace EPI.CSharp.Services
12 | {
13 | public class ContractService : BaseService
14 | {
15 | ///
16 | /// 获取合约信息
17 | ///
18 | ///
19 | public List GetContracts()
20 | {
21 | try
22 | {
23 | ContractMySql contractMySql = new ContractMySql();
24 | return contractMySql.GetContracts();
25 | }
26 | catch(Exception ex)
27 | {
28 | Log("GetContracts", ex);
29 | return null;
30 | }
31 | }
32 |
33 | ///
34 | /// 获取合约信息
35 | ///
36 | ///
37 | public List GetContracts(string[] contracts)
38 | {
39 | try
40 | {
41 | ContractMySql contractMySql = new ContractMySql();
42 | return contractMySql.GetContracts(contracts);
43 | }
44 | catch (Exception ex)
45 | {
46 | Log("GetContracts", ex);
47 | return null;
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/CSharp/Services/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("FServices")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("FServices")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("0cb731cb-caf6-4495-b62a-b8083353e5f1")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/Services/Services.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {0CB731CB-CAF6-4495-B62A-B8083353E5F1}
8 | Library
9 | Properties
10 | EPI.CSharp.Services
11 | Services
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 | ..\Resources\Newtonsoft.Json.dll
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {704f62d5-467c-4701-be8e-020984078f74}
55 | Commons
56 |
57 |
58 | {f1be9ae9-8ec2-4d29-88f7-ada74f20ccba}
59 | DataAccess
60 |
61 |
62 | {fca5e410-9f2b-4a74-a7ae-45227d92e64d}
63 | Models
64 |
65 |
66 |
67 |
74 |
--------------------------------------------------------------------------------
/CSharp/Services/UserService.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Commons;
2 | using EPI.CSharp.Model;
3 | using Newtonsoft.Json;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace EPI.CSharp.Services
11 | {
12 | public class UserService : BaseService
13 | {
14 | public Users Login(string userName, string userPwd)
15 | {
16 | var url = HostUrl + "/api/user/login";
17 | var jsonResult = Net.PostWebRequest(url, string.Format("userName={0}&userPwd={1}", userName, userPwd), Encoding.UTF8);
18 | ResData resData = JsonConvert.DeserializeObject(jsonResult);
19 | if (resData.status)
20 | {
21 | return JsonConvert.DeserializeObject(resData.result.ToString());
22 | }
23 | else return null;
24 | }
25 |
26 | public Users GetUserInfo(int userId, string token)
27 | {
28 | var url = HostUrl + "/api/user/info?"+ string.Format("id={0}&access_token={1}", userId, token);
29 | var jsonResult = Net.GetWebRequest(url);
30 | ResData resData = JsonConvert.DeserializeObject(jsonResult);
31 | if (resData.status)
32 | {
33 | return JsonConvert.DeserializeObject(resData.result.ToString());
34 | }
35 | else return null;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/CSharp/SettleWorker/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("SettleWorker")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("SettleWorker")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("bf31c984-33e8-4f35-999c-11769113ed69")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/SettleWorker/SettleWorker.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BF31C984-33E8-4F35-999C-11769113ED69}
8 | Library
9 | Properties
10 | EPI.CSharp.SettleWorker
11 | SettleWorker
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
53 |
--------------------------------------------------------------------------------
/CSharp/StrategyWorker/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("StrategyWorker")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("StrategyWorker")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("25854259-78de-41f7-b278-2411bf6b996f")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/StrategyWorker/StrategyWorker.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {25854259-78DE-41F7-B278-2411BF6B996F}
8 | Library
9 | Properties
10 | EPI.CSharp.StrategyWorker
11 | StrategyWorker
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
53 |
--------------------------------------------------------------------------------
/CSharp/Tests/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CSharp/Tests/Program.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Model;
2 | using EPI.CSharp.Services;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace EPI.CSharp.Tests
10 | {
11 | class Program
12 | {
13 | public static Users UserInfo { get; set; }
14 |
15 | static void Main(string[] args)
16 | {
17 | // 测试获取Web数据
18 | //UserService userService = new UserService();
19 | //UserInfo = userService.Login("jie", "123456");
20 | //var user = userService.GetUserInfo(UserInfo.UserId, UserInfo.Token);
21 |
22 | // 测试ZeroMQ
23 | //ZMQTest zmqTest = new ZMQTest();
24 | //zmqTest.StartPubServer();
25 | //zmqTest.StartSubClient();
26 |
27 | //zmqTest.StartPullServer();
28 | //zmqTest.StartPushClient();
29 |
30 | //zmqTest.StartRouterServer();
31 | //zmqTest.StartDealerWorker("Worker1");
32 |
33 | //zmqTest.StartDealerWorker("Worker2");
34 |
35 | //zmqTest.StartDealerClient();
36 |
37 | //while (true)
38 | //{
39 | // var msg = Console.ReadLine();
40 | // if (msg == "Q")
41 | // {
42 | // zmqTest.Stop();
43 | // Console.WriteLine("程序已结束.");
44 | // Console.Read();
45 | // break;
46 | // }
47 |
48 | //}
49 |
50 | StrategyTest strategyTest = new StrategyTest(100002, "f57e3cb8-0920-4086-8075-8cbc7887ec72");
51 | strategyTest.OnRtnLogEvent += (msg, isError) =>
52 | {
53 | Console.WriteLine(msg);
54 | };
55 | strategyTest.OnRtnErrorEvent += (title, msg) =>
56 | {
57 | Console.WriteLine("{0}:{1}",title,msg);
58 | };
59 | strategyTest.IsSavedToCsv = true;
60 | if (strategyTest.InitSetting("rb000,1M,100000,50,50"))
61 | {
62 | if (strategyTest.CreateMockBarDatas("1M_rb000", "2019-04-01", "2019-05-01", "rb000_1M.csv", null))
63 | {
64 | strategyTest.InitStrategy("9,3,3");
65 | }
66 |
67 | }
68 | Console.Read();
69 |
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/CSharp/Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("Tests")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("Tests")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("366faed0-2472-4173-ab4d-027c8d93bffb")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/CSharp/Tests/StrategyTest.cs:
--------------------------------------------------------------------------------
1 | using EPI.CSharp.Api;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using EPI.CSharp.Model;
8 | using Asteroids.Indicators;
9 |
10 | namespace EPI.CSharp.Tests
11 | {
12 | public class StrategyTest : BaseFastTest
13 | {
14 | KDJ kdj;
15 |
16 | public StrategyTest(int userId, string strategyId) : base(userId, strategyId)
17 | {
18 |
19 | }
20 |
21 | public override bool InitStrategy(object sender)
22 | {
23 | LoadDataCount = 1;
24 | return LoadBarDatas(Setting.Contracts[0], Setting.Cycles[0], 100, false);
25 | }
26 |
27 | public override void FinishedLoadData(string contract, string cycle, List barDatas, bool isLast)
28 | {
29 | if (contract== Setting.Contracts[0] && cycle == Setting.Cycles[0])
30 | {
31 | kdj = new KDJ(barDatas, 9, 3, 3);
32 | }
33 | if (isLast)
34 | {
35 | StartStrategy();
36 | }
37 | }
38 |
39 | public override void RtnBarData(BarData barData, bool isNewBar)
40 | {
41 | kdj.AddBarData(barData);
42 | var postion = GetPosition(barData.Contract);
43 | bool isUp = CrossKdjUp(kdj);
44 | bool isDown = CrossKdjDown(kdj);
45 | if (postion.NetVolume<=0 && isUp)
46 | {
47 | Buy(barData.Contract, 1);
48 | }
49 | else if (postion.NetVolume>=0&& isDown)
50 | {
51 | Sell(barData.Contract, 1);
52 | }
53 | }
54 |
55 |
56 | ///
57 | /// KDJ金叉
58 | ///
59 | ///
60 | bool CrossKdjUp(KDJ kdj)
61 | {
62 | var preDValue = kdj.GetDValue(kdj.Count - 2);
63 | var preJValue = kdj.GetJValue(kdj.Count - 2);
64 | var dValue = kdj.GetDValue(kdj.Count - 1);
65 | var jValue = kdj.GetJValue(kdj.Count - 1);
66 | if (!JPR.IsNaN(preDValue) && !JPR.IsNaN(preJValue) && !JPR.IsNaN(dValue) && !JPR.IsNaN(jValue))
67 | {
68 | return preJValue < preDValue && jValue > dValue;
69 | }
70 | return false;
71 | }
72 | ///
73 | /// KDJ死叉
74 | ///
75 | ///
76 | bool CrossKdjDown(KDJ kdj)
77 | {
78 | var preDValue = kdj.GetDValue(kdj.Count - 2);
79 | var preJValue = kdj.GetJValue(kdj.Count - 2);
80 | var dValue = kdj.GetDValue(kdj.Count - 1);
81 | var jValue = kdj.GetJValue(kdj.Count - 1);
82 | if (!JPR.IsNaN(preDValue) && !JPR.IsNaN(preJValue) && !JPR.IsNaN(dValue) && !JPR.IsNaN(jValue))
83 | {
84 | return preJValue > preDValue && jValue < dValue;
85 | }
86 | return false;
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/CSharp/Tests/Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {366FAED0-2472-4173-AB4D-027C8D93BFFB}
8 | Exe
9 | Properties
10 | EPI.CSharp.Tests
11 | Tests
12 | v4.5
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | ..\Resources\ZeroMQ.4.1.0.26\lib\net40\ZeroMQ.dll
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | {86e4f9a4-d170-41ab-9385-1965b09c4e1c}
59 | Api
60 |
61 |
62 | {20677463-0008-4077-85d1-f439b7e49dd2}
63 | Asteroids
64 |
65 |
66 | {f1be9ae9-8ec2-4d29-88f7-ada74f20ccba}
67 | DataAccess
68 |
69 |
70 | {fca5e410-9f2b-4a74-a7ae-45227d92e64d}
71 | Models
72 |
73 |
74 | {0cb731cb-caf6-4495-b62a-b8083353e5f1}
75 | Services
76 |
77 |
78 |
79 |
86 |
--------------------------------------------------------------------------------
/Datas/quant_accounts.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `accounts`
20 | --
21 |
22 | DROP TABLE IF EXISTS `accounts`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `accounts` (
26 | `UserId` int(11) NOT NULL,
27 | `StaticRight` double NOT NULL DEFAULT '0',
28 | `Fee` double NOT NULL DEFAULT '0',
29 | `UsedMargin` double NOT NULL DEFAULT '0',
30 | `FrozenMargin` double NOT NULL DEFAULT '0',
31 | `FrozenFee` double NOT NULL DEFAULT '0',
32 | PRIMARY KEY (`UserId`)
33 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
34 | /*!40101 SET character_set_client = @saved_cs_client */;
35 |
36 | --
37 | -- Dumping data for table `accounts`
38 | --
39 |
40 | LOCK TABLES `accounts` WRITE;
41 | /*!40000 ALTER TABLE `accounts` DISABLE KEYS */;
42 | /*!40000 ALTER TABLE `accounts` ENABLE KEYS */;
43 | UNLOCK TABLES;
44 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
45 |
46 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
47 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
48 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
49 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
50 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
51 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
52 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
53 |
54 | -- Dump completed on 2019-04-27 21:02:33
55 |
--------------------------------------------------------------------------------
/Datas/quant_contracts.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `contracts`
20 | --
21 |
22 | DROP TABLE IF EXISTS `contracts`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `contracts` (
26 | `Code` varchar(20) NOT NULL,
27 | `ExCode` varchar(20) NOT NULL,
28 | `Name` varchar(20) DEFAULT NULL,
29 | `Category` varchar(10) NOT NULL,
30 | `Exchange` varchar(20) NOT NULL,
31 | `Status` tinyint(4) NOT NULL DEFAULT '1',
32 | PRIMARY KEY (`Code`)
33 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
34 | /*!40101 SET character_set_client = @saved_cs_client */;
35 |
36 | --
37 | -- Dumping data for table `contracts`
38 | --
39 |
40 | LOCK TABLES `contracts` WRITE;
41 | /*!40000 ALTER TABLE `contracts` DISABLE KEYS */;
42 | INSERT INTO `contracts` VALUES ('rb1910','rb1910','螺纹1910','rb','SHFE',1);
43 | /*!40000 ALTER TABLE `contracts` ENABLE KEYS */;
44 | UNLOCK TABLES;
45 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
46 |
47 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
48 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
49 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
50 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
51 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
52 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
53 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
54 |
55 | -- Dump completed on 2019-04-27 21:02:32
56 |
--------------------------------------------------------------------------------
/Datas/quant_dailymoneys.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `dailymoneys`
20 | --
21 |
22 | DROP TABLE IF EXISTS `dailymoneys`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `dailymoneys` (
26 | `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
27 | `UserId` int(11) NOT NULL,
28 | `StrategyId` varchar(200) DEFAULT NULL,
29 | `Right` double DEFAULT NULL,
30 | `Profit` double DEFAULT NULL,
31 | `Fee` double DEFAULT NULL,
32 | `CreateTime` varchar(45) DEFAULT 'CURRENT_TIMESTAMP',
33 | PRIMARY KEY (`Id`)
34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
35 | /*!40101 SET character_set_client = @saved_cs_client */;
36 |
37 | --
38 | -- Dumping data for table `dailymoneys`
39 | --
40 |
41 | LOCK TABLES `dailymoneys` WRITE;
42 | /*!40000 ALTER TABLE `dailymoneys` DISABLE KEYS */;
43 | /*!40000 ALTER TABLE `dailymoneys` ENABLE KEYS */;
44 | UNLOCK TABLES;
45 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
46 |
47 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
48 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
49 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
50 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
51 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
52 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
53 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
54 |
55 | -- Dump completed on 2019-04-27 21:02:34
56 |
--------------------------------------------------------------------------------
/Datas/quant_logs.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `logs`
20 | --
21 |
22 | DROP TABLE IF EXISTS `logs`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `logs` (
26 | `Id` int(11) NOT NULL AUTO_INCREMENT,
27 | `Category` varchar(45) DEFAULT NULL,
28 | `Message` text,
29 | `CreateTime` datetime DEFAULT CURRENT_TIMESTAMP,
30 | PRIMARY KEY (`Id`),
31 | UNIQUE KEY `Id_UNIQUE` (`Id`)
32 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
33 | /*!40101 SET character_set_client = @saved_cs_client */;
34 |
35 | --
36 | -- Dumping data for table `logs`
37 | --
38 |
39 | LOCK TABLES `logs` WRITE;
40 | /*!40000 ALTER TABLE `logs` DISABLE KEYS */;
41 | INSERT INTO `logs` VALUES (1,'Info','[object Object]','2019-04-12 19:11:41'),(2,'Info','[{\"UserId\":100001,\"UserName\":\"Admin\",\"UserPwd\":\"123456\",\"Status\":1}]','2019-04-12 19:39:21');
42 | /*!40000 ALTER TABLE `logs` ENABLE KEYS */;
43 | UNLOCK TABLES;
44 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
45 |
46 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
47 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
48 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
49 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
50 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
51 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
52 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
53 |
54 | -- Dump completed on 2019-04-27 21:02:32
55 |
--------------------------------------------------------------------------------
/Datas/quant_orders.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `orders`
20 | --
21 |
22 | DROP TABLE IF EXISTS `orders`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `orders` (
26 | `OrderId` int(10) unsigned NOT NULL AUTO_INCREMENT,
27 | `UserId` int(11) NOT NULL,
28 | `StrategyId` varchar(200) NOT NULL,
29 | `OrderType` varchar(20) NOT NULL,
30 | `Contract` varchar(20) NOT NULL,
31 | `Side` varchar(5) NOT NULL,
32 | `InsertPrice` double NOT NULL,
33 | `InsertVolume` int(10) unsigned NOT NULL,
34 | `InsertTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
35 | `TradedPrice` double DEFAULT NULL,
36 | `TradedVolume` int(11) DEFAULT NULL,
37 | `TradedTime` datetime DEFAULT NULL,
38 | `RealAccount` varchar(20) DEFAULT NULL,
39 | `OrderStatus` varchar(20) DEFAULT 'Received',
40 | PRIMARY KEY (`OrderId`)
41 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
42 | /*!40101 SET character_set_client = @saved_cs_client */;
43 |
44 | --
45 | -- Dumping data for table `orders`
46 | --
47 |
48 | LOCK TABLES `orders` WRITE;
49 | /*!40000 ALTER TABLE `orders` DISABLE KEYS */;
50 | /*!40000 ALTER TABLE `orders` ENABLE KEYS */;
51 | UNLOCK TABLES;
52 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
53 |
54 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
55 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
56 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
57 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
58 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
59 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
60 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
61 |
62 | -- Dump completed on 2019-04-27 21:02:34
63 |
--------------------------------------------------------------------------------
/Datas/quant_positions.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `positions`
20 | --
21 |
22 | DROP TABLE IF EXISTS `positions`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `positions` (
26 | `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
27 | `UserId` int(11) NOT NULL,
28 | `StrategyId` varchar(45) DEFAULT NULL,
29 | `Contract` varchar(45) NOT NULL,
30 | `LongVolume` int(10) unsigned NOT NULL DEFAULT '0',
31 | `LongPrice` double NOT NULL DEFAULT '0',
32 | `ShortVolume` int(10) unsigned NOT NULL DEFAULT '0',
33 | `ShortPrice` double NOT NULL DEFAULT '0',
34 | PRIMARY KEY (`Id`)
35 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
36 | /*!40101 SET character_set_client = @saved_cs_client */;
37 |
38 | --
39 | -- Dumping data for table `positions`
40 | --
41 |
42 | LOCK TABLES `positions` WRITE;
43 | /*!40000 ALTER TABLE `positions` DISABLE KEYS */;
44 | /*!40000 ALTER TABLE `positions` ENABLE KEYS */;
45 | UNLOCK TABLES;
46 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
47 |
48 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
49 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
50 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
51 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
52 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
53 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
54 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
55 |
56 | -- Dump completed on 2019-04-27 21:02:33
57 |
--------------------------------------------------------------------------------
/Datas/quant_reports.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `reports`
20 | --
21 |
22 | DROP TABLE IF EXISTS `reports`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `reports` (
26 | `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
27 | `UserId` int(11) NOT NULL,
28 | `StrategyId` varchar(200) DEFAULT NULL,
29 | `InitRight` double NOT NULL DEFAULT '0',
30 | `TotalProfit` double DEFAULT '0',
31 | `TotalFee` double DEFAULT '0',
32 | `MaxRight` double DEFAULT '0',
33 | `MaxUsedMargin` double DEFAULT '0',
34 | `MaxBack` double DEFAULT '0',
35 | `TradedDays` double DEFAULT '0',
36 | `LongWinMoney` double DEFAULT '0',
37 | `LongWinCount` int(11) DEFAULT '0',
38 | `ShortWinMoney` double DEFAULT '0',
39 | `ShortWinCount` int(11) DEFAULT '0',
40 | `LongLossMoney` double DEFAULT '0',
41 | `LongLossCount` int(11) DEFAULT '0',
42 | `ShortLossMoney` double DEFAULT '0',
43 | `ShortLossCount` int(11) DEFAULT '0',
44 | PRIMARY KEY (`Id`)
45 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
46 | /*!40101 SET character_set_client = @saved_cs_client */;
47 |
48 | --
49 | -- Dumping data for table `reports`
50 | --
51 |
52 | LOCK TABLES `reports` WRITE;
53 | /*!40000 ALTER TABLE `reports` DISABLE KEYS */;
54 | /*!40000 ALTER TABLE `reports` ENABLE KEYS */;
55 | UNLOCK TABLES;
56 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
57 |
58 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
59 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
60 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
61 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
62 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
63 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
64 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
65 |
66 | -- Dump completed on 2019-04-27 21:02:33
67 |
--------------------------------------------------------------------------------
/Datas/quant_settles.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `settles`
20 | --
21 |
22 | DROP TABLE IF EXISTS `settles`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `settles` (
26 | `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
27 | `UserId` int(11) NOT NULL,
28 | `StrategyId` varchar(200) DEFAULT NULL,
29 | `Contract` varchar(20) NOT NULL,
30 | `SettlePrice` double NOT NULL,
31 | `LeftVolume` int(11) NOT NULL,
32 | `Profit` double NOT NULL,
33 | `Fee` double NOT NULL,
34 | `CreateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
35 | PRIMARY KEY (`Id`)
36 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
37 | /*!40101 SET character_set_client = @saved_cs_client */;
38 |
39 | --
40 | -- Dumping data for table `settles`
41 | --
42 |
43 | LOCK TABLES `settles` WRITE;
44 | /*!40000 ALTER TABLE `settles` DISABLE KEYS */;
45 | /*!40000 ALTER TABLE `settles` ENABLE KEYS */;
46 | UNLOCK TABLES;
47 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
48 |
49 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
50 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
51 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
52 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
53 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
54 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
55 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
56 |
57 | -- Dump completed on 2019-04-27 21:02:32
58 |
--------------------------------------------------------------------------------
/Datas/quant_strategies.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `strategies`
20 | --
21 |
22 | DROP TABLE IF EXISTS `strategies`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `strategies` (
26 | `StrategyId` varchar(200) NOT NULL,
27 | `UserId` int(11) NOT NULL,
28 | `Name` varchar(45) NOT NULL,
29 | `Category` varchar(45) DEFAULT NULL,
30 | `Code` text,
31 | `StrategyParams` varchar(45) DEFAULT NULL,
32 | `StrategySettings` varchar(45) DEFAULT NULL,
33 | `StrategyWorker` varchar(45) DEFAULT NULL,
34 | `RealAccount` varchar(45) DEFAULT NULL,
35 | `IsAuto` tinyint(4) NOT NULL DEFAULT '0',
36 | `CreateTime` datetime DEFAULT CURRENT_TIMESTAMP,
37 | PRIMARY KEY (`StrategyId`)
38 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
39 | /*!40101 SET character_set_client = @saved_cs_client */;
40 |
41 | --
42 | -- Dumping data for table `strategies`
43 | --
44 |
45 | LOCK TABLES `strategies` WRITE;
46 | /*!40000 ALTER TABLE `strategies` DISABLE KEYS */;
47 | INSERT INTO `strategies` VALUES ('12115d37-80aa-4e98-a37c-a6c970a4057e',100002,'我的趋势策略2','趋势','H4sIAAAAAAAAAwMAAAAAAAAAAAA=','','100,,,10,10,100','','',0,'2019-04-24 08:52:27'),('49e402d8-f514-40e5-8720-f751d7159bf2',100002,'我的新建策略2','震荡','H4sIAAAAAAAAAwMAAAAAAAAAAAA=','','0,,,10,10,100','','',0,'2019-04-24 08:37:06'),('5789755d-5aee-43f6-890c-15bd310393f1',100002,'我的新建策略5','趋势','H4sIAAAAAAAAAysoTcrJTFZIzkksLlYISS0uqeZSAAKuWgDozz/4GQAAAA==','','0,,,10,10,100','','',0,'2019-04-24 08:46:14'),('e4f79fe9-1b56-453c-8f9a-5ed766516db6',100002,'我的趋势策略3','趋势','H4sIAAAAAAAAAwMAAAAAAAAAAAA=','','0,,,10,10,100','','',1,'2019-04-24 08:45:22'),('STY10001',100002,'测试策略1001','趋势','H4sIAAAAAAAAA9VX227bMAz9GgHuS+HYuViPki/AtgwYEOx5UBI1defYgax07d+PlGTHiRP3srTAAMFlKIqkjg5FlQShkpu8Kkngk3RKKCUsJSklkU8oI+mERBmhkdHMUPbZt+QrGP9eP7DRdxLyrob3NCzs2TSavNRWM5flRt9jAmECX2qnl1VVwK+8ZqOfu1NV2FPxvhVvrUgQynLtNgo/jaazb0pojDvG7U4Im6DAGaHhWQBs4uvlr7jag3gxQtYM2Fhc77dboZ5JmJ7OYYiI0AQFBiG40cSETkmaER7jrE0jCswRQW7mrJiPs5hqjLPWGA4tCFBJfbNwhhthrStjT0eERcYV2GdHU7zBwWUCNuBhaiACYdwxhp/cQDTF5NFPzxgzsfa0jwgIl0EJ451QYgtiKbbSECPY11L9QG2NjmGN8WHtjIfdflnkK1hTPUql8rUE0bHhS5nrhVZCy82zVy0f5ArPsIYzk+oGg8/sKfrt0JDXsaZv0x2PQsF3X7cpOjrHVQnZaKv1mojhkKt+TQDlbsFDLb1DgAmwYJK84MohivxhSJg0IjzB0SVSlJiiB0bFhI06Ux1iMJBpUxfjeSXWXKhEaFEbn0C2EClBx45aJ65cSbwtSYhwLs8OA124MWYVpYOlNEUBStgWDgoTXBJNXXHx4HKspgCtH4hotwb+He1PVk2Q8JFNAzKkg7uA5CNj3N5CERZsNDI4ZC5V8IP3cbeazoOJR4PnYi+nhkDjYZrcVUqKFfLNszxeVSVUiymSHO/IhdQ6Lze3C/gUMnaz9c3QqQ6Wy5noTejnVSFP47KiiFE/HPFd0U/Ba3jtHTCID2mhOPJ9K9yJopYd8cVi7OaXvNZyCOIhJ0rqvUIQtdrLM5n1Fq+EthxIn1Zyp213lE89yAehnVcbz7Wgi7U4IyxxAm36LRCcW8qPUQMeDK4YfhDUdpf2MC5t037P94jHKl/Dnywv8/perpsK8mqtgHukWw2Y0kF9oMQ8r+ElEDvuYDuC1tNckMaifZbMRa2v03LyOzysTqlirZtyv1CurmeY1VMz2mprlwLy8IoLguuUtnsmBu4aKuUf+MJb0DsGp+14L1XQIOGlqUaA5Y2YjD4dE/75mHwMVcLrUiX8D2B5DVuuCwv/NFgsHp076p/TX2ihDi/vtyf3oU3q9MbHSXyGjfH/YHyGZTiGW9Fxe7kU8y8EMM0/aA8AAA==','','0,,,10,10,100','','',1,'2019-04-21 19:45:58');
48 | /*!40000 ALTER TABLE `strategies` ENABLE KEYS */;
49 | UNLOCK TABLES;
50 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
51 |
52 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
53 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
54 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
55 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
56 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
57 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
58 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
59 |
60 | -- Dump completed on 2019-04-27 21:02:33
61 |
--------------------------------------------------------------------------------
/Datas/quant_trades.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `trades`
20 | --
21 |
22 | DROP TABLE IF EXISTS `trades`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `trades` (
26 | `TradeId` int(10) unsigned NOT NULL AUTO_INCREMENT,
27 | `OrderId` int(11) NOT NULL,
28 | `UserId` int(11) NOT NULL,
29 | `StrategyId` varchar(200) DEFAULT NULL,
30 | `Contract` varchar(20) NOT NULL,
31 | `Side` varchar(5) NOT NULL,
32 | `TradedPrice` double NOT NULL,
33 | `TradedVolume` int(11) NOT NULL,
34 | `TradedTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
35 | `Fee` double NOT NULL,
36 | `RealAccount` varchar(20) DEFAULT NULL,
37 | PRIMARY KEY (`TradeId`)
38 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
39 | /*!40101 SET character_set_client = @saved_cs_client */;
40 |
41 | --
42 | -- Dumping data for table `trades`
43 | --
44 |
45 | LOCK TABLES `trades` WRITE;
46 | /*!40000 ALTER TABLE `trades` DISABLE KEYS */;
47 | /*!40000 ALTER TABLE `trades` ENABLE KEYS */;
48 | UNLOCK TABLES;
49 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
50 |
51 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
52 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
53 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
54 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
55 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
56 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
57 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
58 |
59 | -- Dump completed on 2019-04-27 21:02:33
60 |
--------------------------------------------------------------------------------
/Datas/quant_users.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: quant
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.16-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `users`
20 | --
21 |
22 | DROP TABLE IF EXISTS `users`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `users` (
26 | `UserId` int(10) unsigned NOT NULL AUTO_INCREMENT,
27 | `UserName` varchar(100) NOT NULL,
28 | `UserPwd` varchar(45) NOT NULL,
29 | `Status` tinyint(4) DEFAULT '1',
30 | PRIMARY KEY (`UserId`)
31 | ) ENGINE=InnoDB AUTO_INCREMENT=100003 DEFAULT CHARSET=utf8;
32 | /*!40101 SET character_set_client = @saved_cs_client */;
33 |
34 | --
35 | -- Dumping data for table `users`
36 | --
37 |
38 | LOCK TABLES `users` WRITE;
39 | /*!40000 ALTER TABLE `users` DISABLE KEYS */;
40 | INSERT INTO `users` VALUES (100001,'Admin','123456',1),(100002,'jie','123456',1);
41 | /*!40000 ALTER TABLE `users` ENABLE KEYS */;
42 | UNLOCK TABLES;
43 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
44 |
45 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
46 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
47 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
48 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
49 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
50 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
51 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
52 |
53 | -- Dump completed on 2019-04-27 21:02:34
54 |
--------------------------------------------------------------------------------
/NodeJs/api/strategy.js:
--------------------------------------------------------------------------------
1 | var express = require('express')
2 | var router = express.Router()
3 | var co = require('co')
4 | const Strategies = require('../models/Strategies')
5 | const Msg = require('../common/Msg')
6 | const util = require('../common/util')
7 |
8 | router.get('/index', util.DoAuth, function (req, res, next) {
9 | co(function* () {
10 | if (req.query.UserId) {
11 | let r1 = yield Strategies.FindAllStrategies(req.query.UserId)
12 | res.json(r1)
13 | } else {
14 | res.json(Msg.Err.ParamError)
15 | }
16 | }).catch(function (err) {
17 | res.json(err)
18 | })
19 | });
20 |
21 | router.get('/detail', util.DoAuth, function (req, res, next) {
22 | co(function* () {
23 | if (req.query.UserId && req.query.StrategyId) {
24 | let r1 = yield Strategies.FindOne(req.query.UserId, req.query.StrategyId)
25 | res.json(r1)
26 | } else {
27 | res.json(Msg.Err.ParamError)
28 | }
29 | }).catch(function (err) {
30 | res.json(err)
31 | })
32 | });
33 |
34 | router.delete('/del', util.DoAuth, function (req, res, next) {
35 | co(function* () {
36 | if (req.body.StrategyId) {
37 | let r1 = yield Strategies.Delete(req.body.UserId, req.body.StrategyId)
38 | res.json(r1)
39 | } else {
40 | res.json(Msg.Err.ParamError)
41 | }
42 | }).catch(function (err) {
43 | res.json(err)
44 | })
45 | });
46 |
47 | router.post('/add', util.DoAuth, function (req, res, next) {
48 | co(function* () {
49 | if (req.body.UserId && req.body.Name) {
50 | var strategy = {
51 | UserId: req.body.UserId,
52 | Name: req.body.Name,
53 | Category: (req.body.Category ? req.body.Category : '趋势'),
54 | Code: req.body.Code,
55 | StrategyParams: req.body.StrategyParams,
56 | StrategySettings: req.body.StrategySettings,
57 | StrategyWorker: req.body.StrategyWorker,
58 | RealAccount: req.body.RealAccount,
59 | IsAuto: (req.body.IsAuto ? 1 : 0)
60 | }
61 | let r1 = yield Strategies.Add(strategy)
62 | res.json(r1)
63 | } else {
64 | res.json(Msg.Err.ParamError)
65 | }
66 | }).catch(function (err) {
67 | res.json(err)
68 | })
69 | });
70 |
71 | router.put('/update', util.DoAuth, function (req, res, next) {
72 | co(function* () {
73 | if (req.body.UserId && req.body.StrategyId && req.body.Name && req.body.Category) {
74 | var strategy = {
75 | StrategyId: req.body.StrategyId,
76 | UserId: req.body.UserId,
77 | Name: req.body.Name,
78 | Category: req.body.Category,
79 | Code: req.body.Code,
80 | StrategyParams: req.body.StrategyParams,
81 | StrategySettings: req.body.StrategySettings,
82 | StrategyWorker: req.body.StrategyWorker,
83 | RealAccount: req.body.RealAccount,
84 | IsAuto: req.body.IsAuto
85 | }
86 | let r1 = yield Strategies.Update(strategy)
87 | res.json(r1)
88 | } else {
89 | res.json(Msg.Err.ParamError)
90 | }
91 | }).catch(function (err) {
92 | res.json(err)
93 | })
94 | });
95 |
96 | module.exports = router
97 |
--------------------------------------------------------------------------------
/NodeJs/api/user.js:
--------------------------------------------------------------------------------
1 | var express = require('express')
2 | var router = express.Router()
3 | var co = require('co')
4 | const Users = require('../models/Users')
5 | const Msg = require('../common/Msg')
6 | const util = require('../common/util')
7 |
8 | router.post('/login', function (req, res, next) {
9 | if (req.session.UserId) {
10 | res.json(Msg.Info.IsLogined)
11 | } else {
12 | co(function* () {
13 | if (req.body.userName && req.body.userPwd) {
14 | let r1 = yield Users.Login(req.body.userName, req.body.userPwd)
15 | req.session.regenerate(function (err) {
16 | if (err) {
17 | res.json(Msg.Error(err))
18 | }
19 | if (r1.status) {
20 | req.session.UserId = r1.result.UserId;
21 | }
22 | res.json(r1)
23 | })
24 | } else {
25 | res.json(Msg.Err.ParamError)
26 | }
27 | }).catch(function (err) {
28 | res.json(Msg.Error(err))
29 | })
30 | }
31 | });
32 |
33 | router.get('/logout', function (req, res, next) {
34 | req.session.destroy(function (err) {
35 | if (err) {
36 | res.json(Msg.Error(err))
37 | return
38 | }
39 | if (req.session) {
40 | res.clearCookie(req.session.UserId)
41 | req.session.UserId = null
42 | }
43 | res.redirect('../../login')
44 | })
45 | })
46 |
47 | router.get('/info', util.DoAuth, function (req, res, next) {
48 | co(function* () {
49 | if (req.query.id) {
50 | let user = yield Users.FindOne(req.query.id)
51 | res.json(user)
52 | } else {
53 | res.json(Msg.Err.NoAccess)
54 | }
55 | }).catch(function (err) {
56 | res.json(Msg.ServerError)
57 | })
58 | });
59 |
60 | module.exports = router
61 |
--------------------------------------------------------------------------------
/NodeJs/app.js:
--------------------------------------------------------------------------------
1 | var createError = require('http-errors')
2 | var express = require('express')
3 | var path = require('path')
4 | var partials = require("express-partials")
5 | var cookieParser = require('cookie-parser')
6 | var logger = require('morgan')
7 | var session = require('express-session');
8 | var FileStore = require('session-file-store')(session);
9 |
10 | var indexRouter = require('./routes/index')
11 | var userRouter = require('./routes/user')
12 | var strategyRouter = require('./routes/strategy')
13 | var userApi = require('./api/user')
14 | var strategyApi = require('./api/strategy')
15 |
16 | var app = express()
17 | app.use(partials())
18 |
19 | app.use(session({
20 | name: 'quant',
21 | secret: 'quantkey', // 用来对session id相关的cookie进行签名
22 | store: new FileStore(), // 本地存储session(文本文件,也可以选择其他store,比如redis的)
23 | saveUninitialized: false, // 是否自动保存未初始化的会话,建议false
24 | resave: false, // 是否每次都重新保存会话,建议false
25 | cookie: {
26 | maxAge: 3600 * 1000 // 有效期,单位是毫秒
27 | }
28 | }))
29 |
30 | // view engine setup
31 | app.set('views', path.join(__dirname, 'views'))
32 | app.set('view engine', 'ejs')
33 |
34 | app.use(logger('dev'))
35 | app.use(express.json())
36 | app.use(express.urlencoded({ extended: false }))
37 | app.use(cookieParser())
38 | app.use(express.static(path.join(__dirname, 'public')))
39 |
40 | app.use('/api/user', userApi)
41 | app.use('/api/strategy', strategyApi)
42 | app.use('/', indexRouter)
43 | app.use('/user', userRouter)
44 | app.use('/strategy', strategyRouter)
45 |
46 | // catch 404 and forward to error handler
47 | app.use(function(req, res, next) {
48 | next(createError(404))
49 | });
50 |
51 | // error handler
52 | app.use(function(err, req, res, next) {
53 | // set locals, only providing error in development
54 | res.locals.message = err.message
55 | res.locals.error = req.app.get('env') === 'development' ? err : {}
56 |
57 | // render the error page
58 | res.status(err.status || 500)
59 | res.render('error')
60 | })
61 |
62 | module.exports = app
63 |
--------------------------------------------------------------------------------
/NodeJs/common/Msg.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | var Err = {}
3 | var Info = {}
4 |
5 | Err.ServerError = { status: false, code: 9001, msg: 'Server Error' }
6 | Err.DBError = { false: false, code: 9002, msg: 'DataBase Error' }
7 | Err.ParamError = { false: false, code: 9003, msg: 'Params Error'}
8 | Err.LoginFaild = { false: false, code: 9103, msg: 'Login Failed' }
9 | Err.NoAccess = { false: false, code: 9104, msg: 'No Access' }
10 |
11 | Info.Success = { status: true, code: 1001, msg: 'Success' }
12 | Info.DBSuccess = { status: true, code: 1001, msg: 'DataBase Success' }
13 | Info.IsLogined = { status: true, code: 1001, msg: 'User is Logined' }
14 |
15 | function Success(obj) {
16 | return { status: true, result: obj}
17 | }
18 | function Error(obj) {
19 | console.log(obj)
20 | return { status: false, result: obj }
21 | }
22 | module.exports = { Err, Info, Success, Error }
--------------------------------------------------------------------------------
/NodeJs/common/util.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | var jwt = require('jwt-simple')
4 | var Buffer = require('Buffer')
5 | const Msg = require('../common/Msg')
6 | // var moment = require('moment')
7 | const secret = Buffer.from('epiquantsecret', 'hex')
8 |
9 | // 获取Token
10 | function GetJwtToken(userId) {
11 | //var expires = moment().add(7,'days').valueOf()
12 | //console.log(expires)
13 | var payload = { Id: userId };
14 | var token = jwt.encode(payload, secret)
15 | console.log(token)
16 | return token
17 | }
18 |
19 | // 验证Token
20 | function DoAuth(req, res, next) {
21 | if (req.session.UserId) {
22 | next()
23 | } else {
24 | var token = (req.body && req.body.access_token) || (req.query && req.query.access_token)
25 | || req.header['x-access-token']
26 | if (token) {
27 | try {
28 | var decoded = jwt.decode(token, secret);
29 | // 此处可以对token信息进行验证和权限控制
30 | next()
31 | } catch (err) {
32 | return next()
33 | }
34 | } else {
35 | if (req.originalUrl.indexOf('/api/') >= 0) {
36 | res.json(Msg.Err.NoAccess)
37 | } else {
38 | res.render('login')
39 | }
40 | }
41 | }
42 | }
43 | // 获取UUID
44 | function GetUUID() {
45 | var s = [];
46 | var hexDigits = "0123456789abcdef";
47 | for (var i = 0; i < 36; i++) {
48 | s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
49 | }
50 | s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
51 | s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
52 | s[8] = s[13] = s[18] = s[23] = "-";
53 |
54 | var uuid = s.join("");
55 | return uuid;
56 | }
57 |
58 |
59 | module.exports = { GetJwtToken, DoAuth, GetUUID }
--------------------------------------------------------------------------------
/NodeJs/models/Strategies.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const mysql = require('./mysqldb')
3 | var Promise = require('bluebird')
4 | var co = require('co')
5 | var util = require('../common/util')
6 | var Msg = require('../common/Msg')
7 |
8 | var Strategies = {}
9 | Strategies.FindOne = function (userId, strategyId) {
10 | return new Promise(function (resolve, reject) {
11 | co(function* () {
12 | const sql = "SELECT * from strategies where UserId = ? and StrategyId = ?"
13 | mysql.db.query(sql, [userId, strategyId], function (err, result) {
14 | if (err) {
15 | reject(err)
16 | } else {
17 | if (result.length > 0) {
18 | resolve(Msg.Success(result[0]))
19 | } else {
20 | resolve(Msg.Err.LoginFaild)
21 | }
22 | }
23 | })
24 | }).catch(function (err) {
25 | reject(err)
26 | })
27 | })
28 | }
29 |
30 | Strategies.FindAllStrategies = function (userId) {
31 | return new Promise(function (resolve, reject) {
32 | co(function* () {
33 | const sql = "SELECT StrategyId,`Name`,Category from strategies where UserId = ? order by Category,`Name`"
34 | mysql.db.query(sql, [userId], function (err, result) {
35 | if (err) {
36 | reject(err)
37 | } else {
38 | if (result.length > 0) {
39 | resolve(Msg.Success(result))
40 | } else {
41 | resolve(Msg.Err.LoginFaild)
42 | }
43 | }
44 | })
45 | }).catch(function (err) {
46 | reject(err)
47 | })
48 | })
49 | }
50 |
51 | Strategies.Add = function (strategy) {
52 | return new Promise(function (resolve, reject) {
53 | co(function* () {
54 | var strategyId = util.GetUUID()
55 | const sql = "insert into strategies(StrategyId,UserId,`Name`,Category,Code,StrategyParams,StrategySettings,StrategyWorker,RealAccount,IsAuto) "
56 | + "values(?,?,?,?,?,?,?,?,?,?)"
57 | mysql.db.query(sql, [
58 | strategyId,
59 | strategy.UserId,
60 | strategy.Name,
61 | strategy.Category,
62 | strategy.Code,
63 | strategy.StrategyParams,
64 | strategy.StrategySettings,
65 | strategy.StrategyWorker,
66 | strategy.RealAccount,
67 | strategy.IsAuto
68 | ], function (err, result) {
69 | if (err) {
70 | reject(err)
71 | } else {
72 | if (result && result.affectedRows > 0) {
73 | resolve(Msg.Success({ Id: strategyId }))
74 | } else {
75 | reject(Msg.Err.DBError)
76 | }
77 | }
78 | })
79 | }).catch(function (err) {
80 | reject(Msg.Error(err))
81 | })
82 | })
83 | }
84 |
85 | Strategies.Delete = function (userId, strategyId) {
86 | return new Promise(function (resolve, reject) {
87 | co(function* () {
88 | const sql = "delete from strategies where StrategyId=? and UserId=?"
89 | mysql.db.query(sql, [strategyId, userId], function (err, result) {
90 | if (err) {
91 | reject(Msg.Error(err))
92 | } else {
93 | if (result && result.affectedRows > 0) {
94 | resolve(Msg.Info.DBSuccess)
95 | } else {
96 | resolve(Msg.Err.DBError)
97 | }
98 | }
99 | })
100 | }).catch(function (err) {
101 | reject(Msg.Error(err))
102 | })
103 | })
104 | }
105 |
106 | Strategies.Update = function (strategy) {
107 | return new Promise(function (resolve, reject) {
108 | co(function* () {
109 | const sql = "update strategies set `Name`=?,Category=?,Code=?,StrategyParams=?,StrategySettings=?,StrategyWorker=?,RealAccount=?,IsAuto=? "
110 | + "where UserId=? and StrategyId=?"
111 | mysql.db.query(sql, [
112 | strategy.Name,
113 | strategy.Category,
114 | strategy.Code,
115 | strategy.StrategyParams,
116 | strategy.StrategySettings,
117 | strategy.StrategyWorker,
118 | strategy.RealAccount,
119 | strategy.IsAuto,
120 | strategy.UserId,
121 | strategy.StrategyId
122 | ], function (err, result) {
123 | if (err) {
124 | reject(Msg.Error(err))
125 | } else {
126 | if (result && result.affectedRows > 0) {
127 | resolve(Msg.Info.DBSuccess)
128 | } else {
129 | resolve(Msg.Err.DBError)
130 | }
131 | }
132 | })
133 | }).catch(function (err) {
134 | reject(Msg.Error(err))
135 | })
136 | })
137 | }
138 |
139 | module.exports = Strategies
--------------------------------------------------------------------------------
/NodeJs/models/Sys.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | var Promise = require('bluebird')
3 | var co = require('co')
4 | const mysql = require('./mysqldb')
5 | const Msg = require('../common/Msg')
6 | // 私有方法
7 | function Log(msg, isError) {
8 | var msgType = isError ? 'Error' : 'Info'
9 | return new Promise(function (resolve, reject) {
10 | if (msg) {
11 | if (typeof msg === typeof {}) {
12 | msg = JSON.stringify(msg)
13 | }
14 | co(function* () {
15 | const sql = "insert into logs(Category,Message) values(?,?)"
16 | mysql.db.query(sql, [msgType, msg], function (err, result) {
17 | if (err) {
18 | reject(Msg.Error(err))
19 | } else {
20 | resolve(result)
21 | }
22 | })
23 | }).catch(function (err) {
24 | reject(Msg.Error(err))
25 | })
26 | } else {
27 | reject(Msg.Err.ParamError)
28 | }
29 | })
30 | }
31 | // 公共Sys类
32 | var Sys = {}
33 | // 添加消息日志
34 | Sys.AddLog = function (msg) {
35 | return Log('info', msg)
36 | }
37 | // 添加错误日志
38 | Sys.AddError = function (msg) {
39 | return Log('Error', msg)
40 | }
41 | module.exports = Sys
--------------------------------------------------------------------------------
/NodeJs/models/Users.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const mysql = require('./mysqldb')
3 | var Promise = require('bluebird')
4 | var co = require('co')
5 | var util = require('../common/util')
6 | var Msg = require('../common/Msg')
7 |
8 | var Users = {}
9 | Users.FindOne = function (id) {
10 | return new Promise(function (resolve, reject) {
11 | co(function* () {
12 | const sql = "select * from users where UserId = ?"
13 | mysql.db.query(sql, [id], function (err, result) {
14 | if (err) {
15 | reject(err)
16 | } else {
17 | if (result.length > 0) {
18 | resolve(Msg.Success(result[0]))
19 | } else {
20 | resolve(Msg.Err.LoginFaild)
21 | }
22 | }
23 | })
24 | }).catch(function (err) {
25 | reject(err)
26 | })
27 | })
28 | }
29 | // 用户登录
30 | Users.Login = function (userName, userPwd) {
31 | return new Promise(function (resolve, reject) {
32 | co(function* () {
33 | const sql = "select * from users where UserName = ? and UserPwd = ?"
34 | mysql.db.query(sql, [userName, userPwd], function (err, result) {
35 | if (err) {
36 | reject(Msg.Error(err))
37 | } else {
38 | if (result.length > 0) {
39 | var user = result[0]
40 | var token = util.GetJwtToken(user.UserId)
41 | resolve(Msg.Success({ Token: token, UserId: user.UserId, UserName: user.UserName }))
42 | } else {
43 | resolve(Msg.Err.LoginFaild)
44 | }
45 | }
46 | })
47 | }).catch(function (err) {
48 | reject(Msg.Error(err))
49 | })
50 | })
51 | }
52 | module.exports = Users
--------------------------------------------------------------------------------
/NodeJs/models/mysqldb.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const mysql = require('mysql')
4 | var mysqldb = {}
5 |
6 | function connectDB() {
7 | mysqldb.db = mysql.createConnection({
8 | host: '127.0.0.1',
9 | user: 'root',
10 | password: '123456',
11 | port: '3306',
12 | database: 'quant',
13 | multipleStatements: true
14 | })
15 | console.log("==========>>>>>mysql connect<<<<<<===========")
16 | // 连接错误,2秒重试
17 | mysqldb.db.connect(function (err) {
18 | if (err) {
19 | console.log('error when connecting to db:', err)
20 | setTimeout(handleError, 2000)
21 | } else {
22 | console.log('mysql connect ok!')
23 | }
24 | })
25 | mysqldb.db.on('error', function (err) {
26 | console.log('db error', err)
27 | // 如果是连接断开,自动重新连接
28 | if (err.code == 'PROTOCOL_CONNECTION_LOST' || err.code == 'ECONNREFUSED') {
29 | connectDB()
30 | } else {
31 | console.log(err)
32 | }
33 | })
34 | }
35 | connectDB()
36 |
37 | module.exports = mysqldb
38 |
--------------------------------------------------------------------------------
/NodeJs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodejs",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "Buffer": "0.0.0",
10 | "bluebird": "^3.5.4",
11 | "co": "^4.6.0",
12 | "cookie-parser": "~1.4.3",
13 | "debug": "~2.6.9",
14 | "ejs": "^2.6.1",
15 | "express": "~4.16.0",
16 | "express-partials": "^0.3.0",
17 | "express-session": "^1.16.1",
18 | "http-errors": "~1.6.2",
19 | "jwt-simple": "^0.5.6",
20 | "moment": "^2.24.0",
21 | "morgan": "~1.9.0",
22 | "mysql": "^2.16.0",
23 | "session-file-store": "^1.2.0"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/NodeJs/public/css/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 50px;
3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 | }
5 |
6 | a {
7 | color: #00B7FF;
8 | }
9 |
--------------------------------------------------------------------------------
/NodeJs/public/js/util.js:
--------------------------------------------------------------------------------
1 | // 加密字符串
2 | function encode(encodeStr) {
3 | return window.btoa(pako.gzip(encodeURIComponent(encodeStr), { to: "string" }));
4 | }
5 | // 解密字符串
6 | function decode(decodeStr) {
7 | var decodedData = window.atob(decodeStr);
8 | var charData = decodedData.split('').map(function (x) { return x.charCodeAt(0); });
9 | var binData = new Uint8Array(charData);
10 | var data = pako.inflate(binData);
11 | return decodeURIComponent(String.fromCharCode.apply(null, new Uint16Array(data)));
12 | }
--------------------------------------------------------------------------------
/NodeJs/routes/index.js:
--------------------------------------------------------------------------------
1 | var express = require('express')
2 | var router = express.Router()
3 |
4 | router.get('/', function(req, res, next) {
5 | res.render('index', { title: 'Express' })
6 | })
7 |
8 | router.get('/login', function(req, res, next) {
9 | if (req.session.UserId) {
10 | res.render('index')
11 | } else {
12 | res.render('login')
13 | }
14 | })
15 |
16 | module.exports = router
17 |
--------------------------------------------------------------------------------
/NodeJs/routes/strategy.js:
--------------------------------------------------------------------------------
1 | var express = require('express')
2 | var router = express.Router()
3 | var co = require('co')
4 | const util = require('../common/util')
5 | const Strategies = require('../models/Strategies')
6 | const Msg = require('../common/Msg')
7 |
8 | router.get('/', util.DoAuth, function (req, res, next) {
9 | co(function* () {
10 | if (req.session.UserId) {
11 | let r1 = yield Strategies.FindAllStrategies(req.session.UserId)
12 | res.render('strategy', { Strategies: r1.result })
13 | }
14 | }).catch(function (err) {
15 | res.json(Msg.Error(err))
16 | })
17 | })
18 |
19 | module.exports = router
20 |
--------------------------------------------------------------------------------
/NodeJs/routes/user.js:
--------------------------------------------------------------------------------
1 | var express = require('express')
2 | var router = express.Router()
3 | var co = require('co')
4 | const util = require('../common/util')
5 | const Users = require('../models/Users')
6 | const Msg = require('../common/Msg')
7 |
8 | router.get('/', util.DoAuth, function (req, res, next) {
9 | co(function* () {
10 | if (req.session.UserId) {
11 | let r1 = yield Users.FindOne(req.session.UserId)
12 | res.render('user',{UserName:r1.result.UserName})
13 | }
14 | }).catch(function (err) {
15 | res.json(Msg.Error(err))
16 | })
17 | })
18 |
19 | module.exports = router
20 |
--------------------------------------------------------------------------------
/NodeJs/views/error.ejs:
--------------------------------------------------------------------------------
1 | 错误页面
2 | <%=error%>
--------------------------------------------------------------------------------
/NodeJs/views/footer.ejs:
--------------------------------------------------------------------------------
1 |
11 |
12 |