public void BasicUsage() { var reader = new CsvPriceReader("stock1.csv"); PriceItem price = null; int count = 0; bool foundStopper = false; reader.NewPrice += (sender, e) => { if (e.NewPrice == null) { foundStopper = true; } else { TestOutput.WriteLine($"{e.NewPrice.Date:s} {e.NewPrice.Last,10:n2} {e.NewPrice.Bid,10:n2} {e.NewPrice.Offer,10:n2}"); price = e.NewPrice; count++; } }; reader.Start(); Assert.Equal(4, count); Assert.True(foundStopper); }
public void BasicUsage() { var reader = new CsvPriceReader(StockFileName1); int count = 0; //var item = new PriceItem(); decimal price = 0m; bool foundStopper = false; reader.NewPrice += (sender, e) => { if (e.NewPrice == null) { foundStopper = true; } else { TestOutput.WriteLine($"{e.NewPrice.Date:s} {e.NewPrice.Last,10:n2} {e.NewPrice.Bid,10:n2} {e.NewPrice.Offer,10:n2}"); price = e.NewPrice.Last; count++; //foundStopper = true; } }; reader.Start(); Assert.Equal(4, count); Assert.Equal(16.0m, price); Assert.True(foundStopper); }
static void Main(string[] args) { var priceReader = new CsvPriceReader(args[0]); var reader = new CandleStickReader(timeframe: 5, PriceReader: priceReader); reader.NewCandleStick += C_NewCandleStick; reader.Start(); }
static void Main(string[] args) { // arrange var p = new CsvPriceReader("STOCK.csv.txt"); var c = new CandleStickReader(timeframe: 15, priceReader: p); c.NewCandleStick += C_NewCandleStick; c.Start(); //Console.ReadKey(); }
static void Main(string[] args) { // arrange if (args.Length < 1) { Console.WriteLine("Usage: GF.BackTesting.Client.Exe <FileName>"); return; } var p = new CsvPriceReader(args[0]); var c = new CandleStickReader(timeframe: 15, priceReader: p); c.NewCandleStick += C_NewCandleStick; c.Start(); //Console.ReadKey(); }