void tl_gotTickasync(Tick t) { // on multi-core machines, this will be invoked to write ticks // to a cache where they will be processed by a seperate thread // asynchronously _ar.newTick(t); }
public void TickTest() { // get ticks Tick[] sent = TradeLink.Research.RandomTicks.GenerateSymbol(SYM, MAXTICKS); // send ticks for (int i = 0; i < sent.Length; i++) { ar.newTick(sent[i]); } int waits = 0; bool testtimeout = false; // wait for reception while (!tickdone) { System.Threading.Thread.Sleep(10); if (waits++ % 50 == 0) { if (ar.BadTickWritten + ar.BadTickRead > 0) { break; } //System.Diagnostics.Debugger.Break(); Console.WriteLine(string.Format("waits: {0} tickcount: {1}", waits, tc)); } if ((waits * 10) > sent.Length) { testtimeout = true; break; } } Assert.AreEqual(0, ar.BadTickRead, "null ticks read"); Assert.AreEqual(0, ar.BadTickWritten, "null ticks written"); Assert.AreEqual(0, ar.TickOverrun, "tick overrun"); // verify done string reason = testtimeout ? "TICKTESTTIMEOUT " : string.Empty; reason += tc.ToString() + " ticks recv/" + MAXTICKS.ToString(); Assert.IsTrue(tickdone, reason); //verify count Assert.AreEqual(MAXTICKS, tc); // verify order Assert.IsTrue(torder); }
void tl_gotTick2(Tick t) { _ar.newTick(t); }