public async Task <List <string> > GetUserEmails() { var appUsers = await BR.GetAppUsers(); appUsers = appUsers.Where(e => e.EnableLiveTrading == "Y").ToList(); return(appUsers.Select(e => e.Email).ToList()); }
public async Task ExcecuteMarketTrade(NewOrderRequest orderRequest, AlpacaEnviornment type) { var tasks = new List <Task>(); var trades = new List <TradeTemplate>(); var users = await BR.GetAppUsers(); users = users.Where(e => e.EnableLiveTrading == "Y").ToList(); users.Where(asdfadf => asdfadf.EnablePaperTrading == "Y").ToList(); foreach (var user in users) { var keys = new AlpacaKeys() { LiveApiKey = user.ApiKey, LiveSecretKey = user.SecretKey, PaperApiKey = user.PaperApiKey, PaperSecretKey = user.PaperSecretKey }; var template = new TradeTemplate(type, keys, orderRequest, user.UserId, user); trades.Add(template); } trades.ForEach(e => tasks.Add(e.ExecuteOrder())); await Task.WhenAll(tasks); Logger.Info("Trades"); }