public static async Task StoreDay1Bars(string symbol, List <Bar> bars) { List <Point> points = new List <Point>(); foreach (Bar aBar in bars) { Point aPoint = new Point { Name = "Bar.Daily", Fields = new Dictionary <string, object> { { "LastClose", aBar.LastClose }, { "Open", aBar.Open }, { "High", aBar.High }, { "Low", aBar.Low }, { "Close", aBar.Close }, { "Volume", aBar.Volume }, { "Amount", aBar.Amount } }, Tags = new Dictionary <string, object> { { "Symbol", symbol } }, Timestamp = aBar.BeginTime }; points.Add(aPoint); } await InfluxHelper.WriteAsync(points, dbName); }
public static async Task StoreTrades(string symbol, List <Trade> trades) { List <Point> points = new List <Point>(); foreach (Trade aTrade in trades) { Point aPoint = new Point { Name = "Trade", Fields = new Dictionary <string, object> { { "Price", aTrade.Price }, { "Volume", aTrade.Volume }, { "Amount", aTrade.Amount } }, Tags = new Dictionary <string, object> { { "Symbol", symbol } }, Timestamp = aTrade.DateTime }; points.Add(aPoint); } await InfluxHelper.WriteAsync(points, dbName); }