sdks/java/src/main/java/com/konfigthis/client/api/TradingApi.java
<filename>sdks/java/src/main/java/com/konfigthis/client/api/TradingApi.java<gh_stars>0/*
 * SnapTrade
 * Connect brokerage accounts to your app for live positions and trading
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: nnheo@example.com
 *
 * NOTE: This class is auto generated by Konfig (https://konfigthis.com).
 * Do not edit the class manually.
 */


package com.konfigthis.client.api;

import com.konfigthis.client.ApiCallback;
import com.konfigthis.client.ApiClient;
import com.konfigthis.client.ApiException;
import com.konfigthis.client.ApiResponse;
import com.konfigthis.client.Configuration;
import com.konfigthis.client.Pair;
import com.konfigthis.client.ProgressRequestBody;
import com.konfigthis.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.konfigthis.client.model.Account;
import com.konfigthis.client.model.AccountOrderRecord;
import com.konfigthis.client.model.Action;
import com.konfigthis.client.model.BrokerageSymbol;
import com.konfigthis.client.model.ManualTradeAndImpact;
import com.konfigthis.client.model.ManualTradeForm;
import com.konfigthis.client.model.OrderType;
import com.konfigthis.client.model.SymbolsQuotesInner;
import com.konfigthis.client.model.TimeInForce;
import com.konfigthis.client.model.Trade;
import com.konfigthis.client.model.TradeExecutionStatus;
import com.konfigthis.client.model.TradeImpact;
import com.konfigthis.client.model.TradingCancelUserAccountOrderRequest;
import com.konfigthis.client.model.TradingPlaceOCOOrderRequest;
import java.util.UUID;
import com.konfigthis.client.model.UniversalSymbol;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;

public class TradingApi {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public TradingApi() throws IllegalArgumentException {
        this(Configuration.getDefaultApiClient());
    }

    public TradingApi(ApiClient apiClient) throws IllegalArgumentException {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    private okhttp3.Call cancelUserAccountOrderCall(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = tradingCancelUserAccountOrderRequest;

        // create path and map variables
        String localVarPath = "/accounts/{accountId}/orders/cancel"
            .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (userId != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId));
        }

        if (userSecret != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call cancelUserAccountOrderValidateBeforeCall(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'userId' is set
        if (userId == null) {
            throw new ApiException("Missing the required parameter 'userId' when calling cancelUserAccountOrder(Async)");
        }

        // verify the required parameter 'userSecret' is set
        if (userSecret == null) {
            throw new ApiException("Missing the required parameter 'userSecret' when calling cancelUserAccountOrder(Async)");
        }

        // verify the required parameter 'accountId' is set
        if (accountId == null) {
            throw new ApiException("Missing the required parameter 'accountId' when calling cancelUserAccountOrder(Async)");
        }

        // verify the required parameter 'tradingCancelUserAccountOrderRequest' is set
        if (tradingCancelUserAccountOrderRequest == null) {
            throw new ApiException("Missing the required parameter 'tradingCancelUserAccountOrderRequest' when calling cancelUserAccountOrder(Async)");
        }

        return cancelUserAccountOrderCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback);

    }


