public CloudSTOPanel() { var panel = new QDockPanel(); Content = panel; Loaded += initialize; instanceGrid = new QDataTableGrid(loadInstanceRow, unloadInstanceRow); var controls = new QDockPanel(); systemIdBox = new QComboBox("-1", resetInstanceId, true) { MinWidth = 80, IsTextSearchEnabled = true, IsSynchronizedWithCurrentItem = false }; controls.add(systemIdBox, Dock.Left); var grid = new QGrid(); grid.addColumns(4); instancesLabel = label(""); grid.add(instancesLabel, 0); redGreenLabel = label(""); grid.add(redGreenLabel, 1); summaryLabel = label(""); grid.add(summaryLabel, 2); completionTimeLabel = label(""); grid.add(completionTimeLabel, 3); controls.add(grid, Dock.Left); controls.add(new QButton("Refresh System Ids", refreshSystemIds), Dock.Left); panel.add(controls, Dock.Top); panel.add(instanceGrid, Dock.Top); LogC.info("starting cloud STO tracker"); tracker = new CloudSTOTracker(this); }
public WatcherPanel() { watcher = new LiveWatcher(this); var panel = new QDockPanel(); grid = new QDataTableGrid(loadRow, row => {}); Content = panel; panel.add(filterPanel(), Dock.Top); panel.add(grid); Loaded += (s, e) => initialize(); }
public PositionsPanel() { var panel = new QDockPanel(); Content = panel; positionGrid = new QDataTableGrid(loadPositionRow, unloadPositionRow); panel.add(positionGrid); LogC.info("starting position tracker"); positionTracker = new PositionTracker(this, new QTopic("Redi.Positions.00182087-T.*", PositionTracker.DEFAULT_RECONCILIATION_BROKER, true), new QTopic("Aim.Positions.QMF.*", PositionTracker.DEFAULT_RECONCILIATION_BROKER, true) ); Loaded += (sender, args) => positionTracker.initialize(); }
void addSwitchesPanel(Panel outer) { var pane = dockableChild(outer); ResizingPanel.SetResizeHeight(pane, 100); var switches = new QDockPanel(); pane.Items.Add(new DockableContent { Name = "AdditionalSwitches", Title = "Additional Switches", Content = switches }); switches.add(label("Slippage Calculator"), Dock.Top); switches.add(slippageBox, Dock.Top); switches.add(runInNativeCurrencyBox, Dock.Top); }
public ReconPanel() { Producer <string> buttonText = () => "set LOG__VERBOSE " + (Log.verbose() ? "off" : "on"); QButton[] verboseButton = { null }; verboseButton[0] = new QButton(buttonText(), () => { bool newVerbose; LogC.flipVerbose(out newVerbose); runOnGuiThread(() => verboseButton[0].setText(buttonText())); }) { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Width = 250 }; var dockPanel = new QDockPanel { LastChildFill = false }; Content = dockPanel; dockPanel.add(verboseButton[0], Dock.Top); var executionConfigurationGrid = new QGrid { Height = 25 }; dockPanel.add(executionConfigurationGrid, Dock.Top); O.zeroTo(4, i => executionConfigurationGrid.addColumn(200)); var platformBox = new TextBox(); var routeBox = new TextBox(); var typeBox = new QComboBox("Future", selected => { var config = ExecutionConfigurationTable.currentConfiguration(selected); platformBox.Text = config.platform(); routeBox.Text = config.route(); }, O.list("Equity")); executionConfigurationGrid.add(typeBox, 0); executionConfigurationGrid.add(withLabel("Platform", platformBox), 1); executionConfigurationGrid.add(withLabel("Route", routeBox), 2); executionConfigurationGrid.add(new QButton("Set Current Execution Configuration", () => { var type = typeBox.selected("NA"); var platform = platformBox.Text; var route = routeBox.Text; ExecutionConfigurationTable.CONFIG.insert(type, platform, route); Db.commit(); Email.notification("Execution Configuration Changed for " + type + ": " + platform + ", " + route, "").sendTo("team"); alertUser("Configuration changed for " + type + " - don't forget to restart systems to pick up the change."); }) { Width = 200 }, 3); }
void addTradesTab(Simulator simulator, ItemsControl charts, IEnumerable <Trade> trades) { var dataGrid = new QDataTableGrid(); var table = new QDataTable { { "symbol", typeof(string) }, { "time", typeof(DateTime) }, { "description", typeof(string) }, { "direction", typeof(string) }, { "size", typeof(int) }, { "price", typeof(double) }, { "details", typeof(string) }, { "fxRate", typeof(double) } }; var panel = new QDockPanel(); charts.Items.Add(new DockableContent { Title = title("Trades"), Content = panel }); var controlGrid = new QGrid(); controlGrid.addColumns(2); controlGrid.add(withLabel("S_ymbol", new QComboBox("ALL", selected => table.filter("symbol", selected), markets())), 0); controlGrid.add(withLabel("_Direction", new QComboBox("ALL", selected => table.filter("direction", selected), Objects.list("buy", "sell"))), 1); panel.add(controlGrid, Dock.Top); panel.add(dataGrid, Dock.Bottom); Converter <Trade, DataRow> newTradeRow = trade => { var row = table.NewRow(); row["symbol"] = trade.order().symbol.name; row["time"] = trade.time; row["description"] = trade.description; row["direction"] = trade.direction.longShort("buy", "sell"); row["size"] = trade.size; row["price"] = trade.price; row["details"] = " " + trade.order().details; row["fxRate"] = trade.fxRate; return(row); }; Objects.each(Objects.reverse(trades), trade => table.add(newTradeRow(trade))); dataGrid.populateFromDataTable(table); dataGrid.AutoGeneratedColumns += rightJustifyColumns; simulator.addNewTradeListener((position, trade) => runOnGuiThread(() => table.addAtStart(newTradeRow(trade)))); }
public OrdersPanel() { var panel = new QDockPanel(); Content = panel; Loaded += initialize; systemBox = new QComboBox(onSystemSelected); pvBox = new QComboBox(onPvSelected); marketBox = new QComboBox(onMarketSelected); filterBox = new QComboBox("ALL", onFilterSelected, O.list("Not Ferret", "Ferret")); panel.add(comboBoxPanel(), Dock.Top); panel.add(new FerretPanel(), Dock.Bottom); orderGrid = new QDataTableGrid(loadOrderRow, unloadOrderRow); panel.add(orderGrid); LogC.info("starting order tracker"); orderTracker = new OrderTracker(this); }
void addPositionsTab(Researcher researcher, ItemsControl charts) { var simulator = researcher.simulator; var positionsPane = new DockablePane(); var dataGrid = new QDataTableGrid(); var table = new QDataTable("symbol", "entryTime", "exitTime", "direction") { { "initialSize", typeof(int) }, { "pnl", typeof(double) }, { "barsHeld", typeof(int) }, { "numTrades", typeof(int) }, { "positionHIDDEN", typeof(Position) } }; var panel = new QDockPanel(); positionsPane.Items.Add(new DockableContent { Title = title("Position List"), Content = panel }); charts.Items.Add(new DockableContent { Title = title("Positions"), Content = positionsPane }); var controlGrid = new QGrid(); controlGrid.addColumns(3); controlGrid.add(withLabel("S_ymbol", new QComboBox("ALL", selected => table.filter("symbol", selected), markets())), 0); controlGrid.add(withLabel("_Direction", new QComboBox("ALL", selected => table.filter("direction", selected), Objects.list("long", "short"))), 1); controlGrid.add(withLabel("_P&L", new QComboBox("ALL", selected => table.filter <double>("pnl", value => pnlMatchesSelection(selected, value)), Objects.list("winning", "losing"))), 2); panel.add(controlGrid, Dock.Top); panel.add(dataGrid, Dock.Bottom); Action <DataRow, Position> updateRow = (row, position) => { row["symbol"] = position.symbol.name; row["entryTime"] = Objects.ymdHuman(position.entry().time); row["exitTime"] = position.isClosed() ? Objects.ymdHuman(position.exitTrade().time) : "Open"; row["direction"] = position.entry().direction.ToString(); row["initialSize"] = position.entry().size; row["pnl"] = position.isClosed() ? position.pnl(true, simulator.runInNativeCurrency()) : simulator.pnlForPosition(position); row["barsHeld"] = position.barsHeld(); row["numTrades"] = position.trades().Count; row["positionHIDDEN"] = position; }; Converter <Position, DataRow> newRow = position => { var row = table.NewRow(); updateRow(row, position); return(row); }; Objects.each(Objects.reverse(researcher.positions), position => table.add(newRow(position))); dataGrid.populateFromDataTable(table); dataGrid.AutoGeneratedColumns += rightJustifyColumns; simulator.addNewTradeListener((position, trade) => runOnGuiThread(() => { if (position.isEntry(trade)) { table.addAtStart(newRow(position)); } else { updateRow(table.firstRow("positionHIDDEN", position), position); } })); addFilteredHistogram(positionsPane, table, "Average P&L (Bar To End)", new TradePathHistogramControl(researcher, true, true)); addFilteredHistogram(positionsPane, table, "Cumulative P&L (Bar To End)", new TradePathHistogramControl(researcher, false, true)); addFilteredHistogram(positionsPane, table, "Average P&L (Start To Bar)", new TradePathHistogramControl(researcher, true, false)); addFilteredHistogram(positionsPane, table, "Cumulative P&L (Start To Bar)", new TradePathHistogramControl(researcher, false, false)); addFilteredHistogram(positionsPane, table, "Pnl Distribution", new PositionHistogramControl(researcher, position => position.pnl(true, researcher.simulator.runInNativeCurrency()))); addFilteredHistogram(positionsPane, table, "Entry Size Distribution", new PositionHistogramControl(researcher, position => Objects.first(position.trades()).size)); addFilteredHistogram(positionsPane, table, "Bars Held Distribution", new PositionHistogramControl(researcher, position => position.barsHeld())); }