public SimulationPlateMonitor(IProvider provider, string eastMoneyPath, PlateMonitorForm monitorForm) : base(eastMoneyPath, monitorForm) { if (provider is SimulationDataProvider) { this.sdProvider = (SimulationDataProvider)provider; } }
public RealPlateMonitor(IProvider provider, string eastMoneyPath, PlateMonitorForm monitorForm) : base(eastMoneyPath, monitorForm) { if (provider is GMRealTimeProvider) { this.gmProvider = (GMRealTimeProvider)provider; } }
//移除监控窗体 public void RemoveMonitorForm() { this.monitorForm = null; }
public PlateMonitor(string eastMoneyPath, PlateMonitorForm monitorForm) { this.eastMoneyPath = eastMoneyPath; this.monitorForm = monitorForm; this.patternRecognition = new PatternRecognition(null); }
static void Main(string[] args) { // TO DO: Add your code here bool liveMode = true; PlateMonitorForm monitorForm = null; HotPlateTradeStrategy myStrategy = null; if (liveMode) { monitorForm = new PlateMonitorForm(); GMRealTimeProvider provider = (GMRealTimeProvider)ProviderManager.MarketDataProviders["GMRealTimeProvider"]; RealPlateMonitor plateMonitor = new RealPlateMonitor(provider, @"D:\eastmoney\swc8", monitorForm); myStrategy = new HotPlateTradeStrategy(plateMonitor); myStrategy.StrategyMode = StrategyMode.Live; myStrategy.MarketDataProvider = provider; myStrategy.ExecutionProvider = ProviderManager.ExecutionSimulator; myStrategy.ResetPortfolio = false; //myStrategy.SaveOrders=true;//是否保存委托订单 myStrategy.Portfolio.Persistent = true; //是否保存投资组合 } else { myStrategy = new HotPlateTradeStrategy(null); myStrategy.ResetPortfolio = false; //每次运行是否重置投资组合 myStrategy.CheckBuyPower = true; myStrategy.SimulationEntryDate = new DateTime(2017, 1, 1); myStrategy.SimulationExitDate = new DateTime(2017, 1, 31); } myStrategy.SimulationCash = 100000; Thread aThread = new Thread(new ThreadStart(myStrategy.Start)); if (aThread.ThreadState == ThreadState.Unstarted) { aThread.Start(); } if (monitorForm != null) { Application.Run(monitorForm); } else { MessageBox.Show("Press OK to stop ATS", "SmartQuant Automation", MessageBoxButtons.OK, MessageBoxIcon.Information); } myStrategy.Stop(); aThread.Abort(); aThread.Join(); /*GraphShowForm showForm=new GraphShowForm(); * DateTime curDate=Clock.Now.Date; * string symbol="SZSE.300503"; * Instrument inst=InstrumentManager.Instruments[symbol]; * ISeriesObject[] dailyBars=Util.GetNDailiesBeforeDate(inst,curDate,60); * if (dailyBars.Length>0){ * Util.AdjustDailys(dailyBars);//向前复权 * double[] inputs=new double[60]; * double[] outputs=new double[60]; * double basePrice=((GMDaily)dailyBars[0]).Amount/((GMDaily)dailyBars[0]).Volume; * for(int i=0;i<dailyBars.Length;i++){ * inputs[i]=i; * outputs[i]=((GMDaily)dailyBars[i]).Amount/((GMDaily)dailyBars[i]).Volume; * outputs[i]=(outputs[i]/basePrice-1)*100; * } * PatternRecognition pr=new PatternRecognition(showForm); * RecognitionState ret=pr.Recognition(inputs,outputs); * Console.WriteLine("slope={0},shape={1},speed={2}",ret.Slope,ret.Shape,ret.Speed); * Application.Run(showForm); * }else { * Console.WriteLine("no data."); * }*/ Console.WriteLine("Strategy Stopped!"); }
public PlateMonitor(MdApi mdApi, string eastMoneyPath, PlateMonitorForm monitorForm) { this._md = mdApi; this.eastMoneyPath = eastMoneyPath; this.monitorForm = monitorForm; }