Beispiel #1
0
        void message(string heartbeatTime, string tickProcessedTime)
        {
            var topic = new Topic(system.topicName(OrderTable.prefix, SystemHeartbeat.SUFFIX));

            topic.send(new Dictionary <string, object> {
                { "hostname", "somewhere" },
                { "ticksReceived", 1 },
                { "lastTickProcessed", tickProcessedTime },
                { "timestamp", heartbeatTime }
            });
        }
Beispiel #2
0
        void subscribeSystemHeartbeat(DataRow row, LiveSystem system)
        {
            var topic = new Topic(system.topicName(OrderTable.prefix, SystemHeartbeat.SUFFIX));

            topic.subscribe(fields => gui.runOnGuiThread(() => {
                row["hostname"] = fields.get("hostname");
                row["ticks"]    = fields.longg("ticksReceived");
                var lastTicked  = ymdHuman(fields.time("lastTickProcessed"));
                row["lastTick"] = lastTicked.Substring(0, 4).Equals("0001") ? "no tick" : lastTicked;
                row["lastBeat"] = ymdHuman(fields.time("timestamp"));
                onHeartbeat(system, fields.time("timestamp"));
                onTickProcessed(row, system, fields.time("lastTickProcessed"));
            }));
        }
Beispiel #3
0
        void publishPosition(Symbol symbol)
        {
            var message = new Dictionary <string, object> {
                { "beginValue", beginPositions[symbol] },
                { "liveValue", livePositions[symbol] },
                { "forecastCloseValue", closePositions[symbol] },
                { "beginTimestamp", start },
                { "liveTimestamp", now() },
                { "hostname", hostname() }
            };
            var topicName = liveSystem.topicName(topicPrefix, symbol.name + ".optimalPosition");

            if (LiveTradeMonitor.inNoPublishMode())
            {
                LogC.info("not published to: " + topicName + ":\n" + toShortString(message));
            }
            else
            {
                new Topic(topicName).send(message);
            }
            dirty.Clear();
        }
Beispiel #4
0
 public SystemHeartbeat(LiveSystem liveSystem, Collectible symbol, string topicPrefix)
 {
     topic = new Topic(liveSystem.topicName(topicPrefix, symbol.name + "." + SUFFIX));
 }