Ejemplo n.º 1
0
 // *****************************************************************
 // ****                     Public Methods                      ****
 // *****************************************************************
 //
 //
 // *************************************************************
 // ****             MarketInstrumentInitialized()           ****
 // *************************************************************
 /// <summary>
 /// called once the market for all instruments is subscribed to and we have instrument
 /// details
 /// </summary>
 public override void MarketInstrumentInitialized(Lib.BookHubs.Book marketBook)
 {
     base.MarketInstrumentInitialized(marketBook);
     if (!TryIntitialize())
     {
         m_Log.NewEntry(LogLevel.Error, "RiskManager : Failed To Initialize, Couldn't Find All Instrument Details");
     }
     FatFingerTicks = m_FatFingerTicks;                        // set our tolerances
     RiskIsReady    = true;                                    // set our state to ready
     m_OrderEngine.m_IsRiskCheckPassed = true;                 // let our order engine begin to send orders.
 }
Ejemplo n.º 2
0
        //
        //
        //
        #endregion//Event Handlers

        #region ITimerSubscriber Implementation
        public void TimerSubscriberUpdate(Lib.BookHubs.Book aBook)
        {
            if (PnLCheck(aBook) | CheckQuoteLimits())    // max loss pnl tripped or max number of quotes per second exceeded
            {
                FlagRiskEvents();
            }
            m_SecondCount++;                            // increment our second counter
            if (m_IsRiskTriggered)
            {
                m_RiskCount++;
                if (m_RiskCount == 2)
                {
                    m_Log.NewEntry(LogLevel.Error, "Risk Event Triggered! Pausing Strategy");
                }
            }
            m_TotalNumberOfQuotes     += m_NumberOfQuotesThisSecond; // Add to total's count.
            m_NumberOfQuotesThisSecond = 0;                          // reset count each second.
            //base.BroadcastParameter(m_Quoter.m_StrategyHub, m_Quoter.m_Strategy, 4);
        }
Ejemplo n.º 3
0
        //
        #endregion//Properties

        #region Public Methods
        // *****************************************************************
        // ****                 Public Methods                         ****
        // *****************************************************************
        //
        //
        // *************************************************************
        // ****             MarketInstrumentInitialized()           ****
        // *************************************************************
        //
        /// <summary>
        /// called once the market for all instruments is subscribed to and we have instrument
        /// details
        /// </summary>
        public override void MarketInstrumentInitialized(Lib.BookHubs.Book marketBook)
        {
            if (m_IsMarketReady)
            {
                return;
            }
            m_IsMarketReady = true;
            if (m_StrategyHub.m_Market.TryGetInstrumentDetails(m_Instrument, out m_InstrumentDetails))
            {
                if (m_FillBook == null)
                {
                    m_FillBook = new FillBook(m_Instrument.ToString(), m_InstrumentDetails.Multiplier);
                }
                if (double.IsNaN(m_QuoteTickSize))                      // if our user hasn't defined this yet
                {
                    m_QuoteTickSize = m_InstrumentDetails.TickSize;     // set it to the default tick size here
                }
            }
            else
            {
                Log.NewEntry(LogLevel.Error,
                             "OrderEngine:MarketInstrumentInitialized failed to get instrument details and create order book for {0}", m_Instrument);
            }
        }