private void FireBeforeCellEdit(object source, GTLEmbeddedControlEventArgs args) { args.Cancel = true; GTLTreeNode node = args.TreeNode; // // You can cancel replace as long as it's // // 'NEW' // 'PARTIALLY_FILLED' // 'REPLACED' // string status = node.SubItems[DatabaseObject.RELEASE_STATUS].Text; if (status.Equals("NEW") || status.Equals("PARTIALLY_FILLED") || status.Equals("REPLACED")) { GTLColumn col = data.Columns[args.Column]; if (col.Name.Equals(DatabaseObject.LIMIT_PRC) || col.Name.Equals(DatabaseObject.STOP_PRC)) { args.Cancel = false; } } }
protected void SortData(GTLColumn col) { GSortDirectionTypes sortdir = col.CurrentSortDirection; data.BeginUpdate(); data.BeginNodeListChange(); col.Sort(data.Nodes); data.EndNodeListChange(); data.EndUpdate(); col.CurrentSortDirection = sortdir; }
private void InitializeComponents() { // // Account List // accounts = ControlHelper.NewGlacialTreeList("AccountLimitPaneData"); accounts.SelectedIndexChanged += new GTSelectionChangedEventHandler( FireSelectedIndexChanged); // // account list columns // GTLColumn account_name = new GTLColumn(); account_name.BackColor = Color.White; account_name.CheckBoxes = false; account_name.ImageIndex = -1; account_name.Name = "account_name"; account_name.Text = "Account"; account_name.Width = 132; account_name.SortType = SortTypes.InsertionSort; accounts.Columns.AddRange(new GTLColumn [] { account_name }); // // Context Menu // ContextMenu ctxMenu = new ContextMenu(); // // First, build the actions that you can do // ctxMenu.MenuItems.AddRange(new MenuItem [] { new MenuItem("CREATE ACCOUNT", new EventHandler(FireCreateAccount)), new MenuItem("-"), new MenuItem("CLONE ACCOUNT", new EventHandler(FireCloneAccount)) }); ctxMenu.MenuItems[0].Enabled = false; ctxMenu.MenuItems[2].Enabled = false; accounts.ContextMenu = ctxMenu; this.Controls.AddRange(new Control[] { accounts }); }
private void InitializeComponents() { // // Tree List // data = ControlHelper.NewGlacialTreeList("PositionIntradayListData"); data.ShowPlusMinus = true; // // Tree List columns // GTLColumn accountId = new GTLColumn(); accountId.CheckBoxes = false; accountId.ImageIndex = -1; accountId.Name = "accountId"; accountId.Text = "Account ID"; accountId.SortType = SortTypes.InsertionSort; accountId.Visible = false; GTLColumn investmentSystemId = new GTLColumn(); investmentSystemId.CheckBoxes = false; investmentSystemId.ImageIndex = -1; investmentSystemId.Name = "investmentSystemId"; investmentSystemId.Text = "Investment System ID"; investmentSystemId.SortType = SortTypes.InsertionSort; investmentSystemId.Visible = false; GTLColumn instrumentId = new GTLColumn(); instrumentId.CheckBoxes = false; instrumentId.ImageIndex = -1; instrumentId.Name = "instrumentId"; instrumentId.Text = "Instrument ID"; instrumentId.SortType = SortTypes.InsertionSort; instrumentId.Visible = false; GTLColumn accountName = new GTLColumn(); accountName.CheckBoxes = false; accountName.ImageIndex = -1; accountName.Name = "accountName"; accountName.Text = "Account Name --> Investment System"; accountName.SortType = SortTypes.InsertionSort; accountName.Width = 240; GTLColumn instrumentName = new GTLColumn(); instrumentName.CheckBoxes = false; instrumentName.ImageIndex = -1; instrumentName.Name = "instrumentName"; instrumentName.Text = "Instrument Name"; instrumentName.SortType = SortTypes.InsertionSort; instrumentName.Width = 220; GTLColumn totalPctPL = new GTLColumn(); totalPctPL.CheckBoxes = false; totalPctPL.ImageIndex = -1; totalPctPL.Name = "totalPctPL"; totalPctPL.Text = "Total Pct PL"; totalPctPL.TextAlignment = ContentAlignment.MiddleRight; totalPctPL.SortType = SortTypes.InsertionSort; totalPctPL.Visible = false; GTLColumn totalPL = new GTLColumn(); totalPL.CheckBoxes = false; totalPL.ImageIndex = -1; totalPL.Name = "totalPL"; totalPL.Text = "Total PL"; totalPL.TextAlignment = ContentAlignment.MiddleRight; totalPL.SortType = SortTypes.InsertionSort; GTLColumn openPL = new GTLColumn(); openPL.CheckBoxes = false; openPL.ImageIndex = -1; openPL.Name = "openPL"; openPL.Text = "Open PL"; openPL.TextAlignment = ContentAlignment.MiddleRight; openPL.SortType = SortTypes.InsertionSort; GTLColumn closedPL = new GTLColumn(); closedPL.CheckBoxes = false; closedPL.ImageIndex = -1; closedPL.Name = "closedPL"; closedPL.Text = "Closed PL"; closedPL.TextAlignment = ContentAlignment.MiddleRight; closedPL.SortType = SortTypes.InsertionSort; GTLColumn longPos = new GTLColumn(); longPos.CheckBoxes = false; longPos.ImageIndex = -1; longPos.Name = "longPos"; longPos.Text = "Long Pos"; longPos.TextAlignment = ContentAlignment.MiddleRight; longPos.SortType = SortTypes.InsertionSort; GTLColumn shortPos = new GTLColumn(); shortPos.CheckBoxes = false; shortPos.ImageIndex = -1; shortPos.Name = "shortPos"; shortPos.Text = "Short Pos"; shortPos.TextAlignment = ContentAlignment.MiddleRight; shortPos.SortType = SortTypes.InsertionSort; GTLColumn closedPos = new GTLColumn(); closedPos.CheckBoxes = false; closedPos.ImageIndex = -1; closedPos.Name = "closedPos"; closedPos.Text = "Closed Pos"; closedPos.TextAlignment = ContentAlignment.MiddleRight; closedPos.SortType = SortTypes.InsertionSort; GTLColumn avgOpenPrc = new GTLColumn(); avgOpenPrc.CheckBoxes = false; avgOpenPrc.ImageIndex = -1; avgOpenPrc.Name = "avgOpenPrc"; avgOpenPrc.Text = "Open Prc"; avgOpenPrc.TextAlignment = ContentAlignment.MiddleRight; avgOpenPrc.SortType = SortTypes.InsertionSort; GTLColumn lastPrc = new GTLColumn(); lastPrc.CheckBoxes = false; lastPrc.ImageIndex = -1; lastPrc.Name = "lastPrc"; lastPrc.Text = "Last Prc"; lastPrc.TextAlignment = ContentAlignment.MiddleRight; lastPrc.SortType = SortTypes.InsertionSort; data.Columns.AddRange( new GTLColumn [] { accountName, accountId, investmentSystemId, instrumentId, instrumentName, totalPctPL, totalPL, openPL, closedPL, longPos, shortPos, closedPos, avgOpenPrc, lastPrc }); this.Controls.AddRange(new Control [] { data }); }
private void InitializeComponents() { Label headerLabel = new Label(); headerLabel.Location = new System.Drawing.Point(10, 10); headerLabel.Name = "headerLabel"; headerLabel.Size = new System.Drawing.Size(360, 20); headerLabel.TabIndex = 3; headerLabel.Text = "Create Order:"; headerLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; headerLabel.Font = new System.Drawing.Font( "Tahoma", 10.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); buyButton.Size = new System.Drawing.Size(84, 26); buyButton.Text = "BUY"; buyButton.TabIndex = 1; buyButton.TabStop = true; buyButton.Location = new System.Drawing.Point(180, 10); buyButton.Click += new EventHandler(FireExecuteButton); buyButton.Anchor = AnchorStyles.Right; buyButton.Enabled = false; sellButton.Size = new System.Drawing.Size(84, 26); sellButton.Text = "SELL"; sellButton.TabIndex = 1; sellButton.TabStop = true; sellButton.Location = new System.Drawing.Point(270, 10); sellButton.Click += new EventHandler(FireExecuteButton); sellButton.Anchor = AnchorStyles.Right; sellButton.Enabled = false; Button cancel = new Button(); cancel.Text = "Cancel"; cancel.Size = new System.Drawing.Size(84, 26); cancel.Location = new System.Drawing.Point(360, 10); cancel.Click += new EventHandler(FireCancelButton); cancel.Anchor = AnchorStyles.Right; // // Release to FIX // releaseToFixCheckBox.Text = "Release to FIX"; releaseToFixCheckBox.AutoSize = true; releaseToFixCheckBox.Location = new System.Drawing.Point(60, 16); releaseToFixCheckBox.Name = "releaseToFix"; releaseToFixCheckBox.Anchor = AnchorStyles.Right; releaseToFixCheckBox.Checked = false; // // Strategy List // strategies.BackColor = System.Drawing.SystemColors.Window; strategies.BackgroundStretchToFit = true; strategies.Dock = System.Windows.Forms.DockStyle.Fill; strategies.ItemHeight = 19; strategies.Location = new System.Drawing.Point(10, 80); strategies.MultiSelect = true; strategies.ShowPlusMinus = false; strategies.HotColumnTracking = false; strategies.HotNodeTracking = false; strategies.SnapLastColumn = true; strategies.AlternateBackground = Color.AliceBlue; strategies.ShowRootLines = false; strategies.ShowFocusRect = true; strategies.FastFind = true; strategies.AlternatingColors = false; strategies.Name = "accounts"; strategies.OptimizeForHighNodeCount = false; strategies.HotTrackingColor = SystemColors.HotTrack; strategies.SelectedTextColor = SystemColors.HighlightText; strategies.SelectionColor = SystemColors.Highlight; strategies.UnfocusedSelectionColor = SystemColors.Highlight; strategies.ControlStyle = GTLControlStyles.XP; strategies.Font = new System.Drawing.Font("Tahoma", 9.25F); GTLColumn strategy_name = new GTLColumn(); strategy_name.BackColor = Color.White; strategy_name.CheckBoxes = false; strategy_name.ImageIndex = -1; strategy_name.Name = "strategy_name"; strategy_name.Text = "Strategy Name"; strategy_name.Width = 475; strategy_name.SortType = SortTypes.None; GTLColumn strategy_qty = new GTLColumn(); strategy_qty.BackColor = Color.White; strategy_qty.CheckBoxes = false; strategy_qty.ImageIndex = -1; strategy_qty.Name = "strategy_qty"; strategy_qty.Text = "Signal Size"; strategy_qty.Width = 125; strategy_qty.TextAlignment = ContentAlignment.MiddleRight; strategy_qty.EmbeddedDisplayConditions = GEmbeddedDisplayConditions.SingleClick; strategy_qty.EmbeddedControlType = GEmbeddedControlTypes.TextBox; strategy_qty.SortType = SortTypes.None; strategies.Columns.AddRange( new GTLColumn [] { strategy_name, strategy_qty }); // // Account List // accounts.BackColor = System.Drawing.SystemColors.Window; accounts.BackgroundStretchToFit = true; accounts.Dock = System.Windows.Forms.DockStyle.Fill; accounts.ItemHeight = 19; accounts.Location = new System.Drawing.Point(10, 80); accounts.MultiSelect = true; accounts.ShowPlusMinus = false; accounts.HotColumnTracking = false; accounts.HotNodeTracking = false; accounts.SnapLastColumn = true; accounts.AlternateBackground = Color.AliceBlue; accounts.ShowRootLines = false; accounts.ShowFocusRect = true; accounts.FastFind = true; accounts.AlternatingColors = false; accounts.Name = "accounts"; accounts.OptimizeForHighNodeCount = false; accounts.HotTrackingColor = SystemColors.HotTrack; accounts.SelectedTextColor = SystemColors.HighlightText; accounts.SelectionColor = SystemColors.Highlight; accounts.UnfocusedSelectionColor = SystemColors.Highlight; accounts.ControlStyle = GTLControlStyles.XP; accounts.Font = new System.Drawing.Font("Tahoma", 9.25F); GTLColumn account_name = new GTLColumn(); account_name.BackColor = Color.White; account_name.CheckBoxes = false; account_name.ImageIndex = -1; account_name.Name = "account_name"; account_name.Text = "Account Name"; account_name.Width = 475; account_name.SortType = SortTypes.None; GTLColumn allocation_qty = new GTLColumn(); allocation_qty.BackColor = Color.White; allocation_qty.CheckBoxes = false; allocation_qty.ImageIndex = -1; allocation_qty.Name = "allocation_qty"; allocation_qty.Text = "Allocation Qty"; allocation_qty.Width = 125; allocation_qty.TextAlignment = ContentAlignment.MiddleRight; allocation_qty.EmbeddedDisplayConditions = GEmbeddedDisplayConditions.SingleClick; allocation_qty.EmbeddedControlType = GEmbeddedControlTypes.TextBox; allocation_qty.SortType = SortTypes.None; accounts.Columns.AddRange( new GTLColumn [] { account_name, allocation_qty }); // // Context Menu // strategies.ContextMenu = new ContextMenu(); strategies.ContextMenu.MenuItems.AddRange(new MenuItem [] { new MenuItem("Clear...", new EventHandler(FireClear)) }); // // Disable until instrument selected // accounts.Enabled = false; strategies.Enabled = false; // // Tab Pages // TabPage strategyPage = new TabPage(); strategyPage.Text = "Strategies"; strategyPage.Dock = DockStyle.Fill; strategyPage.Controls.Add(strategies); TabPage accountPage = new TabPage(); accountPage.Text = "Accounts"; accountPage.Dock = DockStyle.Fill; accountPage.Controls.Add(accounts); tabControl.Dock = DockStyle.Fill; tabControl.Size = new System.Drawing.Size(200, 40); tabControl.Name = "tabControl"; tabControl.Controls.AddRange(new Control [] { strategyPage, accountPage }); // // Investment system button drop down // investmentSystemButtonDropDown = new ContextMenuStrip(new System.ComponentModel.Container()); investmentSystemButtonDropDown.Name = "investmentSystemButtonDropDown"; investmentSystemButtonDropDown.Size = new System.Drawing.Size(189, 76); // // Investment system button // investmentSystemButton = new SplitButton(); investmentSystemButton.AutoSize = true; investmentSystemButton.AlwaysDropDown = true; investmentSystemButton.Location = new System.Drawing.Point(10, 40); investmentSystemButton.ClickedImage = "SplitButtonClickedImage.gif"; investmentSystemButton.ContextMenuStrip = investmentSystemButtonDropDown; investmentSystemButton.DisabledImage = "SplitButtonDisabledImage.gif"; investmentSystemButton.HoverImage = "SplitButtonHoverImage.gif"; investmentSystemButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; investmentSystemButton.ImageKey = "SplitButtonImage.gif"; investmentSystemButton.Name = "investmentSystemButton"; investmentSystemButton.NormalImage = "SplitButtonImage.gif"; investmentSystemButton.Size = new System.Drawing.Size(250, 26); investmentSystemButton.TabIndex = 0; investmentSystemButton.Text = "Investment System..."; investmentSystemButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; investmentSystemButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; investmentSystemButton.UseVisualStyleBackColor = true; // // Symbol button drop down // symbolButtonDropDown = new ContextMenuStrip(new System.ComponentModel.Container()); symbolButtonDropDown.Name = "instrumentButtonDropDown"; symbolButtonDropDown.Size = new System.Drawing.Size(189, 76); // // Symbol button // symbolButton = new SplitButton(); symbolButton.AutoSize = true; symbolButton.AlwaysDropDown = true; symbolButton.Location = new System.Drawing.Point(10, 74); symbolButton.ClickedImage = "SplitButtonClickedImage.gif"; symbolButton.ContextMenuStrip = symbolButtonDropDown; symbolButton.DisabledImage = "SplitButtonDisabledImage.gif"; symbolButton.HoverImage = "SplitButtonHoverImage.gif"; symbolButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; symbolButton.ImageKey = "SplitButtonImage.gif"; symbolButton.Name = "symbolButton"; symbolButton.NormalImage = "SplitButtonImage.gif"; symbolButton.Size = new System.Drawing.Size(250, 26); symbolButton.TabIndex = 0; symbolButton.Text = "Symbol..."; symbolButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; symbolButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; symbolButton.UseVisualStyleBackColor = true; // // Instrument button drop down // instrumentButtonDropDown = new ContextMenuStrip(new System.ComponentModel.Container()); instrumentButtonDropDown.Name = "instrumentButtonDropDown"; instrumentButtonDropDown.Size = new System.Drawing.Size(189, 76); // // Instrument button // instrumentButton = new SplitButton(); instrumentButton.AutoSize = true; instrumentButton.AlwaysDropDown = true; instrumentButton.Location = new System.Drawing.Point(10, 108); instrumentButton.ClickedImage = "SplitButtonClickedImage.gif"; instrumentButton.ContextMenuStrip = instrumentButtonDropDown; instrumentButton.DisabledImage = "SplitButtonDisabledImage.gif"; instrumentButton.HoverImage = "SplitButtonHoverImage.gif"; instrumentButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; instrumentButton.ImageKey = "SplitButtonImage.gif"; instrumentButton.Name = "instrumentButton"; instrumentButton.NormalImage = "SplitButtonImage.gif"; instrumentButton.Size = new System.Drawing.Size(250, 26); instrumentButton.TabIndex = 0; instrumentButton.Text = "Instrument..."; instrumentButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; instrumentButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; instrumentButton.UseVisualStyleBackColor = true; // // Stop price // Label stopPriceLabel = new Label(); stopPriceLabel.AutoSize = true; stopPriceLabel.Location = new System.Drawing.Point(280, 52); stopPriceLabel.Name = "stopPriceLabel"; stopPriceLabel.Text = "Stop Price:"; stopPriceLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; stopPriceTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; stopPriceTextBox.Name = "stopPriceTextBox"; stopPriceTextBox.Size = new System.Drawing.Size(80, 22); stopPriceTextBox.Location = new System.Drawing.Point(280, 76); stopPriceTextBox.TextAlign = HorizontalAlignment.Right; stopPriceTextBox.TabIndex = 6; stopPriceTextBox.MaxLength = 8; stopPriceTextBox.Text = ""; stopPriceTextBox.Enabled = false; // // Limit price // Label limitPriceLabel = new Label(); limitPriceLabel.AutoSize = true; limitPriceLabel.Location = new System.Drawing.Point(370, 52); limitPriceLabel.Name = "limitPriceLabel"; limitPriceLabel.Text = "Limit Price:"; limitPriceLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; limitPriceTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; limitPriceTextBox.Name = "limitPriceTextBox"; limitPriceTextBox.Size = new System.Drawing.Size(80, 22); limitPriceTextBox.Location = new System.Drawing.Point(370, 76); limitPriceTextBox.TextAlign = HorizontalAlignment.Right; limitPriceTextBox.TabIndex = 6; limitPriceTextBox.MaxLength = 8; limitPriceTextBox.Text = ""; limitPriceTextBox.Enabled = false; // // TIF // Label tifLabel = new Label(); tifLabel.AutoSize = true; tifLabel.Location = new System.Drawing.Point(460, 52); tifLabel.Name = "tifLabel"; tifLabel.Text = "TIF:"; tifLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; tifComboBox.Name = "tifComboBox"; tifComboBox.DropDownStyle = ComboBoxStyle.DropDownList; tifComboBox.Size = new System.Drawing.Size(60, 22); tifComboBox.Location = new System.Drawing.Point(460, 76); tifComboBox.Items.AddRange(new object [] { "DAY", "GTC" }); tifComboBox.SelectedIndex = 0; // // Order Type -- note that Globex doesn't support MOC orders, so // until we have a way of differentiating order type by instrument, // we're not going to include this order type in the dropdown. // Label orderTypeLabel = new Label(); orderTypeLabel.AutoSize = true; orderTypeLabel.Location = new System.Drawing.Point(530, 52); orderTypeLabel.Name = "orderTypeLabel"; orderTypeLabel.Text = "Order Type:"; orderTypeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; orderTypeComboBox.Name = "orderTypeComboBox"; orderTypeComboBox.DropDownStyle = ComboBoxStyle.DropDownList; orderTypeComboBox.Size = new System.Drawing.Size(90, 22); orderTypeComboBox.Location = new System.Drawing.Point(530, 76); //orderTypeComboBox.Items.AddRange( new object [] { "MARKET", "LIMIT", "STOP", "STOP LIMIT", "MKT ON CLOSE" } ); orderTypeComboBox.Items.AddRange(new object [] { "MARKET", "LIMIT", "STOP", "STOP LIMIT" }); orderTypeComboBox.SelectedIndex = 0; // // Form panels // mainPanel = new Panel(); mainPanel.BackColor = System.Drawing.SystemColors.Window; mainPanel.Dock = System.Windows.Forms.DockStyle.Fill; mainPanel.Name = "mainPanel"; mainPanel.Size = new System.Drawing.Size(460, 360); mainPanel.Controls.AddRange(new Control [] { tabControl }); headerPanel = new Panel(); headerPanel.BackColor = System.Drawing.SystemColors.Window; headerPanel.Dock = System.Windows.Forms.DockStyle.Top; headerPanel.Name = "headerPanel"; headerPanel.Size = new System.Drawing.Size(460, 150); headerPanel.TabIndex = 8; headerPanel.Controls.AddRange(new Control[] { headerLabel, investmentSystemButton, symbolButton, instrumentButton, stopPriceLabel, stopPriceTextBox, limitPriceLabel, limitPriceTextBox, tifLabel, tifComboBox, orderTypeLabel, orderTypeComboBox }); buttonPanel = new Panel(); buttonPanel.BackColor = System.Drawing.SystemColors.Control; buttonPanel.Dock = System.Windows.Forms.DockStyle.Bottom; buttonPanel.Name = "buttonPanel"; buttonPanel.Size = new System.Drawing.Size(460, 50); buttonPanel.Controls.AddRange(new Control[] { releaseToFixCheckBox, buyButton, sellButton, cancel }); this.Controls.AddRange(new Control [] { mainPanel, headerPanel, buttonPanel }); }
private void InitializeComponents() { // // Account List // accounts = new GlacialTreeList("0DAA8D90BB9ACC06C6FDDF11F7DD73E8"); accounts.BackColor = System.Drawing.SystemColors.Window; accounts.BackgroundStretchToFit = true; accounts.Dock = System.Windows.Forms.DockStyle.Fill; accounts.ItemHeight = 19; accounts.Location = new System.Drawing.Point(10, 80); accounts.MultiSelect = false; accounts.ShowPlusMinus = false; accounts.HotColumnTracking = false; accounts.HotNodeTracking = false; accounts.SnapLastColumn = true; accounts.AlternateBackground = Color.AliceBlue; accounts.ShowRootLines = false; accounts.ShowFocusRect = true; accounts.FastFind = true; accounts.AlternatingColors = false; accounts.Name = "accounts"; accounts.OptimizeForHighNodeCount = false; accounts.HotTrackingColor = SystemColors.HotTrack; accounts.SelectedTextColor = SystemColors.HighlightText; accounts.SelectionColor = SystemColors.Highlight; accounts.UnfocusedSelectionColor = SystemColors.Highlight; accounts.ControlStyle = GTLControlStyles.XP; accounts.Font = new System.Drawing.Font("Tahoma", 9.25F); // // account list columns // GTLColumn account_name = new GTLColumn(); account_name.BackColor = Color.White; account_name.CheckBoxes = false; account_name.ImageIndex = -1; account_name.Name = "account_name"; account_name.Text = "Account"; account_name.Width = 132; account_name.SortType = SortTypes.InsertionSort; GTLColumn notional_pl = new GTLColumn(); notional_pl.BackColor = Color.White; notional_pl.CheckBoxes = false; notional_pl.ImageIndex = -1; notional_pl.Name = "notional_pl"; notional_pl.Text = "PL"; notional_pl.Width = 100; notional_pl.TextAlignment = ContentAlignment.MiddleRight; notional_pl.SortType = SortTypes.InsertionSort; accounts.Columns.AddRange(new GTLColumn [] { account_name, notional_pl }); // // Send to FIX checkbox // sendToFix = new CheckBox(); sendToFix.AutoSize = true; sendToFix.CausesValidation = false; sendToFix.Checked = false; sendToFix.Text = "Release to FIX Engine"; sendToFix.Location = new System.Drawing.Point(10, 24); sendToFix.Click += new EventHandler(FireSendToFixChanged); // // flatten menu-items // toolStripMenuItem = new ToolStripMenuItem(); toolStripMenuItem.Name = "ALL"; toolStripMenuItem.Size = new System.Drawing.Size(188, 22); toolStripMenuItem.Text = "Flatten ALL Open Positions"; //toolStripMenuItem.Click += new EventHandler( FireFlattenAccount ); // // toolStripSeparator // toolStripSeparator = new ToolStripSeparator(); toolStripSeparator.Name = "toolStripSeparator"; toolStripSeparator.Size = new System.Drawing.Size(185, 6); System.ComponentModel.IContainer components = new System.ComponentModel.Container(); splitButtonDropDown = new ContextMenuStrip(components); splitButtonDropDown.Name = "splitButtonDropDown"; splitButtonDropDown.Size = new System.Drawing.Size(189, 76); // // Split button // splitButton = new SplitButton(); splitButton.Enabled = sendToFix.Checked; splitButton.AutoSize = true; splitButton.AlwaysDropDown = true; splitButton.Location = new System.Drawing.Point(10, 52); splitButton.ClickedImage = "SplitButtonClickedImage.gif"; splitButton.ContextMenuStrip = splitButtonDropDown; splitButton.DisabledImage = "SplitButtonDisabledImage.gif"; splitButton.HoverImage = "SplitButtonHoverImage.gif"; splitButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; splitButton.ImageKey = "SplitButtonImage.gif"; splitButton.Name = "splitButton"; splitButton.NormalImage = "SplitButtonImage.gif"; splitButton.Size = new System.Drawing.Size(125, 26); splitButton.TabIndex = 0; splitButton.Text = "Flatten Positions"; splitButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; splitButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; splitButton.UseVisualStyleBackColor = true; GroupBox statusGroupBox = new GroupBox(); statusGroupBox.Dock = DockStyle.Top; statusGroupBox.AutoSize = true; statusGroupBox.FlatStyle = FlatStyle.Standard; statusGroupBox.Text = "Dealing Status"; statusGroupBox.Controls.AddRange(new Control [] { sendToFix, splitButton }); Panel spacer1 = new Panel(); spacer1.Size = new System.Drawing.Size(125, 12); spacer1.Dock = DockStyle.Top; Panel spacer2 = new Panel(); spacer2.Size = new System.Drawing.Size(125, 12); spacer2.Dock = DockStyle.Top; this.Controls.AddRange(new Control[] { accounts, spacer1, statusGroupBox }); }
private void InitializeComponents() { // // Tree List // data = ControlHelper.NewGlacialTreeList("ReleaseListData"); data.MultiSelect = true; data.BeforeCellEdit += new GTLEmbeddedControlEventHandler(FireBeforeCellEdit); data.AfterCellEdit += new GTLEmbeddedControlEventHandler(FireAfterCellEdit); // // Tree List columns // GTLColumn release_id = new GTLColumn(); release_id.BackColor = Color.White; release_id.CheckBoxes = false; release_id.ImageIndex = -1; release_id.Name = DatabaseObject.RELEASE_ID; release_id.Text = "Release ID"; release_id.SortType = SortTypes.InsertionSort; release_id.ItemComparerType = ItemComparerTypes.Custom; release_id.ComparerHelper = new CompareById("R"); release_id.SortDirection = GSortDirectionTypes.Descending; GTLColumn order_id = new GTLColumn(); order_id.BackColor = Color.White; order_id.CheckBoxes = false; order_id.ImageIndex = -1; order_id.Name = DatabaseObject.ORDER_ID; order_id.Text = "Order ID"; order_id.SortType = SortTypes.InsertionSort; GTLColumn investment_system_id = new GTLColumn(); investment_system_id.BackColor = Color.White; investment_system_id.CheckBoxes = false; investment_system_id.ImageIndex = -1; investment_system_id.Name = DatabaseObject.INVESTMENT_SYSTEM_ID; investment_system_id.Text = "InvSys ID"; investment_system_id.SortType = SortTypes.InsertionSort; investment_system_id.Visible = false; GTLColumn instrument_id = new GTLColumn(); instrument_id.BackColor = Color.White; instrument_id.CheckBoxes = false; instrument_id.ImageIndex = -1; instrument_id.Name = DatabaseObject.INSTRUMENT_ID; instrument_id.Text = "Instrument ID"; instrument_id.SortType = SortTypes.InsertionSort; instrument_id.Visible = false; GTLColumn account_name = new GTLColumn(); account_name.BackColor = Color.White; account_name.CheckBoxes = false; account_name.ImageIndex = -1; account_name.Name = "account_name"; account_name.Text = "Account Name"; account_name.SortType = SortTypes.InsertionSort; GTLColumn instrument_name = new GTLColumn(); instrument_name.BackColor = Color.White; instrument_name.CheckBoxes = false; instrument_name.ImageIndex = -1; instrument_name.Name = "instrument_name"; instrument_name.Text = "Instrument Name"; instrument_name.SortType = SortTypes.InsertionSort; instrument_name.Width = 220; GTLColumn symbol = new GTLColumn(); symbol.BackColor = Color.White; symbol.CheckBoxes = false; symbol.ImageIndex = -1; symbol.Name = DatabaseObject.SYMBOL; symbol.Text = "Symbol"; symbol.SortType = SortTypes.InsertionSort; GTLColumn client_order_id = new GTLColumn(); client_order_id.BackColor = Color.White; client_order_id.CheckBoxes = false; client_order_id.ImageIndex = -1; client_order_id.Name = DatabaseObject.CLIENT_ORDER_ID; client_order_id.Text = "Client Order ID"; client_order_id.SortType = SortTypes.InsertionSort; GTLColumn session_id = new GTLColumn(); session_id.BackColor = Color.White; session_id.CheckBoxes = false; session_id.ImageIndex = -1; session_id.Name = DatabaseObject.SESSION_ID; session_id.Text = "Session ID"; session_id.SortType = SortTypes.InsertionSort; GTLColumn counterparty_order_id = new GTLColumn(); counterparty_order_id.BackColor = Color.White; counterparty_order_id.CheckBoxes = false; counterparty_order_id.ImageIndex = -1; counterparty_order_id.Name = DatabaseObject.COUNTERPARTY_ORDER_ID; counterparty_order_id.Text = "Cpty Order ID"; counterparty_order_id.SortType = SortTypes.InsertionSort; GTLColumn release_status = new GTLColumn(); release_status.BackColor = Color.White; release_status.CheckBoxes = false; release_status.ImageIndex = -1; release_status.Name = DatabaseObject.RELEASE_STATUS; release_status.Text = "Release Status"; release_status.SortType = SortTypes.InsertionSort; GTLColumn release_type = new GTLColumn(); release_type.BackColor = Color.White; release_type.CheckBoxes = false; release_type.ImageIndex = -1; release_type.Name = DatabaseObject.RELEASE_TYPE; release_type.Text = "Release Type"; release_type.SortType = SortTypes.InsertionSort; GTLColumn release_qty = new GTLColumn(); release_qty.CheckBoxes = false; release_qty.ImageIndex = -1; release_qty.Name = DatabaseObject.RELEASE_QTY; release_qty.Text = "Release Qty"; release_qty.TextAlignment = ContentAlignment.MiddleRight; release_qty.SortType = SortTypes.InsertionSort; //release_qty.EmbeddedDisplayConditions = GEmbeddedDisplayConditions.DoubleClick; //release_qty.EmbeddedControlType = GEmbeddedControlTypes.TextBox; GTLColumn limit_prc = new GTLColumn(); limit_prc.CheckBoxes = false; limit_prc.ImageIndex = -1; limit_prc.Name = DatabaseObject.LIMIT_PRC; limit_prc.Text = "Limit Prc"; limit_prc.TextAlignment = ContentAlignment.MiddleRight; limit_prc.SortType = SortTypes.InsertionSort; limit_prc.EmbeddedDisplayConditions = GEmbeddedDisplayConditions.DoubleClick; limit_prc.EmbeddedControlType = GEmbeddedControlTypes.TextBox; GTLColumn stop_prc = new GTLColumn(); stop_prc.CheckBoxes = false; stop_prc.ImageIndex = -1; stop_prc.Name = DatabaseObject.STOP_PRC; stop_prc.Text = "Stop Prc"; stop_prc.TextAlignment = ContentAlignment.MiddleRight; stop_prc.SortType = SortTypes.InsertionSort; stop_prc.EmbeddedDisplayConditions = GEmbeddedDisplayConditions.DoubleClick; stop_prc.EmbeddedControlType = GEmbeddedControlTypes.TextBox; GTLColumn average_prc = new GTLColumn(); average_prc.CheckBoxes = false; average_prc.ImageIndex = -1; average_prc.Name = DatabaseObject.AVERAGE_PRC; average_prc.Text = "Average Prc"; average_prc.TextAlignment = ContentAlignment.MiddleRight; average_prc.SortType = SortTypes.InsertionSort; GTLColumn executed_val = new GTLColumn(); executed_val.CheckBoxes = false; executed_val.ImageIndex = -1; executed_val.Name = DatabaseObject.EXECUTED_VAL; executed_val.Text = "Executed Val"; executed_val.TextAlignment = ContentAlignment.MiddleRight; executed_val.SortType = SortTypes.InsertionSort; GTLColumn executed_qty = new GTLColumn(); executed_qty.CheckBoxes = false; executed_qty.ImageIndex = -1; executed_qty.Name = DatabaseObject.EXECUTED_QTY; executed_qty.Text = "Executed Qty"; executed_qty.TextAlignment = ContentAlignment.MiddleRight; executed_qty.SortType = SortTypes.InsertionSort; GTLColumn added_datetime = new GTLColumn(); added_datetime.CheckBoxes = false; added_datetime.ImageIndex = -1; added_datetime.Name = DatabaseObject.ADDED_DATETIME; added_datetime.Text = "Added Datetime"; added_datetime.TextAlignment = ContentAlignment.MiddleRight; added_datetime.SortType = SortTypes.InsertionSort; added_datetime.SortDirection = GSortDirectionTypes.Descending; GTLColumn added_by = new GTLColumn(); added_by.CheckBoxes = false; added_by.ImageIndex = -1; added_by.Name = DatabaseObject.ADDED_BY; added_by.Text = "Added By"; added_by.SortType = SortTypes.InsertionSort; GTLColumn updated_datetime = new GTLColumn(); updated_datetime.CheckBoxes = false; updated_datetime.ImageIndex = -1; updated_datetime.Name = DatabaseObject.UPDATED_DATETIME; updated_datetime.Text = "Updated Datetime"; updated_datetime.TextAlignment = ContentAlignment.MiddleRight; updated_datetime.SortType = SortTypes.InsertionSort; GTLColumn updated_by = new GTLColumn(); updated_by.CheckBoxes = false; updated_by.ImageIndex = -1; updated_by.Name = DatabaseObject.UPDATED_BY; updated_by.Text = "Updated By"; updated_by.SortType = SortTypes.InsertionSort; data.Columns.AddRange( new GTLColumn [] { release_id, release_status, release_type, order_id, investment_system_id, instrument_id, account_name, instrument_name, symbol, client_order_id, session_id, counterparty_order_id, release_qty, executed_qty, limit_prc, stop_prc, average_prc, executed_val, added_datetime, added_by, updated_datetime, updated_by }); // // Context Menu // ContextMenu ctxMenu = new ContextMenu(); // // First, build the actions that you can do // MenuItem cancel = new MenuItem("CANCEL RELEASE", new EventHandler(FireCancelRelease)); // // Now build the columns, skipping the first // MenuItem columnItems = new MenuItem("Show Column..."); for (int i = 1; i < data.Columns.Count; i++) { GTLColumn col = data.Columns[i]; MenuItem item = new MenuItem(col.Text, new EventHandler(FireShowColumn)); item.Checked = col.Visible; columnItems.MenuItems.Add(item); } ctxMenu.MenuItems.AddRange(new MenuItem [] { cancel, new MenuItem("-"), columnItems }); data.ContextMenu = ctxMenu; this.Controls.AddRange(new Control [] { data }); }
private void FireAfterCellEdit(object source, GTLEmbeddedControlEventArgs args) { args.Cancel = true; GTLTreeNode node = args.TreeNode; GTLColumn col = data.Columns[args.Column]; if (!controller.Cache.HasRelease(node.Tag)) { MessageBox.Show("Unknown release: " + node.Tag); data.ClearSelection(); return; } string release_type = node.SubItems[DatabaseObject.RELEASE_TYPE].Text; if (col.Name.Equals(DatabaseObject.LIMIT_PRC) && (release_type.Equals("LIMIT") || release_type.Equals("STOP_LIMIT"))) { // // Get the current release // Release release = controller.Cache.GetRelease(node.Tag); TextBox tb = (TextBox)args.Control; // // Ensure something changed... // double old_limit_prc = release.ToDouble(DatabaseObject.LIMIT_PRC); try { // // Test for a valid number // double limit_prc = Double.Parse(tb.Text); // // Ensure new limit price is >= 0 and != old limit price // if (limit_prc >= 0 && limit_prc != old_limit_prc) { controller.SendRpc( new CancelReplaceRelease( release.Id, release[DatabaseObject.STOP_PRC], Convert.ToString(limit_prc))); } } catch (Exception) { MessageBox.Show( " Invalid Limit Price: " + tb.Text, "REPLACE RELEASE Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } data.ClearSelection(); } if (col.Name.Equals(DatabaseObject.STOP_PRC) && (release_type.Equals("STOP") || release_type.Equals("STOP_LIMIT"))) { // // Get the current release // Release release = controller.Cache.GetRelease(node.Tag); TextBox tb = (TextBox)args.Control; // // Ensure something changed... // double old_stop_prc = release.ToDouble(DatabaseObject.STOP_PRC); try { // // Test for a valid number // double stop_prc = Double.Parse(tb.Text); // // Ensure new limit price is >= 0 and != old limit price // if (stop_prc >= 0 && stop_prc != old_stop_prc) { controller.SendRpc( new CancelReplaceRelease( release.Id, Convert.ToString(stop_prc), release[DatabaseObject.LIMIT_PRC])); } } catch (Exception) { MessageBox.Show( " Invalid Stop Price: " + tb.Text, "REPLACE RELEASE Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } data.ClearSelection(); } }
private void InitializeComponents() { // // Tree List // data = ControlHelper.NewGlacialTreeList("ExecutionListData"); // // Tree List columns // GTLColumn execution_id = new GTLColumn(); execution_id.BackColor = Color.White; execution_id.CheckBoxes = false; execution_id.ImageIndex = -1; execution_id.Name = DatabaseObject.EXECUTION_ID; execution_id.Text = "Execution ID"; execution_id.SortType = SortTypes.InsertionSort; execution_id.ItemComparerType = ItemComparerTypes.Custom; execution_id.ComparerHelper = new CompareById("E"); execution_id.SortDirection = GSortDirectionTypes.Descending; GTLColumn order_id = new GTLColumn(); order_id.BackColor = Color.White; order_id.CheckBoxes = false; order_id.ImageIndex = -1; order_id.Name = DatabaseObject.ORDER_ID; order_id.Text = "Order ID"; order_id.SortType = SortTypes.InsertionSort; GTLColumn release_id = new GTLColumn(); release_id.BackColor = Color.White; release_id.CheckBoxes = false; release_id.ImageIndex = -1; release_id.Name = DatabaseObject.RELEASE_ID; release_id.Text = "Release ID"; release_id.SortType = SortTypes.InsertionSort; GTLColumn investment_system_id = new GTLColumn(); investment_system_id.BackColor = Color.White; investment_system_id.CheckBoxes = false; investment_system_id.ImageIndex = -1; investment_system_id.Name = DatabaseObject.INVESTMENT_SYSTEM_ID; investment_system_id.Text = "InvSys ID"; investment_system_id.SortType = SortTypes.InsertionSort; GTLColumn instrument_id = new GTLColumn(); instrument_id.BackColor = Color.White; instrument_id.CheckBoxes = false; instrument_id.ImageIndex = -1; instrument_id.Name = DatabaseObject.INSTRUMENT_ID; instrument_id.Text = "Instrument ID"; instrument_id.SortType = SortTypes.InsertionSort; GTLColumn account_name = new GTLColumn(); account_name.BackColor = Color.White; account_name.CheckBoxes = false; account_name.ImageIndex = -1; account_name.Name = "account_name"; account_name.Text = "Account Name"; account_name.SortType = SortTypes.InsertionSort; GTLColumn instrument_name = new GTLColumn(); instrument_name.BackColor = Color.White; instrument_name.CheckBoxes = false; instrument_name.ImageIndex = -1; instrument_name.Name = "instrument_name"; instrument_name.Text = "Instrument Name"; instrument_name.SortType = SortTypes.InsertionSort; GTLColumn symbol = new GTLColumn(); symbol.BackColor = Color.White; symbol.CheckBoxes = false; symbol.ImageIndex = -1; symbol.Name = DatabaseObject.SYMBOL; symbol.Text = "Symbol"; symbol.SortType = SortTypes.InsertionSort; GTLColumn client_order_id = new GTLColumn(); client_order_id.BackColor = Color.White; client_order_id.CheckBoxes = false; client_order_id.ImageIndex = -1; client_order_id.Name = DatabaseObject.CLIENT_ORDER_ID; client_order_id.Text = "Client Order ID"; client_order_id.SortType = SortTypes.InsertionSort; GTLColumn session_id = new GTLColumn(); session_id.BackColor = Color.White; session_id.CheckBoxes = false; session_id.ImageIndex = -1; session_id.Name = DatabaseObject.COUNTERPARTY_ID; session_id.Text = "Session ID"; session_id.SortType = SortTypes.InsertionSort; GTLColumn counterparty_execution_id = new GTLColumn(); counterparty_execution_id.BackColor = Color.White; counterparty_execution_id.CheckBoxes = false; counterparty_execution_id.ImageIndex = -1; counterparty_execution_id.Name = DatabaseObject.COUNTERPARTY_EXECUTION_ID; counterparty_execution_id.Text = "Cpty Execution ID"; counterparty_execution_id.SortType = SortTypes.InsertionSort; GTLColumn side_code = new GTLColumn(); side_code.BackColor = Color.White; side_code.CheckBoxes = false; side_code.ImageIndex = -1; side_code.Name = DatabaseObject.SIDE_CODE; side_code.Text = "Side Code"; side_code.SortType = SortTypes.InsertionSort; GTLColumn execution_ccy = new GTLColumn(); execution_ccy.BackColor = Color.White; execution_ccy.CheckBoxes = false; execution_ccy.ImageIndex = -1; execution_ccy.Name = DatabaseObject.EXECUTION_CCY; execution_ccy.Text = "Execution Ccy"; execution_ccy.SortType = SortTypes.InsertionSort; GTLColumn execution_status = new GTLColumn(); execution_status.BackColor = Color.White; execution_status.CheckBoxes = false; execution_status.ImageIndex = -1; execution_status.Name = DatabaseObject.EXECUTION_STATUS; execution_status.Text = "Execution Status"; execution_status.SortType = SortTypes.InsertionSort; GTLColumn execution_prc = new GTLColumn(); execution_prc.CheckBoxes = false; execution_prc.ImageIndex = -1; execution_prc.Name = DatabaseObject.EXECUTION_PRC; execution_prc.Text = "Execution Prc"; execution_prc.TextAlignment = ContentAlignment.MiddleRight; execution_prc.SortType = SortTypes.InsertionSort; GTLColumn execution_qty = new GTLColumn(); execution_qty.CheckBoxes = false; execution_qty.ImageIndex = -1; execution_qty.Name = DatabaseObject.EXECUTION_QTY; execution_qty.Text = "Execution Qty"; execution_qty.TextAlignment = ContentAlignment.MiddleRight; execution_qty.SortType = SortTypes.InsertionSort; GTLColumn execution_val = new GTLColumn(); execution_val.CheckBoxes = false; execution_val.ImageIndex = -1; execution_val.Name = DatabaseObject.EXECUTION_VAL; execution_val.Text = "Execution Val"; execution_val.TextAlignment = ContentAlignment.MiddleRight; execution_val.SortType = SortTypes.InsertionSort; GTLColumn leaves_qty = new GTLColumn(); leaves_qty.CheckBoxes = false; leaves_qty.ImageIndex = -1; leaves_qty.Name = DatabaseObject.LEAVES_QTY; leaves_qty.Text = "Leaves Qty"; leaves_qty.TextAlignment = ContentAlignment.MiddleRight; leaves_qty.SortType = SortTypes.InsertionSort; GTLColumn average_prc = new GTLColumn(); average_prc.CheckBoxes = false; average_prc.ImageIndex = -1; average_prc.Name = DatabaseObject.AVERAGE_PRC; average_prc.Text = "Average Prc"; average_prc.TextAlignment = ContentAlignment.MiddleRight; average_prc.SortType = SortTypes.InsertionSort; GTLColumn added_datetime = new GTLColumn(); added_datetime.CheckBoxes = false; added_datetime.ImageIndex = -1; added_datetime.Name = DatabaseObject.ADDED_DATETIME; added_datetime.Text = "Added Datetime"; added_datetime.TextAlignment = ContentAlignment.MiddleRight; added_datetime.SortType = SortTypes.InsertionSort; added_datetime.SortDirection = GSortDirectionTypes.Descending; GTLColumn added_by = new GTLColumn(); added_by.CheckBoxes = false; added_by.ImageIndex = -1; added_by.Name = DatabaseObject.ADDED_BY; added_by.Text = "Added By"; added_by.TextAlignment = ContentAlignment.MiddleRight; added_by.SortType = SortTypes.InsertionSort; GTLColumn updated_datetime = new GTLColumn(); updated_datetime.CheckBoxes = false; updated_datetime.ImageIndex = -1; updated_datetime.Name = DatabaseObject.UPDATED_DATETIME; updated_datetime.Text = "Updated Datetime"; updated_datetime.TextAlignment = ContentAlignment.MiddleRight; updated_datetime.SortType = SortTypes.InsertionSort; GTLColumn updated_by = new GTLColumn(); updated_by.CheckBoxes = false; updated_by.ImageIndex = -1; updated_by.Name = DatabaseObject.UPDATED_BY; updated_by.Text = "Updated By"; updated_by.TextAlignment = ContentAlignment.MiddleRight; updated_by.SortType = SortTypes.InsertionSort; data.Columns.AddRange( new GTLColumn [] { execution_id, execution_status, order_id, release_id, investment_system_id, instrument_id, account_name, instrument_name, symbol, client_order_id, session_id, counterparty_execution_id, side_code, execution_ccy, execution_prc, execution_qty, execution_val, leaves_qty, average_prc, added_datetime, added_by, updated_datetime, updated_by }); // // Context Menu for blotter creation // ContextMenu ctxMenu = new ContextMenu(); MenuItem create = new MenuItem("CREATE BLOTTER", new EventHandler(FireCreateBlotter)); ctxMenu.MenuItems.AddRange(new MenuItem [] { create }); data.ContextMenu = ctxMenu; this.Controls.AddRange(new Control [] { data }); }
private void InitializeComponents() { // // Tree List // data = ControlHelper.NewGlacialTreeList("AccountLimitListData"); data.AlternatingColors = true; data.BeforeCellEdit += new GTLEmbeddedControlEventHandler(FireBeforeCellEdit); data.AfterCellEdit += new GTLEmbeddedControlEventHandler(FireAfterCellEdit); // // Tree List columns // GTLColumn accountId = new GTLColumn(); accountId.CheckBoxes = false; accountId.ImageIndex = -1; accountId.Name = DatabaseObject.ACCOUNT_ID; accountId.Text = "Account ID"; accountId.SortType = SortTypes.InsertionSort; accountId.Visible = false; GTLColumn symbol = new GTLColumn(); symbol.CheckBoxes = false; symbol.ImageIndex = -1; symbol.Name = DatabaseObject.SYMBOL; symbol.Text = "Symbol"; symbol.SortType = SortTypes.InsertionSort; symbol.Width = 150; GTLColumn securityExchange = new GTLColumn(); securityExchange.CheckBoxes = false; securityExchange.ImageIndex = -1; securityExchange.Name = DatabaseObject.SECURITY_EXCHANGE; securityExchange.Text = "Exchange"; securityExchange.SortType = SortTypes.InsertionSort; securityExchange.Width = 150; GTLColumn fixSessionId = new GTLColumn(); fixSessionId.CheckBoxes = false; fixSessionId.ImageIndex = -1; fixSessionId.Name = DatabaseObject.SESSION_ID; fixSessionId.Text = "FIX Session ID"; fixSessionId.SortType = SortTypes.InsertionSort; fixSessionId.Width = 150; fixSessionId.EmbeddedDisplayConditions = GEmbeddedDisplayConditions.DoubleClick; fixSessionId.EmbeddedControlType = GEmbeddedControlTypes.TextBox; GTLColumn max_open_long_qty = new GTLColumn(); max_open_long_qty.CheckBoxes = false; max_open_long_qty.ImageIndex = -1; max_open_long_qty.Name = DatabaseObject.MAX_OPEN_LONG_QTY; max_open_long_qty.Text = "Max Open Long Qty"; max_open_long_qty.TextAlignment = ContentAlignment.MiddleRight; max_open_long_qty.SortType = SortTypes.InsertionSort; max_open_long_qty.Width = 150; max_open_long_qty.EmbeddedDisplayConditions = GEmbeddedDisplayConditions.DoubleClick; max_open_long_qty.EmbeddedControlType = GEmbeddedControlTypes.TextBox; GTLColumn max_open_short_qty = new GTLColumn(); max_open_short_qty.CheckBoxes = false; max_open_short_qty.ImageIndex = -1; max_open_short_qty.Name = DatabaseObject.MAX_OPEN_SHORT_QTY; max_open_short_qty.Text = "Max Open Short Qty"; max_open_short_qty.TextAlignment = ContentAlignment.MiddleRight; max_open_short_qty.SortType = SortTypes.InsertionSort; max_open_short_qty.Width = 150; max_open_short_qty.EmbeddedDisplayConditions = GEmbeddedDisplayConditions.DoubleClick; max_open_short_qty.EmbeddedControlType = GEmbeddedControlTypes.TextBox; GTLColumn max_release_qty = new GTLColumn(); max_release_qty.CheckBoxes = false; max_release_qty.ImageIndex = -1; max_release_qty.Name = DatabaseObject.MAX_RELEASE_QTY; max_release_qty.Text = "Max Release Qty"; max_release_qty.TextAlignment = ContentAlignment.MiddleRight; max_release_qty.SortType = SortTypes.InsertionSort; max_release_qty.Width = 150; max_release_qty.EmbeddedDisplayConditions = GEmbeddedDisplayConditions.DoubleClick; max_release_qty.EmbeddedControlType = GEmbeddedControlTypes.TextBox; data.Columns.AddRange( new GTLColumn [] { accountId, symbol, securityExchange, fixSessionId, max_open_long_qty, max_open_short_qty, max_release_qty }); this.Controls.AddRange(new Control [] { data }); }
private void FireAfterCellEdit(object source, GTLEmbeddedControlEventArgs args) { args.Cancel = true; ColorSubItem csi = null; GTLTreeNode node = args.TreeNode; GTLColumn col = data.Columns[args.Column]; GTLSubItem sub = node.SubItems[args.Column]; if (col.Name.Equals(DatabaseObject.MAX_OPEN_LONG_QTY) || col.Name.Equals(DatabaseObject.MAX_OPEN_SHORT_QTY) || col.Name.Equals(DatabaseObject.MAX_RELEASE_QTY)) { TextBox tb = (TextBox)args.Control; // // Ensure that the text box value is an integer greater // than or equal to zero. // try { int qty = Int32.Parse(tb.Text); if (qty < 0) { MessageBox.Show( " Invalid Quantity: " + tb.Text, "UPDATE Account Limit Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); data.ClearSelection(); csi = new RedColorSubItem(Color.White, node.SubItems[args.Column], node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; return; } } catch (Exception) { MessageBox.Show( " Invalid Quantity: " + tb.Text, "UPDATE Account Limit Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); data.ClearSelection(); csi = new RedColorSubItem(Color.White, node.SubItems[args.Column], node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; return; } // // Update the account limit // string account_id, symbol, security_exchange, fix_session_id, max_open_long_qty, max_open_short_qty, max_release_qty; account_id = node.SubItems[DatabaseObject.ACCOUNT_ID].Text; symbol = node.SubItems[DatabaseObject.SYMBOL].Text; security_exchange = node.SubItems[DatabaseObject.SECURITY_EXCHANGE].Text; fix_session_id = node.SubItems[DatabaseObject.SESSION_ID].Text; if (col.Name.Equals(DatabaseObject.MAX_OPEN_LONG_QTY)) { max_open_long_qty = tb.Text; max_open_short_qty = node.SubItems[DatabaseObject.MAX_OPEN_SHORT_QTY].Text; max_release_qty = node.SubItems[DatabaseObject.MAX_RELEASE_QTY].Text; } else if (col.Name.Equals(DatabaseObject.MAX_OPEN_SHORT_QTY)) { max_open_long_qty = node.SubItems[DatabaseObject.MAX_OPEN_LONG_QTY].Text; max_open_short_qty = tb.Text; max_release_qty = node.SubItems[DatabaseObject.MAX_RELEASE_QTY].Text; } else { max_open_long_qty = node.SubItems[DatabaseObject.MAX_OPEN_LONG_QTY].Text; max_open_short_qty = node.SubItems[DatabaseObject.MAX_OPEN_SHORT_QTY].Text; max_release_qty = tb.Text; } ClientAdapterResponse response = controller.SendRpc(new UpdateAccountLimit( account_id, symbol, security_exchange, fix_session_id, max_open_long_qty, max_open_short_qty, max_release_qty, "1")); response = controller.SendRpc(new ReloadStaticData( )); csi = new BlueColorSubItem(Color.White, sub, node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; args.Cancel = false; data.ClearSelection(); } if (col.Name.Equals(DatabaseObject.SESSION_ID)) { TextBox tb = (TextBox)args.Control; if ("".Equals(tb.Text)) { MessageBox.Show( " Invalid FIX Session ID", "UPDATE Account Limit Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); data.ClearSelection(); csi = new RedColorSubItem(Color.White, node.SubItems[args.Column], node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; return; } // // Update the account limit // ClientAdapterResponse response = controller.SendRpc(new UpdateAccountLimit( node.SubItems[DatabaseObject.ACCOUNT_ID].Text, node.SubItems[DatabaseObject.SYMBOL].Text, node.SubItems[DatabaseObject.SECURITY_EXCHANGE].Text, tb.Text, node.SubItems[DatabaseObject.MAX_OPEN_LONG_QTY].Text, node.SubItems[DatabaseObject.MAX_OPEN_SHORT_QTY].Text, node.SubItems[DatabaseObject.MAX_RELEASE_QTY].Text, "1")); response = controller.SendRpc(new ReloadStaticData( )); csi = new BlueColorSubItem(Color.White, sub, node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; args.Cancel = false; data.ClearSelection(); } }
private void InitializeComponents() { data.Name = "data"; data.BackColor = System.Drawing.SystemColors.Window; data.BackgroundStretchToFit = true; data.Dock = System.Windows.Forms.DockStyle.Fill; data.ItemHeight = 19; data.Location = new System.Drawing.Point(0, 0); data.MultiSelect = false; data.ShowPlusMinus = false; data.HotColumnTracking = false; data.HotNodeTracking = false; data.SnapLastColumn = true; data.AlternateBackground = Color.AliceBlue; data.UnfocusedSelectionColor = Color.LightGray; data.ShowRootLines = false; data.ShowFocusRect = true; data.FastFind = false; data.AlternatingColors = false; data.OptimizeForHighNodeCount = false; data.HotTrackingColor = SystemColors.HotTrack; data.SelectedTextColor = SystemColors.HighlightText; data.SelectionColor = SystemColors.Highlight; data.ControlStyle = GTLControlStyles.XP; data.Font = new System.Drawing.Font("Tahoma", 9.25F); GTLColumn execution_timestamp = new GTLColumn(); execution_timestamp.BackColor = Color.White; execution_timestamp.CheckBoxes = false; execution_timestamp.ImageIndex = -1; execution_timestamp.Name = "execution_timestamp"; execution_timestamp.Text = "TIMESTAMP"; execution_timestamp.SortType = SortTypes.InsertionSort; execution_timestamp.Visible = true; execution_timestamp.Width = 150; execution_timestamp.TextAlignment = ContentAlignment.MiddleRight; GTLColumn execution_timebar = new GTLColumn(); execution_timebar.BackColor = Color.White; execution_timebar.CheckBoxes = false; execution_timebar.ImageIndex = -1; execution_timebar.Name = "execution_timebar"; execution_timebar.Text = "TIMEBAR"; execution_timebar.SortType = SortTypes.InsertionSort; execution_timebar.Visible = true; execution_timebar.Width = 150; execution_timebar.TextAlignment = ContentAlignment.MiddleRight; GTLColumn side_code = new GTLColumn(); side_code.BackColor = Color.White; side_code.CheckBoxes = false; side_code.ImageIndex = -1; side_code.Name = "side_code"; side_code.Text = "SIDE"; side_code.SortType = SortTypes.InsertionSort; side_code.Visible = true; side_code.Width = 90; side_code.TextAlignment = ContentAlignment.MiddleRight; GTLColumn execution_quantity = new GTLColumn(); execution_quantity.BackColor = Color.White; execution_quantity.CheckBoxes = false; execution_quantity.ImageIndex = -1; execution_quantity.Name = "execution_quantity"; execution_quantity.Text = "QUANTITY"; execution_quantity.SortType = SortTypes.InsertionSort; execution_quantity.Visible = true; execution_quantity.Width = 90; execution_quantity.TextAlignment = ContentAlignment.MiddleRight; GTLColumn execution_price = new GTLColumn(); execution_price.BackColor = Color.White; execution_price.CheckBoxes = false; execution_price.ImageIndex = -1; execution_price.Name = "execution_price"; execution_price.Text = "PRICE"; execution_price.SortType = SortTypes.InsertionSort; execution_price.Visible = true; execution_price.Width = 90; execution_price.TextAlignment = ContentAlignment.MiddleRight; data.Columns.AddRange( new GTLColumn [] { execution_timestamp, execution_timebar, side_code, execution_quantity, execution_price }); Label statusDesc = new Label(); statusDesc = new Label(); statusDesc.ForeColor = Color.Black; statusDesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; statusDesc.Location = new System.Drawing.Point(0, 48); statusDesc.Size = new Size(120, 20); statusDesc.Text = "System Status"; statusLabel = new Label(); statusLabel.ForeColor = Color.Black; statusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; statusLabel.Location = new System.Drawing.Point(0, 12); statusLabel.Size = new Size(120, 40); statusLabel.Text = "INIT"; statusLabel.Font = new System.Drawing.Font("Arial", 12.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); Label openPLDesc = new Label(); openPLDesc.ForeColor = Color.Black; openPLDesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; openPLDesc.Location = new System.Drawing.Point(0, 48); openPLDesc.Size = new Size(120, 20); openPLDesc.Text = "Open PL"; openPLLabel = new Label(); openPLLabel.ForeColor = Color.Black; openPLLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; openPLLabel.Location = new System.Drawing.Point(0, 12); openPLLabel.Size = new Size(120, 40); openPLLabel.Text = "0.00"; openPLLabel.Font = new System.Drawing.Font("Arial", 12.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); Label closedPLDesc = new Label(); closedPLDesc.ForeColor = Color.Black; closedPLDesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; closedPLDesc.Location = new System.Drawing.Point(0, 48); closedPLDesc.Size = new Size(120, 20); closedPLDesc.Text = "Closed PL"; closedPLLabel = new Label(); closedPLLabel.ForeColor = Color.Black; closedPLLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; closedPLLabel.Location = new System.Drawing.Point(0, 12); closedPLLabel.Size = new Size(120, 40); closedPLLabel.Text = "0.00"; closedPLLabel.Font = new System.Drawing.Font("Arial", 12.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); bidaskLabel = new Label(); bidaskLabel.BackColor = System.Drawing.Color.Transparent; bidaskLabel.ForeColor = Color.DarkSlateBlue; bidaskLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; bidaskLabel.Anchor = AnchorStyles.Top | AnchorStyles.Right; bidaskLabel.AutoSize = true; bidaskLabel.Text = "[ ASK , BID ]"; bidaskLabel.Font = new System.Drawing.Font( "Tahoma", 12.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); bidaskPanel = new Panel(); bidaskPanel.BackColor = System.Drawing.SystemColors.Control; bidaskPanel.Anchor = AnchorStyles.Top | AnchorStyles.Right; bidaskPanel.Name = "bidaskPanel"; bidaskPanel.Size = new System.Drawing.Size(400, 30); bidaskPanel.Controls.Add(bidaskLabel); bidaskPanel.Padding = new Padding(0, 6, 2, 0); // // Chart // chartPanel = new ChartPanel(); // // Buttons // pauseButton = new Button(); pauseButton.Size = new System.Drawing.Size(194, 26); pauseButton.Text = "PAUSE INVESTMENT SYSTEM"; pauseButton.TabIndex = 1; pauseButton.TabStop = true; pauseButton.Location = new System.Drawing.Point(60, 24); pauseButton.Click += new EventHandler(FirePauseButton); pauseButton.Anchor = AnchorStyles.Right; pauseButton.Enabled = false; flattenButton = new Button(); flattenButton.Size = new System.Drawing.Size(184, 26); flattenButton.Text = "FLATTEN OPEN POSITIONS"; flattenButton.TabIndex = 1; flattenButton.TabStop = true; flattenButton.Location = new System.Drawing.Point(260, 24); flattenButton.Click += new EventHandler(FireFlattenButton); flattenButton.Anchor = AnchorStyles.Right; flattenButton.Enabled = false; stopButton = new Button(); stopButton.Size = new System.Drawing.Size(184, 26); stopButton.Text = "STOP INVESTMENT SYSTEM"; stopButton.TabIndex = 1; stopButton.TabStop = true; stopButton.Location = new System.Drawing.Point(450, 24); stopButton.Click += new EventHandler(FireShutdownButton); stopButton.Anchor = AnchorStyles.Right; stopButton.Enabled = true; // // Info panels // statusPanel = new Panel(); statusPanel.BackColor = System.Drawing.SystemColors.Control; statusPanel.Name = "statusPanel"; statusPanel.Dock = System.Windows.Forms.DockStyle.Left; statusPanel.Size = new System.Drawing.Size(120, 74); statusPanel.Controls.AddRange(new Control [] { statusDesc, statusLabel }); openPLPanel = new Panel(); openPLPanel.BackColor = System.Drawing.SystemColors.Control; openPLPanel.Name = "openPLPanel"; openPLPanel.Dock = System.Windows.Forms.DockStyle.Left; openPLPanel.Size = new System.Drawing.Size(120, 74); openPLPanel.Controls.AddRange(new Control [] { openPLDesc, openPLLabel }); closedPLPanel = new Panel(); closedPLPanel.BackColor = System.Drawing.SystemColors.Control; closedPLPanel.Name = "closedPLPanel"; closedPLPanel.Dock = System.Windows.Forms.DockStyle.Left; closedPLPanel.Size = new System.Drawing.Size(120, 74); closedPLPanel.Controls.AddRange(new Control [] { closedPLDesc, closedPLLabel }); bottomPanel = new Panel(); bottomPanel.BackColor = System.Drawing.SystemColors.Control; bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom; bottomPanel.Name = "bottomPanel"; bottomPanel.Size = new System.Drawing.Size(660, 74); bottomPanel.Controls.AddRange(new Control [] { closedPLPanel, openPLPanel, statusPanel, stopButton }); // // TabControl // tabControl = new TabControl(); tabControl.Padding = new System.Drawing.Point(12, 6); TabPage chartPage = new TabPage("TimeBar"); chartPage.BackColor = System.Drawing.Color.WhiteSmoke; TabPage tradePage = new TabPage("Trades"); TabPage propsPage = new TabPage("Properties"); chartPage.Controls.Add(chartPanel); tradePage.Controls.Add(data); tabControl.Dock = System.Windows.Forms.DockStyle.Fill; tabControl.Controls.AddRange(new Control [] { chartPage, tradePage, propsPage }); this.Controls.AddRange(new Control [] { bidaskPanel, tabControl, bottomPanel }); }