Exemplo n.º 1
0
 protected bool Equals(TradeDataEntry other)
 {
     return Date.Equals(other.Date)
            && Open.Equals(other.Open)
            && High.Equals(other.High)
            && Low.Equals(other.Low)
            && Close.Equals(other.Close)
            && Volume == other.Volume;
 }
Exemplo n.º 2
0
        public void ReadValidCsv()
        {
            var plugin = new CsvDataReaderPlugin();
            var receivedDataEntries = plugin.Read(".\\TestData\\ValidTradeData.csv");

            var expectedDate1 = DateTime.Parse("2013-5-20");
            var expectedTradeDataEntry1 = new TradeDataEntry(expectedDate1, 30.16, 30.39, 30.02, 30.17, 1478200);

            var expectedDate2 = DateTime.Parse("2013-5-17");
            var expectedTradeDataEntry2 = new TradeDataEntry(expectedDate2, 29.77, 30.26, 29.77, 30.26, 2481400);

            var expectedDataEntries = new List<TradeDataEntry> {expectedTradeDataEntry1, expectedTradeDataEntry2};

            CollectionAssert.AreEqual(expectedDataEntries, receivedDataEntries);
        }
Exemplo n.º 3
0
        public void ReadValidXmlData()
        {
            var xmlTradeDataReader = new XmlDataReaderPlugin();

            var expectedDate1 = DateTime.Parse("2013-5-20");
            var expectedTradeDataEntry1 = new TradeDataEntry(expectedDate1, 30.16, 30.39, 30.02, 30.17, 1478200);

            var expectedDate2 = DateTime.Parse("2013-5-17");
            var expectedTradeDataEntry2 = new TradeDataEntry(expectedDate2, 29.77, 30.26, 29.77, 30.26, 2481400);

            var expectedDataEntries = new List<TradeDataEntry> {expectedTradeDataEntry1, expectedTradeDataEntry2};

            var data = xmlTradeDataReader.Read(".\\TestData\\ValidTradeData.xml");

            CollectionAssert.AreEqual(expectedDataEntries, data.ToList());
        }
Exemplo n.º 4
0
        public void ReadValidText()
        {
            var plugin = new TextDataReaderPlugin();
            var receivedDataEntries = plugin.Read(".\\TestData\\ValidTradeData.txt");

            var expectedDate1 = DateTime.Parse("2013-5-20");
            var expectedTradeDataEntry1 = new TradeDataEntry(expectedDate1, 30.16, 30.39, 30.02, 30.17, 1478200);

            var expectedDate2 = DateTime.Parse("2013-5-1");
            var expectedTradeDataEntry2 = new TradeDataEntry(expectedDate2, 27.94, 28.19, 27.61, 27.7, 1006900);

            var expectedDate3 = DateTime.Parse("2013-11-11");
            var expectedTradeDataEntry3 = new TradeDataEntry(expectedDate3, 27.94, 28.19, 27.61, 27.7, 1006900);

            var expectedDataEntries = new List<TradeDataEntry> { expectedTradeDataEntry1, expectedTradeDataEntry2, expectedTradeDataEntry3 };

            CollectionAssert.AreEqual(expectedDataEntries, receivedDataEntries);
        }
Exemplo n.º 5
0
 public NewTradeDataEntriesAppearedEventArgs(TradeDataEntry[] entries)
 {
     Entries = entries;
 }
Exemplo n.º 6
0
 public TradeDataEntry ToTradeDataEntry()
 {
     var date = DateTime.ParseExact(Date, "yyyy-M-d", null);
     var domainDataEntry = new TradeDataEntry(date, Open, High, Low, Close, Volume);
     return domainDataEntry;
 }