public void threadSafeFillLiveADMDataPage(OptionRealtimeMonitor optionRealtimeMonitor, int row, int col, String displayValue, bool updateColor, double value) { DataGridView gridLiveFCMData = optionRealtimeMonitor.getGridLiveFCMData; try { int rowToUpdate = row; if (gridLiveFCMData.Rows[rowToUpdate].Cells[col].Value == null || gridLiveFCMData.Rows[rowToUpdate].Cells[col].Value.ToString().CompareTo(displayValue) != 0 ) { gridLiveFCMData.Rows[rowToUpdate].Cells[col].Value = displayValue; if (updateColor) { gridLiveFCMData.Rows[rowToUpdate].Cells[col].Style.BackColor = CommonFormManipulation.plUpDownColor(value); } } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
/// <summary> /// Writes the initialization configuration file. /// </summary> void writeInitializationConfigFile() { #if DEBUG try #endif { SaveOutputFile sof = new SaveOutputFile(TradingSystemConstants.INITIALIZE_CONFIG_DIRECTORY); sof.createConfigFile(TradingSystemConstants.INITIALIZE_OPTION_REALTIME_FILE_NAME); Type configTypes = typeof(INITIALIZATION_CONFIG_VARS); Array configNames = Enum.GetNames(configTypes); sof.writeConfigLineFile(configNames.GetValue((int)INITIALIZATION_CONFIG_VARS.PORTFOLIOGROUP).ToString(), (String)(cmbxPortfolio.SelectedItem)); sof.writeConfigLineFile(configNames.GetValue((int)INITIALIZATION_CONFIG_VARS.DBSERVERNAME).ToString(), (String)(cmbxDatabase.SelectedItem)); //sof.writeConfigLineFile(configNames.GetValue((int)INITIALIZATION_CONFIG_VARS.BROKER).ToString(), // initializationParms.FIX_Broker_18220); //sof.writeConfigLineFile(configNames.GetValue((int)INITIALIZATION_CONFIG_VARS.ACCOUNT).ToString(), // initializationParms.FIX_Acct); sof.closeAndSaveFile(); } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
private List <String> readSeparatedLine(String separatedLine, char separator) { List <String> listOfStrings = new List <string>(); #if DEBUG try #endif { String[] separatedArray = separatedLine.Split(separator); for (int arrayCnt = 0; arrayCnt < separatedArray.Length; arrayCnt++) { String x = separatedArray[arrayCnt].Replace("\"", ""); listOfStrings.Add(x); //separatedArray[arrayCnt].Trim()); } } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif return(listOfStrings); }
private void btnDaysFill_Click(object sender, EventArgs e) { #if DEBUG try #endif { int legCount = 0; double days = 0; if (daysTextBox.Text != null) { days = Convert.ToDouble(daysTextBox.Text); while (legCount < gridViewSpreadGrid.RowCount) { if (gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.CONTRACT_TYPE].Value != null) { gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.DAYS_TO_EXP].Value = days; } legCount++; } } } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
private void threadSafeHideUnhideADMContractSummaryLiveData(int row, bool visible) { try { int rowToUpdate = row; admInputSummaryGrid.Rows[rowToUpdate].Visible = visible; } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
internal void threadSafeMarkAsConnected(DataGridView gridView, int row, int col, bool connected, Color backgroundColor) { try { if (gridView.Rows[row].Cells[col].Style.BackColor != backgroundColor) { gridView.Rows[row].Cells[col].Style.BackColor = backgroundColor; } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
private void AdmReportSummaryForm_DragEnter(object sender, DragEventArgs e) { #if DEBUG try #endif { e.Effect = DragDropEffects.All; } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
private void addRowMenuItem_Click(object sender, EventArgs e) { #if DEBUG try #endif { gridViewSpreadGrid.Rows.Add(); } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
private void AdmReportSummaryForm_FormClosing(object sender, FormClosingEventArgs e) { #if DEBUG try #endif { e.Cancel = true; this.Visible = false; } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
/// <summary> /// Handles the Click event of the btnRunSystem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> void btnRunSystem_Click(Object sender, EventArgs e) { #if DEBUG try #endif { //bool continueToRunSystem = true; initializationParms.runLiveSystem = true; initializationParms.dbServerName = (String)(cmbxDatabase.SelectedItem); if (initializationParms.dbServerName == null) { initializationParms.dbServerName = TradingSystemConstants.DB_DEFAULTSERVERIP; } if (initializationParms.runFromDb) { initializationParms.idPortfolioGroup = pgs[cmbxPortfolio.SelectedIndex].idPortfolioGroup; initializationParms.portfolioGroupName = pgs[cmbxPortfolio.SelectedIndex].portfolioName; } initializationParms.modelDateTime = modelDateTimePicker.Value.Date; initializationParms.useHalfday = checkBoxUseHalfDay.Checked; initializationParms.halfDayTransactionTime = transactionTime.Value; initializationParms.halfDayDecisionOffsetMinutes = (int)decisionMinuteOffset.Value; initializationParms.useCloudDb = checkBoxCloudDB.Checked; //writeInitializationConfigFile(); //if (continueToRunSystem) this.Dispose(); } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
private void listViewFileList_MouseClick(object sender, MouseEventArgs e) { #if DEBUG try #endif { if (e.Button == System.Windows.Forms.MouseButtons.Right) { loadFileListMenuStrip.Show(listViewFileList, new Point(e.X, e.Y)); } } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
/// <summary> /// Initializes a new instance of the <see cref="InitializationForm"/> class. /// </summary> /// <param name="initializationParms">The initialization parms.</param> public InitializationForm(InitializationParms initializationParms) { this.initializationParms = initializationParms; initializationParms.portfolioGroupName = ""; //this.tmlSystemRunType = tmlSystemRunType; InitializeComponent(); loadPortfolioGroups(); this.Text = "OPTIONS REALTIME"; transactionTime.Value = new DateTime(2014, 1, 1, 9, 30, 0); #if DEBUG TSErrorCatch.errorCatchSetup(); #endif }
private void gridViewSpreadGrid_MouseClick(object sender, MouseEventArgs e) { #if DEBUG try #endif { if (e.Button == System.Windows.Forms.MouseButtons.Right) { optionPLChartDataMenuStrip.Show(gridViewSpreadGrid, new Point(e.X, e.Y)); //optionConfigMenuStrip.Show(optionConfigSetupGrid, new Point(e.X, e.Y)); } } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
private void deleteRowMenuItem_Click(object sender, EventArgs e) { #if DEBUG try #endif { if (gridViewSpreadGrid.SelectedCells.Count > 0) { int selectedRow = gridViewSpreadGrid.SelectedCells[0].RowIndex; gridViewSpreadGrid.Rows.RemoveAt(selectedRow); } } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
internal void markLiveAsConnected(DataGridView gridView, int row, int col, bool connected, Color backgroundColor) { try { if (form.InvokeRequired) { ThreadSafeMarkAsConnectedDelegate d = new ThreadSafeMarkAsConnectedDelegate(threadSafeMarkAsConnected); form.Invoke(d, gridView, row, col, connected, backgroundColor); } else { threadSafeMarkAsConnected(gridView, row, col, connected, backgroundColor); } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
// private void initializeBackgroundWorkerProgressBar() // { // try // { // backgroundWorkerProgressBar = new BackgroundWorker(); // backgroundWorkerProgressBar.WorkerReportsProgress = true; // backgroundWorkerProgressBar.WorkerSupportsCancellation = true; // // backgroundWorkerProgressBar.DoWork += // new DoWorkEventHandler(setupBackgroundWorkerProgressBar); // // backgroundWorkerProgressBar.ProgressChanged += // new ProgressChangedEventHandler( // backgroundWorkerProgressBar_ProgressChanged); // // backgroundWorkerProgressBar.RunWorkerAsync(); // } // catch (Exception ex) // { // TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); // } // } // // private void setupBackgroundWorkerProgressBar(object sender, // DoWorkEventArgs e) // { // try // { // while (true) // { // backgroundWorkerProgressBar.ReportProgress(0); // System.Threading.Thread.Sleep(PROGRESS_BAR_REFRESH); // } // } // catch (Exception ex) // { // TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); // } // } // // private void backgroundWorkerProgressBar_ProgressChanged(object sender, // ProgressChangedEventArgs e) // { // try // { // updateProgressBar(progress); // } // catch (Exception ex) // { // TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); // } // } // public void updateProgressBar(double progress) { try { if (this.InvokeRequired) { ThreadSafeProgressBarUpdate d = new ThreadSafeProgressBarUpdate(updateProgressBarValue); this.Invoke(d, progress); } else { updateProgressBarValue(progress); } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
private void initializeBackgroundWorkerProgressBar() { try { backgroundWorkerProgressBar = new BackgroundWorker(); backgroundWorkerProgressBar.WorkerReportsProgress = true; backgroundWorkerProgressBar.WorkerSupportsCancellation = true; backgroundWorkerProgressBar.DoWork += new DoWorkEventHandler(setupBackgroundWorkerProgressBar); backgroundWorkerProgressBar.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); backgroundWorkerProgressBar.RunWorkerAsync(); } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
/// <summary> /// Handles the Click event of the btnExitSystem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void btnExitSystem_Click(System.Object sender, System.EventArgs e) { #if DEBUG try #endif { initializationParms.runLiveSystem = false; //writeInitializationConfigFile(); this.Close(); } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
private void hideUnhideADMContractSummaryLiveData(int row, bool visible) { try { if (this.InvokeRequired) { ThreadSafeHideUnhideContractSummaryLiveDataDelegate d = new ThreadSafeHideUnhideContractSummaryLiveDataDelegate(threadSafeHideUnhideADMContractSummaryLiveData); this.Invoke(d, row, visible); } else { threadSafeHideUnhideADMContractSummaryLiveData(row, visible); } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
public void fillLiveADMDataPage(OptionRealtimeMonitor optionRealtimeMonitor, int row, int col, String displayValue, bool updateColor, double value) { try { if (optionRealtimeMonitor.InvokeRequired) { ThreadSafeFillLiveDataPageDelegate d = new ThreadSafeFillLiveDataPageDelegate(threadSafeFillLiveADMDataPage); optionRealtimeMonitor.Invoke(d, optionRealtimeMonitor, row, col, displayValue, updateColor, value); } else { threadSafeFillLiveADMDataPage(optionRealtimeMonitor, row, col, displayValue, updateColor, value); } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
private void setupBackgroundWorkerProgressBar(object sender, DoWorkEventArgs e) { //this.Invoke(new EventHandler(optionSpreadManager.openThread)); optionSpreadManager.openThread(null, null); try { while (!initialized) { //backgroundWorkerProgressBar.ReportProgress(0); System.Threading.Thread.Sleep(1000); } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } optionSpreadManager.closeThread(null, null); //this.Invoke(new EventHandler(optionSpreadManager.closeThread)); }
public void sendUpdateToContractSummaryLiveData(OptionRealtimeMonitor optionRealtimeMonitor) { DataGridView gridViewContractSummary = optionRealtimeMonitor.getGridViewContractSummary; try { for (int contractSummaryExpressionCnt = 0; contractSummaryExpressionCnt < optionSpreadManager.contractSummaryExpressionListIdx.Count(); contractSummaryExpressionCnt++) { CQGInstrument cqgInstrument = optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]] .cqgInstrument; if (cqgInstrument != null) { statusAndConnectedUpdates.checkUpdateStatus(gridViewContractSummary, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.TIME, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]]); //if (optionSpreadManager.realtimeMonitorSettings.eodAnalysis) if (optionSpreadManager .optionSpreadExpressionList [optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]] .instrument.eodAnalysisAtInstrument) { //gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.TIME].DefaultCellStyle.Font = new Font("Tahoma", 6); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.TIME, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]] .lastTimeUpdated.ToString("yyyy-MM-dd HH:mm", DateTimeFormatInfo.InvariantInfo), false, 0); } else { //gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.TIME].DefaultCellStyle.Font = new Font("Tahoma", 8); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.TIME, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]] .lastTimeUpdated.ToString("HH:mm", DateTimeFormatInfo.InvariantInfo), false, 0); } // gridViewContractSummary // .Rows[heldLotsExpressionCnt].Cells[(int)CONTRACTSUMMARY_DATA_COLUMNS.TOTAL_QTY].Value = // optionSpreadExpressionList[i].numberOfLotsHeldForContractSummary // * optionSpreadManager.portfolioGroupTotalMultiple; fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.ASK, cqgInstrument.ToDisplayPrice( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].ask), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].ask); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.BID, cqgInstrument.ToDisplayPrice( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].bid), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].bid); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.LAST, cqgInstrument.ToDisplayPrice( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].trade), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].trade); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.DFLT_PRICE, cqgInstrument.ToDisplayPrice( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].defaultPrice), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].defaultPrice); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.STTLE, cqgInstrument.ToDisplayPrice( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].settlement), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].settlement); if (optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]] .settlementDateTime.Date.CompareTo(DateTime.Now.Date) >= 0) { fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.SETL_TIME, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].settlementDateTime .ToString("yyyy-MM-dd HH:mm", DateTimeFormatInfo.InvariantInfo), true, 1); } else { fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.SETL_TIME, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].settlementDateTime .ToString("yyyy-MM-dd HH:mm", DateTimeFormatInfo.InvariantInfo), true, -1); } fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.YEST_STTLE, cqgInstrument.ToDisplayPrice( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].yesterdaySettlement), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].yesterdaySettlement); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.IMPL_VOL, cqgInstrument.ToDisplayPrice( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].impliedVol), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].impliedVol); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.THEOR_PRICE, cqgInstrument.ToDisplayPrice( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].theoreticalOptionPrice), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].theoreticalOptionPrice); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.SPAN_IMPL_VOL, Math.Round( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].impliedVolFromSpan, 2).ToString(), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].impliedVolFromSpan); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.SETL_IMPL_VOL, Math.Round( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].settlementImpliedVol, 2).ToString(), false, optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].settlementImpliedVol); int lots = optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]] .numberOfLotsHeldForContractSummary * optionSpreadManager.portfolioGroupTotalMultiple; fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.TOTAL_QTY, lots.ToString(), false, lots); double delta = Math.Round( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].deltaChgForContractSummary * optionSpreadManager.portfolioGroupTotalMultiple, 2); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.DELTA, delta.ToString(), true, delta); double plChg = Math.Round( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].plChgForContractSummary * optionSpreadManager.portfolioGroupTotalMultiple, 2); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.PL_DAY_CHG, plChg.ToString(), true, plChg); int numberOfOrderContracts = optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].numberOfOrderContracts * optionSpreadManager.portfolioGroupTotalMultiple; fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.ORDER_QTY, numberOfOrderContracts.ToString(), false, numberOfOrderContracts); double plChgOrders = Math.Round( optionSpreadManager.optionSpreadExpressionList[optionSpreadManager.contractSummaryExpressionListIdx[contractSummaryExpressionCnt]].plChgOrders * optionSpreadManager.portfolioGroupTotalMultiple, 2); fillContractSummaryLiveData(optionRealtimeMonitor, contractSummaryExpressionCnt, (int)CONTRACTSUMMARY_DATA_COLUMNS.ORDER_PL_CHG, plChgOrders.ToString(), true, plChgOrders); } } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
private StatusAndConnectedUpdates statusAndConnectedUpdates; // { get; set; } public void setupContractSummaryLiveData(OptionRealtimeMonitor optionRealtimeMonitor) { DataGridView gridViewContractSummary = optionRealtimeMonitor.getGridViewContractSummary; try { Type contractSummaryColTypes = typeof(CONTRACTSUMMARY_DATA_COLUMNS); Array contractSummaryColTypesArray = Enum.GetNames(contractSummaryColTypes); gridViewContractSummary.ColumnCount = contractSummaryColTypesArray.Length; gridViewContractSummary.EnableHeadersVisualStyles = false; DataGridViewCellStyle colTotalPortStyle = gridViewContractSummary.ColumnHeadersDefaultCellStyle; colTotalPortStyle.BackColor = Color.Black; colTotalPortStyle.ForeColor = Color.White; DataGridViewCellStyle rowTotalPortStyle = gridViewContractSummary.RowHeadersDefaultCellStyle; rowTotalPortStyle.BackColor = Color.Black; rowTotalPortStyle.ForeColor = Color.White; gridViewContractSummary.Columns[0].Frozen = true; for (int i = 0; i < gridViewContractSummary.ColumnCount; i++) { gridViewContractSummary.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < contractSummaryColTypesArray.Length; i++) { sb.Clear(); sb.Append(contractSummaryColTypesArray.GetValue(i).ToString()); gridViewContractSummary .Columns[i] .HeaderCell.Value = sb.ToString().Replace('_', ' '); gridViewContractSummary.Columns[i].Width = 50; } //gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.CONTRACT].Width = 115; //gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.LEG].Width = 30; //gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.LEG].DefaultCellStyle.Font = new Font("Tahoma", 7); gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.TIME].Width = 70; gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.TIME].DefaultCellStyle.WrapMode = DataGridViewTriState.True; gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.SETL_TIME].DefaultCellStyle.Font = new Font("Tahoma", 6); gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.SETL_TIME].DefaultCellStyle.WrapMode = DataGridViewTriState.True; //gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.EXPR].DefaultCellStyle.Font = new Font("Tahoma", 6); //gridViewContractSummary.Columns[(int)CONTRACTSUMMARY_DATA_COLUMNS.EXPR].DefaultCellStyle.WrapMode = DataGridViewTriState.True; int rowCount = 0; for (int i = 0; i < optionSpreadManager.optionSpreadExpressionList.Count; i++) { if (optionSpreadManager.optionSpreadExpressionList[i].optionExpressionType != OPTION_EXPRESSION_TYPES.OPTION_EXPRESSION_RISK_FREE_RATE && optionSpreadManager.optionSpreadExpressionList[i].numberOfLotsHeldForContractSummary != 0) { rowCount++; } } gridViewContractSummary.RowCount = rowCount; Color rowColor1 = Color.DarkGray; Color rowColor2 = Color.Black; Color currentRowColor = rowColor1; int heldLotsExpressionCnt = 0; for (int instrumentCnt = 0; instrumentCnt <= optionSpreadManager.instruments.Length; instrumentCnt++) { for (int i = 0; i < optionSpreadManager.optionSpreadExpressionList.Count; i++) { if (optionSpreadManager.optionSpreadExpressionList[i].optionExpressionType != OPTION_EXPRESSION_TYPES.OPTION_EXPRESSION_RISK_FREE_RATE && optionSpreadManager.optionSpreadExpressionList[i].instrument.idxOfInstrumentInList == instrumentCnt) { if (optionSpreadManager.optionSpreadExpressionList[i].numberOfLotsHeldForContractSummary != 0) { switch (heldLotsExpressionCnt % 2) { case 0: currentRowColor = rowColor1; break; case 1: currentRowColor = rowColor2; break; } optionSpreadManager.contractSummaryExpressionListIdx.Add(i); //TSErrorCatch.debugWriteOut(optionSpreadManager.optionSpreadExpressionList[i].cqgSymbol + " " + i); gridViewContractSummary .Rows[heldLotsExpressionCnt] .HeaderCell.Style.BackColor = currentRowColor; gridViewContractSummary .Rows[heldLotsExpressionCnt] .HeaderCell.Value = optionSpreadManager.optionSpreadExpressionList[i].cqgSymbol; for (int j = 0; j < gridViewContractSummary.ColumnCount; j++) { gridViewContractSummary.Rows[heldLotsExpressionCnt].Cells[j] = new CustomDataGridViewCell(true); } //gridViewContractSummary // .Rows[heldLotsExpressionCnt].Cells[(int)CONTRACTSUMMARY_DATA_COLUMNS.TOTAL_QTY].Value = // optionSpreadManager.optionSpreadExpressionList[i].numberOfLotsHeldForContractSummary; gridViewContractSummary .Rows[heldLotsExpressionCnt].Cells[(int)CONTRACTSUMMARY_DATA_COLUMNS.SETL_TIME].Value = optionSpreadManager.optionSpreadExpressionList[i].settlementDateTime; gridViewContractSummary .Rows[heldLotsExpressionCnt].Cells[(int)CONTRACTSUMMARY_DATA_COLUMNS.STRIKE_PRICE].Value = optionSpreadManager.optionSpreadExpressionList[i].strikePrice; gridViewContractSummary .Rows[heldLotsExpressionCnt].Cells[(int)CONTRACTSUMMARY_DATA_COLUMNS.INSTRUMENT_ID].Value = optionSpreadManager.optionSpreadExpressionList[i].instrument.idxOfInstrumentInList; heldLotsExpressionCnt++; } } } } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
void loadPortfolioGroups() { #if DEBUG try #endif { SaveOutputFile sof = new SaveOutputFile(); String[] initializationConfigs = sof.readInitializeConfigFile( TradingSystemConstants.INITIALIZE_OPTION_REALTIME_FILE_NAME, (int)REALTIME_CONFIG_FILE_INPUT_TYPE.INITIALIZATION_FILE); initializationParms.initializationConfigs = initializationConfigs; String[] realtimeConfiguration = sof.readInitializeConfigFile( TradingSystemConstants.REALTIME_CONFIGURATION, (int)REALTIME_CONFIG_FILE_INPUT_TYPE.REALTIME_CONFIGURATION); //String[] brokerList = // realtimeConfiguration[(int)REALTIME_CONFIGURATION.MULTIBROKER].Split(','); //initializationParms.fixBrokerList = brokerList; //String[] acctList = // realtimeConfiguration[(int)REALTIME_CONFIGURATION.ACCOUNT].Split(','); //initializationParms.fixAcctList = acctList; if (initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.DBSERVERNAME] == null || initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.DBSERVERNAME].Length == 0) { initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.DBSERVERNAME] = TradingSystemConstants.DB_DEFAULTSERVERIP; } String[] dbServerList = realtimeConfiguration[(int)REALTIME_CONFIGURATION.SERVERNAME].Split(','); //ArrayList dbServerList = sof.readDBserverListFile(); //sof.closeAndSaveFile(); if (dbServerList != null && dbServerList.Length > 0) { int dbSelectedIndex = 0; for (int i = 0; i < dbServerList.Length; i++) { String serverName = (String)(dbServerList[i]); cmbxDatabase.Items.Add(serverName); if (serverName.CompareTo(initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.DBSERVERNAME]) == 0) { dbSelectedIndex = i; } //itemCounter++; } if (cmbxDatabase.Items.Count > 0) { cmbxDatabase.SelectedIndex = dbSelectedIndex; } } else { cmbxDatabase.Items.Add(initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.DBSERVERNAME]); cmbxDatabase.SelectedIndex = 0; } //if (brokerList != null && brokerList.Length > 0) //{ // int dbSelectedIndex = 0; // for (int i = 0; i < brokerList.Length; i++) // { // String brokerName = (String)(brokerList[i]); // cmbxBroker.Items.Add(brokerName); // if (brokerName.CompareTo(initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.BROKER]) == 0) // { // dbSelectedIndex = i; // } // //itemCounter++; // } // if (cmbxBroker.Items.Count > 0) // { // cmbxBroker.SelectedIndex = dbSelectedIndex; // } //} //else //{ // cmbxBroker.Items.Add(initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.BROKER]); // cmbxBroker.SelectedIndex = 0; //} if (initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.DBSERVERNAME] .CompareTo("Azure") == 0) { TMLAzureModelDBQueries btdb = new TMLAzureModelDBQueries(); pgs = btdb.queryPortfolioGroups(0); } else { TMLModelDBQueries btdb = new TMLModelDBQueries(); btdb.connectDB(initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.DBSERVERNAME]); pgs = btdb.queryPortfolioGroups(0); btdb.closeDB(); } bool setSelectedPortfolio = false; for (int i = 0; i < pgs.Length; i++) { StringBuilder portfolioNumberAndName = new StringBuilder(); portfolioNumberAndName.Append(pgs[i].idPortfolioGroup); portfolioNumberAndName.Append(". "); portfolioNumberAndName.Append(pgs[i].portfolioName); cmbxPortfolio.Items.Add(portfolioNumberAndName.ToString()); //if( ) if (initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.PORTFOLIOGROUP] != null && initializationConfigs[(int)INITIALIZATION_CONFIG_VARS.PORTFOLIOGROUP].CompareTo(pgs[i].portfolioName) == 0) { //pgs[i].selected pgs[i].selected = true; cmbxPortfolio.SelectedIndex = i; setSelectedPortfolio = true; } //itemCounter++; } if (!setSelectedPortfolio) { cmbxPortfolio.SelectedIndex = 0; } initializationParms.runFromDb = true; } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
internal void threadsafefillGridLiveADMData(OptionRealtimeMonitor optionRealtimeMonitor) { DataGridView gridLiveFCMData = optionRealtimeMonitor.getGridLiveFCMData; try { List <ADMPositionImportWeb> admPositionImportWeb = optionSpreadManager.admPositionImportWeb; gridLiveFCMData.RowCount = admPositionImportWeb.Count; int rowIdx = 0; //Color rowColor1 = Color.DarkGray; //Color rowColor2 = Color.Black; Color rowColor1 = Color.DarkGray; Color rowColor2 = Color.DarkBlue; Color currentRowColor = rowColor1; for (int instrumentCnt = 0; instrumentCnt <= optionSpreadManager.instruments.Length; instrumentCnt++) { for (int admWebPositionCounter = 0; admWebPositionCounter < admPositionImportWeb.Count; admWebPositionCounter++) { if (admPositionImportWeb[admWebPositionCounter].instrument.idxOfInstrumentInList == instrumentCnt) { admPositionImportWeb[admWebPositionCounter].liveADMRowIdx = rowIdx; switch (rowIdx % 2) { case 0: currentRowColor = rowColor1; break; case 1: currentRowColor = rowColor2; break; } gridLiveFCMData .Rows[rowIdx] .HeaderCell.Style.BackColor = currentRowColor; gridLiveFCMData .Rows[rowIdx] .HeaderCell.Value = admPositionImportWeb[admWebPositionCounter].cqgSymbol; //admPositionsCheckAndFillGrid(admPositionImportWeb[stratCounter], // rowIdx, true); DateTime currentDate = DateTime.Now; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.POFFIC].Value = admPositionImportWeb[admWebPositionCounter].POFFIC; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.PACCT].Value = admPositionImportWeb[admWebPositionCounter].PACCT; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.NET_EDITABLE].Value = admPositionImportWeb[admWebPositionCounter].netContractsEditable; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.NET_AT_ADM].Value = admPositionImportWeb[admWebPositionCounter].Net; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.LONG_TRANS].Value = admPositionImportWeb[admWebPositionCounter].transNetLong; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.SHORT_TRANS].Value = admPositionImportWeb[admWebPositionCounter].transNetShort; //gridLiveADMData.Rows[rowCounter].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.MODEL].Value = // liveADMStrategyInfo.admLegInfo[legCounter].numberOfModelContracts; TimeSpan span = admPositionImportWeb[admWebPositionCounter].contractInfo.expirationDate.Date - currentDate.Date; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.CNTDN].Value = span.Days; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.EXPR].Value = new DateTime( admPositionImportWeb[admWebPositionCounter].contractInfo.expirationDate.Year, admPositionImportWeb[admWebPositionCounter].contractInfo.expirationDate.Month, admPositionImportWeb[admWebPositionCounter].contractInfo.expirationDate.Day, admPositionImportWeb[admWebPositionCounter].contractInfo.optionExpirationTime.Hour, admPositionImportWeb[admWebPositionCounter].contractInfo.optionExpirationTime.Minute, 0 ) .ToString("yyyy-MM-dd HH:mm", DateTimeFormatInfo.InvariantInfo); gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.AVG_LONG_TRANS_PRC].Value = admPositionImportWeb[admWebPositionCounter].transAvgLongPrice; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.AVG_SHORT_TRANS_PRC].Value = admPositionImportWeb[admWebPositionCounter].transAvgShortPrice; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.STRIKE].Value = admPositionImportWeb[admWebPositionCounter].strike; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.DESCRIP].Value = admPositionImportWeb[admWebPositionCounter].Description; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.CUSIP].Value = admPositionImportWeb[admWebPositionCounter].PCUSIP; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.ADMPOSWEB_IDX].Value = admWebPositionCounter; gridLiveFCMData.Rows[rowIdx].Cells[(int)OPTION_LIVE_ADM_DATA_COLUMNS.INSTRUMENT_ID].Value = instrumentCnt; //********************************* gridLiveFCMData .Rows[rowIdx] .HeaderCell.Style.BackColor = currentRowColor; rowIdx++; //rowIdx += liveADMStrategyInfoList[stratCounter].admLegInfo.Count + 1; } } } //updateColorOfADMStrategyGrid(); } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } //return liveLegRowIdexes; }
private OptionSpreadManager optionSpreadManager;// { get; set; } //private StatusAndConnectedUpdates statusAndConnectedUpdates;// { get; set; } internal void setupGridLiveADMData(OptionRealtimeMonitor optionRealtimeMonitor) { DataGridView gridLiveFCMData = optionRealtimeMonitor.getGridLiveFCMData; try { Type liveColTypes = typeof(OPTION_LIVE_ADM_DATA_COLUMNS); Array liveColTypesArray = Enum.GetNames(liveColTypes); gridLiveFCMData.ColumnCount = liveColTypesArray.Length; gridLiveFCMData.EnableHeadersVisualStyles = false; DataGridViewCellStyle colTotalPortStyle = gridLiveFCMData.ColumnHeadersDefaultCellStyle; colTotalPortStyle.BackColor = Color.Black; colTotalPortStyle.ForeColor = Color.White; DataGridViewCellStyle rowTotalPortStyle = gridLiveFCMData.RowHeadersDefaultCellStyle; rowTotalPortStyle.BackColor = Color.Black; rowTotalPortStyle.ForeColor = Color.White; gridLiveFCMData.Columns[0].Frozen = true; StringBuilder sb = new StringBuilder(); for (int i = 0; i < gridLiveFCMData.ColumnCount; i++) { gridLiveFCMData.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; if (i != (int)OPTION_LIVE_ADM_DATA_COLUMNS.NET_EDITABLE) { gridLiveFCMData.Columns[i].ReadOnly = true; } sb.Clear(); sb.Append(liveColTypesArray.GetValue(i).ToString()); gridLiveFCMData .Columns[i] .HeaderCell.Value = sb.ToString().Replace('_', ' '); gridLiveFCMData.Columns[i].Width = 50; } //for (int i = 0; i < liveColTypesArray.Length; i++) //{ //} //************ //gridLiveADMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.CONTRACT].Width = 115; //gridLiveADMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.LEG].Width = 30; //gridLiveADMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.LEG].DefaultCellStyle.Font = new Font("Tahoma", 7); gridLiveFCMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.TIME].Width = 70; gridLiveFCMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.TIME].DefaultCellStyle.WrapMode = DataGridViewTriState.True; gridLiveFCMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.SETL_TIME].DefaultCellStyle.Font = new Font("Tahoma", 6); gridLiveFCMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.SETL_TIME].DefaultCellStyle.WrapMode = DataGridViewTriState.True; gridLiveFCMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.EXPR].DefaultCellStyle.Font = new Font("Tahoma", 6); gridLiveFCMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.EXPR].DefaultCellStyle.WrapMode = DataGridViewTriState.True; //************ //List<LiveADMStrategyInfo> liveADMStrategyInfoList = optionSpreadManager.liveADMStrategyInfoList; fillGridLiveADMData(optionRealtimeMonitor); } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
public void sendUpdateToADMPositionsGrid(OptionRealtimeMonitor optionRealtimeMonitor) //*eQuoteType cqgQuoteType,*/ int spreadExpressionIdx /*int colIdx*/) { //CQGQuote quote = optionSpreadExpressionList[spreadExpressionIdx].cqgInstrument.Quotes[cqgQuoteType]; DataGridView gridLiveFCMData = optionRealtimeMonitor.getGridLiveFCMData; try { List <ADMPositionImportWeb> admPositionImportWeb = optionSpreadManager.admPositionImportWeb; //int optionSpreadCounter = 0; //List<LiveADMStrategyInfo> liveADMStrategyInfoList = optionSpreadManager.liveADMStrategyInfoList; for (int admWebPositionCounter = 0; admWebPositionCounter < admPositionImportWeb.Count; admWebPositionCounter++) { // int totalLegs = liveADMStrategyInfoList[optionSpreadCounter].admLegInfo.Count; // //if (optionSpreadExpressionList[spreadExpressionIdx].cqgInstrument != null) // for (int legCounter = 0; legCounter < totalLegs; legCounter++) // { if (admPositionImportWeb[admWebPositionCounter].contractData.optionSpreadExpression != null) { CQGInstrument cqgInstrument = admPositionImportWeb[admWebPositionCounter].contractData.optionSpreadExpression.cqgInstrument; if (cqgInstrument != null) // && CQG. cqgInstrument) { OptionSpreadExpression optionSpreadExpressionList = admPositionImportWeb[admWebPositionCounter].contractData.optionSpreadExpression; //checkUpdateStatus(admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, // optionSpreadExpressionList, true); optionSpreadManager.statusAndConnectedUpdates.checkUpdateStatus(gridLiveFCMData, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.TIME, optionSpreadExpressionList); //if (optionSpreadManager.realtimeMonitorSettings.eodAnalysis) if (optionSpreadExpressionList.instrument.eodAnalysisAtInstrument) { gridLiveFCMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.TIME].DefaultCellStyle.Font = new Font("Tahoma", 6); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.TIME, optionSpreadExpressionList.lastTimeUpdated.ToString("yyyy-MM-dd HH:mm", DateTimeFormatInfo.InvariantInfo), false, 0); } else { gridLiveFCMData.Columns[(int)OPTION_LIVE_ADM_DATA_COLUMNS.TIME].DefaultCellStyle.Font = new Font("Tahoma", 8); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.TIME, optionSpreadExpressionList.lastTimeUpdated.ToString("HH:mm", DateTimeFormatInfo.InvariantInfo), false, 0); } fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.ASK, cqgInstrument.ToDisplayPrice(optionSpreadExpressionList.ask), false, optionSpreadExpressionList.ask); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.BID, cqgInstrument.ToDisplayPrice(optionSpreadExpressionList.bid), false, optionSpreadExpressionList.bid); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.LAST, cqgInstrument.ToDisplayPrice(optionSpreadExpressionList.trade), false, optionSpreadExpressionList.trade); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.DFLT_PRICE, cqgInstrument.ToDisplayPrice(optionSpreadExpressionList.defaultPrice), false, optionSpreadExpressionList.defaultPrice); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.STTLE, cqgInstrument.ToDisplayPrice(optionSpreadExpressionList.settlement), false, optionSpreadExpressionList.settlement); if (optionSpreadExpressionList.settlementDateTime.Date.CompareTo(DateTime.Now.Date) >= 0) { fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.SETL_TIME, optionSpreadExpressionList.settlementDateTime.ToString("yyyy-MM-dd HH:mm", DateTimeFormatInfo.InvariantInfo), true, 1); } else { fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.SETL_TIME, optionSpreadExpressionList.settlementDateTime.ToString("yyyy-MM-dd HH:mm", DateTimeFormatInfo.InvariantInfo), true, -1); } fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.YEST_STTLE, cqgInstrument.ToDisplayPrice(optionSpreadExpressionList.yesterdaySettlement), false, optionSpreadExpressionList.yesterdaySettlement); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.IMPL_VOL, Math.Round(optionSpreadExpressionList.impliedVol, 2).ToString(), false, optionSpreadExpressionList.impliedVol); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.THEOR_PRICE, cqgInstrument.ToDisplayPrice( optionSpreadExpressionList.theoreticalOptionPrice), false, optionSpreadExpressionList.theoreticalOptionPrice); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.SPAN_IMPL_VOL, Math.Round(optionSpreadExpressionList.impliedVolFromSpan, 2).ToString(), false, optionSpreadExpressionList.impliedVolFromSpan); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.SETL_IMPL_VOL, Math.Round(optionSpreadExpressionList.settlementImpliedVol, 2).ToString(), false, optionSpreadExpressionList.settlementImpliedVol); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.RFR, optionSpreadExpressionList.riskFreeRate.ToString(), false, optionSpreadExpressionList.riskFreeRate); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.PL_DAY_CHG, Math.Round(admPositionImportWeb[admWebPositionCounter].contractData.pAndLDay, 2).ToString(), true, admPositionImportWeb[admWebPositionCounter].contractData.pAndLDay); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.PL_TRANS, Math.Round(admPositionImportWeb[admWebPositionCounter].contractData.pAndLDayOrders, 2).ToString(), true, admPositionImportWeb[admWebPositionCounter].contractData.pAndLDayOrders); //fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, // (int)OPTION_LIVE_ADM_DATA_COLUMNS.PL_DAY_CHG, // Math.Round(admPositionImportWeb[admWebPositionCounter].contractData.pAndLDay, 2).ToString(), // true, admPositionImportWeb[admWebPositionCounter].contractData.pAndLDay); fillLiveADMDataPage(optionRealtimeMonitor, admPositionImportWeb[admWebPositionCounter].liveADMRowIdx, (int)OPTION_LIVE_ADM_DATA_COLUMNS.DELTA, Math.Round(admPositionImportWeb[admWebPositionCounter].contractData.delta, 2).ToString(), true, admPositionImportWeb[admWebPositionCounter].contractData.delta); // //int numberOfContracts = (int)optionStrategies[optionSpreadCounter].optionStrategyParameters[ // // (int)TBL_STRATEGY_STATE_FIELDS.currentPosition].stateValueParsed[legCounter]; // //fillLiveADMDataPage(liveADMStrategyInfoList[optionSpreadCounter].admLegInfo[legCounter].rowIndex, // // (int)OPTION_LIVE_ADM_DATA_COLUMNS.SPREAD_QTY, // // numberOfContracts.ToString(), true, numberOfContracts); // } } } // fillLiveADMDataPage(liveADMStrategyInfoList[optionSpreadCounter].summaryRowIdx, // (int)OPTION_LIVE_ADM_DATA_COLUMNS.PL_DAY_CHG, // Math.Round(liveADMStrategyInfoList[optionSpreadCounter].liveSpreadADMTotals.pAndLDay, 2).ToString(), // true, liveADMStrategyInfoList[optionSpreadCounter].liveSpreadADMTotals.pAndLDay); // fillLiveADMDataPage(liveADMStrategyInfoList[optionSpreadCounter].summaryRowIdx, // (int)OPTION_LIVE_ADM_DATA_COLUMNS.DELTA, // Math.Round(liveADMStrategyInfoList[optionSpreadCounter].liveSpreadADMTotals.delta, 2).ToString(), // true, liveADMStrategyInfoList[optionSpreadCounter].liveSpreadADMTotals.delta); // optionSpreadCounter++; } } catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } }
public void fillChart() { #if DEBUG try #endif { Series serPrice = new Series(); serPrice.ChartType = SeriesChartType.Line; serPrice.Name = "Option PL"; //gridViewSpreadGrid.RowCount = liveADMDataList.liveADMLegList.Count; int legCount = 0; int futureIdx = -1; while (legCount < gridViewSpreadGrid.RowCount) { String contractType = gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.CONTRACT_TYPE].Value.ToString(); if (contractType.CompareTo(optionArrayTypes.optionSpreadContractTypesArray.GetValue( (int)OPTION_SPREAD_CONTRACT_TYPE.FUTURE)) == 0) { futureIdx = legCount; break; } legCount++; } int countOftest = 1000; double futureAvgPrice; if (futureIdx >= 0) { futureAvgPrice = ConversionAndFormatting.convertToTickMovesDouble( gridViewSpreadGrid.Rows[futureIdx] .Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value.ToString(), instrument.tickSize, instrument.tickDisplay); } else { futureAvgPrice = futurePrice; } double[] futurePriceArray = new double[countOftest * 2 + 1]; //double futureAvgPrice = (double)gridViewSpreadGrid.Rows[futureIdx] // .Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value; //double futureAvgPrice = (double)gridViewSpreadGrid.Rows[futureIdx] // .Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value; //double futureAvgPrice = ConversionAndFormatting.convertToTickMovesDouble( // gridViewSpreadGrid.Rows[futureIdx] // .Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value.ToString(), // instrument.tickSize, instrument.tickDisplay); //futureAvgPrice /= instrument.admFuturePriceFactor; double startOfTest = futureAvgPrice - countOftest * instrument.tickSize; //optionBuilderSpreadStructure[ // currentDateContractListMainIdx[aDMDataListSpreadCount][(int)OPTION_SPREAD_ROLL_INDEXES.OPTION_SPREAD_IDX] // ].instrument.tickSize; if (startOfTest < 0) { startOfTest = 0; } for (int count = 0; count < futurePriceArray.Length; count++) { futurePriceArray[count] = startOfTest + count * instrument.tickSize; //optionBuilderSpreadStructure[ //currentDateContractListMainIdx[aDMDataListSpreadCount][(int)OPTION_SPREAD_ROLL_INDEXES.OPTION_SPREAD_IDX] //].instrument.tickSize; } double[,] legPls = new double[gridViewSpreadGrid.RowCount, futurePriceArray.Length]; double[] spreadPl = new double[futurePriceArray.Length]; double riskFreeRate = Convert.ToDouble(riskFreeTextBox.Text) / 100; for (int futurePointCount = 0; futurePointCount < futurePriceArray.Length; futurePointCount++) { double plTotal = 0; legCount = 0; //for (int legCounter = 0; legCounter < gridViewSpreadGrid.RowCount ; // legCounter++) while (legCount < gridViewSpreadGrid.RowCount) { int cellCount = 0; bool continueThisLeg = true; while (cellCount < gridViewSpreadGrid.Rows[legCount].Cells.Count) { if (gridViewSpreadGrid.Rows[legCount].Cells[cellCount].Value == null) { continueThisLeg = false; break; } cellCount++; } if (continueThisLeg) { String contractType = gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.CONTRACT_TYPE].Value.ToString(); //double strike = Convert.ToDouble(gridViewSpreadGrid.Rows[legCount] // .Cells[(int)OPTION_PL_COLUMNS.STRIKE].Value); double strike = ConversionAndFormatting.convertToTickMovesDouble( gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.STRIKE].Value.ToString(), instrument.optionStrikeIncrement, instrument.optionStrikeDisplay); double daysToExp = Convert.ToDouble(gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.DAYS_TO_EXP].Value); daysToExp /= 365; double implVol = Convert.ToDouble(gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.IMPLIED_VOL].Value); //implVol = 15; implVol /= 100; double numOfContracts = Convert.ToDouble(gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.NET].Value); double avgPrice = 0; // Convert.ToDouble(gridViewSpreadGrid.Rows[legCount] // .Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value); if (contractType.CompareTo(optionArrayTypes.optionSpreadContractTypesArray.GetValue( (int)OPTION_SPREAD_CONTRACT_TYPE.FUTURE)) == 0) { avgPrice = ConversionAndFormatting.convertToTickMovesDouble( gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value.ToString(), instrument.tickSize, instrument.tickDisplay); } else { if (instrument.secondaryOptionTickSizeRule > 0) { avgPrice = ConversionAndFormatting.convertToTickMovesDouble( gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value.ToString(), instrument.secondaryOptionTickSize, instrument.optionTickDisplay); } else { avgPrice = ConversionAndFormatting.convertToTickMovesDouble( gridViewSpreadGrid.Rows[legCount] .Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value.ToString(), instrument.optionTickSize, instrument.optionTickDisplay); } } char typeSymbol; bool run = true; double price; double tickSize; double tickValue; if (contractType.CompareTo(optionArrayTypes.optionSpreadContractTypesArray.GetValue( (int)OPTION_SPREAD_CONTRACT_TYPE.CALL)) == 0) { typeSymbol = 'C'; price = OptionCalcs.blackScholes(typeSymbol, futurePriceArray[futurePointCount], strike, daysToExp, riskFreeRate, implVol); tickSize = instrument.optionTickSize; tickValue = instrument.optionTickValue; //run = false; } else if (contractType.CompareTo(optionArrayTypes.optionSpreadContractTypesArray.GetValue( (int)OPTION_SPREAD_CONTRACT_TYPE.PUT)) == 0) { typeSymbol = 'P'; price = OptionCalcs.blackScholes(typeSymbol, futurePriceArray[futurePointCount], strike, daysToExp, riskFreeRate, implVol); tickSize = instrument.optionTickSize; tickValue = instrument.optionTickValue; //run = false; } else { typeSymbol = 'F'; price = futurePriceArray[futurePointCount]; tickSize = instrument.tickSize; tickValue = instrument.tickValue; //run = true; } if (run) { double pl = numOfContracts * (price - avgPrice) / tickSize * tickValue; plTotal += pl; legPls[legCount, futurePointCount] = pl; } } legCount++; } spreadPl[futurePointCount] = plTotal; DataPoint dp = new DataPoint(); dp.SetValueXY( ConversionAndFormatting.convertToTickMovesString( futurePriceArray[futurePointCount], instrument.tickSize, instrument.tickDisplay), //Math.Round(futurePriceArray[futurePointCount], 2), plTotal); //dp.SetValueY(plTotal); serPrice.Points.Add(dp); } chart1.Series.Clear(); chart1.ResetAutoValues(); chart1.Series.Add(serPrice); } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
public void fillGrid(//Instrument instrument, OptionBuilderSpreadStructure optionBuilderSpreadStructure, Instrument instrument, double futurePrice) { #if DEBUG try #endif { //this.liveADMDataList = liveADMDataList; this.instrument = instrument; this.futurePrice = futurePrice; //if (liveADMDataList.liveADMLegList.Count > 0) { //Type optionPLColTypes = typeof(OPTION_PL_COLUMNS); //Array optionPLColTypesArray = Enum.GetNames(optionPLColTypes); //Type optionSpreadContractTypes = typeof(OPTION_SPREAD_CONTRACT_TYPE); //optionSpreadContractTypesArray = Enum.GetNames(optionSpreadContractTypes); gridViewSpreadGrid.ColumnCount = optionArrayTypes.optionPLColTypesArray.Length - 1; DataGridViewComboBoxColumn myCboBox = new DataGridViewComboBoxColumn(); for (int contractTypeCount = 0; contractTypeCount < optionArrayTypes.optionSpreadContractTypesArray.Length; contractTypeCount++) { myCboBox.Items.Add(optionArrayTypes.optionSpreadContractTypesArray.GetValue(contractTypeCount).ToString()); } gridViewSpreadGrid.Columns.Insert(0, myCboBox); gridViewSpreadGrid.EnableHeadersVisualStyles = false; DataGridViewCellStyle colTotalPortStyle = gridViewSpreadGrid.ColumnHeadersDefaultCellStyle; colTotalPortStyle.BackColor = Color.Black; colTotalPortStyle.ForeColor = Color.White; DataGridViewCellStyle rowTotalPortStyle = gridViewSpreadGrid.RowHeadersDefaultCellStyle; rowTotalPortStyle.BackColor = Color.Black; rowTotalPortStyle.ForeColor = Color.White; gridViewSpreadGrid.Columns[(int)OPTION_PL_COLUMNS.CONTRACT_TYPE].Width = 80; gridViewSpreadGrid.Columns[(int)OPTION_PL_COLUMNS.STRIKE].Width = 60; gridViewSpreadGrid.Columns[(int)OPTION_PL_COLUMNS.AVG_PRICE].Width = 60; gridViewSpreadGrid.Columns[(int)OPTION_PL_COLUMNS.NET].Width = 60; gridViewSpreadGrid.Columns[(int)OPTION_PL_COLUMNS.IMPLIED_VOL].Width = 60; gridViewSpreadGrid.Columns[(int)OPTION_PL_COLUMNS.DAYS_TO_EXP].Width = 60; //gridViewSpreadGrid.Columns[(int)OPTION_PL_COLUMNS.RISK_FREE].Width = 60; StringBuilder sb = new StringBuilder(); for (int i = 0; i < optionArrayTypes.optionPLColTypesArray.Length; i++) { sb.Clear(); sb.Append(optionArrayTypes.optionPLColTypesArray.GetValue(i).ToString()); gridViewSpreadGrid .Columns[i] .HeaderCell.Value = sb.ToString().Replace('_', ' '); } gridViewSpreadGrid.RowCount = optionBuilderSpreadStructure.optionBuildLegStructureArray.Length; for (int legCount = 0; legCount < optionBuilderSpreadStructure.optionBuildLegStructureArray.Length; legCount++) { gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.CONTRACT_TYPE].Value = optionArrayTypes.optionSpreadContractTypesArray.GetValue( (int)optionBuilderSpreadStructure.optionBuildLegStructureArray[legCount] .optionParameters[(int)OPTION_CONFIG_LIST.OPT_CALL_PUT_OR_FUT]).ToString(); //gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.STRIKE].Value = // liveADMDataList.liveADMLegList[legCount].strike; //ConversionAndFormatting.convertToTickMovesString( // avgPrice, // instrument.optionTickSize, instrument.optionTickDisplay); //* instrument.admFuturePriceFactor; if ((int)optionBuilderSpreadStructure.optionBuildLegStructureArray[legCount] .optionParameters[(int)OPTION_CONFIG_LIST.OPT_CALL_PUT_OR_FUT] == (int)OPTION_SPREAD_CONTRACT_TYPE.FUTURE) { //double decimals = Math.Pow(10,-(instrument.tickSize.ToString().Substring( //instrument.tickSize.ToString().IndexOf(".") + 1).Length)); //bool notFound = true; int tempLegCounter = 0; while (tempLegCounter < optionBuilderSpreadStructure.optionBuildLegStructureArray.Length) { if ( optionBuilderSpreadStructure.optionBuildLegStructureArray[tempLegCounter] .optionBuildLegDataAtRollDateList[1].optionSettlementDataArray.Length > 0) { break; } tempLegCounter++; } if (tempLegCounter < optionBuilderSpreadStructure.optionBuildLegStructureArray.Length) { double avgPrice = optionBuilderSpreadStructure.optionBuildLegStructureArray[tempLegCounter] .optionBuildLegDataAtRollDateList[1].optionSettlementDataArray.Last().underlyingFuturesContractSettlement; gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value = ConversionAndFormatting.convertToTickMovesString( avgPrice, instrument.tickSize, instrument.tickDisplay); } else { double avgPrice = optionBuilderSpreadStructure.optionBuildLegStructureArray[legCount] .optionBuildLegDataAtRollDateList[1].optionBuildContractLegDataPoint.Last().underlyingFutureClose; gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value = ConversionAndFormatting.convertToTickMovesString( avgPrice, instrument.tickSize, instrument.tickDisplay); } } else { //double decimals = Math.Pow(10,-(instrument.optionTickSize.ToString().Substring( //instrument.optionTickSize.ToString().IndexOf(".") + 1).Length)); gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.STRIKE].Value = ConversionAndFormatting.convertToTickMovesString( //optionBuilderSpreadStructure.optionBuildLegStructureArray[legCount] // .optionBuildLegDataAtRollDateList.Last().optionStrikePrice, optionBuilderSpreadStructure.optionBuildLegStructureArray[legCount] .optionBuildLegDataAtRollDateList[1] .optionSettlementDataArray.Last().strikePrice, instrument.optionStrikeIncrement, instrument.optionStrikeDisplay); double avgPrice = optionBuilderSpreadStructure.optionBuildLegStructureArray[legCount] .optionBuildLegDataAtRollDateList[1].optionSettlementDataArray.Last().optionSettlementPrice; gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.AVG_PRICE].Value = //liveADMDataList.liveADMLegList[legCount].averagePrice; ConversionAndFormatting.convertToTickMovesString( avgPrice, instrument.optionTickSize, instrument.optionTickDisplay); } gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.NET].Value = optionBuilderSpreadStructure.optionBuildLegStructureArray[legCount] .optionParameters[(int)OPTION_CONFIG_LIST.OPT_CONTRACTS]; gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.IMPLIED_VOL].Value = 0; gridViewSpreadGrid.Rows[legCount].Cells[(int)OPTION_PL_COLUMNS.DAYS_TO_EXP].Value = 0; } } fillChart(); } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }
public void setupAdmInputSummaryGrid(List <ADMPositionImportWeb> admSummaryFieldsList, int instrumentSelectedIdx) { #if DEBUG try #endif { this.instrumentSelectedIdx = instrumentSelectedIdx; //fileImportType = ADM_IMPORT_FILE_TYPES.ADM_WEB_POSITIONS; this.admSummaryFieldsList = admSummaryFieldsList; Type admSummaryFieldDisplayedTypes = typeof(ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED); Array admSummaryFieldDisplayedTypeArray = Enum.GetNames(admSummaryFieldDisplayedTypes); admInputSummaryGrid.ColumnCount = admSummaryFieldDisplayedTypeArray.Length; // admSummaryFieldTypeArray.Length; admInputSummaryGrid.EnableHeadersVisualStyles = false; DataGridViewCellStyle colTotalPortStyle = admInputSummaryGrid.ColumnHeadersDefaultCellStyle; colTotalPortStyle.BackColor = Color.Black; colTotalPortStyle.ForeColor = Color.White; DataGridViewCellStyle rowTotalPortStyle = admInputSummaryGrid.RowHeadersDefaultCellStyle; rowTotalPortStyle.BackColor = Color.Black; rowTotalPortStyle.ForeColor = Color.White; for (int i = 0; i < admInputSummaryGrid.ColumnCount; i++) { admInputSummaryGrid.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; admInputSummaryGrid.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } //int col = 0; for (int admCount = 0; admCount < admSummaryFieldDisplayedTypeArray.Length; admCount++) { admInputSummaryGrid.Columns[admCount].HeaderCell.Value = admSummaryFieldDisplayedTypeArray.GetValue(admCount).ToString().Replace('_', ' '); } admInputSummaryGrid.RowCount = admSummaryFieldsList.Count; //int col = 0; for (int admRowCounter = 0; admRowCounter < admSummaryFieldsList.Count; admRowCounter++) { admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.RecordType].Value = admSummaryFieldsList[admRowCounter].RecordType; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.Office].Value = admSummaryFieldsList[admRowCounter].POFFIC; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.Acct].Value = admSummaryFieldsList[admRowCounter].PACCT; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.Description].Value = admSummaryFieldsList[admRowCounter].Description; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.LongQuantity].Value = (int)admSummaryFieldsList[admRowCounter].LongQuantity; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.ShortQuantity].Value = (int)admSummaryFieldsList[admRowCounter].ShortQuantity; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.TradeDate].Value = admSummaryFieldsList[admRowCounter].TradeDate; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.TradePrice].Value = admSummaryFieldsList[admRowCounter].TradePrice; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.WeightedPrice].Value = admSummaryFieldsList[admRowCounter].WeightedPrice; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.SettledPrice].Value = admSummaryFieldsList[admRowCounter].SettledPrice; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.SettledValue].Value = admSummaryFieldsList[admRowCounter].SettledValue; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.Currency].Value = admSummaryFieldsList[admRowCounter].Currency; // admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_FIELDS.PSUBTY].Value // = admSummaryFieldsList[admRowCounter].PSUBTY; // admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_FIELDS.PEXCH].Value // = admSummaryFieldsList[admRowCounter].PEXCH; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.PFC].Value = admSummaryFieldsList[admRowCounter].PFC; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.Strike].Value = admSummaryFieldsList[admRowCounter].aDMStrike; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.PCTYM].Value = admSummaryFieldsList[admRowCounter].PCTYM; admInputSummaryGrid.Rows[admRowCounter].Cells[(int)ADM_SUMMARY_WEB_POSITION_FIELDS_DISPLAYED.INSTRUMENT_ID].Value = admSummaryFieldsList[admRowCounter].instrumentArrayIdx; } updateSelectedInstrumentFromTreeADM(instrumentSelectedIdx); } #if DEBUG catch (Exception ex) { TSErrorCatch.errorCatchOut(Convert.ToString(this), ex); } #endif }