Beispiel #1
0
        IEnumerable <Bar> barList(Symbol symbol, Interval interval)
        {
            var jBars = list <JBar>(symbol.bars(ranges[symbol], interval));

            try {
                return(convert(jBars, jbar => new Bar(jbar, false)));
            } catch (Exception e) {
                throw Bomb.toss("error loading bars for symbol: " + symbol, e);
            }
        }
Beispiel #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);
        }