    private ApiResponse<AccountOrderRecord> cancelUserAccountOrderWithHttpInfo(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest) throws ApiException {
        okhttp3.Call localVarCall = cancelUserAccountOrderValidateBeforeCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, null);
        Type localVarReturnType = new TypeToken<AccountOrderRecord>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call cancelUserAccountOrderAsync(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest, final ApiCallback<AccountOrderRecord> _callback) throws ApiException {

        okhttp3.Call localVarCall = cancelUserAccountOrderValidateBeforeCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback);
        Type localVarReturnType = new TypeToken<AccountOrderRecord>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class CancelUserAccountOrderRequestBuilder {
        private final String userId;
        private final String userSecret;
        private final UUID accountId;
        private UUID brokerageOrderId;

        private CancelUserAccountOrderRequestBuilder(String userId, String userSecret, UUID accountId) {
            this.userId = userId;
            this.userSecret = userSecret;
            this.accountId = accountId;
        }

        /**
         * Set brokerageOrderId
         * @param brokerageOrderId  (optional)
         * @return CancelUserAccountOrderRequestBuilder
         */
        public CancelUserAccountOrderRequestBuilder brokerageOrderId(UUID brokerageOrderId) {
            this.brokerageOrderId = brokerageOrderId;
            return this;
        }
        
        /**
         * Build call for cancelUserAccountOrder
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Order Record of canceled order </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams();
            return cancelUserAccountOrderCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback);
        }

        private TradingCancelUserAccountOrderRequest buildBodyParams() {
            TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = new TradingCancelUserAccountOrderRequest();
            tradingCancelUserAccountOrderRequest.brokerageOrderId(this.brokerageOrderId);
            return tradingCancelUserAccountOrderRequest;
        }

        /**
         * Execute cancelUserAccountOrder request
         * @return AccountOrderRecord
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Order Record of canceled order </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public AccountOrderRecord execute() throws ApiException {
            TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams();
            ApiResponse<AccountOrderRecord> localVarResp = cancelUserAccountOrderWithHttpInfo(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute cancelUserAccountOrder request with HTTP info returned
         * @return ApiResponse&lt;AccountOrderRecord&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Order Record of canceled order </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<AccountOrderRecord> executeWithHttpInfo() throws ApiException {
            TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams();
            return cancelUserAccountOrderWithHttpInfo(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest);
        }

        /**
         * Execute cancelUserAccountOrder request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Order Record of canceled order </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<AccountOrderRecord> _callback) throws ApiException {
            TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams();
            return cancelUserAccountOrderAsync(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback);
        }
    }

    /**
     * Cancel open order in account
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param accountId The ID of the account get positions. (required)
     * @param tradingCancelUserAccountOrderRequest The Order ID to be canceled (required)
     * @return CancelUserAccountOrderRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Order Record of canceled order </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
     </table>
     */
    public CancelUserAccountOrderRequestBuilder cancelUserAccountOrder(String userId, String userSecret, UUID accountId) throws IllegalArgumentException {
        if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null");
            

        if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null");
            

        if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null");
            

        return new CancelUserAccountOrderRequestBuilder(userId, userSecret, accountId);
    }
    private okhttp3.Call getCalculatedTradeImpactByIdCall(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/modify/{tradeId}"
            .replace("{" + "portfolioGroupId" + "}", localVarApiClient.escapeString(portfolioGroupId.toString()))
            .replace("{" + "calculatedTradeId" + "}", localVarApiClient.escapeString(calculatedTradeId.toString()))
            .replace("{" + "tradeId" + "}", localVarApiClient.escapeString(tradeId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getCalculatedTradeImpactByIdValidateBeforeCall(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'portfolioGroupId' is set
        if (portfolioGroupId == null) {
            throw new ApiException("Missing the required parameter 'portfolioGroupId' when calling getCalculatedTradeImpactById(Async)");
        }

        // verify the required parameter 'calculatedTradeId' is set
        if (calculatedTradeId == null) {
            throw new ApiException("Missing the required parameter 'calculatedTradeId' when calling getCalculatedTradeImpactById(Async)");
        }

        // verify the required parameter 'tradeId' is set
        if (tradeId == null) {
            throw new ApiException("Missing the required parameter 'tradeId' when calling getCalculatedTradeImpactById(Async)");
        }

        return getCalculatedTradeImpactByIdCall(portfolioGroupId, calculatedTradeId, tradeId, _callback);

    }


    private ApiResponse<Trade> getCalculatedTradeImpactByIdWithHttpInfo(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId) throws ApiException {
        okhttp3.Call localVarCall = getCalculatedTradeImpactByIdValidateBeforeCall(portfolioGroupId, calculatedTradeId, tradeId, null);
        Type localVarReturnType = new TypeToken<Trade>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call getCalculatedTradeImpactByIdAsync(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId, final ApiCallback<Trade> _callback) throws ApiException {

        okhttp3.Call localVarCall = getCalculatedTradeImpactByIdValidateBeforeCall(portfolioGroupId, calculatedTradeId, tradeId, _callback);
        Type localVarReturnType = new TypeToken<Trade>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class GetCalculatedTradeImpactByIdRequestBuilder {
        private final UUID portfolioGroupId;
        private final UUID calculatedTradeId;
        private final UUID tradeId;

        private GetCalculatedTradeImpactByIdRequestBuilder(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId) {
            this.portfolioGroupId = portfolioGroupId;
            this.calculatedTradeId = calculatedTradeId;
            this.tradeId = tradeId;
        }

        /**
         * Build call for getCalculatedTradeImpactById
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Trade object </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            return getCalculatedTradeImpactByIdCall(portfolioGroupId, calculatedTradeId, tradeId, _callback);
        }


        /**
         * Execute getCalculatedTradeImpactById request
         * @return Trade
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Trade object </td><td>  -  </td></tr>
         </table>
         */
        public Trade execute() throws ApiException {
            ApiResponse<Trade> localVarResp = getCalculatedTradeImpactByIdWithHttpInfo(portfolioGroupId, calculatedTradeId, tradeId);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute getCalculatedTradeImpactById request with HTTP info returned
         * @return ApiResponse&lt;Trade&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Trade object </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<Trade> executeWithHttpInfo() throws ApiException {
            return getCalculatedTradeImpactByIdWithHttpInfo(portfolioGroupId, calculatedTradeId, tradeId);
        }

        /**
         * Execute getCalculatedTradeImpactById request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Trade object </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<Trade> _callback) throws ApiException {
            return getCalculatedTradeImpactByIdAsync(portfolioGroupId, calculatedTradeId, tradeId, _callback);
        }
    }

    /**
     * Return details of a specific trade before it&#39;s placed
     * 
     * @param portfolioGroupId The ID of the PortfolioGroup to perform rebalancing calculations (required)
     * @param calculatedTradeId The ID of calculated trade to get account impact (required)
     * @param tradeId The ID of trade object (required)
     * @return GetCalculatedTradeImpactByIdRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Trade object </td><td>  -  </td></tr>
     </table>
     */
    public GetCalculatedTradeImpactByIdRequestBuilder getCalculatedTradeImpactById(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId) throws IllegalArgumentException {
        if (portfolioGroupId == null) throw new IllegalArgumentException("\"portfolioGroupId\" is required but got null");
            

        if (calculatedTradeId == null) throw new IllegalArgumentException("\"calculatedTradeId\" is required but got null");
            

        if (tradeId == null) throw new IllegalArgumentException("\"tradeId\" is required but got null");
            

        return new GetCalculatedTradeImpactByIdRequestBuilder(portfolioGroupId, calculatedTradeId, tradeId);
    }
    private okhttp3.Call getCalculatedTradesImpactCall(UUID portfolioGroupId, UUID calculatedTradeId, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/impact"
            .replace("{" + "portfolioGroupId" + "}", localVarApiClient.escapeString(portfolioGroupId.toString()))
            .replace("{" + "calculatedTradeId" + "}", localVarApiClient.escapeString(calculatedTradeId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getCalculatedTradesImpactValidateBeforeCall(UUID portfolioGroupId, UUID calculatedTradeId, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'portfolioGroupId' is set
        if (portfolioGroupId == null) {
            throw new ApiException("Missing the required parameter 'portfolioGroupId' when calling getCalculatedTradesImpact(Async)");
        }

        // verify the required parameter 'calculatedTradeId' is set
        if (calculatedTradeId == null) {
            throw new ApiException("Missing the required parameter 'calculatedTradeId' when calling getCalculatedTradesImpact(Async)");
        }

        return getCalculatedTradesImpactCall(portfolioGroupId, calculatedTradeId, _callback);

    }


    private ApiResponse<List<TradeImpact>> getCalculatedTradesImpactWithHttpInfo(UUID portfolioGroupId, UUID calculatedTradeId) throws ApiException {
        okhttp3.Call localVarCall = getCalculatedTradesImpactValidateBeforeCall(portfolioGroupId, calculatedTradeId, null);
        Type localVarReturnType = new TypeToken<List<TradeImpact>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call getCalculatedTradesImpactAsync(UUID portfolioGroupId, UUID calculatedTradeId, final ApiCallback<List<TradeImpact>> _callback) throws ApiException {

        okhttp3.Call localVarCall = getCalculatedTradesImpactValidateBeforeCall(portfolioGroupId, calculatedTradeId, _callback);
        Type localVarReturnType = new TypeToken<List<TradeImpact>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class GetCalculatedTradesImpactRequestBuilder {
        private final UUID portfolioGroupId;
        private final UUID calculatedTradeId;

        private GetCalculatedTradesImpactRequestBuilder(UUID portfolioGroupId, UUID calculatedTradeId) {
            this.portfolioGroupId = portfolioGroupId;
            this.calculatedTradeId = calculatedTradeId;
        }

        /**
         * Build call for getCalculatedTradesImpact
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Impact of trades to make </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            return getCalculatedTradesImpactCall(portfolioGroupId, calculatedTradeId, _callback);
        }


        /**
         * Execute getCalculatedTradesImpact request
         * @return List&lt;TradeImpact&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Impact of trades to make </td><td>  -  </td></tr>
         </table>
         */
        public List<TradeImpact> execute() throws ApiException {
            ApiResponse<List<TradeImpact>> localVarResp = getCalculatedTradesImpactWithHttpInfo(portfolioGroupId, calculatedTradeId);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute getCalculatedTradesImpact request with HTTP info returned
         * @return ApiResponse&lt;List&lt;TradeImpact&gt;&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Impact of trades to make </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<List<TradeImpact>> executeWithHttpInfo() throws ApiException {
            return getCalculatedTradesImpactWithHttpInfo(portfolioGroupId, calculatedTradeId);
        }

        /**
         * Execute getCalculatedTradesImpact request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Impact of trades to make </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<List<TradeImpact>> _callback) throws ApiException {
            return getCalculatedTradesImpactAsync(portfolioGroupId, calculatedTradeId, _callback);
        }
    }

    /**
     * Return the impact of placing a series of trades on the portfolio
     * 
     * @param portfolioGroupId The ID of the PortfolioGroup to perform rebalancing calculations (required)
     * @param calculatedTradeId The ID of calculated trade to get account impact (required)
     * @return GetCalculatedTradesImpactRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Impact of trades to make </td><td>  -  </td></tr>
     </table>
     */
    public GetCalculatedTradesImpactRequestBuilder getCalculatedTradesImpact(UUID portfolioGroupId, UUID calculatedTradeId) throws IllegalArgumentException {
        if (portfolioGroupId == null) throw new IllegalArgumentException("\"portfolioGroupId\" is required but got null");
            

        if (calculatedTradeId == null) throw new IllegalArgumentException("\"calculatedTradeId\" is required but got null");
            

        return new GetCalculatedTradesImpactRequestBuilder(portfolioGroupId, calculatedTradeId);
    }
    private okhttp3.Call getOrderImpactCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = manualTradeForm;

        // create path and map variables
        String localVarPath = "/trade/impact";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (userId != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId));
        }

        if (userSecret != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getOrderImpactValidateBeforeCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'userId' is set
        if (userId == null) {
            throw new ApiException("Missing the required parameter 'userId' when calling getOrderImpact(Async)");
        }

        // verify the required parameter 'userSecret' is set
        if (userSecret == null) {
            throw new ApiException("Missing the required parameter 'userSecret' when calling getOrderImpact(Async)");
        }

        // verify the required parameter 'manualTradeForm' is set
        if (manualTradeForm == null) {
            throw new ApiException("Missing the required parameter 'manualTradeForm' when calling getOrderImpact(Async)");
        }

        return getOrderImpactCall(userId, userSecret, manualTradeForm, _callback);

    }


    private ApiResponse<ManualTradeAndImpact> getOrderImpactWithHttpInfo(String userId, String userSecret, ManualTradeForm manualTradeForm) throws ApiException {
        okhttp3.Call localVarCall = getOrderImpactValidateBeforeCall(userId, userSecret, manualTradeForm, null);
        Type localVarReturnType = new TypeToken<ManualTradeAndImpact>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call getOrderImpactAsync(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback<ManualTradeAndImpact> _callback) throws ApiException {

        okhttp3.Call localVarCall = getOrderImpactValidateBeforeCall(userId, userSecret, manualTradeForm, _callback);
        Type localVarReturnType = new TypeToken<ManualTradeAndImpact>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class GetOrderImpactRequestBuilder {
        private final String userId;
        private final String userSecret;
        private UUID accountId;
        private Action action;
        private OrderType orderType;
        private Double price;
        private Double stop;
        private TimeInForce timeInForce;
        private double units;
        private UUID universalSymbolId;

        private GetOrderImpactRequestBuilder(String userId, String userSecret) {
            this.userId = userId;
            this.userSecret = userSecret;
        }

        /**
         * Set accountId
         * @param accountId  (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder accountId(UUID accountId) {
            this.accountId = accountId;
            return this;
        }
        
        /**
         * Set action
         * @param action  (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder action(Action action) {
            this.action = action;
            return this;
        }
        
        /**
         * Set orderType
         * @param orderType  (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder orderType(OrderType orderType) {
            this.orderType = orderType;
            return this;
        }
        
        /**
         * Set price
         * @param price Trade Price if limit or stop limit order (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder price(Double price) {
            this.price = price;
            return this;
        }
        

        /**
         * Set price
         * @param price Trade Price if limit or stop limit order (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder price(Integer price) {
            this.price = price.doubleValue();
            return this;
        }
        
        /**
         * Set stop
         * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder stop(Double stop) {
            this.stop = stop;
            return this;
        }
        

        /**
         * Set stop
         * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder stop(Integer stop) {
            this.stop = stop.doubleValue();
            return this;
        }
        
        /**
         * Set timeInForce
         * @param timeInForce  (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder timeInForce(TimeInForce timeInForce) {
            this.timeInForce = timeInForce;
            return this;
        }
        
        /**
         * Set units
         * @param units Trade Units (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder units(double units) {
            this.units = units;
            return this;
        }
        
        /**
         * Set universalSymbolId
         * @param universalSymbolId  (optional)
         * @return GetOrderImpactRequestBuilder
         */
        public GetOrderImpactRequestBuilder universalSymbolId(UUID universalSymbolId) {
            this.universalSymbolId = universalSymbolId;
            return this;
        }
        
        /**
         * Build call for getOrderImpact
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Return trade object and it&#39;s impact on the account </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            ManualTradeForm manualTradeForm = buildBodyParams();
            return getOrderImpactCall(userId, userSecret, manualTradeForm, _callback);
        }

        private ManualTradeForm buildBodyParams() {
            ManualTradeForm manualTradeForm = new ManualTradeForm();
            manualTradeForm.accountId(this.accountId);
            manualTradeForm.action(this.action);
            manualTradeForm.orderType(this.orderType);
            manualTradeForm.price(this.price);
            manualTradeForm.stop(this.stop);
            manualTradeForm.timeInForce(this.timeInForce);
            manualTradeForm.units(this.units);
            manualTradeForm.universalSymbolId(this.universalSymbolId);
            return manualTradeForm;
        }

        /**
         * Execute getOrderImpact request
         * @return ManualTradeAndImpact
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Return trade object and it&#39;s impact on the account </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public ManualTradeAndImpact execute() throws ApiException {
            ManualTradeForm manualTradeForm = buildBodyParams();
            ApiResponse<ManualTradeAndImpact> localVarResp = getOrderImpactWithHttpInfo(userId, userSecret, manualTradeForm);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute getOrderImpact request with HTTP info returned
         * @return ApiResponse&lt;ManualTradeAndImpact&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Return trade object and it&#39;s impact on the account </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<ManualTradeAndImpact> executeWithHttpInfo() throws ApiException {
            ManualTradeForm manualTradeForm = buildBodyParams();
            return getOrderImpactWithHttpInfo(userId, userSecret, manualTradeForm);
        }

        /**
         * Execute getOrderImpact request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Return trade object and it&#39;s impact on the account </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<ManualTradeAndImpact> _callback) throws ApiException {
            ManualTradeForm manualTradeForm = buildBodyParams();
            return getOrderImpactAsync(userId, userSecret, manualTradeForm, _callback);
        }
    }

    /**
     * Check impact of trades on account.
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param manualTradeForm  (required)
     * @return GetOrderImpactRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Return trade object and it&#39;s impact on the account </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
     </table>
     */
    public GetOrderImpactRequestBuilder getOrderImpact(String userId, String userSecret) throws IllegalArgumentException {
        if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null");
            

        if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null");
            

        return new GetOrderImpactRequestBuilder(userId, userSecret);
    }
    private okhttp3.Call getUserAccountQuotesCall(String userId, String userSecret, String symbols, String accountId, Boolean useTicker, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/accounts/{accountId}/quotes"
            .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (userId != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId));
        }

        if (userSecret != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret));
        }

        if (symbols != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbols", symbols));
        }

        if (useTicker != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("use_ticker", useTicker));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getUserAccountQuotesValidateBeforeCall(String userId, String userSecret, String symbols, String accountId, Boolean useTicker, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'userId' is set
        if (userId == null) {
            throw new ApiException("Missing the required parameter 'userId' when calling getUserAccountQuotes(Async)");
        }

        // verify the required parameter 'userSecret' is set
        if (userSecret == null) {
            throw new ApiException("Missing the required parameter 'userSecret' when calling getUserAccountQuotes(Async)");
        }

        // verify the required parameter 'symbols' is set
        if (symbols == null) {
            throw new ApiException("Missing the required parameter 'symbols' when calling getUserAccountQuotes(Async)");
        }

        // verify the required parameter 'accountId' is set
        if (accountId == null) {
            throw new ApiException("Missing the required parameter 'accountId' when calling getUserAccountQuotes(Async)");
        }

        return getUserAccountQuotesCall(userId, userSecret, symbols, accountId, useTicker, _callback);

    }


    private ApiResponse<List<SymbolsQuotesInner>> getUserAccountQuotesWithHttpInfo(String userId, String userSecret, String symbols, String accountId, Boolean useTicker) throws ApiException {
        okhttp3.Call localVarCall = getUserAccountQuotesValidateBeforeCall(userId, userSecret, symbols, accountId, useTicker, null);
        Type localVarReturnType = new TypeToken<List<SymbolsQuotesInner>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call getUserAccountQuotesAsync(String userId, String userSecret, String symbols, String accountId, Boolean useTicker, final ApiCallback<List<SymbolsQuotesInner>> _callback) throws ApiException {

        okhttp3.Call localVarCall = getUserAccountQuotesValidateBeforeCall(userId, userSecret, symbols, accountId, useTicker, _callback);
        Type localVarReturnType = new TypeToken<List<SymbolsQuotesInner>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class GetUserAccountQuotesRequestBuilder {
        private final String userId;
        private final String userSecret;
        private final String symbols;
        private final String accountId;
        private Boolean useTicker;

        private GetUserAccountQuotesRequestBuilder(String userId, String userSecret, String symbols, String accountId) {
            this.userId = userId;
            this.userSecret = userSecret;
            this.symbols = symbols;
            this.accountId = accountId;
        }

        /**
         * Set useTicker
         * @param useTicker Should be set to True if providing tickers. (optional)
         * @return GetUserAccountQuotesRequestBuilder
         */
        public GetUserAccountQuotesRequestBuilder useTicker(Boolean useTicker) {
            this.useTicker = useTicker;
            return this;
        }
        
        /**
         * Build call for getUserAccountQuotes
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Returns quotes object with different prices </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            return getUserAccountQuotesCall(userId, userSecret, symbols, accountId, useTicker, _callback);
        }


        /**
         * Execute getUserAccountQuotes request
         * @return List&lt;SymbolsQuotesInner&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Returns quotes object with different prices </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public List<SymbolsQuotesInner> execute() throws ApiException {
            ApiResponse<List<SymbolsQuotesInner>> localVarResp = getUserAccountQuotesWithHttpInfo(userId, userSecret, symbols, accountId, useTicker);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute getUserAccountQuotes request with HTTP info returned
         * @return ApiResponse&lt;List&lt;SymbolsQuotesInner&gt;&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Returns quotes object with different prices </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<List<SymbolsQuotesInner>> executeWithHttpInfo() throws ApiException {
            return getUserAccountQuotesWithHttpInfo(userId, userSecret, symbols, accountId, useTicker);
        }

        /**
         * Execute getUserAccountQuotes request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Returns quotes object with different prices </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<List<SymbolsQuotesInner>> _callback) throws ApiException {
            return getUserAccountQuotesAsync(userId, userSecret, symbols, accountId, useTicker, _callback);
        }
    }

    /**
     * Get symbol quotes
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param symbols List of universal_symbol_id or tickers to get quotes for. (required)
     * @param accountId The ID of the account to get quotes. (required)
     * @return GetUserAccountQuotesRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Returns quotes object with different prices </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
     </table>
     */
    public GetUserAccountQuotesRequestBuilder getUserAccountQuotes(String userId, String userSecret, String symbols, String accountId) throws IllegalArgumentException {
        if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null");
            

        if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null");
            

        if (symbols == null) throw new IllegalArgumentException("\"symbols\" is required but got null");
            

        if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null");
            

        return new GetUserAccountQuotesRequestBuilder(userId, userSecret, symbols, accountId);
    }
    private okhttp3.Call modifyCalculatedTradeByIdCall(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId, Trade trade, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = trade;

        // create path and map variables
        String localVarPath = "/portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/modify/{tradeId}"
            .replace("{" + "portfolioGroupId" + "}", localVarApiClient.escapeString(portfolioGroupId.toString()))
            .replace("{" + "calculatedTradeId" + "}", localVarApiClient.escapeString(calculatedTradeId.toString()))
            .replace("{" + "tradeId" + "}", localVarApiClient.escapeString(tradeId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call modifyCalculatedTradeByIdValidateBeforeCall(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId, Trade trade, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'portfolioGroupId' is set
        if (portfolioGroupId == null) {
            throw new ApiException("Missing the required parameter 'portfolioGroupId' when calling modifyCalculatedTradeById(Async)");
        }

        // verify the required parameter 'calculatedTradeId' is set
        if (calculatedTradeId == null) {
            throw new ApiException("Missing the required parameter 'calculatedTradeId' when calling modifyCalculatedTradeById(Async)");
        }

        // verify the required parameter 'tradeId' is set
        if (tradeId == null) {
            throw new ApiException("Missing the required parameter 'tradeId' when calling modifyCalculatedTradeById(Async)");
        }

        return modifyCalculatedTradeByIdCall(portfolioGroupId, calculatedTradeId, tradeId, trade, _callback);

    }


    private ApiResponse<Trade> modifyCalculatedTradeByIdWithHttpInfo(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId, Trade trade) throws ApiException {
        okhttp3.Call localVarCall = modifyCalculatedTradeByIdValidateBeforeCall(portfolioGroupId, calculatedTradeId, tradeId, trade, null);
        Type localVarReturnType = new TypeToken<Trade>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call modifyCalculatedTradeByIdAsync(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId, Trade trade, final ApiCallback<Trade> _callback) throws ApiException {

        okhttp3.Call localVarCall = modifyCalculatedTradeByIdValidateBeforeCall(portfolioGroupId, calculatedTradeId, tradeId, trade, _callback);
        Type localVarReturnType = new TypeToken<Trade>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class ModifyCalculatedTradeByIdRequestBuilder {
        private final UUID portfolioGroupId;
        private final UUID calculatedTradeId;
        private final UUID tradeId;
        private UUID id;
        private Account account;
        private BrokerageSymbol symbol;
        private UniversalSymbol universalSymbol;
        private String action;
        private Integer units;
        private double price;
        private Integer sequence;

        private ModifyCalculatedTradeByIdRequestBuilder(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId) {
            this.portfolioGroupId = portfolioGroupId;
            this.calculatedTradeId = calculatedTradeId;
            this.tradeId = tradeId;
        }

        /**
         * Set id
         * @param id  (optional)
         * @return ModifyCalculatedTradeByIdRequestBuilder
         */
        public ModifyCalculatedTradeByIdRequestBuilder id(UUID id) {
            this.id = id;
            return this;
        }
        
        /**
         * Set account
         * @param account  (optional)
         * @return ModifyCalculatedTradeByIdRequestBuilder
         */
        public ModifyCalculatedTradeByIdRequestBuilder account(Account account) {
            this.account = account;
            return this;
        }
        
        /**
         * Set symbol
         * @param symbol  (optional)
         * @return ModifyCalculatedTradeByIdRequestBuilder
         */
        public ModifyCalculatedTradeByIdRequestBuilder symbol(BrokerageSymbol symbol) {
            this.symbol = symbol;
            return this;
        }
        
        /**
         * Set universalSymbol
         * @param universalSymbol  (optional)
         * @return ModifyCalculatedTradeByIdRequestBuilder
         */
        public ModifyCalculatedTradeByIdRequestBuilder universalSymbol(UniversalSymbol universalSymbol) {
            this.universalSymbol = universalSymbol;
            return this;
        }
        
        /**
         * Set action
         * @param action  (optional)
         * @return ModifyCalculatedTradeByIdRequestBuilder
         */
        public ModifyCalculatedTradeByIdRequestBuilder action(String action) {
            this.action = action;
            return this;
        }
        
        /**
         * Set units
         * @param units  (optional)
         * @return ModifyCalculatedTradeByIdRequestBuilder
         */
        public ModifyCalculatedTradeByIdRequestBuilder units(Integer units) {
            this.units = units;
            return this;
        }
        
        /**
         * Set price
         * @param price  (optional)
         * @return ModifyCalculatedTradeByIdRequestBuilder
         */
        public ModifyCalculatedTradeByIdRequestBuilder price(double price) {
            this.price = price;
            return this;
        }
        
        /**
         * Set sequence
         * @param sequence  (optional)
         * @return ModifyCalculatedTradeByIdRequestBuilder
         */
        public ModifyCalculatedTradeByIdRequestBuilder sequence(Integer sequence) {
            this.sequence = sequence;
            return this;
        }
        
        /**
         * Build call for modifyCalculatedTradeById
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Modified trade object </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            Trade trade = buildBodyParams();
            return modifyCalculatedTradeByIdCall(portfolioGroupId, calculatedTradeId, tradeId, trade, _callback);
        }

        private Trade buildBodyParams() {
            Trade trade = new Trade();
            trade.id(this.id);
            trade.account(this.account);
            trade.symbol(this.symbol);
            trade.universalSymbol(this.universalSymbol);
            if (this.action != null)
            trade.action(Trade.ActionEnum.fromValue(this.action));
            trade.units(this.units);
            trade.price(this.price);
            trade.sequence(this.sequence);
            return trade;
        }

        /**
         * Execute modifyCalculatedTradeById request
         * @return Trade
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Modified trade object </td><td>  -  </td></tr>
         </table>
         */
        public Trade execute() throws ApiException {
            Trade trade = buildBodyParams();
            ApiResponse<Trade> localVarResp = modifyCalculatedTradeByIdWithHttpInfo(portfolioGroupId, calculatedTradeId, tradeId, trade);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute modifyCalculatedTradeById request with HTTP info returned
         * @return ApiResponse&lt;Trade&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Modified trade object </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<Trade> executeWithHttpInfo() throws ApiException {
            Trade trade = buildBodyParams();
            return modifyCalculatedTradeByIdWithHttpInfo(portfolioGroupId, calculatedTradeId, tradeId, trade);
        }

        /**
         * Execute modifyCalculatedTradeById request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Modified trade object </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<Trade> _callback) throws ApiException {
            Trade trade = buildBodyParams();
            return modifyCalculatedTradeByIdAsync(portfolioGroupId, calculatedTradeId, tradeId, trade, _callback);
        }
    }

    /**
     * Modify units of a trade before it is placed
     * 
     * @param portfolioGroupId The ID of the PortfolioGroup to perform rebalancing calculations (required)
     * @param calculatedTradeId The ID of calculated trade to get account impact (required)
     * @param tradeId The ID of trade object (required)
     * @return ModifyCalculatedTradeByIdRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Modified trade object </td><td>  -  </td></tr>
     </table>
     */
    public ModifyCalculatedTradeByIdRequestBuilder modifyCalculatedTradeById(UUID portfolioGroupId, UUID calculatedTradeId, UUID tradeId) throws IllegalArgumentException {
        if (portfolioGroupId == null) throw new IllegalArgumentException("\"portfolioGroupId\" is required but got null");
            

        if (calculatedTradeId == null) throw new IllegalArgumentException("\"calculatedTradeId\" is required but got null");
            

        if (tradeId == null) throw new IllegalArgumentException("\"tradeId\" is required but got null");
            

        return new ModifyCalculatedTradeByIdRequestBuilder(portfolioGroupId, calculatedTradeId, tradeId);
    }
    private okhttp3.Call placeCalculatedTradesCall(UUID portfolioGroupId, UUID calculatedTradeId, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/placeOrders"
            .replace("{" + "portfolioGroupId" + "}", localVarApiClient.escapeString(portfolioGroupId.toString()))
            .replace("{" + "calculatedTradeId" + "}", localVarApiClient.escapeString(calculatedTradeId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call placeCalculatedTradesValidateBeforeCall(UUID portfolioGroupId, UUID calculatedTradeId, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'portfolioGroupId' is set
        if (portfolioGroupId == null) {
            throw new ApiException("Missing the required parameter 'portfolioGroupId' when calling placeCalculatedTrades(Async)");
        }

        // verify the required parameter 'calculatedTradeId' is set
        if (calculatedTradeId == null) {
            throw new ApiException("Missing the required parameter 'calculatedTradeId' when calling placeCalculatedTrades(Async)");
        }

        return placeCalculatedTradesCall(portfolioGroupId, calculatedTradeId, _callback);

    }


    private ApiResponse<List<TradeExecutionStatus>> placeCalculatedTradesWithHttpInfo(UUID portfolioGroupId, UUID calculatedTradeId) throws ApiException {
        okhttp3.Call localVarCall = placeCalculatedTradesValidateBeforeCall(portfolioGroupId, calculatedTradeId, null);
        Type localVarReturnType = new TypeToken<List<TradeExecutionStatus>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call placeCalculatedTradesAsync(UUID portfolioGroupId, UUID calculatedTradeId, final ApiCallback<List<TradeExecutionStatus>> _callback) throws ApiException {

        okhttp3.Call localVarCall = placeCalculatedTradesValidateBeforeCall(portfolioGroupId, calculatedTradeId, _callback);
        Type localVarReturnType = new TypeToken<List<TradeExecutionStatus>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class PlaceCalculatedTradesRequestBuilder {
        private final UUID portfolioGroupId;
        private final UUID calculatedTradeId;

        private PlaceCalculatedTradesRequestBuilder(UUID portfolioGroupId, UUID calculatedTradeId) {
            this.portfolioGroupId = portfolioGroupId;
            this.calculatedTradeId = calculatedTradeId;
        }

        /**
         * Build call for placeCalculatedTrades
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Return trade execution statuses for all trades submitted </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            return placeCalculatedTradesCall(portfolioGroupId, calculatedTradeId, _callback);
        }


        /**
         * Execute placeCalculatedTrades request
         * @return List&lt;TradeExecutionStatus&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Return trade execution statuses for all trades submitted </td><td>  -  </td></tr>
         </table>
         */
        public List<TradeExecutionStatus> execute() throws ApiException {
            ApiResponse<List<TradeExecutionStatus>> localVarResp = placeCalculatedTradesWithHttpInfo(portfolioGroupId, calculatedTradeId);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute placeCalculatedTrades request with HTTP info returned
         * @return ApiResponse&lt;List&lt;TradeExecutionStatus&gt;&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Return trade execution statuses for all trades submitted </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<List<TradeExecutionStatus>> executeWithHttpInfo() throws ApiException {
            return placeCalculatedTradesWithHttpInfo(portfolioGroupId, calculatedTradeId);
        }

        /**
         * Execute placeCalculatedTrades request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Return trade execution statuses for all trades submitted </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<List<TradeExecutionStatus>> _callback) throws ApiException {
            return placeCalculatedTradesAsync(portfolioGroupId, calculatedTradeId, _callback);
        }
    }

    /**
     * Place orders for the CalculatedTrades in series
     * 
     * @param portfolioGroupId The ID of the PortfolioGroup to perform rebalancing calculations (required)
     * @param calculatedTradeId The ID of calculated trade to get account impact (required)
     * @return PlaceCalculatedTradesRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Return trade execution statuses for all trades submitted </td><td>  -  </td></tr>
     </table>
     */
    public PlaceCalculatedTradesRequestBuilder placeCalculatedTrades(UUID portfolioGroupId, UUID calculatedTradeId) throws IllegalArgumentException {
        if (portfolioGroupId == null) throw new IllegalArgumentException("\"portfolioGroupId\" is required but got null");
            

        if (calculatedTradeId == null) throw new IllegalArgumentException("\"calculatedTradeId\" is required but got null");
            

        return new PlaceCalculatedTradesRequestBuilder(portfolioGroupId, calculatedTradeId);
    }
    private okhttp3.Call placeForceOrderCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = manualTradeForm;

        // create path and map variables
        String localVarPath = "/trade/place";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (userId != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId));
        }

        if (userSecret != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call placeForceOrderValidateBeforeCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'userId' is set
        if (userId == null) {
            throw new ApiException("Missing the required parameter 'userId' when calling placeForceOrder(Async)");
        }

        // verify the required parameter 'userSecret' is set
        if (userSecret == null) {
            throw new ApiException("Missing the required parameter 'userSecret' when calling placeForceOrder(Async)");
        }

        // verify the required parameter 'manualTradeForm' is set
        if (manualTradeForm == null) {
            throw new ApiException("Missing the required parameter 'manualTradeForm' when calling placeForceOrder(Async)");
        }

        return placeForceOrderCall(userId, userSecret, manualTradeForm, _callback);

    }


    private ApiResponse<AccountOrderRecord> placeForceOrderWithHttpInfo(String userId, String userSecret, ManualTradeForm manualTradeForm) throws ApiException {
        okhttp3.Call localVarCall = placeForceOrderValidateBeforeCall(userId, userSecret, manualTradeForm, null);
        Type localVarReturnType = new TypeToken<AccountOrderRecord>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call placeForceOrderAsync(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback<AccountOrderRecord> _callback) throws ApiException {

        okhttp3.Call localVarCall = placeForceOrderValidateBeforeCall(userId, userSecret, manualTradeForm, _callback);
        Type localVarReturnType = new TypeToken<AccountOrderRecord>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class PlaceForceOrderRequestBuilder {
        private final String userId;
        private final String userSecret;
        private UUID accountId;
        private Action action;
        private OrderType orderType;
        private Double price;
        private Double stop;
        private TimeInForce timeInForce;
        private double units;
        private UUID universalSymbolId;

        private PlaceForceOrderRequestBuilder(String userId, String userSecret) {
            this.userId = userId;
            this.userSecret = userSecret;
        }

        /**
         * Set accountId
         * @param accountId  (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder accountId(UUID accountId) {
            this.accountId = accountId;
            return this;
        }
        
        /**
         * Set action
         * @param action  (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder action(Action action) {
            this.action = action;
            return this;
        }
        
        /**
         * Set orderType
         * @param orderType  (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder orderType(OrderType orderType) {
            this.orderType = orderType;
            return this;
        }
        
        /**
         * Set price
         * @param price Trade Price if limit or stop limit order (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder price(Double price) {
            this.price = price;
            return this;
        }
        

        /**
         * Set price
         * @param price Trade Price if limit or stop limit order (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder price(Integer price) {
            this.price = price.doubleValue();
            return this;
        }
        
        /**
         * Set stop
         * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder stop(Double stop) {
            this.stop = stop;
            return this;
        }
        

        /**
         * Set stop
         * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder stop(Integer stop) {
            this.stop = stop.doubleValue();
            return this;
        }
        
        /**
         * Set timeInForce
         * @param timeInForce  (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder timeInForce(TimeInForce timeInForce) {
            this.timeInForce = timeInForce;
            return this;
        }
        
        /**
         * Set units
         * @param units Trade Units (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder units(double units) {
            this.units = units;
            return this;
        }
        
        /**
         * Set universalSymbolId
         * @param universalSymbolId  (optional)
         * @return PlaceForceOrderRequestBuilder
         */
        public PlaceForceOrderRequestBuilder universalSymbolId(UUID universalSymbolId) {
            this.universalSymbolId = universalSymbolId;
            return this;
        }
        
        /**
         * Build call for placeForceOrder
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Trade sucessfully placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            ManualTradeForm manualTradeForm = buildBodyParams();
            return placeForceOrderCall(userId, userSecret, manualTradeForm, _callback);
        }

        private ManualTradeForm buildBodyParams() {
            ManualTradeForm manualTradeForm = new ManualTradeForm();
            manualTradeForm.accountId(this.accountId);
            manualTradeForm.action(this.action);
            manualTradeForm.orderType(this.orderType);
            manualTradeForm.price(this.price);
            manualTradeForm.stop(this.stop);
            manualTradeForm.timeInForce(this.timeInForce);
            manualTradeForm.units(this.units);
            manualTradeForm.universalSymbolId(this.universalSymbolId);
            return manualTradeForm;
        }

        /**
         * Execute placeForceOrder request
         * @return AccountOrderRecord
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Trade sucessfully placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public AccountOrderRecord execute() throws ApiException {
            ManualTradeForm manualTradeForm = buildBodyParams();
            ApiResponse<AccountOrderRecord> localVarResp = placeForceOrderWithHttpInfo(userId, userSecret, manualTradeForm);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute placeForceOrder request with HTTP info returned
         * @return ApiResponse&lt;AccountOrderRecord&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Trade sucessfully placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<AccountOrderRecord> executeWithHttpInfo() throws ApiException {
            ManualTradeForm manualTradeForm = buildBodyParams();
            return placeForceOrderWithHttpInfo(userId, userSecret, manualTradeForm);
        }

        /**
         * Execute placeForceOrder request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Trade sucessfully placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<AccountOrderRecord> _callback) throws ApiException {
            ManualTradeForm manualTradeForm = buildBodyParams();
            return placeForceOrderAsync(userId, userSecret, manualTradeForm, _callback);
        }
    }

    /**
     * Place a trade with NO validation.
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param manualTradeForm  (required)
     * @return PlaceForceOrderRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Trade sucessfully placed </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
     </table>
     */
    public PlaceForceOrderRequestBuilder placeForceOrder(String userId, String userSecret) throws IllegalArgumentException {
        if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null");
            

        if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null");
            

        return new PlaceForceOrderRequestBuilder(userId, userSecret);
    }
    private okhttp3.Call placeOCOOrderCall(String userId, String userSecret, TradingPlaceOCOOrderRequest tradingPlaceOCOOrderRequest, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = tradingPlaceOCOOrderRequest;

        // create path and map variables
        String localVarPath = "/trade/oco";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (userId != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId));
        }

        if (userSecret != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call placeOCOOrderValidateBeforeCall(String userId, String userSecret, TradingPlaceOCOOrderRequest tradingPlaceOCOOrderRequest, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'userId' is set
        if (userId == null) {
            throw new ApiException("Missing the required parameter 'userId' when calling placeOCOOrder(Async)");
        }

        // verify the required parameter 'userSecret' is set
        if (userSecret == null) {
            throw new ApiException("Missing the required parameter 'userSecret' when calling placeOCOOrder(Async)");
        }

        // verify the required parameter 'tradingPlaceOCOOrderRequest' is set
        if (tradingPlaceOCOOrderRequest == null) {
            throw new ApiException("Missing the required parameter 'tradingPlaceOCOOrderRequest' when calling placeOCOOrder(Async)");
        }

        return placeOCOOrderCall(userId, userSecret, tradingPlaceOCOOrderRequest, _callback);

    }


    private ApiResponse<AccountOrderRecord> placeOCOOrderWithHttpInfo(String userId, String userSecret, TradingPlaceOCOOrderRequest tradingPlaceOCOOrderRequest) throws ApiException {
        okhttp3.Call localVarCall = placeOCOOrderValidateBeforeCall(userId, userSecret, tradingPlaceOCOOrderRequest, null);
        Type localVarReturnType = new TypeToken<AccountOrderRecord>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call placeOCOOrderAsync(String userId, String userSecret, TradingPlaceOCOOrderRequest tradingPlaceOCOOrderRequest, final ApiCallback<AccountOrderRecord> _callback) throws ApiException {

        okhttp3.Call localVarCall = placeOCOOrderValidateBeforeCall(userId, userSecret, tradingPlaceOCOOrderRequest, _callback);
        Type localVarReturnType = new TypeToken<AccountOrderRecord>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class PlaceOCOOrderRequestBuilder {
        private final String userId;
        private final String userSecret;
        private Object firstTradeId;
        private Object secondTradeId;

        private PlaceOCOOrderRequestBuilder(String userId, String userSecret) {
            this.userId = userId;
            this.userSecret = userSecret;
        }

        /**
         * Set firstTradeId
         * @param firstTradeId The ID of first trade object obtained from trade/impact endpoint (optional)
         * @return PlaceOCOOrderRequestBuilder
         */
        public PlaceOCOOrderRequestBuilder firstTradeId(Object firstTradeId) {
            this.firstTradeId = firstTradeId;
            return this;
        }
        
        /**
         * Set secondTradeId
         * @param secondTradeId The ID of second trade object obtained from trade/impact endpoint (optional)
         * @return PlaceOCOOrderRequestBuilder
         */
        public PlaceOCOOrderRequestBuilder secondTradeId(Object secondTradeId) {
            this.secondTradeId = secondTradeId;
            return this;
        }
        
        /**
         * Build call for placeOCOOrder
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            TradingPlaceOCOOrderRequest tradingPlaceOCOOrderRequest = buildBodyParams();
            return placeOCOOrderCall(userId, userSecret, tradingPlaceOCOOrderRequest, _callback);
        }

        private TradingPlaceOCOOrderRequest buildBodyParams() {
            TradingPlaceOCOOrderRequest tradingPlaceOCOOrderRequest = new TradingPlaceOCOOrderRequest();
            tradingPlaceOCOOrderRequest.firstTradeId(this.firstTradeId);
            tradingPlaceOCOOrderRequest.secondTradeId(this.secondTradeId);
            return tradingPlaceOCOOrderRequest;
        }

        /**
         * Execute placeOCOOrder request
         * @return AccountOrderRecord
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public AccountOrderRecord execute() throws ApiException {
            TradingPlaceOCOOrderRequest tradingPlaceOCOOrderRequest = buildBodyParams();
            ApiResponse<AccountOrderRecord> localVarResp = placeOCOOrderWithHttpInfo(userId, userSecret, tradingPlaceOCOOrderRequest);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute placeOCOOrder request with HTTP info returned
         * @return ApiResponse&lt;AccountOrderRecord&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<AccountOrderRecord> executeWithHttpInfo() throws ApiException {
            TradingPlaceOCOOrderRequest tradingPlaceOCOOrderRequest = buildBodyParams();
            return placeOCOOrderWithHttpInfo(userId, userSecret, tradingPlaceOCOOrderRequest);
        }

        /**
         * Execute placeOCOOrder request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<AccountOrderRecord> _callback) throws ApiException {
            TradingPlaceOCOOrderRequest tradingPlaceOCOOrderRequest = buildBodyParams();
            return placeOCOOrderAsync(userId, userSecret, tradingPlaceOCOOrderRequest, _callback);
        }
    }

    /**
     * Place a OCO (One Cancels Other) order
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param tradingPlaceOCOOrderRequest  (required)
     * @return PlaceOCOOrderRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
     </table>
     */
    public PlaceOCOOrderRequestBuilder placeOCOOrder(String userId, String userSecret) throws IllegalArgumentException {
        if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null");
            

        if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null");
            

        return new PlaceOCOOrderRequestBuilder(userId, userSecret);
    }
    private okhttp3.Call placeOrderCall(UUID tradeId, String userId, String userSecret, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/trade/{tradeId}"
            .replace("{" + "tradeId" + "}", localVarApiClient.escapeString(tradeId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (userId != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId));
        }

        if (userSecret != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call placeOrderValidateBeforeCall(UUID tradeId, String userId, String userSecret, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'tradeId' is set
        if (tradeId == null) {
            throw new ApiException("Missing the required parameter 'tradeId' when calling placeOrder(Async)");
        }

        // verify the required parameter 'userId' is set
        if (userId == null) {
            throw new ApiException("Missing the required parameter 'userId' when calling placeOrder(Async)");
        }

        // verify the required parameter 'userSecret' is set
        if (userSecret == null) {
            throw new ApiException("Missing the required parameter 'userSecret' when calling placeOrder(Async)");
        }

        return placeOrderCall(tradeId, userId, userSecret, _callback);

    }


    private ApiResponse<AccountOrderRecord> placeOrderWithHttpInfo(UUID tradeId, String userId, String userSecret) throws ApiException {
        okhttp3.Call localVarCall = placeOrderValidateBeforeCall(tradeId, userId, userSecret, null);
        Type localVarReturnType = new TypeToken<AccountOrderRecord>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call placeOrderAsync(UUID tradeId, String userId, String userSecret, final ApiCallback<AccountOrderRecord> _callback) throws ApiException {

        okhttp3.Call localVarCall = placeOrderValidateBeforeCall(tradeId, userId, userSecret, _callback);
        Type localVarReturnType = new TypeToken<AccountOrderRecord>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class PlaceOrderRequestBuilder {
        private final UUID tradeId;
        private final String userId;
        private final String userSecret;

        private PlaceOrderRequestBuilder(UUID tradeId, String userId, String userSecret) {
            this.tradeId = tradeId;
            this.userId = userId;
            this.userSecret = userSecret;
        }

        /**
         * Build call for placeOrder
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            return placeOrderCall(tradeId, userId, userSecret, _callback);
        }


        /**
         * Execute placeOrder request
         * @return AccountOrderRecord
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public AccountOrderRecord execute() throws ApiException {
            ApiResponse<AccountOrderRecord> localVarResp = placeOrderWithHttpInfo(tradeId, userId, userSecret);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute placeOrder request with HTTP info returned
         * @return ApiResponse&lt;AccountOrderRecord&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<AccountOrderRecord> executeWithHttpInfo() throws ApiException {
            return placeOrderWithHttpInfo(tradeId, userId, userSecret);
        }

        /**
         * Execute placeOrder request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<AccountOrderRecord> _callback) throws ApiException {
            return placeOrderAsync(tradeId, userId, userSecret, _callback);
        }
    }

    /**
     * Place order
     * 
     * @param tradeId The ID of trade object obtained from trade/impact endpoint (required)
     * @param userId  (required)
     * @param userSecret  (required)
     * @return PlaceOrderRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Status of order placed </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected Error </td><td>  -  </td></tr>
     </table>
     */
    public PlaceOrderRequestBuilder placeOrder(UUID tradeId, String userId, String userSecret) throws IllegalArgumentException {
        if (tradeId == null) throw new IllegalArgumentException("\"tradeId\" is required but got null");
            

        if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null");
            

        if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null");
            

        return new PlaceOrderRequestBuilder(tradeId, userId, userSecret);
    }
}
