void playto(PlayTo pt) { if (!hasprereq(true)) { return; } bw.RunWorkerAsync(pt); status("Playing next " + pt.ToString().Replace(PLAYTO, string.Empty) + "..."); }
void play(object sender, DoWorkEventArgs e) { PlayTo type = (PlayTo)e.Argument; if (e.Cancel) { return; } int time = (int)(_historicalSimulator.NextTickTime % 100000); long date = (_historicalSimulator.NextTickTime / 100000) * 100000; int t = (int)type; long val = 0; _playTo = type; switch (type) { case PlayTo.End: val = MultiSimImpl.ENDSIM; break; case PlayTo.FiveMin: case PlayTo.OneMin: case PlayTo.TenMin: case PlayTo.HalfHour: val = date + Util.FTADD(time, (t / 10) * 60); break; case PlayTo.Hour: val = date + Util.FTADD(time, (t / 1000) * 3600); break; case PlayTo.TwoHour: val = date + Util.FTADD(time, 2 * 60 * 60); break; case PlayTo.FourHour: val = date + Util.FTADD(time, 4 * 60 * 60); break; case PlayTo.OneSec: case PlayTo.ThirtySec: val = date + Util.FTADD(time, t); break; //case PlayTo.Custom: // ctime = getcusttime(); // if (ctime == 0) // { // _playTo = PlayTo.OneSec; // val = 0; // status("Invalid custom time, playing to next second."); // } // else // val = date + ctime; // break; } _historicalSimulator.PlayTo(val); }
public void Play(PlayTo pt, Action <Results> onCompleted, Action <int> onPercentComplete) { _onCompleted = onCompleted; _onPercentComplete = onPercentComplete; if (!hasprereq(true)) { return; } _backgroundWorker.RunWorkerAsync(pt); status("Playing next " + pt.ToString().Replace(_playToString, string.Empty) + "..."); }
public void Play(PlayTo pt) { if (!hasprereq(true)) { return; } var engineInfo = getEngineInfo(); EngineReset(engineInfo); _backgroundWorker.RunWorkerAsync(pt); StatusUpdate("Playing next " + pt.ToString().Replace(_playToString, string.Empty) + "..."); }
private void play(object sender, DoWorkEventArgs e) { PlayTo type = (PlayTo)e.Argument; if (e.Cancel) { return; } int time = (int)(_historicalSimulator.NextTickTime % 100000); long date = (_historicalSimulator.NextTickTime / 100000) * 100000; int t = (int)type; long val = 0; _playTo = type; switch (type) { case PlayTo.End: val = MultiSimImpl.ENDSIM; break; case PlayTo.FiveMin: case PlayTo.OneMin: case PlayTo.TenMin: case PlayTo.HalfHour: val = date + Util.FTADD(time, (t / 10) * 60); break; case PlayTo.Hour: val = date + Util.FTADD(time, (t / 1000) * 3600); break; case PlayTo.TwoHour: val = date + Util.FTADD(time, 2 * 60 * 60); break; case PlayTo.FourHour: val = date + Util.FTADD(time, 4 * 60 * 60); break; case PlayTo.OneSec: case PlayTo.ThirtySec: val = date + Util.FTADD(time, t); break; } _historicalSimulator.PlayTo(val); }
void Play(object sender, DoWorkEventArgs e) { PlayTo type = (PlayTo)e.Argument; if (e.Cancel) { return; } int t = (int)type; h.Initialize(); int maxmin = (t > 127) && (t < 450) ? t - 127 : 0; long firsttime = h.NextTickTime % 1000000; long rem = h.NextTickTime - firsttime; int stop = Util.FTADD((int)firsttime, maxmin * 60); rem += stop; h.PlayTo(rem); }
void playtobut_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { pt = (PlayTo)Enum.Parse(typeof(PlayTo), e.ClickedItem.Text); string extra = ""; if (pt == PlayTo.Time) { extra = Microsoft.VisualBasic.Interaction.InputBox("When should Kadina stop reading ticks? Enter a time in TLTime. 930 = 9:30AM, 1459 = 2:59PM", "PlayTo Time", "0", 0, 0); try { time = Convert.ToInt32(extra); DateTime dt = Util.TLT2DT(time); // this should throw exceptions for bad times } catch (Exception) { status("You entered an invalid time."); return; } } else { time = 0; } status("Playing to next " + e.ClickedItem.Text + " " + extra); }
public DarkLightSimBroker(IHub hub, BrokerConfigurationModel config) : base(hub, config) { //Plug into Tradelink _broker = new Broker(); _broker.UseBidAskFills = config.SimUseBidAskFills; _broker.GotFill += PublishFill; _broker.GotOrder += PublishOrderAck; _broker.GotOrderCancel += PublishOrderCancelAck; loadTickData(config.TickFiles); _historicalSimulator = new MultiSimImpl(_historicalDataFiles.ToArray()); _historicalSimulator.GotTick += PublishTick; //Set up tick player _backgroundWorker = new BackgroundWorker(); _backgroundWorker.DoWork += play; _backgroundWorker.WorkerReportsProgress = false; _backgroundWorker.WorkerSupportsCancellation = true; _backgroundWorker.RunWorkerCompleted += playComplete; _playTo = config.PlayToValue; }
void Play(object sender, DoWorkEventArgs e) { PlayTo type = (PlayTo)e.Argument; if (e.Cancel) { return; } // set our counter limits (0 = not used) int t = (int)type; int maxtick = (t >= 0) && (t < 32)? t: 0; int maxquote = (t > 31) && (t < 64) ? t - 31 : 0; int maxtrade = (t > 63) && (t < 128) ? t - 63 : 0; int maxmin = (t > 127) && (t < 450) ? t - 127 : 0; int quote = 0, tick = 0, trade = 0; DateTime start = DateTime.Now; bool needtoset = true; int itime = 0; while (!sr.EndOfStream) { if (e.Cancel) { break; } Tick tk = eSigTick.FromStream(stock.Symbol, sr); if (tk.isTrade && !isDesiredExchange(tk.ex)) { continue; } else if (tk.hasBid && !isDesiredExchange(tk.be)) { continue; } else if (tk.hasAsk && !isDesiredExchange(tk.oe)) { continue; } if (needtoset) { start = Util.ToDateTime(tk.time, tk.sec); needtoset = false; } if ((mybox != null) && ((itime == 0) || (itime != tk.time))) { // load all the indicies for this time List <Index> itix = FetchIdx(tk.time); itime = tk.time; // send them to the box (before we send the tix) for (int id = 0; id < itix.Count; id++) { mybox.NewIndex(itix[id]); } } if (KadTick != null) { KadTick(tk); } tick++; if (tk.isTrade) { trade++; } if (tk.isQuote) { quote++; } if ((type == PlayTo.Time) && (time != 0) && (tk.time == time)) { break; } TimeSpan since = new TimeSpan(Util.ToDateTime(tk.time, tk.sec).Ticks - start.Ticks); if ((maxmin != 0) && ((int)since.TotalMinutes >= maxmin)) { break; } if ((maxtick != 0) && (tick >= maxtick)) { break; } if ((maxtrade != 0) && (trade >= maxtrade)) { break; } if ((maxquote != 0) && (quote >= maxquote)) { break; } } }
void Play(object sender, DoWorkEventArgs e) { PlayTo type = (PlayTo)e.Argument; if (e.Cancel) { return; } int time = (int)(h.NextTickTime % 100000); long date = (h.NextTickTime / 100000) * 100000; int t = (int)type; long val = 0; pt = type; switch (type) { case PlayTo.End: val = MultiSimImpl.ENDSIM; break; case PlayTo.FiveMin: case PlayTo.OneMin: case PlayTo.TenMin: case PlayTo.HalfHour: val = date + Util.FTADD(time, (t / 10) * 60); break; case PlayTo.Hour: val = date + Util.FTADD(time, (t / 1000) * 3600); break; case PlayTo.TwoHour: val = date + Util.FTADD(time, 2 * 60 * 60); break; case PlayTo.FourHour: val = date + Util.FTADD(time, 4 * 60 * 60); break; case PlayTo.OneSec: case PlayTo.ThirtySec: val = date + Util.FTADD(time, t); break; case PlayTo.Custom: ctime = getcusttime(); if (ctime == 0) { pt = PlayTo.OneSec; val = 0; status("Invalid custom time, playing to next second."); } else { val = date + ctime; } break; } cleardebugs(); // clear the message box on first box run h.PlayTo(val); }
void playtobut_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { pt = (PlayTo)Enum.Parse(typeof(PlayTo), e.ClickedItem.Text); string extra = ""; if (pt == PlayTo.Time) { extra = Microsoft.VisualBasic.Interaction.InputBox("When should Kadina stop reading ticks? Enter a time in TLTime. 930 = 9:30AM, 1459 = 2:59PM", "PlayTo Time", "0", 0, 0); try { time = Convert.ToInt32(extra); DateTime dt = Util.ToDateTime(time, 0); // this should throw exceptions for bad times } catch (Exception) { status("You entered an invalid time."); return; } } else time = 0; status("Playing to next " + e.ClickedItem.Text+" "+extra); }
void playto(PlayTo pt) { if (!hasprereq(true)) return; bw.RunWorkerAsync(pt); status("Playing next " + pt.ToString().Replace(PLAYTO, string.Empty) + "..."); }
void Play(object sender, DoWorkEventArgs e) { PlayTo type = (PlayTo)e.Argument; if (e.Cancel) return; int time = (int)(h.NextTickTime % 100000); long date = (h.NextTickTime / 100000)*100000; int t = (int)type; long val = 0; pt = type; switch (type) { case PlayTo.End : val = MultiSimImpl.ENDSIM; break; case PlayTo.FiveMin : case PlayTo.OneMin: case PlayTo.TenMin: case PlayTo.HalfHour : val = date + Util.FTADD(time, (t / 10)*60); break; case PlayTo.Hour: val = date + Util.FTADD(time,(t/1000)*3600); break; case PlayTo.TwoHour: val = date + Util.FTADD(time, 2 * 60 * 60); break; case PlayTo.FourHour: val = date + Util.FTADD(time, 4 * 60 * 60); break; case PlayTo.OneSec: case PlayTo.ThirtySec: val = date+ Util.FTADD(time, t); break; case PlayTo.Custom: ctime = getcusttime(); if (ctime == 0) { pt = PlayTo.OneSec; val = 0; status("Invalid custom time, playing to next second."); } else val = date + ctime; break; } cleardebugs(); // clear the message box on first box run h.PlayTo(val); }