Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* SnapTrade
* Connect brokerage accounts to your app for live positions and trading
*
* The version of the OpenAPI document: 1.0.0
* Contact: [email protected]
*
* 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.OptionsPlaceOptionStrategyRequest;
import com.konfigthis.client.model.OptionsPosition;
import com.konfigthis.client.model.OrderTypeStrict;
import com.konfigthis.client.model.StrategyOrderRecord;
import com.konfigthis.client.model.StrategyQuotes;
import com.konfigthis.client.model.TimeInForceStrict;
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 OptionsApiGenerated {
private ApiClient localVarApiClient;
private int localHostIndex;
private String localCustomBaseUrl;
public OptionsApiGenerated() throws IllegalArgumentException {
this(Configuration.getDefaultApiClient());
}
public OptionsApiGenerated(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 localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
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 getOptionStrategyWithHttpInfo(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest) throws ApiException {
okhttp3.Call localVarCall = getOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionsGetOptionStrategyRequest, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call getOptionStrategyAsync(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionsGetOptionStrategyRequest, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class GetOptionStrategyRequestBuilderGenerated {
final UUID underlyingSymbolId;
final List legs;
final String strategyType;
final String userId;
final String userSecret;
final UUID accountId;
public GetOptionStrategyRequestBuilderGenerated(UUID underlyingSymbolId, List 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
Status Code
Description
Response Headers
200
Order Quotes
-
*/
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
Status Code
Description
Response Headers
200
Order Quotes
-
*/
public StrategyQuotes execute() throws ApiException {
OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams();
ApiResponse localVarResp = getOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionsGetOptionStrategyRequest);
return localVarResp.getResponseBody();
}
/**
* Execute getOptionStrategy request with HTTP info returned
* @return ApiResponse<StrategyQuotes>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
Order Quotes
-
*/
public ApiResponse 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
Status Code
Description
Response Headers
200
Order Quotes
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams();
return getOptionStrategyAsync(userId, userSecret, accountId, optionsGetOptionStrategyRequest, _callback);
}
}
/**
* Create options strategy
* 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 to create the option strategy object in. (required)
* @param optionsGetOptionStrategyRequest (required)
* @return GetOptionStrategyRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
Order Quotes
-
*/
public OptionsApi.GetOptionStrategyRequestBuilder getOptionStrategy(UUID underlyingSymbolId, List 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 ((OptionsApi) this).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 localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
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> getOptionsChainWithHttpInfo(String userId, String userSecret, UUID accountId, UUID symbol) throws ApiException {
okhttp3.Call localVarCall = getOptionsChainValidateBeforeCall(userId, userSecret, accountId, symbol, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call getOptionsChainAsync(String userId, String userSecret, UUID accountId, UUID symbol, final ApiCallback> _callback) throws ApiException {
okhttp3.Call localVarCall = getOptionsChainValidateBeforeCall(userId, userSecret, accountId, symbol, _callback);
Type localVarReturnType = new TypeToken>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class GetOptionsChainRequestBuilderGenerated {
final String userId;
final String userSecret;
final UUID accountId;
final UUID symbol;
public GetOptionsChainRequestBuilderGenerated(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
Status Code
Description
Response Headers
200
List of all Options available for the brokerage symbol
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return getOptionsChainCall(userId, userSecret, accountId, symbol, _callback);
}
/**
* Execute getOptionsChain request
* @return List<OptionChainInner>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
List of all Options available for the brokerage symbol
-
*/
public List execute() throws ApiException {
ApiResponse> localVarResp = getOptionsChainWithHttpInfo(userId, userSecret, accountId, symbol);
return localVarResp.getResponseBody();
}
/**
* Execute getOptionsChain request with HTTP info returned
* @return ApiResponse<List<OptionChainInner>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
List of all Options available for the brokerage symbol
-
*/
public ApiResponse> 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
Status Code
Description
Response Headers
200
List of all Options available for the brokerage symbol
-
*/
public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException {
return getOptionsChainAsync(userId, userSecret, accountId, symbol, _callback);
}
}
/**
* Get the options chain for a symbol
* Returns the option chain for the specified symbol in the specified account.
* @param userId (required)
* @param userSecret (required)
* @param accountId The ID of the account to get the options chain from. (required)
* @param symbol Universal symbol ID if symbol (required)
* @return GetOptionsChainRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
List of all Options available for the brokerage symbol
-
*/
public OptionsApi.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 ((OptionsApi) this).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 localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
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 getOptionsStrategyQuoteWithHttpInfo(String userId, String userSecret, UUID accountId, UUID optionStrategyId) throws ApiException {
okhttp3.Call localVarCall = getOptionsStrategyQuoteValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call getOptionsStrategyQuoteAsync(String userId, String userSecret, UUID accountId, UUID optionStrategyId, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getOptionsStrategyQuoteValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class GetOptionsStrategyQuoteRequestBuilderGenerated {
final String userId;
final String userSecret;
final UUID accountId;
final UUID optionStrategyId;
public GetOptionsStrategyQuoteRequestBuilderGenerated(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
Status Code
Description
Response Headers
200
Order Quotes
-
*/
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
Status Code
Description
Response Headers
200
Order Quotes
-
*/
public StrategyQuotes execute() throws ApiException {
ApiResponse localVarResp = getOptionsStrategyQuoteWithHttpInfo(userId, userSecret, accountId, optionStrategyId);
return localVarResp.getResponseBody();
}
/**
* Execute getOptionsStrategyQuote request with HTTP info returned
* @return ApiResponse<StrategyQuotes>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
Order Quotes
-
*/
public ApiResponse 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
Status Code
Description
Response Headers
200
Order Quotes
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
return getOptionsStrategyQuoteAsync(userId, userSecret, accountId, optionStrategyId, _callback);
}
}
/**
* Get options strategy quotes
* Returns a Strategy Quotes object which has latest market data of the specified option strategy.
* @param userId (required)
* @param userSecret (required)
* @param accountId The ID of the account the strategy will be placed in. (required)
* @param optionStrategyId Option strategy id obtained from response when creating option strategy object (required)
* @return GetOptionsStrategyQuoteRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
Order Quotes
-
*/
public OptionsApi.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 ((OptionsApi) this).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 localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
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> listOptionHoldingsWithHttpInfo(String userId, String userSecret, UUID accountId) throws ApiException {
okhttp3.Call localVarCall = listOptionHoldingsValidateBeforeCall(userId, userSecret, accountId, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call listOptionHoldingsAsync(String userId, String userSecret, UUID accountId, final ApiCallback> _callback) throws ApiException {
okhttp3.Call localVarCall = listOptionHoldingsValidateBeforeCall(userId, userSecret, accountId, _callback);
Type localVarReturnType = new TypeToken>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class ListOptionHoldingsRequestBuilderGenerated {
final String userId;
final String userSecret;
final UUID accountId;
public ListOptionHoldingsRequestBuilderGenerated(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
Status Code
Description
Response Headers
200
OK
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return listOptionHoldingsCall(userId, userSecret, accountId, _callback);
}
/**
* Execute listOptionHoldings request
* @return List<OptionsPosition>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
*/
public List execute() throws ApiException {
ApiResponse> localVarResp = listOptionHoldingsWithHttpInfo(userId, userSecret, accountId);
return localVarResp.getResponseBody();
}
/**
* Execute listOptionHoldings request with HTTP info returned
* @return ApiResponse<List<OptionsPosition>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
*/
public ApiResponse> 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
Status Code
Description
Response Headers
200
OK
-
*/
public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException {
return listOptionHoldingsAsync(userId, userSecret, accountId, _callback);
}
}
/**
* List account option positions
* Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
* @param userId (required)
* @param userSecret (required)
* @param accountId (required)
* @return ListOptionHoldingsRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
*/
public OptionsApi.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 ((OptionsApi) this).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 localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
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 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(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call placeOptionStrategyAsync(String userId, String userSecret, UUID accountId, UUID optionStrategyId, OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = placeOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class PlaceOptionStrategyRequestBuilderGenerated {
final OrderTypeStrict orderType;
final TimeInForceStrict timeInForce;
final String userId;
final String userSecret;
final UUID accountId;
final UUID optionStrategyId;
Double price;
public PlaceOptionStrategyRequestBuilderGenerated(OrderTypeStrict orderType, TimeInForceStrict timeInForce, String userId, String userSecret, UUID accountId, UUID optionStrategyId) {
this.orderType = orderType;
this.timeInForce = timeInForce;
this.userId = userId;
this.userSecret = userSecret;
this.accountId = accountId;
this.optionStrategyId = optionStrategyId;
}
/**
* Set price
* @param price Trade Price if limit or stop limit order (optional)
* @return OptionsApi.PlaceOptionStrategyRequestBuilder
*/
public OptionsApi.PlaceOptionStrategyRequestBuilder price(Double price) {
this.price = price;
return (OptionsApi.PlaceOptionStrategyRequestBuilder) this;
}
/**
* Set price
* @param price Trade Price if limit or stop limit order (optional)
* @return OptionsApi.PlaceOptionStrategyRequestBuilder
*/
public OptionsApi.PlaceOptionStrategyRequestBuilder price(Integer price) {
this.price = price.doubleValue();
return (OptionsApi.PlaceOptionStrategyRequestBuilder) this;
}
/**
* 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
Status Code
Description
Response Headers
200
Status of strategy order placed
-
*/
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();
optionsPlaceOptionStrategyRequest.orderType(this.orderType);
optionsPlaceOptionStrategyRequest.timeInForce(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
Status Code
Description
Response Headers
200
Status of strategy order placed
-
*/
public StrategyOrderRecord execute() throws ApiException {
OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams();
ApiResponse localVarResp = placeOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest);
return localVarResp.getResponseBody();
}
/**
* Execute placeOptionStrategy request with HTTP info returned
* @return ApiResponse<StrategyOrderRecord>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
Status of strategy order placed
-
*/
public ApiResponse 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
Status Code
Description
Response Headers
200
Status of strategy order placed
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams();
return placeOptionStrategyAsync(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback);
}
}
/**
* Place an option strategy order
* Places the option strategy order and returns the order record received from the brokerage.
* @param userId (required)
* @param userSecret (required)
* @param accountId The ID of the account to execute the strategy in. (required)
* @param optionStrategyId Option strategy id obtained from response when creating option strategy object (required)
* @param optionsPlaceOptionStrategyRequest (required)
* @return PlaceOptionStrategyRequestBuilder
* @http.response.details
Status Code
Description
Response Headers
200
Status of strategy order placed
-
*/
public OptionsApi.PlaceOptionStrategyRequestBuilder placeOptionStrategy(OrderTypeStrict orderType, TimeInForceStrict timeInForce, 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 ((OptionsApi) this).new PlaceOptionStrategyRequestBuilder(orderType, timeInForce, userId, userSecret, accountId, optionStrategyId);
}
}