Ejemplo n.º 1
0
        public void ImportFromCsv()
        {
            var importer = new CsvImporter("fb.csv", new CultureInfo("en-US"));
            var candles  = importer.ImportAsync("FB").Result;

            Assert.AreEqual(candles.Count(), 1342);
            var firstIOhlcvData = candles.First();

            Assert.AreEqual(firstIOhlcvData.DateTime, new DateTime(2012, 5, 18));
        }
Ejemplo n.º 2
0
        protected async Task <IEnumerable <Candle> > ImportCandlesAsync()
        {
            var csvImporter = new CsvImporter("fb.csv", new CultureInfo("en-US"));

            return(await csvImporter.ImportAsync("fb"));

            //var yahooImporter = new YahooFinanceImporter();
            //var candles = await yahooImporter.ImportAsync("FB");
            //File.WriteAllLines("fb.csv", candles.Select(c => $"{c.DateTime.ToString("d")},{c.Open},{c.High},{c.Low},{c.Close},{c.Volume}"));
            //return candles;
        }
Ejemplo n.º 3
0
        protected async Task <IEnumerable <IOhlcv> > ImportIOhlcvDatasAsync(string fileName = "fb.csv")
        {
            // Last record: 09/18/2017
            var csvImporter = new CsvImporter(fileName, CultureInfo.GetCultureInfo("en-US"));

            return(await csvImporter.ImportAsync(string.Empty));

            //var yahooImporter = new YahooFinanceImporter();
            //var candles = await yahooImporter.ImportAsync("FB");
            //File.WriteAllLines("fb.csv", candles.Select(c => $"{c.DateTime.ToString("d")},{c.Open},{c.High},{c.Low},{c.Close},{c.Volume}"));
            //return candles;
        }
Ejemplo n.º 4
0
        public Benchmark()
        {
            var config = new CsvImportConfiguration()
            {
                Culture         = "en-US",
                Delimiter       = ";",
                DateFormat      = "yyyyMMdd HHmmss",
                HasHeaderRecord = false
            };
            var importer = new CsvImporter("Data/EURUSD.csv", config);

            _data = importer.ImportAsync("EURUSD").Result.ToArray();
        }
Ejemplo n.º 5
0
        public void ImportFromCsvWithTime()
        {
            var config = new CsvImportConfiguration()
            {
                Culture         = "en-US",
                Delimiter       = ";",
                DateFormat      = "yyyyMMdd HHmmss",
                HasHeaderRecord = false
            };
            var importer = new CsvImporter("EURUSD.csv", config);
            var candles  = importer.ImportAsync("EURUSD").Result;

            Assert.AreEqual(744, candles.Count);
            var firstIOhlcvData = candles.First();

            Assert.AreEqual(new DateTime(2000, 5, 30, 17, 27, 00), firstIOhlcvData.DateTime);
        }
Ejemplo n.º 6
0
        public Benchmark()
        {
            var config = new CsvImportConfiguration()
            {
                Culture         = "en-US",
                Delimiter       = ";",
                DateFormat      = "yyyyMMdd HHmmss",
                HasHeaderRecord = false
            };
            var importer = new CsvImporter("Data/EURUSD.csv", config);

            _data = importer.ImportAsync("EURUSD").Result.ToArray();

            _tradeData = new ITickTrade[_n];
            var d = DateTimeOffset.Now;

            for (int i = 0; i < _n; i++)
            {
                _tradeData[i] = new Trade(d.AddSeconds(i), 1, 1);
            }
        }
Ejemplo n.º 7
0
        public async Task <IEnumerable <Candle> > ImportCandlesAsync()
        {
            var csvImporter = new CsvImporter("fb.csv", new CultureInfo("en-US"));

            return(await csvImporter.ImportAsync("fb"));
        }
Ejemplo n.º 8
0
        public async Task <IEnumerable <IOhlcv> > ImportIOhlcvDatasAsync()
        {
            var csvImporter = new CsvImporter("fb.csv", CultureInfo.GetCultureInfo("en-US"));

            return(await csvImporter.ImportAsync("fb"));
        }
Ejemplo n.º 9
0
        protected async Task <IEnumerable <IOhlcv> > ImportCCiIOhlcvDatasAsync()
        {
            var csvImporter = new CsvImporter("cci_test.csv", CultureInfo.GetCultureInfo("en-US"));

            return(await csvImporter.ImportAsync("cci_test"));
        }
Ejemplo n.º 10
0
        protected async static Task <IEnumerable <IOhlcv> > importData(string file, string symbol)
        {
            var csvImport = new CsvImporter(file, CultureInfo.GetCultureInfo("en-US"));

            return(await csvImport.ImportAsync(symbol));
        }
Ejemplo n.º 11
0
        public async Task <IEnumerable <IOhlcv> > ImportIOhlcvDatasAsync(string script)
        {
            var csvImporter = new CsvImporter(@"Data/" + script + ".csv", CultureInfo.GetCultureInfo("en-US"));

            return(await csvImporter.ImportAsync(script));
        }
        protected async Task <IEnumerable <IOhlcv> > ImportCandlesAsync()
        {
            var csvImporter = new CsvImporter("fb.csv", CultureInfo.GetCultureInfo("en-US"));

            return(await csvImporter.ImportAsync("fb"));
        }