public static void TestArcticDateTimeIndex(string lib = "net.securities", string host = "localhost", bool purge = true, bool del = true, string symbol = "S1") { var driver = new MongoClient("mongodb://" + host); var arctic = new Arctic(driver, lib, purge: purge); if (del) { var delcnt = arctic.DeleteAsync(symbol).Result; Console.WriteLine("Deleted {0} versi\tons for {1}".Args(delcnt, symbol)); } var df = new DataFrame(new Series[] { new DateTimeSeries(new[] { new DateTime(2014, 1, 1), new DateTime(2014, 2, 1) }, name: "date"), new Series <long>(new long[] { 1, 2 }, name: "val") }, index: "date"); var df2 = new DataFrame(new Series[] { new DateTimeSeries(new[] { new DateTime(2014, 3, 1), new DateTime(2014, 4, 1) }, name: "date"), new Series <long>(new long[] { 3, 4 }, name: "val") }, index: "date"); var df4 = new DataFrame(new Series[] { new DateTimeSeries(new[] { new DateTime(2014, 3, 1), new DateTime(2014, 4, 1), new DateTime(2014, 5, 1) }, name: "date"), new Series <long>(new long[] { 3, 4, 5 }, name: "val") }, index: "date"); var df3 = new DataFrame(new Series[] { new DateTimeSeries(new[] { new DateTime(2014, 5, 1), new DateTime(2014, 6, 1) }, name: "date"), new Series <long>(new long[] { 5, 6 }, name: "val") }, index: "date"); Stopwatch sw = new Stopwatch(); sw.Start(); var version = arctic.AppendAsync(symbol, df, CHUNKSIZE).Result; var version2 = arctic.AppendAsync(symbol, df2, CHUNKSIZE).Result; var version3 = arctic.AppendAsync(symbol, df2, CHUNKSIZE).Result; var version4 = arctic.AppendAsync(symbol, df4, CHUNKSIZE).Result; var read1 = arctic.Read(symbol, new DateRange(new DateTime(2014, 3, 1))); Console.WriteLine(read1); var read2 = arctic.Read(symbol, new DateRange(new DateTime(2014, 1, 1), new DateTime(2014, 2, 1))); Console.WriteLine(read2); sw.Stop(); long rows = df.Rows.Count;// + df2.Rows.Count; Console.WriteLine("write {0} took {1}s = {2}/sec -> ver:\n {3}".Args(rows, sw.Elapsed.TotalSeconds, rows / sw.Elapsed.TotalSeconds, version)); }
public static void TestWriteArctic(string lib = "net.securities", string host = "localhost", bool purge = true, bool del = true, string symbol = "S1") { var driver = new MongoClient("mongodb://" + host); var arctic = new Arctic(driver, lib, purge: purge); if (del) { var delcnt = arctic.DeleteAsync(symbol).Result; Console.WriteLine("Deleted {0} versi\tons for {1}".Args(delcnt, symbol)); } //var df = SampleDataFrame (); var df = RandomDataFrame(); //var df2 = SampleDataFrame (df[0].AsDateTime()[-1]); Stopwatch sw = new Stopwatch(); sw.Start(); var version = arctic.AppendAsync(symbol, df, CHUNKSIZE).Result; //var version2 = arctic.AppendAsync (symbol, df2, CHUNKSIZE).Result; sw.Stop(); long rows = df.Rows.Count;// + df2.Rows.Count; Console.WriteLine("write {0} took {1}s = {2}/sec -> ver:\n {3}".Args(rows, sw.Elapsed.TotalSeconds, rows / sw.Elapsed.TotalSeconds, version)); }