// // // // // private void UpdateEventList() { if (comboBoxInstrumentNames.SelectedItem == null) { return; } InstrumentName name = (InstrumentName)comboBoxInstrumentNames.SelectedItem; listBoxFillEvents.SuspendLayout(); listBoxFillEvents.Items.Clear(); string s; EventSeries series = m_EventPlayer.SeriesList[name]; for (int i = 0; i < series.Series.Count; ++i) { Fill fill = series.Series[i]; s = string.Format("{0} \t{1}", fill.LocalTime.ToString(Misty.Lib.Utilities.Strings.FormatDateTimeZone), fill); listBoxFillEvents.Items.Add(s); } listBoxFillEvents.ResumeLayout(); // Update the initial book state. s = string.Format("{0}", series.InitialState.LocalTime.ToString(Misty.Lib.Utilities.Strings.FormatDateTimeZone)); textStartingBookDateTime.Text = s; s = string.Format("{0}", series.InitialState); textStartingBookFill.Text = s; // update the final book state. s = string.Format("{0}", series.FinalState.LocalTime.ToString(Misty.Lib.Utilities.Strings.FormatDateTimeZone)); textFinalBookDateTime.Text = s; s = string.Format("{0}", series.FinalState); textFinalBookFill.Text = s; }
}// UpdateInstrumentNameList() // // // // // **** Update Event List **** // private void UpdateEventList() { if (comboBoxInstrumentNames.SelectedItem == null) { return; } InstrumentName name = (InstrumentName)comboBoxInstrumentNames.SelectedItem; // Determine selected instrument. DateTime selectedDateTime = DateTime.MinValue; // DateTime that is currently selected... object selectedItem = listBoxFillEvents.SelectedItem; // Determine selected item. if (selectedItem != null) { string s1 = selectedItem.ToString(); DateTime.TryParse(s1.Substring(0, s1.IndexOf('\t', 0)), out selectedDateTime); } // Update the listbox. listBoxFillEvents.SuspendLayout(); listBoxFillEvents.Items.Clear(); EventSeries series = m_EventPlayer.SeriesList[name]; this.textBoxInitialState.Text = string.Format(FillFormat, series.InitialState.LocalTime.ToString(Misty.Lib.Utilities.Strings.FormatDateTimeFull), series.InitialState); int selectedIndex = 0; for (int i = 0; i < series.Series.Count; ++i) { Fill fill = series.Series[i]; string s = string.Format(FillFormat, fill.LocalTime.ToString(Misty.Lib.Utilities.Strings.FormatDateTimeFull), fill); listBoxFillEvents.Items.Add(s); //m_SelectedPosQty += fill.Qty; if (fill.LocalTime.CompareTo(selectedDateTime) >= 0) { selectedIndex = i; } } listBoxFillEvents.ResumeLayout(); // Select a fill. if (selectedIndex < listBoxFillEvents.Items.Count) { listBoxFillEvents.SelectedIndex = selectedIndex; } }
// // // // // ********************************************************** // **** Update Selected Event() ***** // ********************************************************** // private void UpdateSelectedEvent() { // Validate if (comboBoxInstrumentNames.SelectedItem == null) { return; } InstrumentName name = (InstrumentName)comboBoxInstrumentNames.SelectedItem; // Determine selected instrument. int selectedIndex = listBoxFillEvents.SelectedIndex; // Selected event index if (selectedIndex < 0) { if (m_EventPlayer.SeriesList[name].InitialState == null) { this.textSelectedDate.Text = " "; this.textSelectedTime.Text = " "; this.textSelectedEXTime.Text = " "; this.textSettletime.Text = " "; this.textSelectedFill.Text = " "; this.textSelectedPosition.Text = " "; } else { this.textSelectedDate.Text = string.Format("{0:ddd dd MMM yyyy}", m_EventPlayer.SeriesList[name].InitialState.LocalTime); this.textSelectedTime.Text = string.Format("{0:hh:mm:ss.fff tt}", m_EventPlayer.SeriesList[name].InitialState.LocalTime); this.textSelectedEXTime.Text = string.Format("{0:hh:mm:ss.fff tt}", m_EventPlayer.SeriesList[name].InitialState.LocalTime); this.textSettletime.Text = ""; this.textSelectedFill.Text = " "; this.textSelectedPosition.Text = string.Format("{0}", m_EventPlayer.SeriesList[name].InitialState); } return; } else if (selectedIndex >= m_EventPlayer.SeriesList[name].Series.Count) { listBoxFillEvents.SelectedIndex = m_EventPlayer.SeriesList[name].Series.Count - 1; } EventSeries series = m_EventPlayer.SeriesList[name]; int m_SelectedPosQty = 0; double m_SelectedPosCost = 0; m_SelectedPosQty = series.InitialState.Qty; for (int i = 0; i <= selectedIndex; ++i) { m_SelectedPosQty += series.Series[i].Qty; } // Fill Fill selectedFill = series.Series[selectedIndex]; this.textSelectedDate.Text = string.Format("{0:ddd dd MMM yyyy}", selectedFill.LocalTime); // prepare settlement information ProductSettlementEntry SettlementEntry; m_ProductSettlementTable.TryFindMatchingEntry(series.Name, out SettlementEntry); DateTime m_SettleDate = m_SettlementDate.Add(SettlementEntry.SettleTime); DateTime settleTimeLocal = TimeZoneInfo.ConvertTime(m_SettleDate, SettlementEntry.TZInfo, TimeZoneInfo.Local); this.textSettletime.Text = string.Format("{0:hh:mm:ss.fff tt}", settleTimeLocal); this.EXSettle.Text = SettlementEntry.SettleTime.ToString(); // settlement information ends here this.textSelectedTime.Text = string.Format("{0:hh:mm:ss.fff tt}", selectedFill.LocalTime); this.textSelectedEXTime.Text = string.Format("{0:hh:mm:ss.fff tt}", selectedFill.ExchangeTime); this.textSelectedFill.Text = string.Format("{0} @ {1}", selectedFill.Qty, selectedFill.Price); this.textSelectedPosition.Text = string.Format("{0} @ {1}", m_SelectedPosQty, m_SelectedPosCost); }