/// <summary>
        ///     Creates an order based on the provided request
        /// </summary>
        /// <param name="request">The <see cref="CreateOrderRequest" /> that is used to define the order</param>
        /// <returns>
        ///     This method can return <see cref="AcknowledgeCreateOrderResponse" />, <see cref="FullCreateOrderResponse" />
        ///     or <see cref="ResultCreateOrderResponse" /> based on the provided NewOrderResponseType enum in the request.
        /// </returns>
        public async Task <BaseCreateOrderResponse> CreateOrderAsync(CreateOrderRequest request)
        {
            Guard.AgainstNull(request.Symbol);
            Guard.AgainstNull(request.Side);
            Guard.AgainstNull(request.Type);
            Guard.AgainstNull(request.Quantity);

            switch (request.NewOrderResponseType)
            {
            case NewOrderResponseType.Acknowledge:
                return(await _apiProcessor.ProcessPostRequest <AcknowledgeCreateOrderResponse>(
                           Endpoints.Account.NewOrder(request)));

            case NewOrderResponseType.Full:
                return(await _apiProcessor.ProcessPostRequest <FullCreateOrderResponse>(
                           Endpoints.Account.NewOrder(request)));

            default:
                return(await _apiProcessor.ProcessPostRequest <ResultCreateOrderResponse>(
                           Endpoints.Account.NewOrder(request)));
            }
        }
Example #2
0
 /// <summary>
 /// Starts a user data stream
 /// </summary>
 /// /// <returns><see cref="UserDataStreamResponse"/></returns>
 public async Task <UserDataStreamResponse> StartUserDataStream()
 {
     return(await _apiProcessor.ProcessPostRequest <UserDataStreamResponse>(Endpoints.UserStream.StartUserDataStream));
 }