private static async Task SubmitLimitOrder(string symbol, OrderSide orderSide, decimal price, int quantity) { LimitOrder order; IAlpacaTradingClient client; client = Core.ServiceProvider.GetService <IAlpacaTradingClient>(); if (orderSide == OrderSide.Buy) { order = LimitOrder.Buy(symbol, quantity, price); try { var result = await client.PostOrderAsync(order); Core.Logger.LogInfo($"Order for {result.Symbol} submitted at {result.CreatedAtUtc}"); } catch (Exception e) { Core.Logger.LogError($"{symbol} could not be limit ordered: {e.Message}"); } } if (orderSide == OrderSide.Sell) { order = LimitOrder.Sell(symbol, quantity, price); try { var result = await client.PostOrderAsync(order); Core.Logger.LogInfo($"Order for {result.Symbol} submitted at {result.CreatedAtUtc}"); } catch (Exception e) { Core.Logger.LogError($"{symbol} could not be limit ordered: {e.Message}"); } } }