Exemple #1
0
        private void ImpliedMarketTimer_Tick(object sender, EventArgs e)
        {
            bool canCalculateImpliedMarket = true;

            for (int i = 0; i < legs.Count; i++)
            {
                legs[i] = _level2PanelList[i].getRecentQuoteBook();
                if (legs[i].AskBk == null)
                {
                    canCalculateImpliedMarket = false;
                }
            }

            if (!canCalculateImpliedMarket)
            {
                return;
            }

            SpreadCalculationHelper.ImpliedMarketData impMkt = impliedMarket.CalculateImpliedMarket(legs);
            QuoteInfo infoBid = new QuoteInfo(), infoAsk = new QuoteInfo();

            infoBid.prc = impMkt.bidPrice;
            infoBid.sz  = impMkt.bidSize;
            infoAsk.prc = impMkt.askPrice;
            infoAsk.sz  = impMkt.askSize;
            bookToSendToLevel2Panel.BidBk = new QuoteInfo[] { infoBid };
            bookToSendToLevel2Panel.AskBk = new QuoteInfo[] { infoAsk };

            SendInfraData(bookToSendToLevel2Panel);
        }
        private void ImpliedMarketTimer_Tick(object sender, EventArgs e)
        {
            bool canCalculateImpliedMarket = true;

            for (int i = 1; i < Level2Forms.Count; i++)
            {
                legs[i - 1] = Level2Forms[i].getRecentQuoteBook();
                if (legs[i - 1].AskBk == null)
                {
                    canCalculateImpliedMarket = false;
                }
            }

            if (canCalculateImpliedMarket)
            {
                SpreadCalculationHelper.ImpliedMarketData impMkt = _spreadCalc.CalculateImpliedMarket(legs);
                QuoteInfo infoBid = new QuoteInfo()
                {
                    prc = impMkt.bidPrice, sz = impMkt.bidSize
                };
                QuoteInfo infoAsk = new QuoteInfo()
                {
                    prc = impMkt.askPrice, sz = impMkt.askSize
                };
                impliedMarketBook.BidBk = new QuoteInfo[] { infoBid };
                impliedMarketBook.AskBk = new QuoteInfo[] { infoAsk };

                Level2Forms[0].InfraDataReceiveHandler(impliedMarketBook);
            }
        }