// // #endregion// members #region Constructors // ***************************************************************** // **** Constructors **** // ***************************************************************** public FormAddFills(UV.TTServices.Markets.MarketTTAPI priceHub, FillHub aFillHub) { InitializeComponent(); Log = aFillHub.Log; m_FillHub = aFillHub; m_Market = priceHub; this.buttonDeleteBook.Text = ButtonDeleteBook_Normal; // set this to normal this.buttonDeleteBook.Enabled = false; // TODO: disable until i can work out the "dupe key" problems. #if (DEBUG) this.buttonDeleteBook.Enabled = false; #endif }
// // #endregion//Constructors #region Public Methods // ***************************************************************** // **** Public Methods **** // ***************************************************************** /// <summary> /// When an instrument is clicked on in the position viewer window, that window /// calls this routine letting us know which instrument is active. /// </summary> /* * public void SetInstrument(FillHub fillHub, UV.Lib.Products.InstrumentBase instrument) * { * m_CurrentInstrument = instrument; // set current instrument * m_FillHub = fillHub; // set current fill hub * this.Text = string.Format("Add Fills - {0}", m_CurrentInstrument.FullName); * this.labelInstrumentName.Text = m_CurrentInstrument.FullName; * this.labelExpirationDate.Text = string.Format("{0:ddd dd MMM yyyy}", m_CurrentInstrument.ExpirationDate); * * // Update Markets * UV.Lib.BookHubs.Book aBook; * if (m_Market.TryEnterReadBook(out aBook)) * { * foreach (UV.Lib.BookHubs.MarketInstrument mktInstr in aBook.Instruments.Values) * { * if (mktInstr.Name.Equals(m_CurrentInstrument.FullName)) * { * labelAskPrice.Text = mktInstr.Price[UV.Lib.Utilities.QTMath.AskSide][0].ToString(); * labelBidPrice.Text = mktInstr.Price[UV.Lib.Utilities.QTMath.BidSide][0].ToString(); * labelAskQty.Text = mktInstr.Qty[UV.Lib.Utilities.QTMath.AskSide][0].ToString(); * labelBidQty.Text = mktInstr.Qty[UV.Lib.Utilities.QTMath.BidSide][0].ToString(); * break; * } * } * m_Market.ExitReadBook(aBook); * } * // Reset defaults * SetConfirmMode(buttonSubmitFill,false,0); * }//SetInstrument() * // */ // // public void SetInstrument(FillHub fillHub, InstrumentName instrument) { m_CurrentInstrument = instrument; // set current instrument m_FillHub = fillHub; // set current fill hub this.Text = string.Format("Add Fills - {0}", m_CurrentInstrument.FullName); this.labelInstrumentName.Text = m_CurrentInstrument.FullName; /* * UV.Lib.Products.InstrumentBase instrBase; * if (m_Market.TryGetInstrument(instrument, out instrBase)) * { * this.labelExpirationDate.Text = string.Format("{0:ddd dd MMM yyyy}", instrBase.ExpirationDate); * } * else * this.labelExpirationDate.Text = "unknown market instr"; */ TradingTechnologies.TTAPI.InstrumentDetails details; if (m_Market.TryLookupInstrumentDetails(instrument, out details)) { this.labelExpirationDate.Text = string.Format("{0:ddd dd MMM yyyy}", details.ExpirationDate.ToDateTime()); } else { this.labelExpirationDate.Text = "unknown market instr"; } // Update Markets Book aBook; if (m_Market.TryEnterReadBook(out aBook)) { foreach (Market mktInstr in aBook.Instruments.Values) { if (mktInstr.Name.Equals(m_CurrentInstrument)) { labelAskPrice.Text = mktInstr.Price[QTMath.AskSide][0].ToString(); labelBidPrice.Text = mktInstr.Price[QTMath.BidSide][0].ToString(); labelAskQty.Text = mktInstr.Qty[QTMath.AskSide][0].ToString(); labelBidQty.Text = mktInstr.Qty[QTMath.BidSide][0].ToString(); break; } } m_Market.ExitReadBook(aBook); } // Reset defaults SetConfirmMode(buttonSubmitFill, false, 0); }//SetInstrument()
}// // // // // private void FormAddFills_FormClosing(object sender, FormClosingEventArgs e) { m_Market = null; m_FillHub = null; Log = null; }