示例#1
0
        void updateNode(LiveSystem liveSystem, QNode node)
        {
            var childNodes = list <LiveMarketNode>(node.children());
            var totalTicks = sum(convert(childNodes, child => child.ticksReceived));

            if (totalTicks == 0)
            {
                return;
            }
            var tickRate = sum(convert(childNodes, child => child.tickRate));
            var tickLag  = max(convert(childNodes, child => child.tickLag));

            node.color = tickLag - 5000;
            node.size  = isEqualSizes_ ? 1 : Math.Max(1F, tickRate);
            var isDown            = exists(childNodes, child => child.isDown);
            var downText          = isDown ? "" : "DOWN ";
            var lastTickProcessed = max(convert(childNodes, child => child.lastTickProcessed));

            node.text =
                downText +
                liveSystem.pv().name() + " - " + liveSystem.id() + "\n" +
                tickRate.ToString("n0") + "/min, " + tickLag + "ms\n" +
                totalTicks.ToString("n0") + "\n" +
                lastTickProcessed.ToString("HH:mm:ss") + "\n";
        }
示例#2
0
 public void killAndRestart(QNode selected, string runOn)
 {
     if (selected is LiveMarketNode || selected is LiveSystemNode)
     {
         killAndRestart(selected.parent(), runOn);
         return;
     }
     restart(runOn, selected.text);
 }
示例#3
0
 public static void kill(QNode selected)
 {
     if (selected is LiveMarketNode || selected is LiveSystemNode)
     {
         kill(selected.parent());
         return;
     }
     kill(selected.text);
 }
示例#4
0
        public List <QNode> nodes()
        {
            var bySystem = new LazyDictionary <string, List <LiveSystem> > (system => new List <LiveSystem>());

            each(systems, liveSystem => bySystem.get(liveSystem.siv().system()).Add(liveSystem));
            var result = list(convert(bySystem.keys(), system => {
                var liveSystems = bySystem.get(system);
                var systemNode  = new QNode(system, liveSystems.Count, 0);
                each(liveSystems, liveSystem => {
                    var liveSystemNode = systemNode.add(new LiveSystemNode(liveSystem, 1, 0));
                    var liveMarkets    = list <MsivPv>(liveSystem.liveMarkets());
                    each(liveMarkets, liveMarket => {
                        try {
                            var symbol         = new Symbol(liveMarket.market());
                            var liveMarketNode = new LiveMarketNode(symbol, 1, 0);
                            liveSystemNode.add(liveMarketNode);
                            var topic = new Topic(liveSystem.topicName(OrderTable.prefix, symbol.name + "." + SystemHeartbeat.SUFFIX));
                            topic.subscribeIfNeeded();
                            updateModelNodes += () => updateNode(topic, liveMarket, liveMarketNode);
                            symbol.subscribe(bar => recordMarketDataTickReceived(liveMarket, bar.time));
                            topic.subscribe(fields => {
                                var tickTime = fields.time("lastTickProcessed");
                                ticks.get(liveMarket).systemProcessed(date(tickTime));
                            });
                        } catch (Exception ex) {
                            LogC.err("exception caught subscribing to tick data for " + liveMarket + ", " + system, ex);
                            gui.alertUser("exception caught susbcribing to data for " + liveMarket + ", " + system + ".\nSkipping... see log for details.");
                        }
                    });
                    updateModelNodes += () => updateNode(liveSystem, liveSystemNode);
                });
                updateModelNodes += () => updateNode(systemNode);
                return(systemNode);
            }));

            timerManager().everyMillis(1000, updateModelNodes, out timer);
            LiveLauncher.subscribeHeartbeat(gui.launcherAvailable);
            LogC.ignore(timer);
            return(result);
        }
示例#5
0
 static void updateNode(QNode node)
 {
     node.size  = sum(convert(node.children(), child => child.size));
     node.color = max(convert(node.children(), child => child.color));
 }
示例#6
0
 void setParent(QNode newParent)
 {
     Bomb.unlessNull(parent_, () => "parent is already set to " + parent_.text);
     parent_ = newParent;
 }