Ejemplo n.º 1
0
 public static ExchangeStatus CurrentExchangeStatus(Exchange exchange)
 {
     try
     {
         if (IsDateBusinessDay(DateTime.Now))
         {
             if (m_oOpeningHours == null)
             {
                 GoogleHistoricalDataInterpreter oGHDI = new GoogleHistoricalDataInterpreter();
                 m_oOpeningHours = oGHDI.GetStartEndOfExchange(Instruments[0], exchange); //ugly, what happens when the first instruments doesn't exists at the exchange...?
             }
             if ((DateTime.Now >= m_oOpeningHours.Item1 && DateTime.Now <= m_oOpeningHours.Item2))
             {
                 m_oExchangeStatus = ExchangeStatus.Open;
             }
             else
             {
                 m_oExchangeStatus = ExchangeStatus.Closed;
             }
         }
         else
         {
             m_oExchangeStatus = ExchangeStatus.Closed;
         }
     }
     catch
     {
         m_oExchangeStatus = ExchangeStatus.Undefined;
     }
     return(m_oExchangeStatus);
 }