示例#1
0
        public void testSymbolValueLive()
        {
            Log.setFile(@"C:\logs\jefftest");

            SystemTimeSeriesTable.SYSTEM_TS.insert("testone", "ASCII", "ActiveMQ", "somedangtopic");
            AsciiTable.SYSTEM_ASCII.insert("testone", @"\\nysrv37\share\Tools\RightEdge\TransitionTest\TY1C.full.csv", true, 1);
            var manager  = new SpudManager();
            var barSpud  = new BarSpud(manager);
            var barSpud2 = new BarSpud(manager);
            var symbol   = new Symbol("testone");
            var spud     = symbol.doubles(barSpud);
            var spud2    = new Symbol("RE.TEST.TY.1C").doubles(barSpud2);

            manager.newBar();
            barSpud.set(new Bar(1, 3, 1, 2, O.date("2008/08/06")));
            barSpud2.set(new Bar(1, 3, 1, 2, O.date("2008/08/06")));

            manager.newTick();
            spud.doSubscribe();

            barSpud.lastTickedAt(O.date("2008/08/06 11:22:34"));
            spud2.doSubscribe();
            IsTrue(spud2.isDirty());
            symbol.javaSymbol().jmsLive().topic().send("value=97.1|timestamp=2008/08/06 11:22:33|MSTimestamp=2008/06/05 13:10:08");

            Bombs(() => LogC.info("" + spud[0]), "stale");
            symbol.javaSymbol().jmsLive().topic().send("value=97.2|timestamp=2008/08/06 11:22:34|MSTimestamp=2008/06/05 13:10:08");
            O.wait(() => spud[0] == 97.2);
            barSpud.lastTickedAt(O.date("2008/08/06 11:22:35"));
            spud.allowStaleTicks();
            AreEqual(97.2, spud[0]);
            AreEqual(116.140625, spud2[0]);
        }
示例#2
0
        public void testSymbolBarSpud()
        {
            var manager = new SpudManager();
            var barSpud = new BarSpud(manager);
            var symbol  = new Symbol("RE.TEST.TY.1C");
            var spud    = symbol.bars(barSpud);

            barSpud.set(new Bar(1, 3, 1, 2, O.date("2007/01/02")));
            AreEqual(105.04687500, spud[0].close);
            barSpud.lastTickedAt(O.date("2007/01/02 12:34:55"));
            symbol.javaSymbol().jmsLive().publish(new JTick(98, 100, 96, 99, 93, O.jDate("2007/01/02 12:34:56")));
            O.sleep(250);
            AreEqual(105.04687500, spud[0].close);

            manager.goLive();
            symbol.javaSymbol().jmsLive().publish(new JTick(98, 100, 96, 99, 93, O.jDate("2007/01/02 12:34:57")));
            O.wait(() => spud[0].time.Equals(date("2007/01/02 12:34:57")));

            AreEqual(98.0, spud[0].close);
            AreEqual(93.0, spud[0].low);
        }
示例#3
0
 public override T this[int index] {
     get {
         if (index != 0 || !inLive || !bars_.hasTicked() || noLiveUpdates)
         {
             return(base[index]);
         }
         // if we are dirty, then we need to be careful not to overwrite the live value with last night's
         beClean();
         var tickTime = bars_.lastTickedAt();
         try { if (!allowStaleTicks_)
               {
                   wait(50, 10, () => tickTime.CompareTo(lastTickReceived()) < 1);
               }
         }
         catch {
             LogC.info("dropping tick @" + ymdHuman(bars_[0].time) +
                       " symbol " + symbol.name + " has not ticked since " + ymdHuman(lastTickedAt));
             throw new AbortBar("stale data in symbol spud " + this);
         }
         return(base[index]);
     }
 }