public async Task ReportSell(IBroker broker, Sample sample) { PrintWithColor(ConsoleColor.Red, $"Executed sell @ {sample.Value:0.####}: Value={broker.GetTotalValue(sample):0.####} ({broker.Asset2Holdings} asset 2)"); using (var appender = file.AppendText()) { await appender.WriteLineAsync($"{DateTime.Now},{sample.Value},sell,{broker.Asset2Holdings},{broker.Asset1Holdings}"); await appender.FlushAsync(); } }