// Submit an order if quantity is not zero. private async Task SubmitOrder(Int32 quantity, Decimal price, OrderSide side) { if (quantity == 0) { Console.WriteLine("No order necessary."); return; } Console.WriteLine($"Submitting {side} order for {quantity} shares at ${price}."); var order = await alpacaTradingClient.PostOrderAsync( side.Limit(symbol, quantity, price)); lastTradeId = order.OrderId; }
// Submit an order if quantity is not zero. public async Task SubmitOrder(int quantity, Decimal price, OrderSide side) { if (quantity == 0) { Console.WriteLine("No order necessary."); return; } Console.WriteLine($"Submitting {side} order for {quantity} shares at ${price}."); var order = ironfe.IronTrade.PostOrderAsync( side.Limit(symbol, quantity, price), token).Result; lastTradeId = order.OrderId; }
// Submit an order if quantity is not zero. private async Task SubmitOrder(Int32 quantity, Decimal price, OrderSide side) { if (quantity == 0) { return; } try { var order = await alpacaTradingClient.PostOrderAsync( side.Limit(symbol, quantity, price)); lastTradeId = order.OrderId; lastTradeOpen = true; } catch (Exception e) { Console.WriteLine("Warning: " + e.Message); } }
/// <summary> /// Submit Order takes the quantaty price you are willing to pay and if it is a sell or buy order /// </summary> /// <param name="quantity"></param> /// <param name="price"></param> /// <param name="side"></param> /// <param name="ticker" </param> /// <returns></returns> /// /// Alpaca API version public async Task SubmitOrder(int quantity, decimal price, OrderSide side, string ticker = "") { if (quantity == 0) { return; } try { var order = await ironfe.IronTrade.PostOrderAsync( side.Limit(ticker, quantity, price), Token); var lastTradeId = order.OrderId; var lastTradeOpen = true; } catch (Exception e) { Console.WriteLine("Warning: " + e.Message); } }