public void positionUpdate(Position position, Trade trade, TradeEmailFunc tradeEmail) { if (!isLive) { return; } // just in case we are trading this for the first time in live mode (typically just a test situation) var symbol = position.symbol; initialize(symbol); livePositions[symbol] += trade.size * trade.direction; closePositions[symbol] += trade.size * trade.direction; dirty[symbol] = true; if (LiveTradeMonitor.inNoPublishMode()) { return; } var id = trade.order().filledUpdateDb(trade.price, liveSystem, topicPrefix); var email = tradeEmail(liveSystem, trade, id); var liveOrder = LiveOrders.ORDERS.order(id); liveOrder.emailInterestedParties(email); }
public void goLive() { if (LiveTradeMonitor.inNoPublishMode()) { return; } timerManager().everyMillis(waitTimeMillis, () => topic.send(new Dictionary <string, object> { { "hostname", hostname() }, { "ticksReceived", ticks }, { "lastTickProcessed", ymdHuman(lastTick) }, { "timestamp", ymdHuman(now()) } }), out timer); }
void tryOrderSubmission(Order order) { if (LiveTradeMonitor.inNoPublishMode() || !order.canSubmitToFerret()) { return; } if (ferretApproved) { writeOrderToFerret(order); } else { info("skipping order submission - system is not enabled for ferret."); } }
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(); }