/// <summary>
 /// Creates new order for execution using Alpaca REST API endpoint.
 /// </summary>
 /// <param name="orderBase">New order placement request parameters.</param>
 /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
 /// <returns>Read-only order information object for newly created order.</returns>
 public Task <IOrder> PostOrderAsync(
     OrderBase orderBase,
     CancellationToken cancellationToken = default)
 {
     orderBase.EnsureNotNull(nameof(orderBase)).Validate();
     return(postOrderAsync(orderBase.GetJsonRequest(), cancellationToken));
 }
Exemple #2
0
 /// <summary>
 /// Creates new instance of the <see cref="OrderBase"/> class.
 /// </summary>
 /// <param name="baseOrder">Base order for getting parameters.</param>
 protected internal OrderBase(
     OrderBase baseOrder)
     : this(
         baseOrder.EnsureNotNull(nameof(baseOrder)).Symbol,
         baseOrder.Quantity,
         baseOrder.Side,
         baseOrder.Type)
 {
     Duration      = baseOrder.Duration;
     ClientOrderId = baseOrder.ClientOrderId;
     ExtendedHours = baseOrder.ExtendedHours;
 }