예제 #1
0
        /// <summary>
        /// Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object
        /// each time it is called.
        /// </summary>
        public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)
        {
            //New USDINR object
            DollarRupee currency = new DollarRupee();

            try
            {
                string[] data = line.Split(',');
                currency.Time   = DateTime.Parse(data[0], CultureInfo.InvariantCulture);
                currency.Close  = Convert.ToDecimal(data[1], CultureInfo.InvariantCulture);
                currency.Symbol = "USDINR";
                currency.Value  = currency.Close;
            }
            catch
            {
            }

            return(currency);
        }
예제 #2
0
 /// <summary>
 /// Event Handler for Nifty Data Events: These Nifty objects are created from our
 /// "Nifty" type below and fired into this event handler.
 /// </summary>
 /// <param name="data">One(1) Nifty Object, streamed into our algorithm synchronised in time with our other data streams</param>
 public void OnData(DollarRupee data)
 {
     today = new CorrelationPair(data.Time);
     today.CurrencyPrice = Convert.ToDouble(data.Close);
 }