sdks/java/src/main/java/com/konfigthis/client/api/OptionsApi.java
<reponame>passiv/snaptrade-sdks<filename>sdks/java/src/main/java/com/konfigthis/client/api/OptionsApi.java/*
 * SnapTrade
 * Connect brokerage accounts to your app for live positions and trading
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: lyhxr@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.OptionChainInner;
import com.konfigthis.client.model.OptionLeg;
import com.konfigthis.client.model.OptionsGetOptionStrategyRequest;
import com.konfigthis.client.model.OptionsHoldings;
import com.konfigthis.client.model.OptionsPlaceOptionStrategyRequest;
import com.konfigthis.client.model.StrategyOrderRecord;
import com.konfigthis.client.model.StrategyQuotes;
import java.util.UUID;

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 OptionsApi {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

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

    public OptionsApi(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 getOptionStrategyCall(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest, 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 = optionsGetOptionStrategyRequest;

        // create path and map variables
        String localVarPath = "/accounts/{accountId}/optionStrategy"
            .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 getOptionStrategyValidateBeforeCall(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest, 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 getOptionStrategy(Async)");
        }

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

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

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

        return getOptionStrategyCall(userId, userSecret, accountId, optionsGetOptionStrategyRequest, _callback);

    }


    private ApiResponse<StrategyQuotes> getOptionStrategyWithHttpInfo(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest) throws ApiException {
        okhttp3.Call localVarCall = getOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionsGetOptionStrategyRequest, null);
        Type localVarReturnType = new TypeToken<StrategyQuotes>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call getOptionStrategyAsync(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest, final ApiCallback<StrategyQuotes> _callback) throws ApiException {

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

    public class GetOptionStrategyRequestBuilder {
        private final UUID underlyingSymbolId;
        private final List<OptionLeg> legs;
        private final String strategyType;
        private final String userId;
        private final String userSecret;
        private final UUID accountId;

        private GetOptionStrategyRequestBuilder(UUID underlyingSymbolId, List<OptionLeg> legs, String strategyType, String userId, String userSecret, UUID accountId) {
            this.underlyingSymbolId = underlyingSymbolId;
            this.legs = legs;
            this.strategyType = strategyType;
            this.userId = userId;
            this.userSecret = userSecret;
            this.accountId = accountId;
        }

        /**
         * Build call for getOptionStrategy
         * @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 Quotes </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 {
            OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams();
            return getOptionStrategyCall(userId, userSecret, accountId, optionsGetOptionStrategyRequest, _callback);
        }

        private OptionsGetOptionStrategyRequest buildBodyParams() {
            OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = new OptionsGetOptionStrategyRequest();
            optionsGetOptionStrategyRequest.underlyingSymbolId(this.underlyingSymbolId);
            optionsGetOptionStrategyRequest.legs(this.legs);
            if (this.strategyType != null)
            optionsGetOptionStrategyRequest.strategyType(OptionsGetOptionStrategyRequest.StrategyTypeEnum.fromValue(this.strategyType));
            return optionsGetOptionStrategyRequest;
        }

        /**
         * Execute getOptionStrategy request
         * @return StrategyQuotes
         * @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 Quotes </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public StrategyQuotes execute() throws ApiException {
            OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams();
            ApiResponse<StrategyQuotes> localVarResp = getOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionsGetOptionStrategyRequest);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute getOptionStrategy request with HTTP info returned
         * @return ApiResponse&lt;StrategyQuotes&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 Quotes </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<StrategyQuotes> executeWithHttpInfo() throws ApiException {
            OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams();
            return getOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionsGetOptionStrategyRequest);
        }

        /**
         * Execute getOptionStrategy 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 Quotes </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<StrategyQuotes> _callback) throws ApiException {
            OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams();
            return getOptionStrategyAsync(userId, userSecret, accountId, optionsGetOptionStrategyRequest, _callback);
        }
    }

    /**
     * Creates an option strategy object that will be used to place an option strategy order
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param accountId The ID of the account get positions. (required)
     * @param optionsGetOptionStrategyRequest  (required)
     * @return GetOptionStrategyRequestBuilder
     * @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 Quotes </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
     </table>
     */
    public GetOptionStrategyRequestBuilder getOptionStrategy(UUID underlyingSymbolId, List<OptionLeg> legs, String strategyType, String userId, String userSecret, UUID accountId) throws IllegalArgumentException {
        if (underlyingSymbolId == null) throw new IllegalArgumentException("\"underlyingSymbolId\" is required but got null");
            

        if (legs == null) throw new IllegalArgumentException("\"legs\" is required but got null");
        if (strategyType == null) throw new IllegalArgumentException("\"strategyType\" 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");
            

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

        return new GetOptionStrategyRequestBuilder(underlyingSymbolId, legs, strategyType, userId, userSecret, accountId);
    }
    private okhttp3.Call getOptionsChainCall(String userId, String userSecret, UUID accountId, UUID symbol, 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}/optionsChain"
            .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 (symbol != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbol", symbol));
        }

        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 getOptionsChainValidateBeforeCall(String userId, String userSecret, UUID accountId, UUID symbol, 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 getOptionsChain(Async)");
        }

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

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

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

        return getOptionsChainCall(userId, userSecret, accountId, symbol, _callback);

    }


    private ApiResponse<List<OptionChainInner>> getOptionsChainWithHttpInfo(String userId, String userSecret, UUID accountId, UUID symbol) throws ApiException {
        okhttp3.Call localVarCall = getOptionsChainValidateBeforeCall(userId, userSecret, accountId, symbol, null);
        Type localVarReturnType = new TypeToken<List<OptionChainInner>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call getOptionsChainAsync(String userId, String userSecret, UUID accountId, UUID symbol, final ApiCallback<List<OptionChainInner>> _callback) throws ApiException {

        okhttp3.Call localVarCall = getOptionsChainValidateBeforeCall(userId, userSecret, accountId, symbol, _callback);
        Type localVarReturnType = new TypeToken<List<OptionChainInner>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class GetOptionsChainRequestBuilder {
        private final String userId;
        private final String userSecret;
        private final UUID accountId;
        private final UUID symbol;

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

        /**
         * Build call for getOptionsChain
         * @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> List of all Options available for the brokerage symbol </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 getOptionsChainCall(userId, userSecret, accountId, symbol, _callback);
        }


        /**
         * Execute getOptionsChain request
         * @return List&lt;OptionChainInner&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> List of all Options available for the brokerage symbol </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public List<OptionChainInner> execute() throws ApiException {
            ApiResponse<List<OptionChainInner>> localVarResp = getOptionsChainWithHttpInfo(userId, userSecret, accountId, symbol);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute getOptionsChain request with HTTP info returned
         * @return ApiResponse&lt;List&lt;OptionChainInner&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> List of all Options available for the brokerage symbol </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<List<OptionChainInner>> executeWithHttpInfo() throws ApiException {
            return getOptionsChainWithHttpInfo(userId, userSecret, accountId, symbol);
        }

        /**
         * Execute getOptionsChain 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> List of all Options available for the brokerage symbol </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<List<OptionChainInner>> _callback) throws ApiException {
            return getOptionsChainAsync(userId, userSecret, accountId, symbol, _callback);
        }
    }

    /**
     * Get the options chain
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param accountId The ID of the account get positions. (required)
     * @param symbol Universal symbol ID if symbol (required)
     * @return GetOptionsChainRequestBuilder
     * @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> List of all Options available for the brokerage symbol </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
     </table>
     */
    public GetOptionsChainRequestBuilder getOptionsChain(String userId, String userSecret, UUID accountId, UUID symbol) 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");
            

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

        return new GetOptionsChainRequestBuilder(userId, userSecret, accountId, symbol);
    }
    private okhttp3.Call getOptionsStrategyQuoteCall(String userId, String userSecret, UUID accountId, UUID optionStrategyId, 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}/optionStrategy/{optionStrategyId}"
            .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString()))
            .replace("{" + "optionStrategyId" + "}", localVarApiClient.escapeString(optionStrategyId.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, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getOptionsStrategyQuoteValidateBeforeCall(String userId, String userSecret, UUID accountId, UUID optionStrategyId, 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 getOptionsStrategyQuote(Async)");
        }

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

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

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

        return getOptionsStrategyQuoteCall(userId, userSecret, accountId, optionStrategyId, _callback);

    }


    private ApiResponse<StrategyQuotes> getOptionsStrategyQuoteWithHttpInfo(String userId, String userSecret, UUID accountId, UUID optionStrategyId) throws ApiException {
        okhttp3.Call localVarCall = getOptionsStrategyQuoteValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, null);
        Type localVarReturnType = new TypeToken<StrategyQuotes>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call getOptionsStrategyQuoteAsync(String userId, String userSecret, UUID accountId, UUID optionStrategyId, final ApiCallback<StrategyQuotes> _callback) throws ApiException {

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

    public class GetOptionsStrategyQuoteRequestBuilder {
        private final String userId;
        private final String userSecret;
        private final UUID accountId;
        private final UUID optionStrategyId;

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

        /**
         * Build call for getOptionsStrategyQuote
         * @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 Quotes </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 getOptionsStrategyQuoteCall(userId, userSecret, accountId, optionStrategyId, _callback);
        }


        /**
         * Execute getOptionsStrategyQuote request
         * @return StrategyQuotes
         * @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 Quotes </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public StrategyQuotes execute() throws ApiException {
            ApiResponse<StrategyQuotes> localVarResp = getOptionsStrategyQuoteWithHttpInfo(userId, userSecret, accountId, optionStrategyId);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute getOptionsStrategyQuote request with HTTP info returned
         * @return ApiResponse&lt;StrategyQuotes&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 Quotes </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<StrategyQuotes> executeWithHttpInfo() throws ApiException {
            return getOptionsStrategyQuoteWithHttpInfo(userId, userSecret, accountId, optionStrategyId);
        }

        /**
         * Execute getOptionsStrategyQuote 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 Quotes </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<StrategyQuotes> _callback) throws ApiException {
            return getOptionsStrategyQuoteAsync(userId, userSecret, accountId, optionStrategyId, _callback);
        }
    }

    /**
     * Get latest market data of option strategy
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param accountId The ID of the account get positions. (required)
     * @param optionStrategyId Option strategy id obtained from response when creating option strategy object (required)
     * @return GetOptionsStrategyQuoteRequestBuilder
     * @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 Quotes </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
     </table>
     */
    public GetOptionsStrategyQuoteRequestBuilder getOptionsStrategyQuote(String userId, String userSecret, UUID accountId, UUID optionStrategyId) 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");
            

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

        return new GetOptionsStrategyQuoteRequestBuilder(userId, userSecret, accountId, optionStrategyId);
    }
    private okhttp3.Call listOptionHoldingsCall(String userId, String userSecret, UUID accountId, 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}/options"
            .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 = {
        };
        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 listOptionHoldingsValidateBeforeCall(String userId, String userSecret, UUID accountId, 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 listOptionHoldings(Async)");
        }

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

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

        return listOptionHoldingsCall(userId, userSecret, accountId, _callback);

    }


    private ApiResponse<OptionsHoldings> listOptionHoldingsWithHttpInfo(String userId, String userSecret, UUID accountId) throws ApiException {
        okhttp3.Call localVarCall = listOptionHoldingsValidateBeforeCall(userId, userSecret, accountId, null);
        Type localVarReturnType = new TypeToken<OptionsHoldings>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call listOptionHoldingsAsync(String userId, String userSecret, UUID accountId, final ApiCallback<OptionsHoldings> _callback) throws ApiException {

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

    public class ListOptionHoldingsRequestBuilder {
        private final String userId;
        private final String userSecret;
        private final UUID accountId;

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

        /**
         * Build call for listOptionHoldings
         * @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> The option holdings in 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 {
            return listOptionHoldingsCall(userId, userSecret, accountId, _callback);
        }


        /**
         * Execute listOptionHoldings request
         * @return OptionsHoldings
         * @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> The option holdings in the account </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public OptionsHoldings execute() throws ApiException {
            ApiResponse<OptionsHoldings> localVarResp = listOptionHoldingsWithHttpInfo(userId, userSecret, accountId);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute listOptionHoldings request with HTTP info returned
         * @return ApiResponse&lt;OptionsHoldings&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> The option holdings in the account </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<OptionsHoldings> executeWithHttpInfo() throws ApiException {
            return listOptionHoldingsWithHttpInfo(userId, userSecret, accountId);
        }

        /**
         * Execute listOptionHoldings 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> The option holdings in the account </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<OptionsHoldings> _callback) throws ApiException {
            return listOptionHoldingsAsync(userId, userSecret, accountId, _callback);
        }
    }

    /**
     * Get the options holdings in the account
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param accountId The ID of the account get positions. (required)
     * @return ListOptionHoldingsRequestBuilder
     * @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> The option holdings in the account </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
     </table>
     */
    public ListOptionHoldingsRequestBuilder listOptionHoldings(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 ListOptionHoldingsRequestBuilder(userId, userSecret, accountId);
    }
    private okhttp3.Call placeOptionStrategyCall(String userId, String userSecret, UUID accountId, UUID optionStrategyId, OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest, 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 = optionsPlaceOptionStrategyRequest;

        // create path and map variables
        String localVarPath = "/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute"
            .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString()))
            .replace("{" + "optionStrategyId" + "}", localVarApiClient.escapeString(optionStrategyId.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 placeOptionStrategyValidateBeforeCall(String userId, String userSecret, UUID accountId, UUID optionStrategyId, OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest, 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 placeOptionStrategy(Async)");
        }

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

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

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

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

        return placeOptionStrategyCall(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback);

    }


    private ApiResponse<StrategyOrderRecord> placeOptionStrategyWithHttpInfo(String userId, String userSecret, UUID accountId, UUID optionStrategyId, OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest) throws ApiException {
        okhttp3.Call localVarCall = placeOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, null);
        Type localVarReturnType = new TypeToken<StrategyOrderRecord>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call placeOptionStrategyAsync(String userId, String userSecret, UUID accountId, UUID optionStrategyId, OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest, final ApiCallback<StrategyOrderRecord> _callback) throws ApiException {

        okhttp3.Call localVarCall = placeOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback);
        Type localVarReturnType = new TypeToken<StrategyOrderRecord>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class PlaceOptionStrategyRequestBuilder {
        private final String orderType;
        private final String timeInForce;
        private final Double price;
        private final String userId;
        private final String userSecret;
        private final UUID accountId;
        private final UUID optionStrategyId;

        private PlaceOptionStrategyRequestBuilder(String orderType, String timeInForce, double price, String userId, String userSecret, UUID accountId, UUID optionStrategyId) {
            this.orderType = orderType;
            this.timeInForce = timeInForce;
            this.price = price;
            this.userId = userId;
            this.userSecret = userSecret;
            this.accountId = accountId;
            this.optionStrategyId = optionStrategyId;
        }

        /**
         * Build call for placeOptionStrategy
         * @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 strategy 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 {
            OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams();
            return placeOptionStrategyCall(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback);
        }

        private OptionsPlaceOptionStrategyRequest buildBodyParams() {
            OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = new OptionsPlaceOptionStrategyRequest();
            if (this.orderType != null)
            optionsPlaceOptionStrategyRequest.orderType(OptionsPlaceOptionStrategyRequest.OrderTypeEnum.fromValue(this.orderType));
            if (this.timeInForce != null)
            optionsPlaceOptionStrategyRequest.timeInForce(OptionsPlaceOptionStrategyRequest.TimeInForceEnum.fromValue(this.timeInForce));
            optionsPlaceOptionStrategyRequest.price(this.price);
            return optionsPlaceOptionStrategyRequest;
        }

        /**
         * Execute placeOptionStrategy request
         * @return StrategyOrderRecord
         * @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 strategy order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public StrategyOrderRecord execute() throws ApiException {
            OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams();
            ApiResponse<StrategyOrderRecord> localVarResp = placeOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest);
            return localVarResp.getResponseBody();
        }

        /**
         * Execute placeOptionStrategy request with HTTP info returned
         * @return ApiResponse&lt;StrategyOrderRecord&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 strategy order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<StrategyOrderRecord> executeWithHttpInfo() throws ApiException {
            OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams();
            return placeOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest);
        }

        /**
         * Execute placeOptionStrategy 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 strategy order placed </td><td>  -  </td></tr>
            <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<StrategyOrderRecord> _callback) throws ApiException {
            OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams();
            return placeOptionStrategyAsync(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback);
        }
    }

    /**
     * Place an option strategy order on the brokerage
     * 
     * @param userId  (required)
     * @param userSecret  (required)
     * @param accountId The ID of the account get positions. (required)
     * @param optionStrategyId Option strategy id obtained from response when creating option strategy object (required)
     * @param optionsPlaceOptionStrategyRequest  (required)
     * @return PlaceOptionStrategyRequestBuilder
     * @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 strategy order placed </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Unexpected error </td><td>  -  </td></tr>
     </table>
     */
    public PlaceOptionStrategyRequestBuilder placeOptionStrategy(String orderType, String timeInForce, double price, String userId, String userSecret, UUID accountId, UUID optionStrategyId) throws IllegalArgumentException {
        if (orderType == null) throw new IllegalArgumentException("\"orderType\" is required but got null");
            

        if (timeInForce == null) throw new IllegalArgumentException("\"timeInForce\" 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");
            

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

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

        return new PlaceOptionStrategyRequestBuilder(orderType, timeInForce, price, userId, userSecret, accountId, optionStrategyId);
    }
}
